|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef WindowDefs_h__ |
|
7 #define WindowDefs_h__ |
|
8 |
|
9 /* |
|
10 * nsWindowDefs - nsWindow related definitions, consts, and macros. |
|
11 */ |
|
12 |
|
13 #include "nsBaseWidget.h" |
|
14 #include "nsdefs.h" |
|
15 #include "resource.h" |
|
16 |
|
17 /************************************************************** |
|
18 * |
|
19 * SECTION: defines |
|
20 * |
|
21 **************************************************************/ |
|
22 |
|
23 // A magic APP message that can be sent to quit, sort of like a QUERYENDSESSION/ENDSESSION, |
|
24 // but without the query. |
|
25 #define MOZ_WM_APP_QUIT (WM_APP+0x0300) |
|
26 // Used as a "tracer" event to probe event loop latency. |
|
27 #define MOZ_WM_TRACE (WM_APP+0x0301) |
|
28 // Our internal message for WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_VSCROLL and |
|
29 // WM_HSCROLL |
|
30 #define MOZ_WM_MOUSEVWHEEL (WM_APP+0x0310) |
|
31 #define MOZ_WM_MOUSEHWHEEL (WM_APP+0x0311) |
|
32 #define MOZ_WM_VSCROLL (WM_APP+0x0312) |
|
33 #define MOZ_WM_HSCROLL (WM_APP+0x0313) |
|
34 #define MOZ_WM_MOUSEWHEEL_FIRST MOZ_WM_MOUSEVWHEEL |
|
35 #define MOZ_WM_MOUSEWHEEL_LAST MOZ_WM_HSCROLL |
|
36 // If a popup window is being activated, we try to reactivate the previous |
|
37 // window with this message. |
|
38 #define MOZ_WM_REACTIVATE (WM_APP+0x0314) |
|
39 |
|
40 // Internal message for ensuring the file picker is visible on multi monitor |
|
41 // systems, and when the screen resolution changes. |
|
42 #define MOZ_WM_ENSUREVISIBLE (WM_APP+0x374F) |
|
43 |
|
44 #ifndef SM_CXPADDEDBORDER |
|
45 #define SM_CXPADDEDBORDER 92 |
|
46 #endif |
|
47 |
|
48 #ifndef WM_THEMECHANGED |
|
49 #define WM_THEMECHANGED 0x031A |
|
50 #endif |
|
51 |
|
52 #ifndef WM_GETOBJECT |
|
53 #define WM_GETOBJECT 0x03d |
|
54 #endif |
|
55 |
|
56 #ifndef PBT_APMRESUMEAUTOMATIC |
|
57 #define PBT_APMRESUMEAUTOMATIC 0x0012 |
|
58 #endif |
|
59 |
|
60 #ifndef WM_MOUSEHWHEEL |
|
61 #define WM_MOUSEHWHEEL 0x020E |
|
62 #endif |
|
63 |
|
64 #ifndef MOUSEEVENTF_HWHEEL |
|
65 #define MOUSEEVENTF_HWHEEL 0x01000 |
|
66 #endif |
|
67 |
|
68 #ifndef WM_MOUSELEAVE |
|
69 #define WM_MOUSELEAVE 0x02A3 |
|
70 #endif |
|
71 |
|
72 #ifndef SPI_GETWHEELSCROLLCHARS |
|
73 #define SPI_GETWHEELSCROLLCHARS 0x006C |
|
74 #endif |
|
75 |
|
76 #ifndef SPI_SETWHEELSCROLLCHARS |
|
77 #define SPI_SETWHEELSCROLLCHARS 0x006D |
|
78 #endif |
|
79 |
|
80 #ifndef MAPVK_VSC_TO_VK |
|
81 #define MAPVK_VK_TO_VSC 0 |
|
82 #define MAPVK_VSC_TO_VK 1 |
|
83 #define MAPVK_VK_TO_CHAR 2 |
|
84 #define MAPVK_VSC_TO_VK_EX 3 |
|
85 #define MAPVK_VK_TO_VSC_EX 4 |
|
86 #endif |
|
87 |
|
88 // ConstrainPosition window positioning slop value |
|
89 #define kWindowPositionSlop 20 |
|
90 |
|
91 // Origin of the system context menu when displayed in full screen mode |
|
92 #define MOZ_SYSCONTEXT_X_POS 20 |
|
93 #define MOZ_SYSCONTEXT_Y_POS 20 |
|
94 |
|
95 // Drop shadow window style |
|
96 #define CS_XP_DROPSHADOW 0x00020000 |
|
97 |
|
98 // Don't put more than this many rects in the dirty region, just fluff |
|
99 // out to the bounding-box if there are more |
|
100 #define MAX_RECTS_IN_REGION 100 |
|
101 |
|
102 // App Command messages for IntelliMouse and Natural Keyboard Pro |
|
103 // These messages are not included in Visual C++ 6.0, but are in 7.0+ |
|
104 #ifndef WM_APPCOMMAND |
|
105 #define WM_APPCOMMAND 0x0319 |
|
106 #endif |
|
107 |
|
108 #define FAPPCOMMAND_MASK 0xF000 |
|
109 |
|
110 #ifndef WM_GETTITLEBARINFOEX |
|
111 #define WM_GETTITLEBARINFOEX 0x033F |
|
112 #endif |
|
113 |
|
114 #ifndef CCHILDREN_TITLEBAR |
|
115 #define CCHILDREN_TITLEBAR 5 |
|
116 #endif |
|
117 |
|
118 #ifndef APPCOMMAND_BROWSER_BACKWARD |
|
119 #define APPCOMMAND_BROWSER_BACKWARD 1 |
|
120 #define APPCOMMAND_BROWSER_FORWARD 2 |
|
121 #define APPCOMMAND_BROWSER_REFRESH 3 |
|
122 #define APPCOMMAND_BROWSER_STOP 4 |
|
123 #define APPCOMMAND_BROWSER_SEARCH 5 |
|
124 #define APPCOMMAND_BROWSER_FAVORITES 6 |
|
125 #define APPCOMMAND_BROWSER_HOME 7 |
|
126 |
|
127 /* |
|
128 * Additional commands currently not in use. |
|
129 * |
|
130 *#define APPCOMMAND_VOLUME_MUTE 8 |
|
131 *#define APPCOMMAND_VOLUME_DOWN 9 |
|
132 *#define APPCOMMAND_VOLUME_UP 10 |
|
133 *#define APPCOMMAND_MEDIA_NEXTTRACK 11 |
|
134 *#define APPCOMMAND_MEDIA_PREVIOUSTRACK 12 |
|
135 *#define APPCOMMAND_MEDIA_STOP 13 |
|
136 *#define APPCOMMAND_MEDIA_PLAY_PAUSE 14 |
|
137 *#define APPCOMMAND_LAUNCH_MAIL 15 |
|
138 *#define APPCOMMAND_LAUNCH_MEDIA_SELECT 16 |
|
139 *#define APPCOMMAND_LAUNCH_APP1 17 |
|
140 *#define APPCOMMAND_LAUNCH_APP2 18 |
|
141 *#define APPCOMMAND_BASS_DOWN 19 |
|
142 *#define APPCOMMAND_BASS_BOOST 20 |
|
143 *#define APPCOMMAND_BASS_UP 21 |
|
144 *#define APPCOMMAND_TREBLE_DOWN 22 |
|
145 *#define APPCOMMAND_TREBLE_UP 23 |
|
146 *#define FAPPCOMMAND_MOUSE 0x8000 |
|
147 *#define FAPPCOMMAND_KEY 0 |
|
148 *#define FAPPCOMMAND_OEM 0x1000 |
|
149 */ |
|
150 |
|
151 #define GET_APPCOMMAND_LPARAM(lParam) ((short)(HIWORD(lParam) & ~FAPPCOMMAND_MASK)) |
|
152 |
|
153 /* |
|
154 *#define GET_DEVICE_LPARAM(lParam) ((WORD)(HIWORD(lParam) & FAPPCOMMAND_MASK)) |
|
155 *#define GET_MOUSEORKEY_LPARAM GET_DEVICE_LPARAM |
|
156 *#define GET_FLAGS_LPARAM(lParam) (LOWORD(lParam)) |
|
157 *#define GET_KEYSTATE_LPARAM(lParam) GET_FLAGS_LPARAM(lParam) |
|
158 */ |
|
159 #endif // #ifndef APPCOMMAND_BROWSER_BACKWARD |
|
160 |
|
161 //Tablet PC Mouse Input Source |
|
162 #define TABLET_INK_SIGNATURE 0xFFFFFF00 |
|
163 #define TABLET_INK_CHECK 0xFF515700 |
|
164 #define TABLET_INK_TOUCH 0x00000080 |
|
165 #define MOUSE_INPUT_SOURCE() WinUtils::GetMouseInputSource() |
|
166 |
|
167 /************************************************************** |
|
168 * |
|
169 * SECTION: enums |
|
170 * |
|
171 **************************************************************/ |
|
172 |
|
173 // nsWindow::sCanQuit |
|
174 typedef enum |
|
175 { |
|
176 TRI_UNKNOWN = -1, |
|
177 TRI_FALSE = 0, |
|
178 TRI_TRUE = 1 |
|
179 } TriStateBool; |
|
180 |
|
181 /************************************************************** |
|
182 * |
|
183 * SECTION: constants |
|
184 * |
|
185 **************************************************************/ |
|
186 |
|
187 /* |
|
188 * Native windows class names |
|
189 * |
|
190 * ::: IMPORTANT ::: |
|
191 * |
|
192 * External apps and drivers depend on window class names. |
|
193 * For example, changing the window classes could break |
|
194 * touchpad scrolling or screen readers. |
|
195 */ |
|
196 const uint32_t kMaxClassNameLength = 40; |
|
197 const char kClassNameHidden[] = "MozillaHiddenWindowClass"; |
|
198 const char kClassNameGeneral[] = "MozillaWindowClass"; |
|
199 const char kClassNameDialog[] = "MozillaDialogClass"; |
|
200 const char kClassNameDropShadow[] = "MozillaDropShadowWindowClass"; |
|
201 const char kClassNameTemp[] = "MozillaTempWindowClass"; |
|
202 |
|
203 /************************************************************** |
|
204 * |
|
205 * SECTION: structs |
|
206 * |
|
207 **************************************************************/ |
|
208 |
|
209 // Used for synthesizing events |
|
210 struct KeyPair { |
|
211 uint8_t mGeneral; |
|
212 uint8_t mSpecific; |
|
213 KeyPair(uint32_t aGeneral, uint32_t aSpecific) |
|
214 : mGeneral(uint8_t(aGeneral)), mSpecific(uint8_t(aSpecific)) {} |
|
215 }; |
|
216 |
|
217 #if (WINVER < 0x0600) |
|
218 struct TITLEBARINFOEX |
|
219 { |
|
220 DWORD cbSize; |
|
221 RECT rcTitleBar; |
|
222 DWORD rgstate[CCHILDREN_TITLEBAR + 1]; |
|
223 RECT rgrect[CCHILDREN_TITLEBAR + 1]; |
|
224 }; |
|
225 #endif |
|
226 |
|
227 namespace mozilla { |
|
228 namespace widget { |
|
229 |
|
230 struct MSGResult |
|
231 { |
|
232 // Result for the message. |
|
233 LRESULT& mResult; |
|
234 // If mConsumed is true, the caller shouldn't call next wndproc. |
|
235 bool mConsumed; |
|
236 |
|
237 MSGResult(LRESULT* aResult = nullptr) : |
|
238 mResult(aResult ? *aResult : mDefaultResult), mConsumed(false) |
|
239 { |
|
240 } |
|
241 |
|
242 private: |
|
243 LRESULT mDefaultResult; |
|
244 }; |
|
245 |
|
246 } // namespace widget |
|
247 } // namespace mozilla |
|
248 |
|
249 /************************************************************** |
|
250 * |
|
251 * SECTION: macros |
|
252 * |
|
253 **************************************************************/ |
|
254 |
|
255 #define NSRGB_2_COLOREF(color) \ |
|
256 RGB(NS_GET_R(color),NS_GET_G(color),NS_GET_B(color)) |
|
257 #define COLOREF_2_NSRGB(color) \ |
|
258 NS_RGB(GetRValue(color), GetGValue(color), GetBValue(color)) |
|
259 |
|
260 #define VERIFY_WINDOW_STYLE(s) \ |
|
261 NS_ASSERTION(((s) & (WS_CHILD | WS_POPUP)) != (WS_CHILD | WS_POPUP), \ |
|
262 "WS_POPUP and WS_CHILD are mutually exclusive") |
|
263 |
|
264 #endif /* WindowDefs_h__ */ |