michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * vim: sw=2 ts=8 et : michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsBaseScreen_h michael@0: #define nsBaseScreen_h michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsIScreen.h" michael@0: michael@0: class nsBaseScreen : public nsIScreen michael@0: { michael@0: public: michael@0: nsBaseScreen(); michael@0: virtual ~nsBaseScreen(); michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: // nsIScreen interface michael@0: michael@0: // These simply forward to the device-pixel versions; michael@0: // implementations where global display pixels may not correspond michael@0: // to per-screen device pixels must override. michael@0: NS_IMETHOD GetRectDisplayPix(int32_t *outLeft, int32_t *outTop, michael@0: int32_t *outWidth, int32_t *outHeight); michael@0: NS_IMETHOD GetAvailRectDisplayPix(int32_t *outLeft, int32_t *outTop, michael@0: int32_t *outWidth, int32_t *outHeight); michael@0: michael@0: /** michael@0: * Simple management of screen brightness locks. This abstract base class michael@0: * allows all widget implementations to share brightness locking code. michael@0: */ michael@0: NS_IMETHOD LockMinimumBrightness(uint32_t aBrightness); michael@0: NS_IMETHOD UnlockMinimumBrightness(uint32_t aBrightness); michael@0: michael@0: NS_IMETHOD GetRotation(uint32_t* aRotation) { michael@0: *aRotation = nsIScreen::ROTATION_0_DEG; michael@0: return NS_OK; michael@0: } michael@0: NS_IMETHOD SetRotation(uint32_t aRotation) { return NS_ERROR_NOT_AVAILABLE; } michael@0: michael@0: NS_IMETHOD GetContentsScaleFactor(double* aContentsScaleFactor); michael@0: michael@0: protected: michael@0: /** michael@0: * Manually set the current level of brightness locking. This is called after michael@0: * we determine, based on the current active locks, what the strongest michael@0: * lock is. You should normally not call this function - it will be michael@0: * called automatically by this class. michael@0: * michael@0: * Each widget implementation should implement this in a way that michael@0: * makes sense there. This is normally the only function that michael@0: * contains widget-specific code. michael@0: * michael@0: * The default implementation does nothing. michael@0: * michael@0: * @param aBrightness The current brightness level to set. If this is michael@0: * nsIScreen::BRIGHTNESS_LEVELS michael@0: * (an impossible value for a brightness level to be), michael@0: * then that signifies that there is no current michael@0: * minimum brightness level, and the screen can shut off. michael@0: */ michael@0: virtual void ApplyMinimumBrightness(uint32_t aBrightness) { } michael@0: michael@0: private: michael@0: /** michael@0: * Checks what the minimum brightness value is, and calls michael@0: * ApplyMinimumBrightness. michael@0: */ michael@0: void CheckMinimumBrightness(); michael@0: michael@0: uint32_t mBrightnessLocks[nsIScreen::BRIGHTNESS_LEVELS]; michael@0: }; michael@0: michael@0: #endif // nsBaseScreen_h