OLD | NEW |
| (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_NATIVE_TABBED_PANE_WIN_H_ | |
6 #define UI_VIEWS_CONTROLS_TABBED_PANE_NATIVE_TABBED_PANE_WIN_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "ui/views/controls/native_control_win.h" | |
11 #include "ui/views/controls/tabbed_pane/native_tabbed_pane_wrapper.h" | |
12 | |
13 namespace views { | |
14 | |
15 class TabbedPane; | |
16 class TabLayout; | |
17 class Widget; | |
18 | |
19 class NativeTabbedPaneWin : public NativeControlWin, | |
20 public NativeTabbedPaneWrapper { | |
21 public: | |
22 explicit NativeTabbedPaneWin(TabbedPane* tabbed_pane); | |
23 virtual ~NativeTabbedPaneWin(); | |
24 | |
25 // NativeTabbedPaneWrapper implementation: | |
26 virtual void AddTab(const string16& title, View* contents); | |
27 virtual void AddTabAtIndex(int index, | |
28 const string16& title, | |
29 View* contents, | |
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; | |
40 | |
41 // NativeControlWin overrides. | |
42 virtual void CreateNativeControl(); | |
43 virtual bool ProcessMessage(UINT message, | |
44 WPARAM w_param, | |
45 LPARAM l_param, | |
46 LRESULT* result); | |
47 | |
48 // View overrides: | |
49 virtual void Layout(); | |
50 virtual FocusTraversable* GetFocusTraversable(); | |
51 virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child); | |
52 | |
53 private: | |
54 // Called upon creation of native control to initialize tabs that are added | |
55 // before the native control is created. | |
56 void InitializeTabs(); | |
57 | |
58 // Adds a tab with the given content to native control at the given index. | |
59 void AddNativeTab(int index, const string16& title); | |
60 | |
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); | |
65 | |
66 // Resizes the HWND control to macth the size of the containing view. | |
67 void ResizeContents(); | |
68 | |
69 // The tabbed-pane we are bound to. | |
70 TabbedPane* tabbed_pane_; | |
71 | |
72 // The layout manager we use for managing our tabs. | |
73 TabLayout* tab_layout_manager_; | |
74 | |
75 // The views associated with the different tabs. | |
76 std::vector<View*> tab_views_; | |
77 | |
78 // The tab's title strings. | |
79 std::vector<const string16> tab_titles_; | |
80 | |
81 // The index of the selected tab. | |
82 int selected_index_; | |
83 | |
84 // The window displayed in the tab. | |
85 Widget* content_window_; | |
86 | |
87 DISALLOW_COPY_AND_ASSIGN(NativeTabbedPaneWin); | |
88 }; | |
89 | |
90 } // namespace views | |
91 | |
92 #endif // UI_VIEWS_CONTROLS_TABBED_PANE_NATIVE_TABBED_PANE_WIN_H_ | |
OLD | NEW |