rainmeter-studio/Library/TrayWindow.h

102 lines
2.4 KiB
C
Raw Normal View History

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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2009-02-10 18:37:48 +00:00
*/
#ifndef __TRAYWINDOW_H__
#define __TRAYWINDOW_H__
#include <windows.h>
2013-12-24 11:20:19 +00:00
#include <ole2.h> // For Gdiplus.h.
#include <gdiplus.h>
#include <vector>
2009-02-10 18:37:48 +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
};
2013-05-31 14:18:52 +00:00
class ConfigParser;
class Measure;
2013-05-31 14:18:52 +00:00
class TrayWindow
2009-02-10 18:37:48 +00:00
{
public:
2013-05-31 14:18:52 +00:00
TrayWindow();
~TrayWindow();
2009-02-10 18:37:48 +00:00
TrayWindow(const TrayWindow& other) = delete;
TrayWindow& operator=(TrayWindow other) = delete;
2012-05-05 12:59:35 +00:00
void Initialize();
2013-05-31 14:18:52 +00:00
void ReadOptions(ConfigParser& parser);
2009-02-10 18:37:48 +00:00
HWND GetWindow() { return m_Window; }
2012-05-05 11:49:22 +00:00
bool IsTrayIconEnabled() { return m_IconEnabled; }
2012-11-13 14:11:43 +00:00
void SetTrayIcon(bool enabled);
2009-02-10 18:37:48 +00:00
2012-05-05 11:43:48 +00:00
void ShowWelcomeNotification();
void ShowUpdateNotification(const WCHAR* newVersion);
2009-02-10 18:37:48 +00:00
protected:
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
private:
2012-05-05 11:43:48 +00:00
enum TRAY_NOTIFICATION
{
TRAY_NOTIFICATION_NONE,
TRAY_NOTIFICATION_WELCOME,
TRAY_NOTIFICATION_UPDATE
};
bool AddTrayIcon();
bool IsTrayIconReady();
void TryAddTrayIcon();
void CheckTrayIcon();
void RemoveTrayIcon();
void ModifyTrayIcon(double value);
2009-02-10 18:37:48 +00:00
HICON CreateTrayIcon(double value);
2012-05-05 11:43:48 +00:00
void ShowNotification(TRAY_NOTIFICATION id, const WCHAR* title, const WCHAR* text);
2012-05-05 11:49:22 +00:00
HICON m_Icon;
2009-02-10 18:37:48 +00:00
HWND m_Window;
2013-05-31 14:18:52 +00:00
Measure* m_Measure;
2009-02-10 18:37:48 +00:00
TRAY_METER_TYPE m_MeterType;
2012-05-05 11:49:22 +00:00
Gdiplus::Color m_Color1;
Gdiplus::Color m_Color2;
2009-02-10 18:37:48 +00:00
Gdiplus::Bitmap* m_Bitmap;
2012-05-05 11:49:22 +00:00
std::vector<HICON> m_Icons;
2009-02-10 18:37:48 +00:00
2012-05-05 11:49:22 +00:00
double m_Values[TRAYICON_SIZE];
int m_Pos;
2012-05-05 11:43:48 +00:00
TRAY_NOTIFICATION m_Notification;
2012-10-25 09:26:46 +00:00
bool m_TrayContextMenuEnabled;
2012-05-05 11:49:22 +00:00
bool m_IconEnabled;
2009-02-10 18:37:48 +00:00
};
#endif