| Index: ui/gfx/monitor.h
|
| diff --git a/ui/gfx/monitor.h b/ui/gfx/monitor.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7e2d5310f298a35f5e2b7e44eb5cfbf921e465d8
|
| --- /dev/null
|
| +++ b/ui/gfx/monitor.h
|
| @@ -0,0 +1,66 @@
|
| +// 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 {
|
| +
|
| +class UI_EXPORT Monitor {
|
| + public:
|
| + Monitor();
|
| + virtual ~Monitor();
|
| +
|
| + // Returns the monitor's bounds in gfx::Screen's coordinates.
|
| + virtual Rect GetBounds() const = 0;
|
| +
|
| + // Returns the monitor's work area in gfx::Screen's coordinates.
|
| + virtual Rect GetWorkArea() const = 0;
|
| +
|
| + // 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.
|
| + virtual float GetDeviceScaleFactor() const = 0;
|
| +
|
| + // Utility functions that just return the size of monitor and
|
| + // work area.
|
| + Size GetSize() const;
|
| + Size GetWorkAreaSize() const;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(Monitor);
|
| +};
|
| +
|
| +// Simple monitor class that stores bounds and workarea.
|
| +class UI_EXPORT SimpleMonitor : public Monitor {
|
| + public:
|
| + SimpleMonitor();
|
| + explicit SimpleMonitor(const gfx::Rect& bounds);
|
| + virtual ~SimpleMonitor();
|
| +
|
| + void set_bounds(const Rect& bounds) { bounds_ = bounds; }
|
| + void set_work_area(const Rect& work_area) { work_area_ = work_area; }
|
| +
|
| + // Monitor overrides:
|
| + virtual Rect GetBounds() const OVERRIDE;
|
| + virtual Rect GetWorkArea() const OVERRIDE;
|
| + virtual float GetDeviceScaleFactor() const OVERRIDE;
|
| +
|
| + private:
|
| + Rect bounds_;
|
| + Rect work_area_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(SimpleMonitor);
|
| +};
|
| +
|
| +} // namespace gfx
|
| +
|
| +#endif // UI_GFX_MONITOR_H_
|
|
|