Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: chrome/browser/ui/panels/panel_strip.h

Issue 8776035: Add PanelOverflowStrip to handle panel overflow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_PANEL_STRIP_H_ 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ 6 #define CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/ui/panels/auto_hiding_desktop_bar.h" 12 #include "chrome/browser/ui/panels/auto_hiding_desktop_bar.h"
13 #include "chrome/browser/ui/panels/panel_mouse_watcher_observer.h" 13 #include "chrome/browser/ui/panels/panel_mouse_watcher_observer.h"
14 #include "chrome/browser/ui/panels/panel.h" 14 #include "chrome/browser/ui/panels/panel.h"
jennb 2011/12/02 21:16:58 Could you move this before panel_mouse_watcher_obs
jianli 2011/12/02 23:23:46 Done.
15 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
16 16
17 class Browser; 17 class Browser;
18 class PanelManager; 18 class PanelManager;
19 19
20 // This class manages a group of panels displayed in a horizontal strip, 20 // This class manages a group of panels displayed in a horizontal strip,
21 // positioning the panels and controlling how they are displayed. 21 // positioning the panels and controlling how they are displayed.
22 // Panels in the strip appear minimized, showing title-only or expanded. 22 // Panels in the strip appear minimized, showing title-only or expanded.
23 // All panels in the strip are contained within the bounds of the strip. 23 // All panels in the strip are contained within the bounds of the strip.
24 class PanelStrip : public PanelMouseWatcherObserver { 24 class PanelStrip : public PanelMouseWatcherObserver {
25 public: 25 public:
26 typedef std::vector<Panel*> Panels; 26 typedef std::vector<Panel*> Panels;
27 27
28 explicit PanelStrip(PanelManager* panel_manager); 28 explicit PanelStrip(PanelManager* panel_manager);
29 virtual ~PanelStrip(); 29 virtual ~PanelStrip();
30 30
31 // Sets the bounds of the panel strip. 31 // Sets the bounds of the panel strip.
32 // |bounds| is in screen coordinates. 32 // |bounds| is in screen coordinates.
jennb 2011/12/02 21:16:58 Could you cleanup |bounds| for me? Thx.
jianli 2011/12/02 23:23:46 Done.
33 void SetDisplayArea(const gfx::Rect& area); 33 void SetDisplayArea(const gfx::Rect& area);
34 34
35 // Adds a panel to the strip. The panel may be a newly created panel or one 35 // Adds a panel to the strip. The panel may be a newly created panel or one
36 // that is transitioning from another grouping of panels. 36 // that is transitioning from another grouping of panels.
37 void AddPanel(Panel* panel); 37 void AddPanel(Panel* panel);
38 38
39 // Returns |false| if the panel is not in the strip. 39 // Returns |false| if the panel is not in the strip.
40 bool Remove(Panel* panel); 40 bool Remove(Panel* panel);
41 void RemoveAll(); 41 void RemoveAll();
42 42
43 // Drags the given panel. 43 // Drags the given panel.
44 void StartDragging(Panel* panel); 44 void StartDragging(Panel* panel);
45 void Drag(int delta_x); 45 void Drag(int delta_x);
46 void EndDragging(bool cancelled); 46 void EndDragging(bool cancelled);
47 47
48 // Invoked when a panel's expansion state changes. 48 // Invoked when a panel's expansion state changes.
49 void OnPanelExpansionStateChanged(Panel::ExpansionState old_state, 49 void OnPanelExpansionStateChanged(Panel* panel,
50 Panel::ExpansionState new_state); 50 Panel::ExpansionState old_state);
51 51
52 // Invoked when the preferred window size of the given panel might need to 52 // Invoked when the preferred window size of the given panel might need to
53 // get changed. 53 // get changed.
54 void OnPreferredWindowSizeChanged( 54 void OnPreferredWindowSizeChanged(
55 Panel* panel, const gfx::Size& preferred_window_size); 55 Panel* panel, const gfx::Size& preferred_window_size);
56 56
57 // Returns true if we should bring up the titlebars, given the current mouse 57 // Returns true if we should bring up the titlebars, given the current mouse
58 // point. 58 // point.
59 bool ShouldBringUpTitlebars(int mouse_x, int mouse_y) const; 59 bool ShouldBringUpTitlebars(int mouse_x, int mouse_y) const;
60 60
61 // Brings up or down the titlebars for all minimized panels. 61 // Brings up or down the titlebars for all minimized panels.
62 void BringUpOrDownTitlebars(bool bring_up); 62 void BringUpOrDownTitlebars(bool bring_up);
63 63
64 // Returns the bottom position for the panel per its expansion state. If auto- 64 // Returns the bottom position for the panel per its expansion state. If auto-
65 // hide bottom bar is present, we want to move the minimized panel to the 65 // hide bottom bar is present, we want to move the minimized panel to the
66 // bottom of the screen, not the bottom of the work area. 66 // bottom of the screen, not the bottom of the work area.
67 int GetBottomPositionForExpansionState( 67 int GetBottomPositionForExpansionState(
68 Panel::ExpansionState expansion_state) const; 68 Panel::ExpansionState expansion_state) const;
69 69
70 int num_panels() const { return panels_.size(); } 70 int num_panels() const { return panels_.size(); }
71 bool is_dragging_panel() const; 71 bool is_dragging_panel() const;
72 const Panels& panels() const { return panels_; } 72 const Panels& panels() const { return panels_; }
73 gfx::Rect display_area() const { return display_area_; }
73 74
74 int GetMaxPanelWidth() const; 75 int GetMaxPanelWidth() const;
75 int GetMaxPanelHeight() const; 76 int GetMaxPanelHeight() const;
76 int StartingRightPosition() const; 77 int StartingRightPosition() const;
77 78
78 // Overridden from PanelMouseWatcherObserver: 79 // Overridden from PanelMouseWatcherObserver:
79 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE; 80 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE;
80 81
81 void OnAutoHidingDesktopBarVisibilityChanged( 82 void OnAutoHidingDesktopBarVisibilityChanged(
82 AutoHidingDesktopBar::Alignment alignment, 83 AutoHidingDesktopBar::Alignment alignment,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // Absolute minimum width and height for panels, including non-client area. 191 // Absolute minimum width and height for panels, including non-client area.
191 // Should only be big enough to accomodate a close button on the reasonably 192 // Should only be big enough to accomodate a close button on the reasonably
192 // recognisable titlebar. 193 // recognisable titlebar.
193 static const int kPanelMinWidth; 194 static const int kPanelMinWidth;
194 static const int kPanelMinHeight; 195 static const int kPanelMinHeight;
195 196
196 DISALLOW_COPY_AND_ASSIGN(PanelStrip); 197 DISALLOW_COPY_AND_ASSIGN(PanelStrip);
197 }; 198 };
198 199
199 #endif // CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ 200 #endif // CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698