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 // Note: The screen and monitor currently uses pixels coordinate | |
Ben Goodger (Google)
2012/04/24 21:17:08
pixel
oshima
2012/04/25 02:38:01
Done.
| |
17 // system. ENABLE_DIP macro (which is enabled with enable_dip=1 gyp | |
18 // flag) will make this inconsistent with views' coordinate system | |
19 // because views will use DIP coordinate system, which uses | |
20 // (1.0/device_scale_factor) scale of the pixel coordinate system. | |
21 // TODO(oshima): Change aura/screen to DIP coordinate system and | |
22 // update this comment. | |
23 class UI_EXPORT Monitor { | |
24 public: | |
25 Monitor(); | |
26 explicit Monitor(const gfx::Rect& bounds); | |
27 ~Monitor(); | |
28 | |
29 // Gets/Sets the monitor's bounds in gfx::Screen's coordinates. | |
30 const Rect& bounds() const { return bounds_; } | |
31 void set_bounds(const Rect& bounds) { bounds_ = bounds; } | |
32 | |
33 // Gets/Sets the monitor's work area in gfx::Screen's coordinates. | |
34 const Rect& work_area() const { return work_area_; } | |
35 void set_work_area(const Rect& work_area) { work_area_ = work_area; } | |
36 | |
37 // Output device's pixel scale factor. This specifies how much the | |
38 // UI should be scaled when the actual output has more pixels than | |
39 // standard monitors (which is around 100~120dpi.) The potential return | |
40 // values depend on each platforms. | |
41 float device_scale_factor() const { return device_scale_factor_; } | |
42 void set_device_scale_factor(float scale) { device_scale_factor_ = scale; } | |
43 | |
44 // Utility functions that just return the size of monitor and | |
45 // work area. | |
46 const Size& size() const { return bounds_.size(); } | |
47 const Size& work_area_size() const { return work_area_.size(); } | |
48 | |
49 // Sets the monitor bounds and updates the work are using the same insets | |
50 // between old bounds and work area. | |
51 void SetBoundsAndUpdateWorkArea(const gfx::Rect& bounds); | |
52 | |
53 // Sets the monitor size and updates the work are using the same insets | |
54 // between old bounds and work area. | |
55 void SetSizeAndUpdateWorkArea(const gfx::Size& size); | |
56 | |
57 // Computes and updates the monitor's work are using insets and the bounds. | |
58 void UpdateWorkAreaWithInsets(const gfx::Insets& work_area_insets); | |
59 | |
60 private: | |
61 Rect bounds_; | |
62 Rect work_area_; | |
63 float device_scale_factor_; | |
64 | |
65 // Allow copy but disallow assign. | |
66 void operator=(const Monitor&); | |
67 }; | |
Ben Goodger (Google)
2012/04/24 21:17:08
DISALLOW_COPY_AND_ASSIGN
oshima
2012/04/25 02:38:01
We do allow copy and assign for gfx::Rect/gfx::Siz
| |
68 | |
69 } // namespace gfx | |
70 | |
71 #endif // UI_GFX_MONITOR_H_ | |
OLD | NEW |