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_WM_DEFAULT_WINDOW_RESIZER_H_ | 5 #ifndef ASH_WM_DEFAULT_WINDOW_RESIZER_H_ |
6 #define ASH_WM_DEFAULT_WINDOW_RESIZER_H_ | 6 #define ASH_WM_DEFAULT_WINDOW_RESIZER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ash/wm/window_resizer.h" | 9 #include "ash/wm/window_resizer.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 | 11 |
12 namespace ash { | 12 namespace ash { |
13 | 13 |
14 namespace internal { | 14 namespace internal { |
15 class RootWindowEventFilter; | 15 class RootWindowEventFilter; |
16 } | 16 } |
17 | 17 |
18 // WindowResizer is used by ToplevelWindowEventFilter to handle dragging, moving | 18 // WindowResizer is used by ToplevelWindowEventFilter to handle dragging, moving |
19 // or resizing a window. All coordinates passed to this are in the parent | 19 // or resizing a window. All coordinates passed to this are in the parent |
20 // windows coordiantes. | 20 // windows coordiantes. |
21 class ASH_EXPORT DefaultWindowResizer : public WindowResizer { | 21 class ASH_EXPORT DefaultWindowResizer : public WindowResizer { |
22 public: | 22 public: |
23 virtual ~DefaultWindowResizer(); | 23 virtual ~DefaultWindowResizer(); |
24 | 24 |
25 // Creates a new DefaultWindowResizer. The caller takes ownership of the | 25 // Creates a new DefaultWindowResizer. The caller takes ownership of the |
26 // returned object. Returns NULL if not resizable. | 26 // returned object. Returns NULL if not resizable. |
27 static DefaultWindowResizer* Create(aura::Window* window, | 27 static DefaultWindowResizer* Create(aura::Window* window, |
28 const gfx::Point& location, | 28 const gfx::Point& location, |
29 int window_component, | 29 int window_component); |
30 int grid_size); | |
31 | 30 |
32 // Returns true if the drag will result in changing the window in anyway. | 31 // Returns true if the drag will result in changing the window in anyway. |
33 bool is_resizable() const { return details_.is_resizable; } | 32 bool is_resizable() const { return details_.is_resizable; } |
34 | 33 |
35 bool changed_size() const { | 34 bool changed_size() const { |
36 return !(details_.bounds_change & kBoundsChange_Repositions); | 35 return !(details_.bounds_change & kBoundsChange_Repositions); |
37 } | 36 } |
38 aura::Window* target_window() const { return details_.window; } | 37 aura::Window* target_window() const { return details_.window; } |
39 | 38 |
40 // WindowResizer overides: | 39 // WindowResizer overides: |
41 virtual void Drag(const gfx::Point& location) OVERRIDE; | 40 virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE; |
42 virtual void CompleteDrag() OVERRIDE; | 41 virtual void CompleteDrag(int event_flags) OVERRIDE; |
43 virtual void RevertDrag() OVERRIDE; | 42 virtual void RevertDrag() OVERRIDE; |
44 | 43 |
45 private: | 44 private: |
46 explicit DefaultWindowResizer(const Details& details); | 45 explicit DefaultWindowResizer(const Details& details); |
47 | 46 |
48 const Details details_; | 47 const Details details_; |
49 | 48 |
50 // Set to true once Drag() is invoked and the bounds of the window change. | 49 // Set to true once Drag() is invoked and the bounds of the window change. |
51 bool did_move_or_resize_; | 50 bool did_move_or_resize_; |
52 | 51 |
53 internal::RootWindowEventFilter* root_filter_; | 52 internal::RootWindowEventFilter* root_filter_; |
54 | 53 |
55 DISALLOW_COPY_AND_ASSIGN(DefaultWindowResizer); | 54 DISALLOW_COPY_AND_ASSIGN(DefaultWindowResizer); |
56 }; | 55 }; |
57 | 56 |
58 } // namespace aura | 57 } // namespace aura |
59 | 58 |
60 #endif // ASH_WM_DEFAULT_WINDOW_RESIZER_H_ | 59 #endif // ASH_WM_DEFAULT_WINDOW_RESIZER_H_ |
OLD | NEW |