Chromium Code Reviews| Index: ui/gfx/monitor.h |
| diff --git a/ui/gfx/monitor.h b/ui/gfx/monitor.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..386260beda1939b2c4062282846ce366998eb7f5 |
| --- /dev/null |
| +++ b/ui/gfx/monitor.h |
| @@ -0,0 +1,58 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_GFX_MONITOR_H_ |
| +#define UI_GFX_MONITOR_H_ |
| +#pragma once |
| + |
| +#include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| +#include "ui/base/ui_export.h" |
| +#include "ui/gfx/rect.h" |
| + |
| +namespace gfx { |
| + |
| +// Note: The screen and monitor currently uses pixels coordinate |
| +// system. ENABLE_DIP macro (which is enabled with enable_dip=1 gyp |
| +// flag) will make this inconsistent with views' coordinate system |
| +// because views will use DIP coordinate system, which uses |
| +// (1.0/device_scale_factor) scale of the pixel coordinate system. |
| +// TODO(oshima): Change aura/screen to DIP coordinate system and |
| +// update this comment. |
| +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
|
| + public: |
| + Monitor(); |
| + ~Monitor(); |
| + |
| + // Gets/Sets the monitor's bounds in gfx::Screen's coordinates. |
| + const Rect& bounds() const { return bounds_; } |
| + void set_bounds(const Rect& bounds) { bounds_ = bounds; } |
| + |
| + // Gets/Sets the monitor's work area in gfx::Screen's coordinates. |
| + const Rect& work_area() const { return work_area_; } |
| + void set_work_area(const Rect& work_area) { work_area_ = work_area; } |
| + |
| + // Output device's pixel scale factor. This specifies how much the |
| + // UI should be scaled when the actual output has more pixels than |
| + // standard monitors (which is around 100~120dpi.) The potential return |
| + // values depend on each platforms. |
| + float device_scale_factor() const { return device_scale_factor_; } |
| + void set_device_scale_factor(float scale) { device_scale_factor_ = scale; } |
| + |
| + // Utility functions that just return the size of monitor and |
| + // work area. |
| + const Size& size() const { return bounds_.size(); } |
| + const Size& work_area_size() const { return work_area_.size(); } |
| + |
| + private: |
| + Rect bounds_; |
| + Rect work_area_; |
| + float device_scale_factor_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(Monitor); |
| +}; |
| + |
| +} // namespace gfx |
| + |
| +#endif // UI_GFX_MONITOR_H_ |