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