MySQL Workbench  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
tabswitcher.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; version 2 of the
7  * License.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17  * 02110-1301 USA
18  */
19 
20 #ifndef _MFORMS_TABSWITCHER_H_
21 #define _MFORMS_TABSWITCHER_H_
22 
23 #include <vector>
24 
25 #include "cairo/cairo.h"
26 
27 #include "base/drawing.h"
28 #include "mforms/base.h"
29 #include "mforms/drawbox.h"
30 #include "mforms/tabview.h"
31 
32 namespace mforms
33 {
36  };
37 
43 
48  };
49 
50  class TabSwitcherPimpl;
51 
53  {
54  public:
56  virtual ~TabSwitcher();
57 
58  void attach_to_tabview(TabView *tabView);
59 
60  int add_item(const std::string &title, const std::string &sub_title,
61  const std::string &icon_path, const std::string &alt_icon_path);
62  void set_icon(int index, const std::string &icon_path, const std::string &alt_icon_path);
63 
64  void set_selected(int index);
65  int get_selected();
66  void set_needs_relayout();
67 
68  void set_collapsed(bool flag);
69  bool get_collapsed();
70 
71 #ifndef SWIG
72  boost::signals2::signal<void ()>* signal_changed() { return &_signal_changed; };
73  boost::signals2::signal<void ()>* signal_collapse_changed() { return &_signal_collapse_changed; };
74 
75 #ifndef DOXYGEN_SHOULD_SKIP_THIS
76  virtual int get_preferred_height();
77  virtual void set_layout_dirty();
78 
79  virtual void repaint(cairo_t *cr, int x, int y, int w, int h);
80  virtual bool mouse_down(mforms::MouseButton button, int x, int y);
81  virtual bool mouse_up(mforms::MouseButton button, int x, int y);
82  virtual bool mouse_click(mforms::MouseButton button, int x, int y);
83  virtual bool mouse_enter();
84  virtual bool mouse_leave();
85 #endif
86 #endif
87  private:
88  TabSwitcherPimpl *_pimpl;
89  boost::signals2::signal<void ()> _signal_changed;
90  boost::signals2::signal<void ()> _signal_collapse_changed;
93 
97 
98  void tab_changed();
99 
100  bool collapse();
101  };
102 };
103 
104 #endif
105 
106 
TabElementPart
Definition: tabswitcher.h:38
TimeoutHandle _timeout
Definition: tabswitcher.h:92
boost::signals2::signal< void()> * signal_collapse_changed()
Definition: tabswitcher.h:73
boost::signals2::signal< void()> * signal_changed()
Definition: tabswitcher.h:72
int TimeoutHandle
Definition: utilities.h:93
boost::signals2::signal< void()> _signal_changed
Definition: tabswitcher.h:89
MouseButton
Definition: view.h:69
#define MFORMS_EXPORT
Definition: base.h:33
boost::signals2::signal< void()> _signal_collapse_changed
Definition: tabswitcher.h:90
TabSwitcherType
Definition: tabswitcher.h:34
TabView * _tabView
Definition: tabswitcher.h:91
A Notebook/Tabbed view.
Definition: tabview.h:58
MySQL Workbench 6.1 documentation