summaryrefslogtreecommitdiff
path: root/plugins/w7ui/subclassmgr.h
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2012-05-18 22:10:43 +0000
committerKirill Volinsky <mataes2007@gmail.com>2012-05-18 22:10:43 +0000
commit725f68b6808a8a30778f58223fac75386f082785 (patch)
treeccba410760749d45139e5e78fd5e08f416ade1a0 /plugins/w7ui/subclassmgr.h
parentf920ef497f3299ae24fe783ce03bdd93b419f764 (diff)
plugins folders renaming
git-svn-id: http://svn.miranda-ng.org/main/trunk@61 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/w7ui/subclassmgr.h')
-rw-r--r--plugins/w7ui/subclassmgr.h71
1 files changed, 0 insertions, 71 deletions
diff --git a/plugins/w7ui/subclassmgr.h b/plugins/w7ui/subclassmgr.h
deleted file mode 100644
index 1cf2433254..0000000000
--- a/plugins/w7ui/subclassmgr.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef subclassmgr_h__
-#define subclassmgr_h__
-
-struct TSubclassData
-{
- WNDPROC oldWndProc;
- LPARAM lParam;
-};
-
-typedef LRESULT (*TSubclassProc)(MSG *msg, TSubclassData *data);
-
-class CSubclassMgr
-{
-public:
- static void Subclass(HWND hwnd, TSubclassProc newWndProc, LPARAM lParam)
- {
- TWindowInfo *wi = new TWindowInfo;
- wi->hwnd = hwnd;
- wi->newWndProc = newWndProc;
- wi->lParam = lParam;
- Instance().m_windows.insert(wi);
- wi->oldWndProc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)GlobalSubclassProc);
- }
-
-private:
- CSubclassMgr(): m_windows(5, TWindowInfo::Compare) {}
- CSubclassMgr(const CSubclassMgr &);
- CSubclassMgr &operator=(const CSubclassMgr &);
-
- static CSubclassMgr &Instance()
- {
- static CSubclassMgr theInstance;
- return theInstance;
- }
-
- struct TWindowInfo
- {
- HWND hwnd;
- WNDPROC oldWndProc;
- TSubclassProc newWndProc;
- LPARAM lParam;
-
- static int Compare(const TWindowInfo *p1, const TWindowInfo *p2)
- {
- return (int)p1->hwnd - (int)p2->hwnd;
- }
- };
-
- OBJLIST<TWindowInfo> m_windows;
-
- static LRESULT CALLBACK GlobalSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- TWindowInfo search = { hwnd };
- TWindowInfo *wnd = Instance().m_windows.find(&search);
- if (!wnd) return DefWindowProc(hwnd, message, wParam, lParam);
-
- MSG msg = { hwnd, message, wParam, lParam };
- TSubclassData data = { wnd->oldWndProc, wnd->lParam };
- LRESULT result = wnd->newWndProc(&msg, &data);
-
- if (message == WM_DESTROY)
- {
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)wnd->oldWndProc);
- Instance().m_windows.remove(wnd);
- }
-
- return result;
- }
-};
-
-#endif // subclassmgr_h__