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

Side by Side Diff: ui/views/controls/tabbed_pane/tabbed_pane.h

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_H_
6 #define UI_VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/strings/string16.h"
11 #include "ui/views/view.h"
12
13 namespace views {
14
15 class Tab;
16 class TabbedPaneListener;
17 class TabStrip;
18
19 // TabbedPane is a view that shows tabs. When the user clicks on a tab, the
20 // associated view is displayed.
21 class VIEWS_EXPORT TabbedPane : public View {
22 public:
23 // Internal class name.
24 static const char kViewClassName[];
25
26 TabbedPane();
27 virtual ~TabbedPane();
28
29 TabbedPaneListener* listener() const { return listener_; }
30 void set_listener(TabbedPaneListener* listener) { listener_ = listener; }
31
32 int selected_tab_index() const { return selected_tab_index_; }
33
34 // Returns the number of tabs.
35 int GetTabCount();
36
37 // Returns the contents of the selected tab or NULL if there is none.
38 View* GetSelectedTab();
39
40 // Adds a new tab at the end of this TabbedPane with the specified |title|.
41 // |contents| is the view displayed when the tab is selected and is owned by
42 // the TabbedPane.
43 void AddTab(const base::string16& title, View* contents);
44
45 // Adds a new tab at |index| with |title|. |contents| is the view displayed
46 // when the tab is selected and is owned by the TabbedPane. If the tabbed pane
47 // is currently empty, the new tab is selected.
48 void AddTabAtIndex(int index, const base::string16& title, View* contents);
49
50 // Selects the tab at |index|, which must be valid.
51 void SelectTabAt(int index);
52
53 // Selects |tab| (the tabstrip view, not its content) if it is valid.
54 void SelectTab(Tab* tab);
55
56 // Overridden from View:
57 virtual gfx::Size GetPreferredSize() const override;
58 virtual const char* GetClassName() const override;
59
60 private:
61 friend class TabStrip;
62
63 // Get the Tab (the tabstrip view, not its content) at the valid |index|.
64 Tab* GetTabAt(int index);
65
66 // Overridden from View:
67 virtual void Layout() override;
68 virtual void ViewHierarchyChanged(
69 const ViewHierarchyChangedDetails& details) override;
70 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
71 virtual void OnFocus() override;
72 virtual void GetAccessibleState(ui::AXViewState* state) override;
73
74 // A listener notified when tab selection changes. Weak, not owned.
75 TabbedPaneListener* listener_;
76
77 // The tab strip and contents container. The child indices of these members
78 // correspond to match each Tab with its respective content View.
79 TabStrip* tab_strip_;
80 View* contents_;
81
82 // The selected tab index or -1 if invalid.
83 int selected_tab_index_;
84
85 DISALLOW_COPY_AND_ASSIGN(TabbedPane);
86 };
87
88 } // namespace views
89
90 #endif // UI_VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_H_
OLDNEW
« no previous file with comments | « ui/views/controls/styled_label_unittest.cc ('k') | ui/views/controls/tabbed_pane/tabbed_pane.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698