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