| Index: ui/views/controls/tabbed_pane/tabbed_pane.h
|
| diff --git a/ui/views/controls/tabbed_pane/tabbed_pane.h b/ui/views/controls/tabbed_pane/tabbed_pane.h
|
| index aa808acadcb1f439f215433e0b6c20423b88ab77..44c48bb232a246a38443d833f5e71a8d3d740528 100644
|
| --- a/ui/views/controls/tabbed_pane/tabbed_pane.h
|
| +++ b/ui/views/controls/tabbed_pane/tabbed_pane.h
|
| @@ -12,6 +12,7 @@
|
|
|
| namespace views {
|
|
|
| +class Label;
|
| class Tab;
|
| class TabbedPaneListener;
|
| class TabStrip;
|
| @@ -34,9 +35,6 @@ class VIEWS_EXPORT TabbedPane : public View {
|
| // Returns the number of tabs.
|
| int GetTabCount();
|
|
|
| - // Returns the contents of the selected tab or NULL if there is none.
|
| - View* GetSelectedTab();
|
| -
|
| // Adds a new tab at the end of this TabbedPane with the specified |title|.
|
| // |contents| is the view displayed when the tab is selected and is owned by
|
| // the TabbedPane.
|
| @@ -58,17 +56,32 @@ class VIEWS_EXPORT TabbedPane : public View {
|
| const char* GetClassName() const override;
|
|
|
| private:
|
| + friend class FocusTraversalTest;
|
| + friend class Tab;
|
| friend class TabStrip;
|
| + FRIEND_TEST_ALL_PREFIXES(TabbedPaneTest, AddAndSelect);
|
| + FRIEND_TEST_ALL_PREFIXES(TabbedPaneTest, ArrowKeyBindings);
|
|
|
| // Get the Tab (the tabstrip view, not its content) at the valid |index|.
|
| Tab* GetTabAt(int index);
|
|
|
| + // Get the Tab (the tabstrip view, not its content) at the selected index.
|
| + Tab* GetSelectedTab();
|
| +
|
| + // Returns the content View of the currently selected Tab.
|
| + View* GetSelectedTabContentView();
|
| +
|
| + // Moves the selection by |delta| tabs, where negative delta means leftwards
|
| + // and positive delta means rightwards. Returns whether the selection could be
|
| + // moved by that amount; the only way this can fail is if there is only one
|
| + // tab.
|
| + bool MoveSelectionBy(int delta);
|
| +
|
| // Overridden from View:
|
| void Layout() override;
|
| void ViewHierarchyChanged(
|
| const ViewHierarchyChangedDetails& details) override;
|
| bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
|
| - void OnFocus() override;
|
| void GetAccessibleState(ui::AXViewState* state) override;
|
|
|
| // A listener notified when tab selection changes. Weak, not owned.
|
| @@ -85,6 +98,60 @@ class VIEWS_EXPORT TabbedPane : public View {
|
| DISALLOW_COPY_AND_ASSIGN(TabbedPane);
|
| };
|
|
|
| +// The tab view shown in the tab strip.
|
| +class Tab : public View {
|
| + public:
|
| + // Internal class name.
|
| + static const char kViewClassName[];
|
| +
|
| + Tab(TabbedPane* tabbed_pane, const base::string16& title, View* contents);
|
| + ~Tab() override;
|
| +
|
| + View* contents() const { return contents_; }
|
| +
|
| + bool selected() const { return contents_->visible(); }
|
| + void SetSelected(bool selected);
|
| +
|
| + // Overridden from View:
|
| + bool OnMousePressed(const ui::MouseEvent& event) override;
|
| + void OnMouseEntered(const ui::MouseEvent& event) override;
|
| + void OnMouseExited(const ui::MouseEvent& event) override;
|
| + void OnGestureEvent(ui::GestureEvent* event) override;
|
| + gfx::Size GetPreferredSize() const override;
|
| + void Layout() override;
|
| + const char* GetClassName() const override;
|
| + void OnFocus() override;
|
| + void OnBlur() override;
|
| + bool OnKeyPressed(const ui::KeyEvent& event) override;
|
| +
|
| + protected:
|
| + Label* title() { return title_; }
|
| +
|
| + // Called whenever |tab_state_| changes.
|
| + virtual void OnStateChanged();
|
| +
|
| + // Returns whether the containing TabStrip has focus.
|
| + bool ContainerHasFocus();
|
| +
|
| + private:
|
| + enum TabState {
|
| + TAB_INACTIVE,
|
| + TAB_ACTIVE,
|
| + TAB_HOVERED,
|
| + };
|
| +
|
| + void SetState(TabState tab_state);
|
| +
|
| + TabbedPane* tabbed_pane_;
|
| + Label* title_;
|
| + gfx::Size preferred_title_size_;
|
| + TabState tab_state_;
|
| + // The content view associated with this tab.
|
| + View* contents_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(Tab);
|
| +};
|
| +
|
| } // namespace views
|
|
|
| #endif // UI_VIEWS_CONTROLS_TABBED_PANE_TABBED_PANE_H_
|
|
|