2009-02-10 18:37:48 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 2004 Kimmo Pekkola
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __TRAYWINDOW_H__
|
|
|
|
#define __TRAYWINDOW_H__
|
|
|
|
|
|
|
|
#include <windows.h>
|
2011-02-07 08:02:12 +00:00
|
|
|
#include <gdiplus.h>
|
|
|
|
#include <vector>
|
2009-02-10 18:37:48 +00:00
|
|
|
|
2011-11-25 19:11:46 +00:00
|
|
|
typedef HRESULT (WINAPI * FPLOADICONMETRIC)(HINSTANCE hinst, PCWSTR pszName, int lims, HICON* phico);
|
|
|
|
|
2011-02-16 14:46:17 +00:00
|
|
|
#define WM_TRAY_DELAYED_REFRESH_ALL WM_APP + 0
|
|
|
|
#define WM_TRAY_DELAYED_EXECUTE WM_APP + 1
|
2010-03-29 21:50:05 +00:00
|
|
|
|
2011-02-16 14:46:17 +00:00
|
|
|
#define WM_TRAY_NOTIFYICON WM_USER + 101
|
2009-02-10 18:37:48 +00:00
|
|
|
#define TRAYICON_SIZE 16
|
|
|
|
|
|
|
|
enum TRAY_METER_TYPE
|
|
|
|
{
|
|
|
|
TRAY_METER_TYPE_NONE,
|
|
|
|
TRAY_METER_TYPE_HISTOGRAM,
|
|
|
|
TRAY_METER_TYPE_BITMAP
|
|
|
|
};
|
|
|
|
|
2011-02-07 08:02:12 +00:00
|
|
|
class CConfigParser;
|
|
|
|
class CMeasure;
|
|
|
|
|
2009-02-10 18:37:48 +00:00
|
|
|
class CTrayWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CTrayWindow(HINSTANCE instance);
|
|
|
|
~CTrayWindow();
|
|
|
|
|
|
|
|
void ReadConfig(CConfigParser& parser);
|
|
|
|
HWND GetWindow() { return m_Window; }
|
2011-04-19 00:02:00 +00:00
|
|
|
bool IsTrayIconEnabled() { return m_TrayIconEnabled; }
|
2009-02-10 18:37:48 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
|
|
|
|
private:
|
|
|
|
BOOL AddTrayIcon();
|
|
|
|
BOOL RemoveTrayIcon();
|
|
|
|
BOOL ModifyTrayIcon(double value);
|
|
|
|
HICON CreateTrayIcon(double value);
|
|
|
|
|
|
|
|
HICON m_TrayIcon;
|
|
|
|
HWND m_Window;
|
|
|
|
HINSTANCE m_Instance;
|
|
|
|
CMeasure* m_Measure;
|
|
|
|
|
|
|
|
TRAY_METER_TYPE m_MeterType;
|
|
|
|
Gdiplus::Color m_TrayColor1;
|
|
|
|
Gdiplus::Color m_TrayColor2;
|
|
|
|
Gdiplus::Bitmap* m_Bitmap;
|
|
|
|
|
|
|
|
std::vector<HICON> m_TrayIcons;
|
|
|
|
|
|
|
|
double m_TrayValues[TRAYICON_SIZE];
|
|
|
|
int m_TrayPos;
|
2011-04-19 00:02:00 +00:00
|
|
|
|
|
|
|
bool m_TrayIconEnabled;
|
2009-02-10 18:37:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|