summaryrefslogtreecommitdiff
path: root/w7ui/dwmwindow.h
diff options
context:
space:
mode:
authorwatcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-04-21 14:14:52 +0000
committerwatcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-04-21 14:14:52 +0000
commitcb4a46e7fbe62d788e66ed6121c717a2d22a4d7c (patch)
tree30df260fdc5a1b5a7049c2f8cac8b7ef17513d6d /w7ui/dwmwindow.h
parent19b6f534d2e784a1e120bf52c4aa07004798f473 (diff)
svn.miranda.im is moving to a new home!
git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@7 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'w7ui/dwmwindow.h')
-rw-r--r--w7ui/dwmwindow.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/w7ui/dwmwindow.h b/w7ui/dwmwindow.h
new file mode 100644
index 0000000..e795823
--- /dev/null
+++ b/w7ui/dwmwindow.h
@@ -0,0 +1,59 @@
+#ifndef dwmwindow_h__
+#define dwmwindow_h__
+
+class CDwmWindow
+{
+public:
+ CDwmWindow();
+ virtual ~CDwmWindow() {}
+
+ HWND hwnd() { return m_hwnd; }
+
+ template<class TWindow>
+ static TWindow *GetWindow(HWND hwnd)
+ {
+ return (TWindow *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ }
+
+protected:
+ // events
+ virtual void OnActivate(HWND hwndFrom) {}
+ virtual void OnClose() {}
+ virtual void OnRenderThumbnail(int mzxWidth, int maxHeight) {}
+ virtual void OnRenderPreview() {}
+ virtual void OnTimer(int id) {}
+ virtual void OnToolbar(int id, INT_PTR data) {}
+
+ // timer stuff
+ void SetTimer(int id, int timeout);
+ void KillTimer(int id);
+
+ // manage thumbnail and aero peek
+ void InvalidateThumbnail();
+ void SetPreview(HBITMAP hbmp, int x, int y);
+ void SetThumbnail(HBITMAP hbmp);
+
+ // manage toolbar
+ bool AddButton(HICON hIcon, TCHAR *text, INT_PTR data, DWORD flags = THBF_ENABLED);
+ void UpdateButtons(ITaskbarList3 *p);
+
+ //utilities
+ static HBITMAP CreateDwmBitmap(int width, int height);
+ static void MakeBitmapOpaque(HBITMAP hBmp);
+ static void DrawGradient(HDC hdc, int x, int y, int width, int height, RGBQUAD *rgb0, RGBQUAD *rgb1);
+
+private:
+ HWND m_hwnd;
+
+ bool m_btnInitialized;
+ int m_btnCount;
+ THUMBBUTTON m_btnInfo[7];
+ INT_PTR m_btnData[7];
+
+ LRESULT CALLBACK WndProc(UINT msg, WPARAM wParam, LPARAM lParam);
+
+ static void GlobalInitWndClass();
+ static LRESULT CALLBACK GlobalWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+};
+
+#endif // dwmwindow_h__ \ No newline at end of file