OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_GFX_MONITOR_H_ |
| 6 #define UI_GFX_MONITOR_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" |
| 11 #include "ui/base/ui_export.h" |
| 12 #include "ui/gfx/rect.h" |
| 13 |
| 14 namespace gfx { |
| 15 |
| 16 class UI_EXPORT Monitor { |
| 17 public: |
| 18 Monitor(); |
| 19 virtual ~Monitor(); |
| 20 |
| 21 // Returns the monitor's bounds in gfx::Screen's coordinates. |
| 22 virtual Rect GetBounds() const = 0; |
| 23 |
| 24 // Returns the monitor's work area in gfx::Screen's coordinates. |
| 25 virtual Rect GetWorkArea() const = 0; |
| 26 |
| 27 // Output device's pixel scale factor. This specifies how much the |
| 28 // UI should be scaled when the actual output has more pixels than |
| 29 // standard monitors (which is around 100~120dpi.) For aura, this |
| 30 // value is either 1.0 or 2.0, but may return different values on |
| 31 // other platforms. |
| 32 virtual float GetDeviceScaleFactor() const = 0; |
| 33 |
| 34 // Utility functions that just return the size of monitor and |
| 35 // work area. |
| 36 Size GetSize() const; |
| 37 Size GetWorkAreaSize() const; |
| 38 |
| 39 private: |
| 40 DISALLOW_COPY_AND_ASSIGN(Monitor); |
| 41 }; |
| 42 |
| 43 // Simple monitor class that stores bounds and workarea. |
| 44 class UI_EXPORT SimpleMonitor : public Monitor { |
| 45 public: |
| 46 SimpleMonitor(); |
| 47 explicit SimpleMonitor(const gfx::Rect& bounds); |
| 48 virtual ~SimpleMonitor(); |
| 49 |
| 50 void set_bounds(const Rect& bounds) { bounds_ = bounds; } |
| 51 void set_work_area(const Rect& work_area) { work_area_ = work_area; } |
| 52 |
| 53 // Monitor overrides: |
| 54 virtual Rect GetBounds() const OVERRIDE; |
| 55 virtual Rect GetWorkArea() const OVERRIDE; |
| 56 virtual float GetDeviceScaleFactor() const OVERRIDE; |
| 57 |
| 58 private: |
| 59 Rect bounds_; |
| 60 Rect work_area_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(SimpleMonitor); |
| 63 }; |
| 64 |
| 65 } // namespace gfx |
| 66 |
| 67 #endif // UI_GFX_MONITOR_H_ |
OLD | NEW |