widget/windows/nsWindowDefs.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/windows/nsWindowDefs.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,264 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef WindowDefs_h__
    1.10 +#define WindowDefs_h__
    1.11 +
    1.12 +/*
    1.13 + * nsWindowDefs - nsWindow related definitions, consts, and macros.
    1.14 + */
    1.15 +
    1.16 +#include "nsBaseWidget.h"
    1.17 +#include "nsdefs.h"
    1.18 +#include "resource.h"
    1.19 +
    1.20 +/**************************************************************
    1.21 + *
    1.22 + * SECTION: defines
    1.23 + * 
    1.24 + **************************************************************/
    1.25 +
    1.26 +// A magic APP message that can be sent to quit, sort of like a QUERYENDSESSION/ENDSESSION,
    1.27 +// but without the query.
    1.28 +#define MOZ_WM_APP_QUIT                   (WM_APP+0x0300)
    1.29 +// Used as a "tracer" event to probe event loop latency.
    1.30 +#define MOZ_WM_TRACE                      (WM_APP+0x0301)
    1.31 +// Our internal message for WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_VSCROLL and
    1.32 +// WM_HSCROLL
    1.33 +#define MOZ_WM_MOUSEVWHEEL                (WM_APP+0x0310)
    1.34 +#define MOZ_WM_MOUSEHWHEEL                (WM_APP+0x0311)
    1.35 +#define MOZ_WM_VSCROLL                    (WM_APP+0x0312)
    1.36 +#define MOZ_WM_HSCROLL                    (WM_APP+0x0313)
    1.37 +#define MOZ_WM_MOUSEWHEEL_FIRST           MOZ_WM_MOUSEVWHEEL
    1.38 +#define MOZ_WM_MOUSEWHEEL_LAST            MOZ_WM_HSCROLL
    1.39 +// If a popup window is being activated, we try to reactivate the previous
    1.40 +// window with this message.
    1.41 +#define MOZ_WM_REACTIVATE                 (WM_APP+0x0314)
    1.42 +
    1.43 +// Internal message for ensuring the file picker is visible on multi monitor
    1.44 +// systems, and when the screen resolution changes.
    1.45 +#define MOZ_WM_ENSUREVISIBLE              (WM_APP+0x374F)
    1.46 +
    1.47 +#ifndef SM_CXPADDEDBORDER
    1.48 +#define SM_CXPADDEDBORDER                 92
    1.49 +#endif
    1.50 +
    1.51 +#ifndef WM_THEMECHANGED
    1.52 +#define WM_THEMECHANGED                   0x031A
    1.53 +#endif
    1.54 +
    1.55 +#ifndef WM_GETOBJECT
    1.56 +#define WM_GETOBJECT                      0x03d
    1.57 +#endif
    1.58 +
    1.59 +#ifndef PBT_APMRESUMEAUTOMATIC
    1.60 +#define PBT_APMRESUMEAUTOMATIC            0x0012
    1.61 +#endif
    1.62 +
    1.63 +#ifndef WM_MOUSEHWHEEL
    1.64 +#define WM_MOUSEHWHEEL                    0x020E
    1.65 +#endif
    1.66 +
    1.67 +#ifndef MOUSEEVENTF_HWHEEL
    1.68 +#define MOUSEEVENTF_HWHEEL                0x01000
    1.69 +#endif
    1.70 +
    1.71 +#ifndef WM_MOUSELEAVE
    1.72 +#define WM_MOUSELEAVE                     0x02A3
    1.73 +#endif
    1.74 +
    1.75 +#ifndef SPI_GETWHEELSCROLLCHARS
    1.76 +#define SPI_GETWHEELSCROLLCHARS           0x006C
    1.77 +#endif
    1.78 +
    1.79 +#ifndef SPI_SETWHEELSCROLLCHARS
    1.80 +#define SPI_SETWHEELSCROLLCHARS           0x006D
    1.81 +#endif
    1.82 +
    1.83 +#ifndef MAPVK_VSC_TO_VK
    1.84 +#define MAPVK_VK_TO_VSC                   0
    1.85 +#define MAPVK_VSC_TO_VK                   1
    1.86 +#define MAPVK_VK_TO_CHAR                  2
    1.87 +#define MAPVK_VSC_TO_VK_EX                3
    1.88 +#define MAPVK_VK_TO_VSC_EX                4
    1.89 +#endif
    1.90 +
    1.91 +// ConstrainPosition window positioning slop value
    1.92 +#define kWindowPositionSlop               20
    1.93 +
    1.94 +// Origin of the system context menu when displayed in full screen mode
    1.95 +#define MOZ_SYSCONTEXT_X_POS              20
    1.96 +#define MOZ_SYSCONTEXT_Y_POS              20
    1.97 +
    1.98 +// Drop shadow window style
    1.99 +#define CS_XP_DROPSHADOW                  0x00020000
   1.100 +
   1.101 +// Don't put more than this many rects in the dirty region, just fluff
   1.102 +// out to the bounding-box if there are more
   1.103 +#define MAX_RECTS_IN_REGION               100
   1.104 +
   1.105 +// App Command messages for IntelliMouse and Natural Keyboard Pro
   1.106 +// These messages are not included in Visual C++ 6.0, but are in 7.0+
   1.107 +#ifndef WM_APPCOMMAND
   1.108 +#define WM_APPCOMMAND                     0x0319
   1.109 +#endif
   1.110 +
   1.111 +#define FAPPCOMMAND_MASK                  0xF000
   1.112 +
   1.113 +#ifndef WM_GETTITLEBARINFOEX
   1.114 +#define WM_GETTITLEBARINFOEX              0x033F
   1.115 +#endif
   1.116 +
   1.117 +#ifndef CCHILDREN_TITLEBAR
   1.118 +#define CCHILDREN_TITLEBAR                5
   1.119 +#endif
   1.120 +
   1.121 +#ifndef APPCOMMAND_BROWSER_BACKWARD
   1.122 +  #define APPCOMMAND_BROWSER_BACKWARD       1
   1.123 +  #define APPCOMMAND_BROWSER_FORWARD        2
   1.124 +  #define APPCOMMAND_BROWSER_REFRESH        3
   1.125 +  #define APPCOMMAND_BROWSER_STOP           4
   1.126 +  #define APPCOMMAND_BROWSER_SEARCH         5
   1.127 +  #define APPCOMMAND_BROWSER_FAVORITES      6
   1.128 +  #define APPCOMMAND_BROWSER_HOME           7
   1.129 +
   1.130 +  /* 
   1.131 +   * Additional commands currently not in use.
   1.132 +   *
   1.133 +   *#define APPCOMMAND_VOLUME_MUTE            8
   1.134 +   *#define APPCOMMAND_VOLUME_DOWN            9
   1.135 +   *#define APPCOMMAND_VOLUME_UP              10
   1.136 +   *#define APPCOMMAND_MEDIA_NEXTTRACK        11
   1.137 +   *#define APPCOMMAND_MEDIA_PREVIOUSTRACK    12
   1.138 +   *#define APPCOMMAND_MEDIA_STOP             13
   1.139 +   *#define APPCOMMAND_MEDIA_PLAY_PAUSE       14
   1.140 +   *#define APPCOMMAND_LAUNCH_MAIL            15
   1.141 +   *#define APPCOMMAND_LAUNCH_MEDIA_SELECT    16
   1.142 +   *#define APPCOMMAND_LAUNCH_APP1            17
   1.143 +   *#define APPCOMMAND_LAUNCH_APP2            18
   1.144 +   *#define APPCOMMAND_BASS_DOWN              19
   1.145 +   *#define APPCOMMAND_BASS_BOOST             20
   1.146 +   *#define APPCOMMAND_BASS_UP                21
   1.147 +   *#define APPCOMMAND_TREBLE_DOWN            22
   1.148 +   *#define APPCOMMAND_TREBLE_UP              23
   1.149 +   *#define FAPPCOMMAND_MOUSE                 0x8000
   1.150 +   *#define FAPPCOMMAND_KEY                   0
   1.151 +   *#define FAPPCOMMAND_OEM                   0x1000
   1.152 +   */
   1.153 +
   1.154 +  #define GET_APPCOMMAND_LPARAM(lParam)     ((short)(HIWORD(lParam) & ~FAPPCOMMAND_MASK))
   1.155 +
   1.156 +  /*
   1.157 +   *#define GET_DEVICE_LPARAM(lParam)         ((WORD)(HIWORD(lParam) & FAPPCOMMAND_MASK))
   1.158 +   *#define GET_MOUSEORKEY_LPARAM             GET_DEVICE_LPARAM
   1.159 +   *#define GET_FLAGS_LPARAM(lParam)          (LOWORD(lParam))
   1.160 +   *#define GET_KEYSTATE_LPARAM(lParam)       GET_FLAGS_LPARAM(lParam)
   1.161 +   */
   1.162 +#endif // #ifndef APPCOMMAND_BROWSER_BACKWARD
   1.163 +
   1.164 +//Tablet PC Mouse Input Source
   1.165 +#define TABLET_INK_SIGNATURE 0xFFFFFF00
   1.166 +#define TABLET_INK_CHECK     0xFF515700
   1.167 +#define TABLET_INK_TOUCH     0x00000080
   1.168 +#define MOUSE_INPUT_SOURCE() WinUtils::GetMouseInputSource()
   1.169 +
   1.170 +/**************************************************************
   1.171 + *
   1.172 + * SECTION: enums
   1.173 + * 
   1.174 + **************************************************************/
   1.175 +
   1.176 +// nsWindow::sCanQuit
   1.177 +typedef enum
   1.178 +{
   1.179 +    TRI_UNKNOWN = -1,
   1.180 +    TRI_FALSE = 0,
   1.181 +    TRI_TRUE = 1
   1.182 +} TriStateBool;
   1.183 +
   1.184 +/**************************************************************
   1.185 + *
   1.186 + * SECTION: constants
   1.187 + * 
   1.188 + **************************************************************/
   1.189 +
   1.190 +/*
   1.191 + * Native windows class names
   1.192 + *
   1.193 + * ::: IMPORTANT :::
   1.194 + *
   1.195 + * External apps and drivers depend on window class names.
   1.196 + * For example, changing the window classes could break
   1.197 + * touchpad scrolling or screen readers.
   1.198 + */
   1.199 +const uint32_t kMaxClassNameLength   = 40;
   1.200 +const char kClassNameHidden[]        = "MozillaHiddenWindowClass";
   1.201 +const char kClassNameGeneral[]       = "MozillaWindowClass";
   1.202 +const char kClassNameDialog[]        = "MozillaDialogClass";
   1.203 +const char kClassNameDropShadow[]    = "MozillaDropShadowWindowClass";
   1.204 +const char kClassNameTemp[]          = "MozillaTempWindowClass";
   1.205 +
   1.206 +/**************************************************************
   1.207 + *
   1.208 + * SECTION: structs
   1.209 + * 
   1.210 + **************************************************************/
   1.211 +
   1.212 +// Used for synthesizing events
   1.213 +struct KeyPair {
   1.214 +  uint8_t mGeneral;
   1.215 +  uint8_t mSpecific;
   1.216 +  KeyPair(uint32_t aGeneral, uint32_t aSpecific)
   1.217 +    : mGeneral(uint8_t(aGeneral)), mSpecific(uint8_t(aSpecific)) {}
   1.218 +};
   1.219 +
   1.220 +#if (WINVER < 0x0600)
   1.221 +struct TITLEBARINFOEX
   1.222 +{
   1.223 +    DWORD cbSize;
   1.224 +    RECT rcTitleBar;
   1.225 +    DWORD rgstate[CCHILDREN_TITLEBAR + 1];
   1.226 +    RECT rgrect[CCHILDREN_TITLEBAR + 1];
   1.227 +};
   1.228 +#endif
   1.229 +
   1.230 +namespace mozilla {
   1.231 +namespace widget {
   1.232 +
   1.233 +struct MSGResult
   1.234 +{
   1.235 +  // Result for the message.
   1.236 +  LRESULT& mResult;
   1.237 +  // If mConsumed is true, the caller shouldn't call next wndproc.
   1.238 +  bool mConsumed;
   1.239 +
   1.240 +  MSGResult(LRESULT* aResult = nullptr) :
   1.241 +    mResult(aResult ? *aResult : mDefaultResult), mConsumed(false)
   1.242 +  {
   1.243 +  }
   1.244 +
   1.245 +private:
   1.246 +  LRESULT mDefaultResult;
   1.247 +};
   1.248 +
   1.249 +} // namespace widget
   1.250 +} // namespace mozilla
   1.251 +
   1.252 +/**************************************************************
   1.253 + *
   1.254 + * SECTION: macros
   1.255 + * 
   1.256 + **************************************************************/
   1.257 +
   1.258 +#define NSRGB_2_COLOREF(color) \
   1.259 +      RGB(NS_GET_R(color),NS_GET_G(color),NS_GET_B(color))
   1.260 +#define COLOREF_2_NSRGB(color) \
   1.261 +      NS_RGB(GetRValue(color), GetGValue(color), GetBValue(color))
   1.262 +
   1.263 +#define VERIFY_WINDOW_STYLE(s) \
   1.264 +      NS_ASSERTION(((s) & (WS_CHILD | WS_POPUP)) != (WS_CHILD | WS_POPUP), \
   1.265 +      "WS_POPUP and WS_CHILD are mutually exclusive")
   1.266 +
   1.267 +#endif /* WindowDefs_h__ */

mercurial