| 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.) The potential return |
| 30 // values depend on each platforms. |
| 31 virtual float GetDeviceScaleFactor() const = 0; |
| 32 |
| 33 // Utility functions that just return the size of monitor and |
| 34 // work area. |
| 35 Size GetSize() const; |
| 36 Size GetWorkAreaSize() const; |
| 37 |
| 38 private: |
| 39 DISALLOW_COPY_AND_ASSIGN(Monitor); |
| 40 }; |
| 41 |
| 42 // Simple monitor class that stores bounds and workarea. |
| 43 class UI_EXPORT SimpleMonitor : public Monitor { |
| 44 public: |
| 45 SimpleMonitor(); |
| 46 explicit SimpleMonitor(const gfx::Rect& bounds); |
| 47 virtual ~SimpleMonitor(); |
| 48 |
| 49 void set_bounds(const Rect& bounds) { bounds_ = bounds; } |
| 50 void set_work_area(const Rect& work_area) { work_area_ = work_area; } |
| 51 |
| 52 // Monitor overrides: |
| 53 virtual Rect GetBounds() const OVERRIDE; |
| 54 virtual Rect GetWorkArea() const OVERRIDE; |
| 55 virtual float GetDeviceScaleFactor() const OVERRIDE; |
| 56 |
| 57 private: |
| 58 Rect bounds_; |
| 59 Rect work_area_; |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(SimpleMonitor); |
| 62 }; |
| 63 |
| 64 } // namespace gfx |
| 65 |
| 66 #endif // UI_GFX_MONITOR_H_ |
| OLD | NEW |