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

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

Issue 8658009: views: Move tabbed_pane directory to ui/views/controls/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix native_tabbed_pane_wrapper.h 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef VIEWS_CONTROLS_TABBED_PANE_H_
6 #define VIEWS_CONTROLS_TABBED_PANE_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "base/string16.h"
12 #include "views/view.h"
13
14 namespace views {
15
16 class NativeTabbedPaneWrapper;
17 class TabbedPaneListener;
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 TabbedPane();
24 virtual ~TabbedPane();
25
26 TabbedPaneListener* listener() const { return listener_; }
27 void set_listener(TabbedPaneListener* listener) { listener_ = listener; }
28
29 NativeTabbedPaneWrapper* native_wrapper() const {
30 return native_tabbed_pane_;
31 }
32
33 // Returns the number of tabs.
34 int GetTabCount();
35
36 // Returns the index of the selected tab.
37 int GetSelectedTabIndex();
38
39 // Returns the contents of the selected tab.
40 View* GetSelectedTab();
41
42 // Adds a new tab at the end of this TabbedPane with the specified |title|.
43 // |contents| is the view displayed when the tab is selected and is owned by
44 // the TabbedPane.
45 void AddTab(const string16& title, View* contents);
46
47 // Adds a new tab at |index| with |title|.
48 // |contents| is the view displayed when the tab is selected and is owned by
49 // the TabbedPane. If |select_if_first_tab| is true and the tabbed pane is
50 // currently empty, the new tab is selected. If you pass in false for
51 // |select_if_first_tab| you need to explicitly invoke SelectTabAt, otherwise
52 // the tabbed pane will not have a valid selection.
53 void AddTabAtIndex(int index,
54 const string16& title,
55 View* contents,
56 bool select_if_first_tab);
57
58 // Removes the tab at |index| and returns the associated content view.
59 // The caller becomes the owner of the returned view.
60 View* RemoveTabAtIndex(int index);
61
62 // Selects the tab at |index|, which must be valid.
63 void SelectTabAt(int index);
64
65 void SetAccessibleName(const string16& name);
66
67 // View:
68 virtual gfx::Size GetPreferredSize() OVERRIDE;
69
70 protected:
71 // The object that actually implements the tabbed-pane.
72 // Protected for tests access.
73 NativeTabbedPaneWrapper* native_tabbed_pane_;
74
75 private:
76 // The tabbed-pane's class name.
77 static const char kViewClassName[];
78
79 // We support Ctrl+Tab and Ctrl+Shift+Tab to navigate tabbed option pages.
80 void LoadAccelerators();
81
82 // View:
83 virtual void Layout() OVERRIDE;
84 virtual void ViewHierarchyChanged(bool is_add,
85 View* parent,
86 View* child) OVERRIDE;
87 // Handles Ctrl+Tab and Ctrl+Shift+Tab navigation of pages.
88 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
89 virtual std::string GetClassName() const OVERRIDE;
90 virtual void OnFocus() OVERRIDE;
91 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE;
92 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
93
94 // The listener we notify about tab selection changes.
95 TabbedPaneListener* listener_;
96
97 // The accessible name of this view.
98 string16 accessible_name_;
99
100 DISALLOW_COPY_AND_ASSIGN(TabbedPane);
101 };
102
103 } // namespace views
104
105 #endif // VIEWS_CONTROLS_TABBED_PANE_H_
OLDNEW
« no previous file with comments | « views/controls/tabbed_pane/native_tabbed_pane_wrapper.h ('k') | views/controls/tabbed_pane/tabbed_pane.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698