OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ | 5 #ifndef ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ |
6 #define ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ | 6 #define ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "ui/gfx/point.h" | 12 #include "ui/gfx/point.h" |
13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
14 | 14 |
15 namespace aura { | 15 namespace aura { |
16 class RootWindow; | 16 class RootWindow; |
| 17 class EventFilter; |
17 } | 18 } |
18 | 19 |
19 namespace ash { | 20 namespace ash { |
20 namespace internal { | 21 namespace internal { |
21 | 22 |
| 23 class MagnificationControllerImpl; |
| 24 |
22 class MagnificationController { | 25 class MagnificationController { |
23 public: | 26 public: |
24 MagnificationController(); | 27 MagnificationController(); |
25 | 28 |
26 virtual ~MagnificationController() {} | 29 virtual ~MagnificationController(); |
27 | 30 |
28 // Sets the magnification ratio. 1.0f means no magnification. | 31 // Sets the magnification ratio. 1.0f means no magnification. |
29 void SetScale(float scale); | 32 void SetScale(float scale, bool animation); |
30 // Returns the current magnification ratio. | 33 // Returns the current magnification ratio. |
31 float GetScale() const { return scale_; } | 34 float GetScale() const; |
32 | 35 |
33 // Set the top-left point of the magnification window. | 36 // Set the top-left point of the magnification window. |
34 void MoveWindow(int x, int y); | 37 void MoveWindow(int x, int y, bool animation); |
35 void MoveWindow(const gfx::Point& point); | 38 void MoveWindow(const gfx::Point& point, bool animation); |
36 // Returns the current top-left point of the magnification window. | 39 // Returns the current top-left point of the magnification window. |
37 gfx::Point GetWindowPosition() const { return gfx::Point(x_, y_); } | 40 gfx::Point GetWindowPosition() const; |
38 | 41 |
39 // Ensures that the given point/rect is inside the magnification window. If | 42 // Ensures that the given point/rect is inside the magnification window. If |
40 // not, the controller moves the window to contain the given point/rect. | 43 // not, the controller moves the window to contain the given point/rect. |
41 void EnsureShowRect(const gfx::Rect& rect); | 44 void EnsureShowRect(const gfx::Rect& rect, bool animation); |
42 void EnsureShowPoint(const gfx::Point& point, bool animation); | 45 void EnsureShowPoint(const gfx::Point& point, bool animation); |
43 | 46 |
| 47 aura::EventFilter* GetEventFilter() const; |
| 48 |
44 private: | 49 private: |
45 aura::RootWindow* root_window_; | 50 scoped_ptr<MagnificationControllerImpl> impl_; |
46 | |
47 // Current scale, position of the magnification window. | |
48 float scale_; | |
49 int x_; | |
50 int y_; | |
51 | |
52 // Returns the rect of the magnification window. | |
53 gfx::Rect GetWindowRect(); | |
54 // Moves the magnification window to new scale and position. This method | |
55 // should be called internally just after the scale and/or the position are | |
56 // changed. | |
57 void RedrawScreen(bool animation); | |
58 | 51 |
59 DISALLOW_COPY_AND_ASSIGN(MagnificationController); | 52 DISALLOW_COPY_AND_ASSIGN(MagnificationController); |
60 }; | 53 }; |
61 | 54 |
62 } // namespace internal | 55 } // namespace internal |
63 } // namespace ash | 56 } // namespace ash |
64 | 57 |
65 #endif // ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ | 58 #endif // ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ |
OLD | NEW |