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

Side by Side Diff: chrome/browser/ui/views/tabs/side_tab_strip.h

Issue 6822006: Adds scroll buttons to side tabs so that you can get to all the tabs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 9 years, 8 months 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_VIEWS_TABS_SIDE_TAB_STRIP_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_SIDE_TAB_STRIP_H_
6 #define CHROME_BROWSER_UI_VIEWS_TABS_SIDE_TAB_STRIP_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TABS_SIDE_TAB_STRIP_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" 9 #include "chrome/browser/ui/views/tabs/base_tab_strip.h"
10 #include "views/controls/button/button.h"
10 11
11 struct TabRendererData; 12 struct TabRendererData;
12 13
13 class SideTabStrip : public BaseTabStrip { 14 class SideTabStrip : public BaseTabStrip, public views::ButtonListener {
14 public: 15 public:
15 // The tabs are inset by this much along all axis. 16 // The tabs are inset by this much along all axis.
16 static const int kTabStripInset; 17 static const int kTabStripInset;
17 18
18 explicit SideTabStrip(TabStripController* controller); 19 explicit SideTabStrip(TabStripController* controller);
19 virtual ~SideTabStrip(); 20 virtual ~SideTabStrip();
20 21
21 // AbstractTabStripView implementation: 22 // AbstractTabStripView implementation:
22 virtual bool IsPositionInWindowCaption(const gfx::Point& point) OVERRIDE; 23 virtual bool IsPositionInWindowCaption(const gfx::Point& point) OVERRIDE;
23 virtual void SetBackgroundOffset(const gfx::Point& offset) OVERRIDE; 24 virtual void SetBackgroundOffset(const gfx::Point& offset) OVERRIDE;
24 25
25 // BaseTabStrip implementation: 26 // BaseTabStrip implementation:
26 virtual void StartHighlight(int model_index) OVERRIDE; 27 virtual void StartHighlight(int model_index) OVERRIDE;
27 virtual void StopAllHighlighting() OVERRIDE; 28 virtual void StopAllHighlighting() OVERRIDE;
28 virtual BaseTab* CreateTabForDragging() OVERRIDE; 29 virtual BaseTab* CreateTabForDragging() OVERRIDE;
29 virtual void RemoveTabAt(int model_index) OVERRIDE; 30 virtual void RemoveTabAt(int model_index) OVERRIDE;
30 virtual void SelectTabAt(int old_model_index, int new_model_index) OVERRIDE; 31 virtual void SelectTabAt(int old_model_index, int new_model_index) OVERRIDE;
31 virtual void TabTitleChangedNotLoading(int model_index) OVERRIDE; 32 virtual void TabTitleChangedNotLoading(int model_index) OVERRIDE;
32 33
33 // views::View overrides: 34 // views::View overrides:
34 virtual gfx::Size GetPreferredSize() OVERRIDE; 35 virtual gfx::Size GetPreferredSize() OVERRIDE;
35 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; 36 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE;
37 virtual views::View* GetEventHandlerForPoint(
38 const gfx::Point& point) OVERRIDE;
39
40 // views::ButtonListener overrides:
41 virtual void ButtonPressed(views::Button* sender,
42 const views::Event& event) OVERRIDE;
36 43
37 protected: 44 protected:
38 // BaseTabStrip overrides: 45 // BaseTabStrip overrides:
39 virtual BaseTab* CreateTab() OVERRIDE; 46 virtual BaseTab* CreateTab() OVERRIDE;
40 virtual bool IgnoreTitlePrefixEliding(BaseTab* tab) OVERRIDE; 47 virtual bool IgnoreTitlePrefixEliding(BaseTab* tab) OVERRIDE;
41 virtual void GenerateIdealBounds() OVERRIDE; 48 virtual void GenerateIdealBounds() OVERRIDE;
42 virtual void StartInsertTabAnimation(int model_index) OVERRIDE; 49 virtual void StartInsertTabAnimation(int model_index) OVERRIDE;
43 virtual void AnimateToIdealBounds() OVERRIDE; 50 virtual void AnimateToIdealBounds() OVERRIDE;
44 virtual void DoLayout() OVERRIDE; 51 virtual void DoLayout() OVERRIDE;
45 virtual void LayoutDraggedTabsAt(const std::vector<BaseTab*>& tabs, 52 virtual void LayoutDraggedTabsAt(const std::vector<BaseTab*>& tabs,
46 BaseTab* active_tab, 53 BaseTab* active_tab,
47 const gfx::Point& location, 54 const gfx::Point& location,
48 bool initial_drag) OVERRIDE; 55 bool initial_drag) OVERRIDE;
49 virtual void CalculateBoundsForDraggedTabs( 56 virtual void CalculateBoundsForDraggedTabs(
50 const std::vector<BaseTab*>& tabs, 57 const std::vector<BaseTab*>& tabs,
51 std::vector<gfx::Rect>* bounds) OVERRIDE; 58 std::vector<gfx::Rect>* bounds) OVERRIDE;
52 virtual int GetSizeNeededForTabs(const std::vector<BaseTab*>& tabs) OVERRIDE; 59 virtual int GetSizeNeededForTabs(const std::vector<BaseTab*>& tabs) OVERRIDE;
53 60
61 // views::View protected overrides:
62 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
63
54 private: 64 private:
65 // Sets |first_tab_y_offset_|. This ensures |new_offset| is legal.
66 void SetFirstTabYOffset(int new_offset);
67
68 // Returns the max y offset.
69 int GetMaxOffset() const;
70
71 // Returns the max visible y-coordinate for tabs.
72 int GetMaxTabY() const;
73
74 // Make sure the tab at |tab_index| is visible.
75 void MakeTabVisible(int tab_index);
76
55 // The "New Tab" button. 77 // The "New Tab" button.
56 views::View* newtab_button_; 78 views::View* newtab_button_;
57 79
58 // Ideal bounds of the new tab button. 80 // Ideal bounds of the new tab button.
59 gfx::Rect newtab_button_bounds_; 81 gfx::Rect newtab_button_bounds_;
60 82
83 // Scroll buttons.
84 views::View* scroll_up_button_;
85 views::View* scroll_down_button_;
86
61 // Separator between mini-tabs and the new tab button. The separator is 87 // Separator between mini-tabs and the new tab button. The separator is
62 // positioned above the visible area if there are no mini-tabs. 88 // positioned above the visible area if there are no mini-tabs.
63 views::View* separator_; 89 views::View* separator_;
64 90
65 // Bounds of the sepatator. 91 // Bounds of the sepatator.
66 gfx::Rect separator_bounds_; 92 gfx::Rect separator_bounds_;
67 93
94 // Offset the first tab (or new tab button) is positioned at. If the user has
95 // scrolled the tabs this is non-zero.
96 int first_tab_y_offset_;
97
98 // Height needed to display the tabs, separator and new tab button. Doesn't
99 // include any padding.
100 int ideal_height_;
101
68 DISALLOW_COPY_AND_ASSIGN(SideTabStrip); 102 DISALLOW_COPY_AND_ASSIGN(SideTabStrip);
69 }; 103 };
70 104
71 #endif // CHROME_BROWSER_UI_VIEWS_TABS_SIDE_TAB_STRIP_H_ 105 #endif // CHROME_BROWSER_UI_VIEWS_TABS_SIDE_TAB_STRIP_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/base_tab_strip.cc ('k') | chrome/browser/ui/views/tabs/side_tab_strip.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698