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 VIEWS_CONTROLS_TABBED_PANE_NATIVE_TABBED_PANE_WRAPPER_H_ | |
6 #define VIEWS_CONTROLS_TABBED_PANE_NATIVE_TABBED_PANE_WRAPPER_H_ | |
7 #pragma once | |
8 | |
9 #include "base/string16.h" | |
10 | |
11 namespace views { | |
12 | |
13 class TabbedPane; | |
14 class View; | |
15 | |
16 // An interface implemented by an object that provides a platform-native | |
17 // tabbed-pane. | |
18 class NativeTabbedPaneWrapper { | |
19 public: | |
20 // The TabbedPane calls this when it is destroyed to clean up the wrapper | |
21 // object. | |
22 virtual ~NativeTabbedPaneWrapper() {} | |
23 | |
24 // Adds a new tab at the end of this TabbedPane with the specified |title|. | |
25 // |contents| is the view displayed when the tab is selected and is owned by | |
26 // the TabbedPane. | |
27 virtual void AddTab(const string16& title, View* contents) = 0; | |
28 | |
29 // Adds a new tab at the specified |index| with the specified |title|. | |
30 // |contents| is the view displayed when the tab is selected and is owned by | |
31 // the TabbedPane. If |select_if_first_tab| is true and the tabbed pane is | |
32 // currently empty, the new tab is selected. If you pass in false for | |
33 // |select_if_first_tab| you need to explicitly invoke SelectTabAt, otherwise | |
34 // the tabbed pane will not have a valid selection. | |
35 virtual void AddTabAtIndex(int index, | |
36 const string16& title, | |
37 View* contents, | |
38 bool select_if_first_tab) = 0; | |
39 | |
40 // Removes the tab at the specified |index| and returns the associated content | |
41 // view. The caller becomes the owner of the returned view. | |
42 virtual View* RemoveTabAtIndex(int index) = 0; | |
43 | |
44 // Selects the tab at the specified |index|, which must be valid. | |
45 virtual void SelectTabAt(int index) = 0; | |
46 | |
47 // Returns the number of tabs. | |
48 virtual int GetTabCount() = 0; | |
49 | |
50 // Returns the index of the selected tab. | |
51 virtual int GetSelectedTabIndex() = 0; | |
52 | |
53 // Returns the contents of the selected tab. | |
54 virtual View* GetSelectedTab() = 0; | |
55 | |
56 // Retrieves the views::View that hosts the native control. | |
57 virtual View* GetView() = 0; | |
58 | |
59 // Sets the focus to the tabbed pane native view. | |
60 virtual void SetFocus() = 0; | |
61 | |
62 // Gets the preferred size of the tabbed pane. | |
63 virtual gfx::Size GetPreferredSize() = 0; | |
64 | |
65 // Returns a handle to the underlying native view for testing. | |
66 virtual gfx::NativeView GetTestingHandle() const = 0; | |
67 | |
68 // Creates an appropriate NativeTabbedPaneWrapper for the platform. | |
69 static NativeTabbedPaneWrapper* CreateNativeWrapper(TabbedPane* tabbed_pane); | |
70 }; | |
71 | |
72 } // namespace views | |
73 | |
74 #endif // VIEWS_CONTROLS_TABBED_PANE_NATIVE_TABBED_PANE_WRAPPER_H_ | |
OLD | NEW |