1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
19 * Portions created by the Initial Developer are Copyright (C) 2009
20 * the Initial Developer. All Rights Reserved.
23 * Jim Mathies <jmathies@mozilla.com>.
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #ifndef WindowDefs_h__
40 #define WindowDefs_h__
43 * nsWindowDefs - nsWindow related definitions, consts, and macros.
46 #include "nsBaseWidget.h"
50 /**************************************************************
54 **************************************************************/
56 // A magic APP message that can be sent to quit, sort of like a QUERYENDSESSION/ENDSESSION,
57 // but without the query.
58 #define MOZ_WM_APP_QUIT (WM_APP+0x0300)
60 // GetWindowsVersion constants
61 #define WIN2K_VERSION 0x500
62 #define WINXP_VERSION 0x501
63 #define WIN2K3_VERSION 0x502
64 #define VISTA_VERSION 0x600
65 #define WIN7_VERSION 0x601
67 #define WM_XP_THEMECHANGED 0x031A
70 #define WM_GETOBJECT 0x03d
73 #ifndef PBT_APMRESUMEAUTOMATIC
74 #define PBT_APMRESUMEAUTOMATIC 0x0012
77 #ifndef WM_MOUSEHWHEEL
78 #define WM_MOUSEHWHEEL 0x020E
82 #define WM_MOUSELEAVE 0x02A3
85 #ifndef SPI_GETWHEELSCROLLCHARS
86 #define SPI_GETWHEELSCROLLCHARS 0x006C
89 #ifndef MAPVK_VSC_TO_VK
90 #define MAPVK_VK_TO_VSC 0
91 #define MAPVK_VSC_TO_VK 1
92 #define MAPVK_VK_TO_CHAR 2
95 // ConstrainPosition window positioning slop value
96 #define kWindowPositionSlop 20
98 // Drop shadow window style
99 #define CS_XP_DROPSHADOW 0x00020000
101 // Don't put more than this many rects in the dirty region, just fluff
102 // out to the bounding-box if there are more
103 #define MAX_RECTS_IN_REGION 100
105 // App Command messages for IntelliMouse and Natural Keyboard Pro
106 // These messages are not included in Visual C++ 6.0, but are in 7.0+
107 #ifndef WM_APPCOMMAND
108 #define WM_APPCOMMAND 0x0319
111 #define FAPPCOMMAND_MASK 0xF000
113 #ifndef WM_GETTITLEBARINFOEX
114 #define WM_GETTITLEBARINFOEX 0x033F
117 #ifndef CCHILDREN_TITLEBAR
118 #define CCHILDREN_TITLEBAR 5
121 #ifndef APPCOMMAND_BROWSER_BACKWARD
122 #define APPCOMMAND_BROWSER_BACKWARD 1
123 #define APPCOMMAND_BROWSER_FORWARD 2
124 #define APPCOMMAND_BROWSER_REFRESH 3
125 #define APPCOMMAND_BROWSER_STOP 4
126 #define APPCOMMAND_BROWSER_SEARCH 5
127 #define APPCOMMAND_BROWSER_FAVORITES 6
128 #define APPCOMMAND_BROWSER_HOME 7
131 * Additional commands currently not in use.
133 *#define APPCOMMAND_VOLUME_MUTE 8
134 *#define APPCOMMAND_VOLUME_DOWN 9
135 *#define APPCOMMAND_VOLUME_UP 10
136 *#define APPCOMMAND_MEDIA_NEXTTRACK 11
137 *#define APPCOMMAND_MEDIA_PREVIOUSTRACK 12
138 *#define APPCOMMAND_MEDIA_STOP 13
139 *#define APPCOMMAND_MEDIA_PLAY_PAUSE 14
140 *#define APPCOMMAND_LAUNCH_MAIL 15
141 *#define APPCOMMAND_LAUNCH_MEDIA_SELECT 16
142 *#define APPCOMMAND_LAUNCH_APP1 17
143 *#define APPCOMMAND_LAUNCH_APP2 18
144 *#define APPCOMMAND_BASS_DOWN 19
145 *#define APPCOMMAND_BASS_BOOST 20
146 *#define APPCOMMAND_BASS_UP 21
147 *#define APPCOMMAND_TREBLE_DOWN 22
148 *#define APPCOMMAND_TREBLE_UP 23
149 *#define FAPPCOMMAND_MOUSE 0x8000
150 *#define FAPPCOMMAND_KEY 0
151 *#define FAPPCOMMAND_OEM 0x1000
154 #define GET_APPCOMMAND_LPARAM(lParam) ((short)(HIWORD(lParam) & ~FAPPCOMMAND_MASK))
157 *#define GET_DEVICE_LPARAM(lParam) ((WORD)(HIWORD(lParam) & FAPPCOMMAND_MASK))
158 *#define GET_MOUSEORKEY_LPARAM GET_DEVICE_LPARAM
159 *#define GET_FLAGS_LPARAM(lParam) (LOWORD(lParam))
160 *#define GET_KEYSTATE_LPARAM(lParam) GET_FLAGS_LPARAM(lParam)
162 #endif // #ifndef APPCOMMAND_BROWSER_BACKWARD
165 #ifndef RDW_NOINTERNALPAINT
166 #define RDW_NOINTERNALPAINT 0
171 #endif // defined(WINCE)
173 //Tablet PC Mouse Input Source
175 #define TABLET_INK_SIGNATURE 0xFFFFFF00
176 #define TABLET_INK_CHECK 0xFF515700
177 #define TABLET_INK_TOUCH 0x00000080
178 #define MOUSE_INPUT_SOURCE() GetMouseInputSource()
180 #define MOUSE_INPUT_SOURCE() nsIDOMNSMouseEvent::MOZ_SOURCE_MOUSE
183 /**************************************************************
187 **************************************************************/
189 // nsWindow::sCanQuit
197 /**************************************************************
201 **************************************************************/
204 * Native windows class names
208 * External apps and drivers depend on window class names.
209 * For example, changing the window classes could break
210 * touchpad scrolling or screen readers.
212 const PRUint32 kMaxClassNameLength
= 40;
213 const LPCWSTR kClassNameHidden
= L
"MozillaHiddenWindowClass";
214 const LPCWSTR kClassNameUI
= L
"MozillaUIWindowClass";
215 const LPCWSTR kClassNameContent
= L
"MozillaContentWindowClass";
216 const LPCWSTR kClassNameContentFrame
= L
"MozillaContentFrameWindowClass";
217 const LPCWSTR kClassNameGeneral
= L
"MozillaWindowClass";
218 const LPCWSTR kClassNameDialog
= L
"MozillaDialogClass";
219 const LPCWSTR kClassNameDropShadow
= L
"MozillaDropShadowWindowClass";
221 static const PRUint32 sModifierKeyMap
[][3] = {
222 { nsIWidget::CAPS_LOCK
, VK_CAPITAL
, 0 },
223 { nsIWidget::NUM_LOCK
, VK_NUMLOCK
, 0 },
224 { nsIWidget::SHIFT_L
, VK_SHIFT
, VK_LSHIFT
},
225 { nsIWidget::SHIFT_R
, VK_SHIFT
, VK_RSHIFT
},
226 { nsIWidget::CTRL_L
, VK_CONTROL
, VK_LCONTROL
},
227 { nsIWidget::CTRL_R
, VK_CONTROL
, VK_RCONTROL
},
228 { nsIWidget::ALT_L
, VK_MENU
, VK_LMENU
},
229 { nsIWidget::ALT_R
, VK_MENU
, VK_RMENU
}
232 /**************************************************************
236 **************************************************************/
239 struct nsAlternativeCharCode
; // defined in nsGUIEvent.h
240 struct nsFakeCharMessage
{
245 // Used in char processing
246 struct nsModifierKeyState
{
248 PRBool mIsControlDown
;
251 nsModifierKeyState();
252 nsModifierKeyState(PRBool aIsShiftDown
, PRBool aIsControlDown
,
254 mIsShiftDown(aIsShiftDown
), mIsControlDown(aIsControlDown
),
255 mIsAltDown(aIsAltDown
)
260 // Used for synthesizing events
264 KeyPair(PRUint32 aGeneral
, PRUint32 aSpecific
)
265 : mGeneral(PRUint8(aGeneral
)), mSpecific(PRUint8(aSpecific
)) {}
268 #ifndef TITLEBARINFOEX
269 struct TITLEBARINFOEX
273 DWORD rgstate
[CCHILDREN_TITLEBAR
+ 1];
274 RECT rgrect
[CCHILDREN_TITLEBAR
+ 1];
278 /**************************************************************
282 **************************************************************/
284 #define NSRGB_2_COLOREF(color) \
285 RGB(NS_GET_R(color),NS_GET_G(color),NS_GET_B(color))
286 #define COLOREF_2_NSRGB(color) \
287 NS_RGB(GetRValue(color), GetGValue(color), GetBValue(color))
289 #define VERIFY_WINDOW_STYLE(s) \
290 NS_ASSERTION(((s) & (WS_CHILD | WS_POPUP)) != (WS_CHILD | WS_POPUP), \
291 "WS_POPUP and WS_CHILD are mutually exclusive")
293 #endif /* WindowDefs_h__ */