2 Copyright (C) 2015 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef _WIDGETS_TABBABLE_H_
21 #define _WIDGETS_TABBABLE_H_
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>
30 #include "gtkmm2ext/window_proxy.h"
31 #include "widgets/visibility.h"
39 class VisibilityTracker;
42 namespace ArdourWidgets {
44 class LIBWIDGETS_API Tabbable : public Gtkmm2ext::WindowProxy
47 Tabbable (Gtk::Widget&, const std::string&, bool tabbed_by_default = true);
50 void add_to_notebook (Gtk::Notebook& notebook, const std::string& tab_title);
52 void make_invisible ();
53 void change_visibility ();
57 Gtk::Widget& contents() const { return _contents; }
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);
63 void set_default_tabbed (bool yn);
65 virtual void show_window ();
67 bool window_visible () const;
69 bool tabbed_by_default () const;
71 Gtk::Window* current_toplevel () const;
73 Gtk::Notebook* tab_root_drop ();
75 int set_state (const XMLNode&, int version);
76 XMLNode& get_state ();
78 static std::string xml_node_name();
80 sigc::signal1<void,Tabbable&> StateChange;
83 bool delete_event_handler (GdkEventAny *ev);
86 Gtk::Widget& _contents;
87 Gtk::Notebook _own_notebook;
88 Gtk::Notebook* _parent_notebook;
89 std::string _tab_title;
90 bool tab_requested_by_state;
94 bool tab_close_clicked (GdkEventButton*);
95 void show_own_window (bool and_pack_it);
96 void window_mapped ();
97 void window_unmapped ();
100 } /* end namespace */