soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SwndMsgCracker.h
1#ifndef __SWNDMSGCRACKER__H__
2#define __SWNDMSGCRACKER__H__
3
4#define SOUI_MSG_MAP_BEGIN() \
5 protected: \
6 virtual BOOL ProcessSwndMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult) \
7 {
8
9#define SOUI_MSG_MAP_END() \
10 if (!IsMsgHandled()) \
11 return __baseCls::ProcessSwndMessage(uMsg, wParam, lParam, lResult); \
12 return TRUE; \
13 }
14
15#define SOUI_MSG_MAP_END_BASE() \
16 return FALSE; \
17 }
18
19// BOOL OnEraseBkgnd(SNS::IRenderTarget * pRT)
20#define MSG_WM_ERASEBKGND_EX(func) \
21 if (uMsg == WM_ERASEBKGND) \
22 { \
23 SetMsgHandled(TRUE); \
24 lResult = (LRESULT)func((SNS::IRenderTarget *)wParam); \
25 if (IsMsgHandled()) \
26 return TRUE; \
27 }
28
29// void OnPaint(SNS::IRenderTarget * pRT)
30#define MSG_WM_PAINT_EX(func) \
31 if (uMsg == WM_PAINT) \
32 { \
33 SetMsgHandled(TRUE); \
34 func((SNS::IRenderTarget *)wParam); \
35 lResult = 0; \
36 if (IsMsgHandled()) \
37 return TRUE; \
38 }
39
40// void OnNcPaint(SNS::IRenderTarget * pRT)
41#define MSG_WM_NCPAINT_EX(func) \
42 if (uMsg == WM_NCPAINT) \
43 { \
44 SetMsgHandled(TRUE); \
45 func((SNS::IRenderTarget *)wParam); \
46 lResult = 0; \
47 if (IsMsgHandled()) \
48 return TRUE; \
49 }
50
51// void OnSetFont(IFont *pFont, BOOL bRedraw)
52#define MSG_WM_SETFONT_EX(func) \
53 if (uMsg == WM_SETFONT) \
54 { \
55 SetMsgHandled(TRUE); \
56 func((IFontS *)wParam, (BOOL)LOWORD(lParam)); \
57 lResult = 0; \
58 if (IsMsgHandled()) \
59 return TRUE; \
60 }
61
62// void OnSetFocus(SWND wndOld)
63#define MSG_WM_SETFOCUS_EX(func) \
64 if (uMsg == WM_SETFOCUS) \
65 { \
66 SetMsgHandled(TRUE); \
67 func((SWND)wParam); \
68 lResult = 0; \
69 if (IsMsgHandled()) \
70 return TRUE; \
71 }
72
73// void OnSetFocus(SWND wndOld,CFocusManager::FocusChangeReason)
74#define MSG_WM_SETFOCUS_EX2(func) \
75 if (uMsg == WM_SETFOCUS) \
76 { \
77 SetMsgHandled(TRUE); \
78 func((SWND)wParam, (SFocusManager::FocusChangeReason)lParam); \
79 lResult = 0; \
80 if (IsMsgHandled()) \
81 return TRUE; \
82 }
83
84// void OnKillFocus(SWND wndFocus)
85#define MSG_WM_KILLFOCUS_EX(func) \
86 if (uMsg == WM_KILLFOCUS) \
87 { \
88 SetMsgHandled(TRUE); \
89 func((SWND)wParam); \
90 lResult = 0; \
91 if (IsMsgHandled()) \
92 return TRUE; \
93 }
94
95// void OnNcMouseHover(int nFlag,CPoint pt)
96#define MSG_WM_NCMOUSEHOVER(func) \
97 if (uMsg == WM_NCMOUSEHOVER) \
98 { \
99 SetMsgHandled(TRUE); \
100 func(wParam, CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \
101 lResult = 0; \
102 if (IsMsgHandled()) \
103 return TRUE; \
104 }
105
106// void OnNcMouseLeave()
107#define MSG_WM_NCMOUSELEAVE(func) \
108 if (uMsg == WM_NCMOUSELEAVE) \
109 { \
110 SetMsgHandled(TRUE); \
111 func(); \
112 lResult = 0; \
113 if (IsMsgHandled()) \
114 return TRUE; \
115 }
116
117// void OnTimer(char cTimerID)
118#define MSG_WM_TIMER_EX(func) \
119 if (uMsg == WM_TIMER) \
120 { \
121 SetMsgHandled(TRUE); \
122 func((char)wParam); \
123 lResult = 0; \
124 if (IsMsgHandled()) \
125 return TRUE; \
126 }
127
128#endif // __SWNDMSGCRACKER__H__