summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext/tabbable.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-11-20 09:27:41 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2016-02-22 15:31:25 -0500
commit361c8421df8361033161372cc2392647c8a75920 (patch)
treeabd4b39d54b2ae1b65e97a21ed668d60e9c92aa0 /libs/gtkmm2ext/tabbable.cc
parentc4962ca180a8394f38c955cdcb11f88e934ce3c1 (diff)
provide Tabbable::change_visibility(), which has slightly odd semantics that are neither toggle nor one-shot
Diffstat (limited to 'libs/gtkmm2ext/tabbable.cc')
-rw-r--r--libs/gtkmm2ext/tabbable.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/libs/gtkmm2ext/tabbable.cc b/libs/gtkmm2ext/tabbable.cc
index 928e501751..1c720591f5 100644
--- a/libs/gtkmm2ext/tabbable.cc
+++ b/libs/gtkmm2ext/tabbable.cc
@@ -170,6 +170,32 @@ Tabbable::show_window ()
}
}
+/** If this Tabbable is currently parented by a tab, ensure that the tab is the
+ * current one. If it is parented by a window, then toggle the visibility of
+ * that window.
+ */
+void
+Tabbable::change_visibility ()
+{
+ if (tabbed()) {
+ _parent_notebook->set_current_page (_parent_notebook->page_num (_contents));
+ return;
+ }
+
+ if (tab_requested_by_state) {
+ /* should be tabbed, but currently isn't parented by a notebook */
+ return;
+ }
+
+ if (_window && (current_toplevel() == _window)) {
+ if (_window->is_visible ()) {
+ _window->hide ();
+ } else {
+ _window->present ();
+ }
+ }
+}
+
void
Tabbable::make_visible ()
{
@@ -358,4 +384,3 @@ Tabbable::window_unmapped ()
{
StateChange (*this);
}
-