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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 virtual void AddPanel(Panel* panel) OVERRIDE; | 46 virtual void AddPanel(Panel* panel) OVERRIDE; |
47 virtual bool RemovePanel(Panel* panel) OVERRIDE; | 47 virtual bool RemovePanel(Panel* panel) OVERRIDE; |
48 virtual void CloseAll() OVERRIDE; | 48 virtual void CloseAll() OVERRIDE; |
49 virtual void ResizePanelWindow( | 49 virtual void ResizePanelWindow( |
50 Panel* panel, | 50 Panel* panel, |
51 const gfx::Size& preferred_window_size) OVERRIDE; | 51 const gfx::Size& preferred_window_size) OVERRIDE; |
52 virtual void OnPanelAttentionStateChanged(Panel* panel) OVERRIDE; | 52 virtual void OnPanelAttentionStateChanged(Panel* panel) OVERRIDE; |
53 virtual void ActivatePanel(Panel* panel) OVERRIDE; | 53 virtual void ActivatePanel(Panel* panel) OVERRIDE; |
54 virtual void MinimizePanel(Panel* panel) OVERRIDE; | 54 virtual void MinimizePanel(Panel* panel) OVERRIDE; |
55 virtual void RestorePanel(Panel* panel) OVERRIDE; | 55 virtual void RestorePanel(Panel* panel) OVERRIDE; |
56 | 56 virtual bool CanDragPanel(const Panel* panel) const OVERRIDE; |
57 // Drags the given panel. | 57 virtual void StartDraggingPanel(Panel* panel) OVERRIDE; |
58 void StartDragging(Panel* panel); | 58 virtual void DragPanel(Panel* panel, int delta_x, int delta_y) OVERRIDE; |
59 void Drag(int delta_x); | 59 virtual void EndDraggingPanel(Panel* panel, bool cancelled) OVERRIDE; |
60 void EndDragging(bool cancelled); | |
61 | 60 |
62 // Invoked when a panel's expansion state changes. | 61 // Invoked when a panel's expansion state changes. |
63 void OnPanelExpansionStateChanged(Panel* panel); | 62 void OnPanelExpansionStateChanged(Panel* panel); |
64 | 63 |
65 // Returns true if we should bring up the titlebars, given the current mouse | 64 // Returns true if we should bring up the titlebars, given the current mouse |
66 // point. | 65 // point. |
67 bool ShouldBringUpTitlebars(int mouse_x, int mouse_y) const; | 66 bool ShouldBringUpTitlebars(int mouse_x, int mouse_y) const; |
68 | 67 |
69 // Brings up or down the titlebars for all minimized panels. | 68 // Brings up or down the titlebars for all minimized panels. |
70 void BringUpOrDownTitlebars(bool bring_up); | 69 void BringUpOrDownTitlebars(bool bring_up); |
71 | 70 |
72 // Returns the bottom position for the panel per its expansion state. If auto- | 71 // Returns the bottom position for the panel per its expansion state. If auto- |
73 // hide bottom bar is present, we want to move the minimized panel to the | 72 // hide bottom bar is present, we want to move the minimized panel to the |
74 // bottom of the screen, not the bottom of the work area. | 73 // bottom of the screen, not the bottom of the work area. |
75 int GetBottomPositionForExpansionState( | 74 int GetBottomPositionForExpansionState( |
76 Panel::ExpansionState expansion_state) const; | 75 Panel::ExpansionState expansion_state) const; |
77 | 76 |
78 // num_panels() and panels() only includes panels in the panel strip that | 77 // num_panels() and panels() only includes panels in the panel strip that |
79 // do NOT have a temporary layout. | 78 // do NOT have a temporary layout. |
80 int num_panels() const { return panels_.size(); } | 79 int num_panels() const { return panels_.size(); } |
81 const Panels& panels() const { return panels_; } | 80 const Panels& panels() const { return panels_; } |
82 | 81 |
83 bool is_dragging_panel() const; | |
84 gfx::Rect display_area() const { return display_area_; } | 82 gfx::Rect display_area() const { return display_area_; } |
85 | 83 |
86 int GetMaxPanelWidth() const; | 84 int GetMaxPanelWidth() const; |
87 int GetMaxPanelHeight() const; | 85 int GetMaxPanelHeight() const; |
88 int StartingRightPosition() const; | 86 int StartingRightPosition() const; |
89 | 87 |
90 void OnAutoHidingDesktopBarVisibilityChanged( | 88 void OnAutoHidingDesktopBarVisibilityChanged( |
91 AutoHidingDesktopBar::Alignment alignment, | 89 AutoHidingDesktopBar::Alignment alignment, |
92 AutoHidingDesktopBar::Visibility visibility); | 90 AutoHidingDesktopBar::Visibility visibility); |
93 | 91 |
(...skipping 21 matching lines...) Expand all Loading... |
115 | 113 |
116 // Handles all the panels that're delayed to be removed. | 114 // Handles all the panels that're delayed to be removed. |
117 void DelayedRemove(); | 115 void DelayedRemove(); |
118 | 116 |
119 // Does the actual remove. Caller is responsible for rearranging | 117 // Does the actual remove. Caller is responsible for rearranging |
120 // the panel strip if necessary. | 118 // the panel strip if necessary. |
121 // Returns |false| if panel is not in the strip. | 119 // Returns |false| if panel is not in the strip. |
122 bool DoRemove(Panel* panel); | 120 bool DoRemove(Panel* panel); |
123 | 121 |
124 // Help functions to drag the given panel. | 122 // Help functions to drag the given panel. |
125 void DragLeft(); | 123 void DragLeft(Panel* dragging_panel); |
126 void DragRight(); | 124 void DragRight(Panel* dragging_panel); |
127 | 125 |
128 // Does the real job of bringing up or down the titlebars. | 126 // Does the real job of bringing up or down the titlebars. |
129 void DoBringUpOrDownTitlebars(bool bring_up); | 127 void DoBringUpOrDownTitlebars(bool bring_up); |
130 // The callback for a delyed task, checks if it still need to perform | 128 // The callback for a delyed task, checks if it still need to perform |
131 // the delayed action. | 129 // the delayed action. |
132 void DelayedBringUpOrDownTitlebarsCheck(); | 130 void DelayedBringUpOrDownTitlebarsCheck(); |
133 | 131 |
134 int GetRightMostAvailablePosition() const; | 132 int GetRightMostAvailablePosition() const; |
135 | 133 |
136 // Called by AddPanel() after a delay to move a newly created panel from | 134 // Called by AddPanel() after a delay to move a newly created panel from |
(...skipping 18 matching lines...) Expand all Loading... |
155 // are moved to overflow after a delay. | 153 // are moved to overflow after a delay. |
156 std::set<Panel*> panels_in_temporary_layout_; | 154 std::set<Panel*> panels_in_temporary_layout_; |
157 | 155 |
158 int minimized_panel_count_; | 156 int minimized_panel_count_; |
159 bool are_titlebars_up_; | 157 bool are_titlebars_up_; |
160 | 158 |
161 // |True| to temporarily prevent refreshing panel layout, e.g. while | 159 // |True| to temporarily prevent refreshing panel layout, e.g. while |
162 // moving panels to overflow area to make room for a panel in this strip. | 160 // moving panels to overflow area to make room for a panel in this strip. |
163 bool disable_layout_refresh_; | 161 bool disable_layout_refresh_; |
164 | 162 |
165 // Panel to drag. | 163 // Iterator of panel being dragged. |
166 Panel* dragging_panel_; | |
167 Panels::iterator dragging_panel_iterator_; | 164 Panels::iterator dragging_panel_iterator_; |
168 | 165 |
169 // Original x coordinate of the panel to drag. This is used to get back to | 166 // Original x coordinate of the panel to drag. This is used to get back to |
170 // the original position when we cancel the dragging. | 167 // the original position when we cancel the dragging. |
171 int dragging_panel_original_x_; | 168 int dragging_panel_original_x_; |
172 | 169 |
173 // Bounds of the panel to drag. It is first set to the original bounds when | 170 // Bounds of the panel to drag. It is first set to the original bounds when |
174 // the dragging happens. Then it is updated to the position that will be set | 171 // the dragging happens. Then it is updated to the position that will be set |
175 // to when the dragging ends. | 172 // to when the dragging ends. |
176 gfx::Rect dragging_panel_bounds_; | 173 gfx::Rect dragging_panel_bounds_; |
(...skipping 10 matching lines...) Expand all Loading... |
187 // Absolute minimum width and height for panels, including non-client area. | 184 // Absolute minimum width and height for panels, including non-client area. |
188 // Should only be big enough to accomodate a close button on the reasonably | 185 // Should only be big enough to accomodate a close button on the reasonably |
189 // recognisable titlebar. | 186 // recognisable titlebar. |
190 static const int kPanelMinWidth; | 187 static const int kPanelMinWidth; |
191 static const int kPanelMinHeight; | 188 static const int kPanelMinHeight; |
192 | 189 |
193 DISALLOW_COPY_AND_ASSIGN(DockedPanelStrip); | 190 DISALLOW_COPY_AND_ASSIGN(DockedPanelStrip); |
194 }; | 191 }; |
195 | 192 |
196 #endif // CHROME_BROWSER_UI_PANELS_DOCKED_PANEL_STRIP_H_ | 193 #endif // CHROME_BROWSER_UI_PANELS_DOCKED_PANEL_STRIP_H_ |
OLD | NEW |