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 CHROME_BROWSER_UI_PANELS_DOCKED_PANEL_STRIP_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_DOCKED_PANEL_STRIP_H_ |
6 #define CHROME_BROWSER_UI_PANELS_DOCKED_PANEL_STRIP_H_ | 6 #define CHROME_BROWSER_UI_PANELS_DOCKED_PANEL_STRIP_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <set> | 10 #include <set> |
(...skipping 25 matching lines...) Expand all Loading... | |
36 | 36 |
37 // Rearranges the positions of the panels in the strip. | 37 // Rearranges the positions of the panels in the strip. |
38 // Handles moving panels to/from overflow area as needed. | 38 // Handles moving panels to/from overflow area as needed. |
39 // This is called when the display space has been changed, i.e. working | 39 // This is called when the display space has been changed, i.e. working |
40 // area being changed or a panel being closed. | 40 // area being changed or a panel being closed. |
41 virtual void RefreshLayout() OVERRIDE; | 41 virtual void RefreshLayout() OVERRIDE; |
42 | 42 |
43 // Adds a panel to the strip. The panel may be a newly created panel or one | 43 // Adds a panel to the strip. The panel may be a newly created panel or one |
44 // that is transitioning from another grouping of panels. | 44 // that is transitioning from another grouping of panels. |
45 virtual void AddPanel(Panel* panel) OVERRIDE; | 45 virtual void AddPanel(Panel* panel) OVERRIDE; |
46 virtual void AddPanelAtPosition(Panel* panel, | |
47 const gfx::Point& position) OVERRIDE; | |
46 virtual bool RemovePanel(Panel* panel) OVERRIDE; | 48 virtual bool RemovePanel(Panel* panel) OVERRIDE; |
47 virtual void CloseAll() OVERRIDE; | 49 virtual void CloseAll() OVERRIDE; |
48 virtual void ResizePanelWindow( | 50 virtual void ResizePanelWindow( |
49 Panel* panel, | 51 Panel* panel, |
50 const gfx::Size& preferred_window_size) OVERRIDE; | 52 const gfx::Size& preferred_window_size) OVERRIDE; |
51 virtual void OnPanelAttentionStateChanged(Panel* panel) OVERRIDE; | 53 virtual void OnPanelAttentionStateChanged(Panel* panel) OVERRIDE; |
52 virtual void ActivatePanel(Panel* panel) OVERRIDE; | 54 virtual void ActivatePanel(Panel* panel) OVERRIDE; |
53 virtual void MinimizePanel(Panel* panel) OVERRIDE; | 55 virtual void MinimizePanel(Panel* panel) OVERRIDE; |
54 virtual void RestorePanel(Panel* panel) OVERRIDE; | 56 virtual void RestorePanel(Panel* panel) OVERRIDE; |
55 virtual bool CanShowPanelAsActive(const Panel* panel) const OVERRIDE; | 57 virtual bool CanShowPanelAsActive(const Panel* panel) const OVERRIDE; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 private: | 102 private: |
101 enum TitlebarAction { | 103 enum TitlebarAction { |
102 NO_ACTION, | 104 NO_ACTION, |
103 BRING_UP, | 105 BRING_UP, |
104 BRING_DOWN | 106 BRING_DOWN |
105 }; | 107 }; |
106 | 108 |
107 // Overridden from PanelMouseWatcherObserver: | 109 // Overridden from PanelMouseWatcherObserver: |
108 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE; | 110 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE; |
109 | 111 |
112 // Ensures that there is sufficient space in the strip to add a panel with | |
113 // the specified width. We might need to bump panels in the strip to make | |
114 // room for this panel. | |
115 void EnsureEnoughSpaceForPanel(int width); | |
116 | |
110 // Keep track of the minimized panels to control mouse watching. | 117 // Keep track of the minimized panels to control mouse watching. |
111 void IncrementMinimizedPanels(); | 118 void IncrementMinimizedPanels(); |
112 void DecrementMinimizedPanels(); | 119 void DecrementMinimizedPanels(); |
113 | 120 |
114 // Help functions to drag the given panel. | 121 // Help functions to drag the given panel. |
115 void DragLeft(Panel* dragging_panel); | 122 void DragLeft(Panel* dragging_panel); |
116 void DragRight(Panel* dragging_panel); | 123 void DragRight(Panel* dragging_panel); |
117 | 124 |
118 // Does the real job of bringing up or down the titlebars. | 125 // Does the real job of bringing up or down the titlebars. |
119 void DoBringUpOrDownTitlebars(bool bring_up); | 126 void DoBringUpOrDownTitlebars(bool bring_up); |
120 // The callback for a delyed task, checks if it still need to perform | 127 // The callback for a delyed task, checks if it still need to perform |
121 // the delayed action. | 128 // the delayed action. |
122 void DelayedBringUpOrDownTitlebarsCheck(); | 129 void DelayedBringUpOrDownTitlebarsCheck(); |
123 | 130 |
124 int GetRightMostAvailablePosition() const; | 131 int GetRightMostAvailablePosition() const; |
125 | 132 |
126 // Called by AddPanel() after a delay to move a newly created panel from | 133 // Called by AddPanel() after a delay to move a newly created panel from |
127 // the panel strip to overflow because the panel could not fit | 134 // the panel strip to overflow because the panel could not fit |
128 // within the bounds of the panel strip. New panels are first displayed | 135 // within the bounds of the panel strip. New panels are first displayed |
129 // in the panel strip, then moved to overflow so that all created | 136 // in the panel strip, then moved to overflow so that all created |
130 // panels are (at least briefly) visible before entering overflow. | 137 // panels are (at least briefly) visible before entering overflow. |
131 void DelayedMovePanelToOverflow(Panel* panel); | 138 void DelayedMovePanelToOverflow(Panel* panel); |
132 | 139 |
140 // Returns next panel in the list that is placed after the given iterator. | |
141 // Returns NULL if the given iterator refers to the last panel in the list. | |
142 Panel* GetNextPanel(const Panels::iterator& iter) const; | |
jennb
2012/03/01 00:33:38
Is this just a wrapper for iter++?
jianli
2012/03/02 22:42:43
Yes. I removed it since it is not needed.
| |
143 | |
133 Panel* dragging_panel() const; | 144 Panel* dragging_panel() const; |
134 | 145 |
135 PanelManager* panel_manager_; // Weak, owns us. | 146 PanelManager* panel_manager_; // Weak, owns us. |
136 | 147 |
137 // All panels in the panel strip must fit within this area. | 148 // All panels in the panel strip must fit within this area. |
138 gfx::Rect display_area_; | 149 gfx::Rect display_area_; |
139 | 150 |
140 Panels panels_; | 151 Panels panels_; |
141 | 152 |
142 // Stores newly created panels that have a temporary layout until they | 153 // Stores newly created panels that have a temporary layout until they |
143 // are moved to overflow after a delay. | 154 // are moved to overflow after a delay. |
144 std::set<Panel*> panels_in_temporary_layout_; | 155 std::set<Panel*> panels_in_temporary_layout_; |
145 | 156 |
146 int minimized_panel_count_; | 157 int minimized_panel_count_; |
147 bool are_titlebars_up_; | 158 bool are_titlebars_up_; |
148 | 159 |
149 // |True| to temporarily prevent refreshing panel layout, e.g. while | 160 // |True| to temporarily prevent refreshing panel layout, e.g. while |
150 // moving panels to overflow area to make room for a panel in this strip. | 161 // moving panels to overflow area to make room for a panel in this strip. |
151 bool disable_layout_refresh_; | 162 bool disable_layout_refresh_; |
152 | 163 |
153 // Referring to current position in |panels_| where the dragging panel | 164 // Referring to current position in |panels_| where the dragging panel |
154 // resides. | 165 // resides. |
155 Panels::iterator dragging_panel_current_iterator_; | 166 Panels::iterator dragging_panel_current_iterator_; |
156 | 167 |
157 // Referring to original position in |panels_| where the dragging panel | 168 // Panel to restore after when the drag is cancelled and the dragging panel |
158 // resides. | 169 // needs to get back to its original position. If NULL, the panel will be |
159 Panels::iterator dragging_panel_original_iterator_; | 170 // restored at the end of the list. |
171 Panel* panel_to_restore_after_on_drag_cancelled_; | |
jennb
2012/03/01 00:33:38
I don't understand the comment for this var.
jianli
2012/03/02 22:42:43
Per discussion, removed.
| |
160 | 172 |
161 // Delayed transitions support. Sometimes transitions between minimized and | 173 // Delayed transitions support. Sometimes transitions between minimized and |
162 // title-only states are delayed, for better usability with Taskbars/Docks. | 174 // title-only states are delayed, for better usability with Taskbars/Docks. |
163 TitlebarAction delayed_titlebar_action_; | 175 TitlebarAction delayed_titlebar_action_; |
164 | 176 |
165 // Owned by MessageLoop after posting. | 177 // Owned by MessageLoop after posting. |
166 base::WeakPtrFactory<DockedPanelStrip> titlebar_action_factory_; | 178 base::WeakPtrFactory<DockedPanelStrip> titlebar_action_factory_; |
167 | 179 |
168 static const int kPanelsHorizontalSpacing = 4; | 180 static const int kPanelsHorizontalSpacing = 4; |
169 | 181 |
170 // Absolute minimum width and height for panels, including non-client area. | 182 // Absolute minimum width and height for panels, including non-client area. |
171 // Should only be big enough to accomodate a close button on the reasonably | 183 // Should only be big enough to accomodate a close button on the reasonably |
172 // recognisable titlebar. | 184 // recognisable titlebar. |
173 static const int kPanelMinWidth; | 185 static const int kPanelMinWidth; |
174 static const int kPanelMinHeight; | 186 static const int kPanelMinHeight; |
175 | 187 |
176 DISALLOW_COPY_AND_ASSIGN(DockedPanelStrip); | 188 DISALLOW_COPY_AND_ASSIGN(DockedPanelStrip); |
177 }; | 189 }; |
178 | 190 |
179 #endif // CHROME_BROWSER_UI_PANELS_DOCKED_PANEL_STRIP_H_ | 191 #endif // CHROME_BROWSER_UI_PANELS_DOCKED_PANEL_STRIP_H_ |
OLD | NEW |