Ardour  9.0-pre0-582-g084a23a80d
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/box.h>
24 #include <gtkmm/button.h>
25 #include <gtkmm/eventbox.h>
26 #include <gtkmm/image.h>
27 #include <gtkmm/label.h>
28 #include <gtkmm/notebook.h>
29 
30 #include "gtkmm2ext/window_proxy.h"
31 
32 #include "widgets/ardour_button.h"
33 #include "widgets/eventboxext.h"
34 #include "widgets/pane.h"
35 #include "widgets/visibility.h"
36 
37 namespace Gtk {
38  class Window;
39  class Notebook;
40 }
41 
42 namespace Gtkmm2ext {
43  class VisibilityTracker;
44 }
45 
46 namespace ArdourWidgets {
47 
49 {
50 public:
51  enum PaneLayout {
52  NoPanes = 0x00,
53  PaneLeft = 0x01,
54  PaneRight = 0x02,
55  PaneBottom = 0x04,
56  AttLeft = 0x08,
57  AttBottom = 0x10,
58  };
59 
60  Tabbable (const std::string& user_visible_name, std::string const & untranslated_name, Gtk::Widget* top = NULL, bool tabbed_by_default = true, PaneLayout pl = PaneRight);
62 
63  void add_to_notebook (Gtk::Notebook& notebook);
64  void make_visible ();
65  void make_invisible ();
67  void attach ();
68  void detach ();
69 
70  Gtk::Widget& contents() const { return *_contents; }
71 
72  /* this is where ArdourUI packs the tab switchers
73  * (record/cues/edit/mix) into my toolbar area,
74  * in the case where I'm attached to the main window
75  */
76  Gtk::EventBox& tab_btn_box () {return content_tabbables;}
77 
78  Gtk::Window* get (bool create = false);
79  Gtk::Window* own_window () { return get (false); }
80  virtual Gtk::Window* use_own_window (bool and_pack_it);
81 
82  void set_default_tabbed (bool yn);
83 
84  virtual void show_window ();
85 
86  bool window_visible () const;
87  bool tabbed() const;
88  bool tabbed_by_default () const;
89 
91 
93 
94  int set_state (const XMLNode&, int version);
95  XMLNode& get_state () const;
96 
97  static std::string xml_node_name();
98 
99  sigc::signal1<void,Tabbable&> StateChange;
100 
104 
105 protected:
106  virtual void showhide_att_left (bool yn);
107  virtual void showhide_att_right (bool yn);
108  virtual void showhide_att_bottom (bool yn);
109 
111 
112  /* This is the heirarchy of a Tabbable's widget packing.
113  *
114  * The end result is to provide 7 event-boxes (marked with a $) where the tab can put its contents.
115  *
116  * +--_content_vbox----------------------------------------------------------------------------------+
117  * | |
118  * | /--toolbar_frame------------------------------------------------------------------------------\ |
119  * | | +--content_header_hbox--------------------------------------------------------------------+ | |
120  * | | | | | |
121  * | | | +--content_app_bar--------------------+ +--attachment_hbox--+ +--content_tabbables--+ | | |
122  * | | | $ (EBOX) | | (internal) | $ (EBOX) | | | |
123  * | | | | MAIN APPLICATION BAR | | (attachment btns) | | PAGE SWITCHER BTN | | | |
124  * | | | | | | | | | | | |
125  * | | | +-------------------------------------+ +-------------------+ +---------------------+ | | |
126  * | | | | | |
127  * | | +-----------------------------------------------------------------------------------------+ | |
128  * | \---------------------------------------------------------------------------------------------/ |
129  * | |
130  * | +--content_hbox--OR--content_left_pane--(EXPAND|FILL)-----------------------------------------+ |
131  * | | | |
132  * | | +--att_left--+ +--content_midlevel_vbox--OR-content_midlevel_vpane--(EXPAND|FILL)-------+ | |
133  * | | $ (EBOX) | | +--content_right_pane--(EXPAND|FILL)---------------------------------+ | | |
134  * | | | | | | +--content_inner_vbox-----------------+ +--content_right_vbox--+ | | | |
135  * | | | O | | | | | | | | | | |
136  * | | | P S | | | | +--content_main_top---------------+ | | +--att_right-------+ | | | | |
137  * | | | T I | | | | $ OPTIONAL TOOLBAR (EBOX) | | | $ (EBOX) | | | | | |
138  * | | | I D | | | | +---------------------------------+ |<->| | | | | | | |
139  * | | | O E |<->| | | | P | | OPTIONAL | | | | | |
140  * | | | N B | O | | | +--content_main--(EXPAND|FILL)----+ | A | | SIDEBAR | | | | | |
141  * | | | A A | P | | | $ (EBOX) | | N | | | | | | | |
142  * | | | L R | T | | | | | | E | | | | | | | |
143  * | | | | . | | | | !! MAIN PAGE CONTENT !! | |<->| | (LIST) | | | | | |
144  * | | | | P | | | | | | | | | | | | | |
145  * | | | | A | | | | | | | | | | | | | |
146  * | | | | N | | | +---------------------------------+ | | +------------------+ | | | | |
147  * | | | (STRIP) | E | | +-------------------------------------+ +----------------------+ | | | |
148  * | | | |<->| +--------------------------------------------------------------------+ | | |
149  * | | | | | 🡅 OPTIONAL 🡅 | | |
150  * | | | | | 🡇 PANE 🡇 | | |
151  * | | | | | +-content_att_bottom-------------------------------------------------+ | | |
152  * | | | | | $ (EBOX) | | | |
153  * | | | | | | OPTIONAL BOTTOM (PROPERTIES) | | | |
154  * | | | | | | | | | |
155  * | | | | | +--------------------------------------------------------------------+ | | |
156  * | | +------------+ +------------------------------------------------------------------------+ | |
157  * | +---------------------------------------------------------------------------------------------+ |
158  * | |
159  * +-------------------------------------------------------------------------------------------------+
160  *
161  */
162 
163  /* clang-format off */
164  /* _content_vbox * toplevel
165  * toolbar_frame * the frame is managed in the implementation */
167  EventBoxExt content_app_bar; /* a placeholder for the transport bar, if you want one */
168  Gtk::EventBox content_attachments; /* a placeholder the (strip, list, props) visibility buttons for this tab */
170  EventBoxExt content_tabbables; /* a placeholder for the tabbable switching buttons (used by ArdourUI) */
173  EventBoxExt content_att_left; /* a placeholder for the mixer strip, if you want one */
178  EventBoxExt content_main_top; /* a placeholder for the content-specific toolbar, if you want one */
179  EventBoxExt content_main; /* a placeholder for the innermost content (recorder, cues, editor, mixer) */
181  EventBoxExt content_att_right; /* a placeholder for the sidebar list, if you want one */
182  EventBoxExt content_att_bottom; /* a placeholder for the property box, if you want one */
183  /* clang-format on */
184 
185  /* visibility controls */
189 
190 private:
191  void default_layout ();
192  void show_tab ();
193  void hide_tab ();
195  void show_own_window (bool and_pack_it);
196  void window_mapped ();
198 
199  Gtk::VBox _content_vbox; /* this is the root widget for a full-featured tabbable, which contains: */
200  Gtk::Widget* _contents; /* for most Tabbables this will be content_vbox; but rc_options, for example, does something different. */
205 
206 };
207 
208 } /* end namespace */
209 
210 #endif
EventBoxExt content_att_left
Definition: tabbable.h:173
Gtk::HBox content_hbox
Definition: tabbable.h:172
sigc::signal1< void, Tabbable & > StateChange
Definition: tabbable.h:99
EventBoxExt content_tabbables
Definition: tabbable.h:170
Gtk::Window * get(bool create=false)
bool tabbed_by_default() const
EventBoxExt content_app_bar
Definition: tabbable.h:167
ArdourWidgets::ArdourButton right_attachment_button
Definition: tabbable.h:187
virtual void showhide_att_right(bool yn)
virtual void showhide_att_left(bool yn)
virtual void showhide_att_bottom(bool yn)
EventBoxExt content_main_top
Definition: tabbable.h:178
Gtk::Widget & contents() const
Definition: tabbable.h:70
Gtk::EventBox & tab_btn_box()
Definition: tabbable.h:76
void add_to_notebook(Gtk::Notebook &notebook)
int set_state(const XMLNode &, int version)
PaneLayout _panelayout
Definition: tabbable.h:204
Tabbable(const std::string &user_visible_name, std::string const &untranslated_name, Gtk::Widget *top=NULL, bool tabbed_by_default=true, PaneLayout pl=PaneRight)
static std::string xml_node_name()
Gtk::EventBox content_attachments
Definition: tabbable.h:168
EventBoxExt content_att_right
Definition: tabbable.h:181
Gtk::Notebook * _parent_notebook
Definition: tabbable.h:202
Gtk::Widget * _contents
Definition: tabbable.h:200
virtual Gtk::Window * use_own_window(bool and_pack_it)
bool tab_close_clicked(GdkEventButton *)
Gtk::Window * own_window()
Definition: tabbable.h:79
Gtk::VBox _content_vbox
Definition: tabbable.h:199
ArdourWidgets::ArdourButton bottom_attachment_button
Definition: tabbable.h:188
Gtk::VBox content_midlevel_vbox
Definition: tabbable.h:175
EventBoxExt content_att_bottom
Definition: tabbable.h:182
Gtk::HBox content_attachment_hbox
Definition: tabbable.h:169
EventBoxExt content_main
Definition: tabbable.h:179
bool delete_event_handler(GdkEventAny *ev)
Gtk::Notebook _own_notebook
Definition: tabbable.h:201
XMLNode & get_state() const
Gtk::VBox content_inner_vbox
Definition: tabbable.h:177
Gtk::Window * current_toplevel() const
bool window_visible() const
Gtk::HBox content_header_hbox
Definition: tabbable.h:166
Gtk::VBox content_right_vbox
Definition: tabbable.h:180
Gtk::Notebook * tab_root_drop()
virtual void show_window()
void show_own_window(bool and_pack_it)
void set_default_tabbed(bool yn)
ArdourWidgets::ArdourButton left_attachment_button
Definition: tabbable.h:186
Definition: Window.h:41
Definition: xml++.h:114
Definition: ardour_ui.h:188
#define LIBWIDGETS_API