2 * Copyright (C) 2009 Adam Kropelin
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General
6 * Public License as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public
14 * License along with this program; if not, write to the Free
15 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
23 Meter::Meter(HWND hwnd
, UINT id
, int warn
, int critical
, int level
) :
28 _hwnd
= GetDlgItem(hwnd
, id
);
31 void Meter::Set(int level
)
36 SendMessage(_hwnd
, PBM_SETPOS
, level
, 0);
39 // Figure out bar color.
41 if (_warn
> _critical
)
46 else if (level
> _critical
)
54 if (level
>= _critical
)
56 else if (level
>= _warn
)
62 SendMessage(_hwnd
, PBM_SETBARCOLOR
, 0, color
);