Chromium Code Reviews| 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 bool RemovePanel(Panel* panel) OVERRIDE; | 46 virtual bool RemovePanel(Panel* panel) OVERRIDE; |
| 47 virtual void CloseAll() OVERRIDE; | 47 virtual void CloseAll() OVERRIDE; |
| 48 virtual void ResizePanelWindow( | 48 virtual void ResizePanelWindow( |
| 49 Panel* panel, | 49 Panel* panel, |
| 50 const gfx::Size& preferred_window_size) OVERRIDE; | 50 const gfx::Size& preferred_window_size) OVERRIDE; |
| 51 virtual void OnPanelAttentionStateChanged(Panel* panel) OVERRIDE; | 51 virtual void OnPanelAttentionStateChanged(Panel* panel) OVERRIDE; |
| 52 virtual void ActivatePanel(Panel* panel) OVERRIDE; | 52 virtual void ActivatePanel(Panel* panel) OVERRIDE; |
| 53 virtual void MinimizePanel(Panel* panel) OVERRIDE; | 53 virtual void MinimizePanel(Panel* panel) OVERRIDE; |
| 54 virtual void RestorePanel(Panel* panel) OVERRIDE; | 54 virtual void RestorePanel(Panel* panel) OVERRIDE; |
| 55 virtual bool CanShowPanelAsActive(const Panel* panel) const OVERRIDE; | 55 virtual bool CanShowPanelAsActive(const Panel* panel) const OVERRIDE; |
| 56 virtual void SavePanelPlacement(Panel* panel) OVERRIDE; | |
| 57 virtual void LoadSavedPanelPlacement() OVERRIDE; | |
| 58 virtual void DiscardSavedPanelPlacement() OVERRIDE; | |
| 56 virtual bool CanDragPanel(const Panel* panel) const OVERRIDE; | 59 virtual bool CanDragPanel(const Panel* panel) const OVERRIDE; |
| 57 virtual void StartDraggingPanel(Panel* panel) OVERRIDE; | 60 virtual void StartDraggingPanelLocally(Panel* panel) OVERRIDE; |
| 58 virtual void DragPanel(Panel* panel, int delta_x, int delta_y) OVERRIDE; | 61 virtual void DragPanelLocally(Panel* panel, |
| 59 virtual void EndDraggingPanel(Panel* panel, bool cancelled) OVERRIDE; | 62 int delta_x, |
| 63 int delta_y) OVERRIDE; | |
| 64 virtual void EndDraggingPanelLocally(Panel* panel, bool cancelled) OVERRIDE; | |
| 65 virtual void AddDraggingPanel(Panel* panel, | |
| 66 const gfx::Point& position) OVERRIDE; | |
| 60 | 67 |
| 61 // Invoked when a panel's expansion state changes. | 68 // Invoked when a panel's expansion state changes. |
| 62 void OnPanelExpansionStateChanged(Panel* panel); | 69 void OnPanelExpansionStateChanged(Panel* panel); |
| 63 | 70 |
| 64 // Returns true if we should bring up the titlebars, given the current mouse | 71 // Returns true if we should bring up the titlebars, given the current mouse |
| 65 // point. | 72 // point. |
| 66 bool ShouldBringUpTitlebars(int mouse_x, int mouse_y) const; | 73 bool ShouldBringUpTitlebars(int mouse_x, int mouse_y) const; |
| 67 | 74 |
| 68 // Brings up or down the titlebars for all minimized panels. | 75 // Brings up or down the titlebars for all minimized panels. |
| 69 void BringUpOrDownTitlebars(bool bring_up); | 76 void BringUpOrDownTitlebars(bool bring_up); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 97 } | 104 } |
| 98 #endif | 105 #endif |
| 99 | 106 |
| 100 private: | 107 private: |
| 101 enum TitlebarAction { | 108 enum TitlebarAction { |
| 102 NO_ACTION, | 109 NO_ACTION, |
| 103 BRING_UP, | 110 BRING_UP, |
| 104 BRING_DOWN | 111 BRING_DOWN |
| 105 }; | 112 }; |
| 106 | 113 |
| 114 struct PanelPlacement { | |
| 115 Panel* panel; | |
| 116 // When |panel| is restored, it will be bring back before | |
|
jennb
2012/03/03 02:19:33
The wording here is confusing to me. How about:
R
jianli
2012/03/07 19:14:31
Done.
| |
| 117 // |panel_to_place_before_|. | |
| 118 Panel* panel_to_place_before_; | |
| 119 | |
| 120 PanelPlacement() : panel(NULL) { } | |
| 121 }; | |
| 122 | |
| 107 // Overridden from PanelMouseWatcherObserver: | 123 // Overridden from PanelMouseWatcherObserver: |
| 108 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE; | 124 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE; |
| 109 | 125 |
| 126 // Inserts |panel| to the collection at |position|. | |
| 127 // Returns the iterator that points to the newly inserted panel. | |
| 128 void InsertPanelToCollection(Panel* panel, Panels::iterator position); | |
|
jennb
2012/03/03 02:19:33
Doesn't return anything. This sounds like a wrappe
jianli
2012/03/07 19:14:31
Removed. We now don't need a wrapper. Instead, I i
| |
| 129 | |
| 130 // Ensures that there is sufficient space in the strip to add a panel with | |
| 131 // the specified width. We might need to bump panels in the strip to make | |
| 132 // room for this panel. | |
| 133 void EnsureAvailableSpace(int width); | |
| 134 | |
| 110 // Keep track of the minimized panels to control mouse watching. | 135 // Keep track of the minimized panels to control mouse watching. |
| 111 void IncrementMinimizedPanels(); | 136 void IncrementMinimizedPanels(); |
| 112 void DecrementMinimizedPanels(); | 137 void DecrementMinimizedPanels(); |
| 113 | 138 |
| 114 // Help functions to drag the given panel. | 139 // Help functions to drag the given panel. |
| 115 void DragLeft(Panel* dragging_panel); | 140 void DragLeft(Panel* dragging_panel); |
| 116 void DragRight(Panel* dragging_panel); | 141 void DragRight(Panel* dragging_panel); |
| 117 | 142 |
| 118 // Does the real job of bringing up or down the titlebars. | 143 // Does the real job of bringing up or down the titlebars. |
| 119 void DoBringUpOrDownTitlebars(bool bring_up); | 144 void DoBringUpOrDownTitlebars(bool bring_up); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 147 bool are_titlebars_up_; | 172 bool are_titlebars_up_; |
| 148 | 173 |
| 149 // |True| to temporarily prevent refreshing panel layout, e.g. while | 174 // |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. | 175 // moving panels to overflow area to make room for a panel in this strip. |
| 151 bool disable_layout_refresh_; | 176 bool disable_layout_refresh_; |
| 152 | 177 |
| 153 // Referring to current position in |panels_| where the dragging panel | 178 // Referring to current position in |panels_| where the dragging panel |
| 154 // resides. | 179 // resides. |
| 155 Panels::iterator dragging_panel_current_iterator_; | 180 Panels::iterator dragging_panel_current_iterator_; |
| 156 | 181 |
| 157 // Referring to original position in |panels_| where the dragging panel | |
| 158 // resides. | |
| 159 Panels::iterator dragging_panel_original_iterator_; | |
| 160 | |
| 161 // Delayed transitions support. Sometimes transitions between minimized and | 182 // Delayed transitions support. Sometimes transitions between minimized and |
| 162 // title-only states are delayed, for better usability with Taskbars/Docks. | 183 // title-only states are delayed, for better usability with Taskbars/Docks. |
| 163 TitlebarAction delayed_titlebar_action_; | 184 TitlebarAction delayed_titlebar_action_; |
| 164 | 185 |
| 165 // Owned by MessageLoop after posting. | 186 // Owned by MessageLoop after posting. |
| 166 base::WeakPtrFactory<DockedPanelStrip> titlebar_action_factory_; | 187 base::WeakPtrFactory<DockedPanelStrip> titlebar_action_factory_; |
| 167 | 188 |
| 189 // Used to save the placement information for a panel. | |
| 190 PanelPlacement saved_panel_placement_; | |
| 191 | |
| 168 static const int kPanelsHorizontalSpacing = 4; | 192 static const int kPanelsHorizontalSpacing = 4; |
| 169 | 193 |
| 170 // Absolute minimum width and height for panels, including non-client area. | 194 // 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 | 195 // Should only be big enough to accomodate a close button on the reasonably |
| 172 // recognisable titlebar. | 196 // recognisable titlebar. |
| 173 static const int kPanelMinWidth; | 197 static const int kPanelMinWidth; |
| 174 static const int kPanelMinHeight; | 198 static const int kPanelMinHeight; |
| 175 | 199 |
| 176 DISALLOW_COPY_AND_ASSIGN(DockedPanelStrip); | 200 DISALLOW_COPY_AND_ASSIGN(DockedPanelStrip); |
| 177 }; | 201 }; |
| 178 | 202 |
| 179 #endif // CHROME_BROWSER_UI_PANELS_DOCKED_PANEL_STRIP_H_ | 203 #endif // CHROME_BROWSER_UI_PANELS_DOCKED_PANEL_STRIP_H_ |
| OLD | NEW |