| OLD | NEW |
| (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 UI_VIEWS_CONTROLS_TABBED_PANE_NATIVE_TABBED_PANE_VIEWS_H_ |
| 6 #define UI_VIEWS_CONTROLS_TABBED_PANE_NATIVE_TABBED_PANE_VIEWS_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <vector> |
| 10 |
| 11 #include "ui/views/controls/tabbed_pane/native_tabbed_pane_wrapper.h" |
| 12 #include "views/view.h" |
| 13 |
| 14 namespace views { |
| 15 |
| 16 class TabLayout; |
| 17 class TabStrip; |
| 18 class Widget; |
| 19 |
| 20 class NativeTabbedPaneViews : public View, |
| 21 public NativeTabbedPaneWrapper { |
| 22 public: |
| 23 explicit NativeTabbedPaneViews(TabbedPane* tabbed_pane); |
| 24 virtual ~NativeTabbedPaneViews(); |
| 25 |
| 26 void TabSelectionChanged(int index); |
| 27 |
| 28 // Overridden from NativeTabbedPaneWrapper: |
| 29 virtual void AddTab(const string16& title, View* contents); |
| 30 virtual void AddTabAtIndex(int index, |
| 31 const string16& title, |
| 32 View* contents, |
| 33 bool select_if_first_tab); |
| 34 virtual View* RemoveTabAtIndex(int index); |
| 35 virtual void SelectTabAt(int index); |
| 36 virtual int GetTabCount(); |
| 37 virtual int GetSelectedTabIndex(); |
| 38 virtual View* GetSelectedTab(); |
| 39 virtual View* GetView(); |
| 40 virtual void SetFocus(); |
| 41 virtual gfx::Size GetPreferredSize(); |
| 42 virtual gfx::NativeView GetTestingHandle() const; |
| 43 |
| 44 // View overrides: |
| 45 virtual void Layout(); |
| 46 virtual FocusTraversable* GetFocusTraversable(); |
| 47 virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child); |
| 48 |
| 49 private: |
| 50 void InitControl(); |
| 51 |
| 52 // Called upon creation of native control to initialize tabs that are added |
| 53 // before the native control is created. |
| 54 void InitializeTabs(); |
| 55 |
| 56 // Adds a tab with the given content to native control at the given index. |
| 57 void AddNativeTab(int index, const string16& title); |
| 58 |
| 59 // Changes the contents view to the view associated with the tab at |index|. |
| 60 // |invoke_listener| controls if this methold should invoke the |
| 61 // Listener::TabSelectedAt callback. |
| 62 void DoSelectTabAt(int index, boolean invoke_listener); |
| 63 |
| 64 // The tabbed-pane we are bound to. |
| 65 TabbedPane* tabbed_pane_; |
| 66 |
| 67 // The layout manager we use for managing our tabs. |
| 68 TabLayout* tab_layout_manager_; |
| 69 |
| 70 // TabStrip. |
| 71 TabStrip* tab_strip_; |
| 72 |
| 73 // The views associated with the different tabs. |
| 74 std::vector<View*> tab_views_; |
| 75 |
| 76 // The tab's title strings. |
| 77 std::vector<const string16> tab_titles_; |
| 78 |
| 79 // The index of the selected tab. |
| 80 int selected_index_; |
| 81 |
| 82 // The window displayed in the tab. |
| 83 Widget* content_window_; |
| 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(NativeTabbedPaneViews); |
| 86 }; |
| 87 |
| 88 } // namespace views |
| 89 |
| 90 #endif // UI_VIEWS_CONTROLS_TABBED_PANE_NATIVE_TABBED_PANE_VIEWS_H_ |
| OLD | NEW |