Ardour  9.0-pre0-386-g96ef4d20f2
tabbable.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef _WIDGETS_TABBABLE_H_
21 #define _WIDGETS_TABBABLE_H_
22 
23 #include <gtkmm/bin.h>
24 #include <gtkmm/box.h>
25 #include <gtkmm/button.h>
26 #include <gtkmm/image.h>
27 #include <gtkmm/label.h>
28 #include <gtkmm/notebook.h>
29 
30 #include "gtkmm2ext/window_proxy.h"
31 #include "widgets/visibility.h"
32 
33 namespace Gtk {
34  class Window;
35  class Notebook;
36 }
37 
38 namespace Gtkmm2ext {
39  class VisibilityTracker;
40 }
41 
42 namespace ArdourWidgets {
43 
45 {
46 public:
47  Tabbable (Gtk::Widget&, const std::string& user_visible_name, std::string const & untranslated_name, bool tabbed_by_default = true);
49 
50  void add_to_notebook (Gtk::Notebook& notebook);
51  void make_visible ();
52  void make_invisible ();
54  void attach ();
55  void detach ();
56 
57  Gtk::Widget& contents() const { return _contents; }
58 
59  Gtk::Window* get (bool create = false);
60  Gtk::Window* own_window () { return get (false); }
61  virtual Gtk::Window* use_own_window (bool and_pack_it);
62 
63  void set_default_tabbed (bool yn);
64 
65  virtual void show_window ();
66 
67  bool window_visible () const;
68  bool tabbed() const;
69  bool tabbed_by_default () const;
70 
71 
73 
75 
76  int set_state (const XMLNode&, int version);
77  XMLNode& get_state () const;
78 
79  static std::string xml_node_name();
80 
81  sigc::signal1<void,Tabbable&> StateChange;
82 
83 protected:
85 
86  sigc::signal1<void, bool> signal_tabbed_changed;
87 
88 private:
93 
94  void show_tab ();
95  void hide_tab ();
97  void show_own_window (bool and_pack_it);
98  void window_mapped ();
99  void window_unmapped ();
100 };
101 
102 } /* end namespace */
103 
104 #endif
sigc::signal1< void, Tabbable & > StateChange
Definition: tabbable.h:81
Gtk::Window * get(bool create=false)
bool tabbed_by_default() const
Gtk::Widget & contents() const
Definition: tabbable.h:57
void add_to_notebook(Gtk::Notebook &notebook)
int set_state(const XMLNode &, int version)
static std::string xml_node_name()
Gtk::Notebook * _parent_notebook
Definition: tabbable.h:91
virtual Gtk::Window * use_own_window(bool and_pack_it)
bool tab_close_clicked(GdkEventButton *)
Gtk::Window * own_window()
Definition: tabbable.h:60
sigc::signal1< void, bool > signal_tabbed_changed
Definition: tabbable.h:86
bool delete_event_handler(GdkEventAny *ev)
Gtk::Notebook _own_notebook
Definition: tabbable.h:90
XMLNode & get_state() const
Gtk::Window * current_toplevel() const
bool window_visible() const
Gtk::Widget & _contents
Definition: tabbable.h:89
Gtk::Notebook * tab_root_drop()
Tabbable(Gtk::Widget &, const std::string &user_visible_name, std::string const &untranslated_name, bool tabbed_by_default=true)
virtual void show_window()
void show_own_window(bool and_pack_it)
void set_default_tabbed(bool yn)
Definition: Window.h:41
Definition: xml++.h:114
Definition: ardour_ui.h:187
#define LIBWIDGETS_API