widget/xpwidgets/nsBaseScreen.h

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

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

mercurial