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.
5 #ifndef VIEWS_CONTROLS_TABBED_PANE_NATIVE_TABBED_PANE_WIN_H_
6 #define VIEWS_CONTROLS_TABBED_PANE_NATIVE_TABBED_PANE_WIN_H_
11 #include "views/controls/native_control_win.h"
12 #include "views/controls/tabbed_pane/native_tabbed_pane_wrapper.h"
19 class NativeTabbedPaneWin
: public NativeControlWin
,
20 public NativeTabbedPaneWrapper
{
22 explicit NativeTabbedPaneWin(TabbedPane
* tabbed_pane
);
23 virtual ~NativeTabbedPaneWin();
25 // NativeTabbedPaneWrapper implementation:
26 virtual void AddTab(const string16
& title
, View
* contents
);
27 virtual void AddTabAtIndex(int index
,
28 const string16
& title
,
30 bool select_if_first_tab
);
31 virtual View
* RemoveTabAtIndex(int index
);
32 virtual void SelectTabAt(int index
);
33 virtual int GetTabCount();
34 virtual int GetSelectedTabIndex();
35 virtual View
* GetSelectedTab();
36 virtual View
* GetView();
37 virtual void SetFocus();
38 virtual gfx::Size
GetPreferredSize();
39 virtual gfx::NativeView
GetTestingHandle() const;
41 // NativeControlWin overrides.
42 virtual void CreateNativeControl();
43 virtual bool ProcessMessage(UINT message
,
49 virtual void Layout();
50 virtual FocusTraversable
* GetFocusTraversable();
51 virtual void ViewHierarchyChanged(bool is_add
, View
*parent
, View
*child
);
54 // Called upon creation of native control to initialize tabs that are added
55 // before the native control is created.
56 void InitializeTabs();
58 // Adds a tab with the given content to native control at the given index.
59 void AddNativeTab(int index
, const string16
& title
);
61 // Changes the contents view to the view associated with the tab at |index|.
62 // |invoke_listener| controls if this methold should invoke the
63 // Listener::TabSelectedAt callback.
64 void DoSelectTabAt(int index
, boolean invoke_listener
);
66 // Resizes the HWND control to macth the size of the containing view.
67 void ResizeContents();
69 // The tabbed-pane we are bound to.
70 TabbedPane
* tabbed_pane_
;
72 // The layout manager we use for managing our tabs.
73 TabLayout
* tab_layout_manager_
;
75 // The views associated with the different tabs.
76 std::vector
<View
*> tab_views_
;
78 // The tab's title strings.
79 std::vector
<const string16
> tab_titles_
;
81 // The index of the selected tab.
84 // The window displayed in the tab.
85 Widget
* content_window_
;
87 DISALLOW_COPY_AND_ASSIGN(NativeTabbedPaneWin
);
92 #endif // VIEWS_CONTROLS_TABBED_PANE_NATIVE_TABBED_PANE_WIN_H_