diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-10-14 13:35:25 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-10-14 13:35:25 +0000 |
commit | 50feaa0ffc1b2e120eb6b22b2970f5bc2f7dc7a4 (patch) | |
tree | 369eb024d7b0b851f0d34482c93a994fec80d728 /plugins/TabSRMM/src/include/taskbar.h | |
parent | ab290eb57836929b5b87a796ac4dfa06292515c8 (diff) |
TabSRMM: folders restructurization
git-svn-id: http://svn.miranda-ng.org/main/trunk@1923 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/include/taskbar.h')
-rw-r--r-- | plugins/TabSRMM/src/include/taskbar.h | 197 |
1 files changed, 197 insertions, 0 deletions
diff --git a/plugins/TabSRMM/src/include/taskbar.h b/plugins/TabSRMM/src/include/taskbar.h new file mode 100644 index 0000000000..9267f6a76a --- /dev/null +++ b/plugins/TabSRMM/src/include/taskbar.h @@ -0,0 +1,197 @@ +/*
+ * astyle --force-indent=tab=4 --brackets=linux --indent-switches
+ * --pad=oper --one-line=keep-blocks --unpad=paren
+ *
+ * Miranda NG: the free IM client for Microsoft* Windows*
+ *
+ * Copyright 2000-2009 Miranda ICQ/IM project,
+ * all portions of this codebase are copyrighted to the people
+ * listed in contributors.txt.
+ *
+ * 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.
+ *
+ * part of tabSRMM messaging plugin for Miranda.
+ *
+ * (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
+ *
+ * $Id: taskbar.h 12227 2010-07-23 16:57:25Z silvercircle $
+ *
+ * - Windows 7 taskbar integration class
+ * - Proxy window class, needed to support custom aero peek tab
+ * thumbnails
+ * - Thumbnail classes to provide task bar thumbnails for Aero peek
+ * preview.
+ */
+
+#ifndef __TASKBAR_H
+#define __TASKBAR_H
+
+#define PROXYCLASSNAME _T("TabSRMM_DWMProxy")
+extern HINSTANCE g_hInst;
+
+class CProxyWindow;
+
+class CThumbBase {
+public:
+ CThumbBase (const CProxyWindow* pWnd);
+ virtual ~CThumbBase ();
+
+ const HBITMAP getHBM () const { return(m_hbmThumb); }
+ const bool isValid () const { return(m_isValid); }
+ virtual void setValid (const bool fNewValid) { m_isValid = fNewValid; }
+ virtual void update () = 0;
+
+protected:
+ HBITMAP m_hbmThumb, m_hbmOld;
+ const TWindowData* m_dat;
+ LONG m_width, m_height;
+ HDC m_hdc;
+ const CProxyWindow* m_pWnd;
+ RECT m_rc, m_rcTop, m_rcBottom, m_rcIcon;
+ DWORD m_dtFlags;
+ SIZE m_sz;
+ LONG m_cx, m_cy;
+ HFONT m_hOldFont;
+
+ virtual void renderBase ();
+
+private:
+ virtual void renderContent () = 0;
+ void setupRect ();
+
+private:
+ bool m_isValid;
+};
+
+class CThumbIM : public CThumbBase {
+
+public:
+ CThumbIM (const CProxyWindow* pWnd);
+ virtual ~CThumbIM () {};
+ void update ();
+
+private:
+ void renderContent ();
+};
+
+class CThumbMUC : public CThumbBase {
+
+public:
+ CThumbMUC (const CProxyWindow* pWnd);
+ virtual ~CThumbMUC () {};
+ void update ();
+
+private:
+ void renderContent ();
+};
+
+class CProxyWindow
+{
+public:
+ CProxyWindow(const TWindowData *dat);
+ ~CProxyWindow();
+
+ void updateIcon (const HICON hIcon) const;
+ void updateTitle (const TCHAR *tszTitle) const;
+ void setBigIcon (const HICON hIcon, bool fInvalidate = true);
+ void setOverlayIcon (const HICON hIcon, bool fInvalidate = true);
+ void activateTab () const;
+ void Invalidate () const;
+ const TWindowData* getDat () const { return(m_dat); }
+ const LONG getWidth () const { return(m_width); }
+ const LONG getHeight () const { return(m_height); }
+ const HWND getHwnd () const { return(m_hwndProxy); }
+ const HICON getBigIcon () const { return(m_hBigIcon); }
+ const HICON getOverlayIcon () const { return(m_hOverlayIcon); }
+ void verifyDwmState ();
+
+ static LRESULT CALLBACK stubWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static void add (TWindowData *dat);
+ static void verify (TWindowData *dat);
+
+private:
+ const TWindowData* m_dat;
+ HWND m_hwndProxy;
+ LONG m_width, m_height;
+ HICON m_hBigIcon, m_hOverlayIcon;
+
+ LRESULT CALLBACK wndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ void sendThumb (LONG width, LONG height);
+ void sendPreview ();
+ CThumbBase* m_thumb;
+};
+
+class CTaskbarInteract
+{
+public:
+ CTaskbarInteract()
+ {
+ m_pTaskbarInterface = 0;
+ m_IconSize = 0;
+ m_isEnabled = IsWinVer7Plus() ? true : false;
+
+ if (m_isEnabled) {
+ ::CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&m_pTaskbarInterface);
+ updateMetrics();
+ if (0 == m_pTaskbarInterface)
+ m_isEnabled = false;
+ }
+
+ /*
+ * register proxy window class
+ */
+ WNDCLASSEX wcex = {0};
+ wcex.cbSize = sizeof(wcex);
+ wcex.lpfnWndProc = CProxyWindow::stubWndProc;
+ wcex.hInstance = g_hInst;
+ wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ wcex.lpszClassName = PROXYCLASSNAME;
+ ::RegisterClassEx(&wcex);
+ }
+
+ ~CTaskbarInteract()
+ {
+ if (m_isEnabled && m_pTaskbarInterface) {
+ m_pTaskbarInterface->Release();
+ m_pTaskbarInterface = 0;
+ m_isEnabled = false;
+ }
+ ::UnregisterClass(PROXYCLASSNAME, g_hInst);
+ }
+ const LONG getIconSize () const { return(m_IconSize); }
+ const bool haveAlwaysGroupingMode () const { return(m_fHaveAlwaysGrouping); }
+
+ bool setOverlayIcon (HWND hwndDlg, LPARAM lParam) const;
+ void clearOverlayIcon (HWND hwndDlg) const;
+ bool haveLargeIcons ();
+ LONG updateMetrics ();
+ void registerTab (const HWND hwndTab, const HWND hwndContainer) const;
+ void unRegisterTab (const HWND hwndTab) const;
+ void SetTabActive (const HWND hwndTab, const HWND hwndGroup) const;
+
+ //const TCHAR* getFileNameFromWindow (const HWND hWnd);
+private:
+ bool m_isEnabled;
+ ITaskbarList3* m_pTaskbarInterface;
+ bool m_fHaveLargeicons;
+ bool m_fHaveAlwaysGrouping;
+ LONG m_IconSize;
+};
+
+extern CTaskbarInteract* Win7Taskbar;
+
+#endif /* __TASKBAR_H */
+
|