OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_WM_WINDOW_MAXIMIZE_H_ | |
sky
2012/07/31 16:11:06
File name should match class name. So, this file s
Mr4D (OOO till 08-26)
2012/08/01 20:48:22
Done & renamed.
| |
6 #define ASH_WM_WINDOW_MAXIMIZE_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "ash/wm/workspace/frame_maximize_button.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "ui/aura/event_filter.h" | |
12 | |
13 namespace base { | |
14 class Timer; | |
15 } | |
16 | |
17 namespace views { | |
18 class RadialMenu; | |
19 } | |
20 | |
21 namespace ash { | |
22 | |
23 // A class which shows a helper UI for the maximize button. This menu is either | |
24 // - showing a bubble showing three buttons and a help. | |
25 // - a helo menu (experimental behind a flag). | |
sky
2012/07/31 16:11:06
halo?
Mr4D (OOO till 08-26)
2012/08/01 20:48:22
Done.
| |
26 // The menu gets created every time after an initial delay. The delay can be | |
27 // reset through a function. | |
28 // Note: The EventFilter dependency is only part of the radial menu and will | |
sky
2012/07/31 16:11:06
Why is the EventFilter part of this class? Shouldn
Mr4D (OOO till 08-26)
2012/08/01 20:48:22
No. The radial menu is a "renderer" with a hit tes
| |
29 // only be used to track mouse movement when the radial menu is shown. This is | |
30 // needed to update the menu in case of a non pressed mouse move. | |
31 class ASH_EXPORT MaximizeBubble : public aura::EventFilter { | |
32 public: | |
33 explicit MaximizeBubble(FrameMaximizeButton* frame_maximize_button, | |
34 bool is_maximized); | |
sky
2012/07/31 16:11:06
indent to match previous line.
Mr4D (OOO till 08-26)
2012/08/01 20:48:22
Done.
| |
35 // Called from the outside to destroy the interface to the menu and | |
36 // the menu itself will delete itself then. | |
37 virtual ~MaximizeBubble(); | |
38 | |
39 // Update the visible menu to reflect the previewed |snap_type| snapping | |
40 // state. | |
41 void SetMenuState(FrameMaximizeButton::SnapType snap_type); | |
42 | |
43 // Return a window handle underneath the snap animation window should | |
44 // operate. | |
45 aura::Window* GetMenuWindow(); | |
46 | |
47 // Reset the delay of the menu creation to the beg. | |
48 void DelayCreation(); | |
49 | |
50 // These functions below to the protected section were added for the | |
51 // experimental radial menu. | |
52 | |
53 // Returns true when the radial menu is turned on | |
54 bool IsRadialMenu(); | |
55 | |
56 // Update the menu status and returns true if menu got hit and a |code| | |
57 // will be set accordingly. | |
58 bool SnapTypeForLocation(const gfx::Point& pt, | |
59 FrameMaximizeButton::SnapType& type); | |
60 | |
61 // EventFilter overrides: | |
62 virtual bool PreHandleKeyEvent(aura::Window* target, | |
sky
2012/07/31 16:11:06
indent to match previous line. If indenting makes
Mr4D (OOO till 08-26)
2012/08/01 20:48:22
Done.
| |
63 aura::KeyEvent* event) OVERRIDE; | |
64 virtual bool PreHandleMouseEvent(aura::Window* target, | |
65 aura::MouseEvent* event) OVERRIDE; | |
66 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, | |
67 aura::TouchEvent* event) OVERRIDE; | |
68 virtual ui::GestureStatus PreHandleGestureEvent(aura::Window* target, | |
69 aura::GestureEvent* event) OVERRIDE; | |
70 | |
71 protected: | |
72 FrameMaximizeButton* frame_maximize_button() { | |
73 return frame_maximize_button_; | |
74 } | |
75 | |
76 // Called from the menu itself: Hides the bubble and destroys it. | |
77 void CloseInternal(); | |
78 | |
79 // Called when a button was clicked. | |
80 void OnButtonClicked(FrameMaximizeButton::SnapType snap_type); | |
81 | |
82 // Tell the owner that the hover status for a button has changed. | |
83 // |snap_type| can be either SNAP_LEFT, SNAP_RIGHT, SNAP_MINIMIZE or | |
84 // SNAP_NONE. | |
85 void OnButtonHover(FrameMaximizeButton::SnapType snap_type); | |
86 | |
87 private: | |
88 class Bubble; | |
89 class BubbleContentsView; | |
90 class BubbleContentsButtonRow; | |
91 class BubbleMenuButton; | |
92 | |
93 // The function which creates the bubble once the delay is elapsed. | |
94 void DelayedBubbleCreation(); | |
95 | |
96 // The status of the associated window: Maximized or normal. | |
97 bool is_maximized() { return is_maximized_; } | |
sky
2012/07/31 16:11:06
const
Mr4D (OOO till 08-26)
2012/08/01 20:48:22
Done.
| |
98 | |
99 // The owning button which is also the anchor for the menu. | |
100 FrameMaximizeButton* frame_maximize_button_; | |
101 | |
102 // The bubble menu. | |
103 Bubble* bubble_; | |
104 | |
105 // The alternative radial menu. | |
106 views::RadialMenu* radial_menu_; | |
107 | |
108 // The snap type which was set by the user's mouse movement (when in | |
109 // hover mode and no button was clicked). | |
110 FrameMaximizeButton::SnapType current_radial_snap_hover_type_; | |
111 | |
112 // If true the owning window is maximized. | |
113 const bool is_maximized_; | |
114 | |
115 // The timer for the delayed creation of the menu. | |
116 scoped_ptr<base::Timer> timer_; | |
117 | |
118 DISALLOW_COPY_AND_ASSIGN(MaximizeBubble); | |
119 }; | |
120 | |
121 } // namespace ash | |
122 | |
123 #endif // ASH_WM_WINDOW_MAXIMIZE_H_ | |
OLD | NEW |