summaryrefslogtreecommitdiffstats
path: root/views/controls/tabbed_pane/native_tabbed_pane_gtk.h
blob: d586e74e90f898e78bae51e071eb548ce0aafe56 (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
// Copyright (c) 2009 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_GTK_H_
#define VIEWS_CONTROLS_TABBED_PANE_NATIVE_TABBED_PANE_GTK_H_

#include "views/controls/native_control_gtk.h"
#include "views/controls/tabbed_pane/native_tabbed_pane_wrapper.h"

namespace views {

class WidgetGtk;

class NativeTabbedPaneGtk : public NativeControlGtk,
                            public NativeTabbedPaneWrapper {
 public:
  explicit NativeTabbedPaneGtk(TabbedPane* tabbed_pane);
  virtual ~NativeTabbedPaneGtk();

  // NativeTabbedPaneWrapper implementation:
  virtual void AddTab(const std::wstring& title, View* contents);
  virtual void AddTabAtIndex(int index,
                             const std::wstring& title,
                             View* contents,
                             bool select_if_first_tab);
  virtual View* RemoveTabAtIndex(int index);
  virtual void SelectTabAt(int index);
  virtual int GetTabCount();
  virtual int GetSelectedTabIndex();
  virtual View* GetSelectedTab();
  virtual View* GetView();
  virtual void SetFocus();
  virtual gfx::NativeView GetTestingHandle() const;

  // NativeControlGtk overrides.
  virtual void CreateNativeControl();

  // View override:
  virtual FocusTraversable* GetFocusTraversable();

 private:
  void DoAddTabAtIndex(int index,
                       const std::wstring& title,
                       View* contents,
                       bool select_if_first_tab);

  // Returns the WidgetGtk containing the tab contents at |index|.
  WidgetGtk* GetWidgetAt(int index);

  View* GetTabViewAt(int index);
  void OnSwitchPage(int selected_tab_index);

  static void CallSwitchPage(GtkNotebook* widget,
                             GtkNotebookPage* page,
                             guint selected_tab_index,
                             NativeTabbedPaneGtk* tabbed_pane);

  // The tabbed-pane we are bound to.
  TabbedPane* tabbed_pane_;

  DISALLOW_COPY_AND_ASSIGN(NativeTabbedPaneGtk);
};

}  // namespace views

#endif  // VIEWS_CONTROLS_TABBED_PANE_NATIVE_TABBED_PANE_GTK_H_