widget/xpwidgets/nsBaseScreen.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     2  * vim: sw=2 ts=8 et :
     3  */
     4 /* This Source Code Form is subject to the terms of the Mozilla Public
     5  * License, v. 2.0. If a copy of the MPL was not distributed with this
     6  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     8 #ifndef nsBaseScreen_h
     9 #define nsBaseScreen_h
    11 #include "mozilla/Attributes.h"
    12 #include "nsIScreen.h"
    14 class nsBaseScreen : public nsIScreen
    15 {
    16 public:
    17   nsBaseScreen();
    18   virtual ~nsBaseScreen();
    20   NS_DECL_ISUPPORTS
    22   // nsIScreen interface
    24   // These simply forward to the device-pixel versions;
    25   // implementations where global display pixels may not correspond
    26   // to per-screen device pixels must override.
    27   NS_IMETHOD GetRectDisplayPix(int32_t *outLeft,  int32_t *outTop,
    28                                int32_t *outWidth, int32_t *outHeight);
    29   NS_IMETHOD GetAvailRectDisplayPix(int32_t *outLeft,  int32_t *outTop,
    30                                     int32_t *outWidth, int32_t *outHeight);
    32   /**
    33    * Simple management of screen brightness locks. This abstract base class
    34    * allows all widget implementations to share brightness locking code.
    35    */
    36   NS_IMETHOD LockMinimumBrightness(uint32_t aBrightness);
    37   NS_IMETHOD UnlockMinimumBrightness(uint32_t aBrightness);
    39   NS_IMETHOD GetRotation(uint32_t* aRotation) {
    40     *aRotation = nsIScreen::ROTATION_0_DEG;
    41     return NS_OK;
    42   }
    43   NS_IMETHOD SetRotation(uint32_t aRotation) { return NS_ERROR_NOT_AVAILABLE; }
    45   NS_IMETHOD GetContentsScaleFactor(double* aContentsScaleFactor);
    47 protected:
    48   /**
    49    * Manually set the current level of brightness locking. This is called after
    50    * we determine, based on the current active locks, what the strongest
    51    * lock is. You should normally not call this function - it will be
    52    * called automatically by this class.
    53    *
    54    * Each widget implementation should implement this in a way that
    55    * makes sense there. This is normally the only function that
    56    * contains widget-specific code.
    57    *
    58    * The default implementation does nothing.
    59    *
    60    * @param aBrightness The current brightness level to set. If this is
    61    *                    nsIScreen::BRIGHTNESS_LEVELS
    62    *                    (an impossible value for a brightness level to be),
    63    *                    then that signifies that there is no current
    64    *                    minimum brightness level, and the screen can shut off.
    65    */
    66   virtual void ApplyMinimumBrightness(uint32_t aBrightness) { }
    68 private:
    69   /**
    70    * Checks what the minimum brightness value is, and calls
    71    * ApplyMinimumBrightness.
    72    */
    73   void CheckMinimumBrightness();
    75   uint32_t mBrightnessLocks[nsIScreen::BRIGHTNESS_LEVELS];
    76 };
    78 #endif // nsBaseScreen_h

mercurial