Bug 1073336 part 5 - Add AnimationPlayerCollection::PlayerUpdated; r=dbaron
[gecko.git] / widget / nsBaseScreen.h
blob7684c9979ee537b59615414ed0bebd94c136a04c
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
16 public:
17 nsBaseScreen();
19 NS_DECL_ISUPPORTS
21 // nsIScreen interface
23 // These simply forward to the device-pixel versions;
24 // implementations where global display pixels may not correspond
25 // to per-screen device pixels must override.
26 NS_IMETHOD GetRectDisplayPix(int32_t *outLeft, int32_t *outTop,
27 int32_t *outWidth, int32_t *outHeight);
28 NS_IMETHOD GetAvailRectDisplayPix(int32_t *outLeft, int32_t *outTop,
29 int32_t *outWidth, int32_t *outHeight);
31 /**
32 * Simple management of screen brightness locks. This abstract base class
33 * allows all widget implementations to share brightness locking code.
35 NS_IMETHOD LockMinimumBrightness(uint32_t aBrightness);
36 NS_IMETHOD UnlockMinimumBrightness(uint32_t aBrightness);
38 NS_IMETHOD GetRotation(uint32_t* aRotation) {
39 *aRotation = nsIScreen::ROTATION_0_DEG;
40 return NS_OK;
42 NS_IMETHOD SetRotation(uint32_t aRotation) { return NS_ERROR_NOT_AVAILABLE; }
44 NS_IMETHOD GetContentsScaleFactor(double* aContentsScaleFactor);
46 protected:
47 virtual ~nsBaseScreen();
49 /**
50 * Manually set the current level of brightness locking. This is called after
51 * we determine, based on the current active locks, what the strongest
52 * lock is. You should normally not call this function - it will be
53 * called automatically by this class.
55 * Each widget implementation should implement this in a way that
56 * makes sense there. This is normally the only function that
57 * contains widget-specific code.
59 * The default implementation does nothing.
61 * @param aBrightness The current brightness level to set. If this is
62 * nsIScreen::BRIGHTNESS_LEVELS
63 * (an impossible value for a brightness level to be),
64 * then that signifies that there is no current
65 * minimum brightness level, and the screen can shut off.
67 virtual void ApplyMinimumBrightness(uint32_t aBrightness) { }
69 private:
70 /**
71 * Checks what the minimum brightness value is, and calls
72 * ApplyMinimumBrightness.
74 void CheckMinimumBrightness();
76 uint32_t mBrightnessLocks[nsIScreen::BRIGHTNESS_LEVELS];
79 #endif // nsBaseScreen_h