| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 ASH_WM_COMMON_WM_EVENT_H_ | |
| 6 #define ASH_WM_COMMON_WM_EVENT_H_ | |
| 7 | |
| 8 #include "ash/ash_export.h" | |
| 9 #include "ash/wm/common/wm_types.h" | |
| 10 #include "base/macros.h" | |
| 11 #include "ui/gfx/geometry/rect.h" | |
| 12 | |
| 13 // TODO(sky): move to common. | |
| 14 namespace ash { | |
| 15 namespace wm { | |
| 16 | |
| 17 // WMEventType defines a set of operations that can change the | |
| 18 // window's state type and bounds. | |
| 19 enum WMEventType { | |
| 20 // Following events are the request to become corresponding state. | |
| 21 // Note that this does not mean the window will be in corresponding | |
| 22 // state and the request may not be fullfilled. | |
| 23 | |
| 24 // NORMAL is used as a restore operation with a few exceptions. | |
| 25 WM_EVENT_NORMAL, | |
| 26 WM_EVENT_MAXIMIZE, | |
| 27 WM_EVENT_MINIMIZE, | |
| 28 WM_EVENT_FULLSCREEN, | |
| 29 WM_EVENT_SNAP_LEFT, | |
| 30 WM_EVENT_SNAP_RIGHT, | |
| 31 WM_EVENT_DOCK, | |
| 32 | |
| 33 // A window is requested to be the given bounds. The request may or | |
| 34 // may not be fulfilled depending on the requested bounds and window's | |
| 35 // state. This will not change the window state type. | |
| 36 WM_EVENT_SET_BOUNDS, | |
| 37 | |
| 38 // Following events are compond events which may lead to different | |
| 39 // states depending on the current state. | |
| 40 | |
| 41 // A user requested to toggle maximized state by double clicking window | |
| 42 // header. | |
| 43 WM_EVENT_TOGGLE_MAXIMIZE_CAPTION, | |
| 44 | |
| 45 // A user requested to toggle maximized state using shortcut. | |
| 46 WM_EVENT_TOGGLE_MAXIMIZE, | |
| 47 | |
| 48 // A user requested to toggle vertical maximize by double clicking | |
| 49 // top/bottom edge. | |
| 50 WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE, | |
| 51 | |
| 52 // A user requested to toggle horizontal maximize by double clicking | |
| 53 // left/right edge. | |
| 54 WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE, | |
| 55 | |
| 56 // A user requested to toggle fullscreen state. | |
| 57 WM_EVENT_TOGGLE_FULLSCREEN, | |
| 58 | |
| 59 // A user requested a cycle of dock and snap left. | |
| 60 // The way this event is processed is the current window state is used as | |
| 61 // the starting state. Assuming normal window start state; if the window can | |
| 62 // be snapped left, snap it; otherwise progress to next state. If the window | |
| 63 // can be docked left, dock it; otherwise progress to next state. If the | |
| 64 // window can be restored; and this isn't the entry condition restore it; | |
| 65 // otherwise apply the bounce animation to the window. | |
| 66 WM_EVENT_CYCLE_SNAP_DOCK_LEFT, | |
| 67 | |
| 68 // A user requested a cycle of dock and snap right. | |
| 69 // See decription of WM_EVENT_CYCLE_SNAP_DOCK_LEFT. | |
| 70 WM_EVENT_CYCLE_SNAP_DOCK_RIGHT, | |
| 71 | |
| 72 // A user requested to center a window. | |
| 73 WM_EVENT_CENTER, | |
| 74 | |
| 75 // TODO(oshima): Investigate if this can be removed from ash. | |
| 76 // Widget requested to show in inactive state. | |
| 77 WM_EVENT_SHOW_INACTIVE, | |
| 78 | |
| 79 // Following events are generated when the workspace envrionment has changed. | |
| 80 // The window's state type will not be changed by these events. | |
| 81 | |
| 82 // The window is added to the workspace, either as a new window, due to | |
| 83 // display disconnection or dragging. | |
| 84 WM_EVENT_ADDED_TO_WORKSPACE, | |
| 85 | |
| 86 // Bounds of the display has changed. | |
| 87 WM_EVENT_DISPLAY_BOUNDS_CHANGED, | |
| 88 | |
| 89 // Bounds of the work area has changed. This will not occur when the work | |
| 90 // area has changed as a result of DISPLAY_BOUNDS_CHANGED. | |
| 91 WM_EVENT_WORKAREA_BOUNDS_CHANGED, | |
| 92 }; | |
| 93 | |
| 94 class ASH_EXPORT WMEvent { | |
| 95 public: | |
| 96 explicit WMEvent(WMEventType type); | |
| 97 virtual ~WMEvent(); | |
| 98 | |
| 99 WMEventType type() const { return type_; } | |
| 100 | |
| 101 private: | |
| 102 WMEventType type_; | |
| 103 DISALLOW_COPY_AND_ASSIGN(WMEvent); | |
| 104 }; | |
| 105 | |
| 106 // An WMEvent to request new bounds for the window. | |
| 107 class ASH_EXPORT SetBoundsEvent : public WMEvent { | |
| 108 public: | |
| 109 SetBoundsEvent(WMEventType type, const gfx::Rect& requested_bounds); | |
| 110 ~SetBoundsEvent() override; | |
| 111 | |
| 112 const gfx::Rect& requested_bounds() const { return requested_bounds_; } | |
| 113 | |
| 114 private: | |
| 115 gfx::Rect requested_bounds_; | |
| 116 | |
| 117 DISALLOW_COPY_AND_ASSIGN(SetBoundsEvent); | |
| 118 }; | |
| 119 | |
| 120 } // namespace wm | |
| 121 } // namespace ash | |
| 122 | |
| 123 #endif // ASH_WM_COMMON_WM_EVENT_H_ | |
| OLD | NEW |