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 | |
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 { | |
Ben Goodger (Google)
2012/04/13 19:57:19
this could just be a struct. you can skip the sett
oshima
2012/04/13 21:18:41
I was going to add a few methods, such as method t
| |
24 public: | |
25 Monitor(); | |
26 ~Monitor(); | |
27 | |
28 // Gets/Sets the monitor's bounds in gfx::Screen's coordinates. | |
29 const Rect& bounds() const { return bounds_; } | |
30 void set_bounds(const Rect& bounds) { bounds_ = bounds; } | |
31 | |
32 // Gets/Sets the monitor's work area in gfx::Screen's coordinates. | |
33 const Rect& work_area() const { return work_area_; } | |
34 void set_work_area(const Rect& work_area) { work_area_ = work_area; } | |
35 | |
36 // Output device's pixel scale factor. This specifies how much the | |
37 // UI should be scaled when the actual output has more pixels than | |
38 // standard monitors (which is around 100~120dpi.) The potential return | |
39 // values depend on each platforms. | |
40 float device_scale_factor() const { return device_scale_factor_; } | |
41 void set_device_scale_factor(float scale) { device_scale_factor_ = scale; } | |
42 | |
43 // Utility functions that just return the size of monitor and | |
44 // work area. | |
45 const Size& size() const { return bounds_.size(); } | |
46 const Size& work_area_size() const { return work_area_.size(); } | |
47 | |
48 private: | |
49 Rect bounds_; | |
50 Rect work_area_; | |
51 float device_scale_factor_; | |
52 | |
53 DISALLOW_COPY_AND_ASSIGN(Monitor); | |
54 }; | |
55 | |
56 } // namespace gfx | |
57 | |
58 #endif // UI_GFX_MONITOR_H_ | |
OLD | NEW |