provide a sigc::signal to track display state changes for a Tabbable
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 23 Jul 2015 01:13:33 +0000 (21:13 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 22 Feb 2016 20:31:22 +0000 (15:31 -0500)
libs/gtkmm2ext/gtkmm2ext/tabbable.h
libs/gtkmm2ext/tabbable.cc

index 131daa1eadce12bcb6d74f839d8084e7cdf99ddb..74a7b437dcbf6d0341772aec138f035c28db0321 100644 (file)
@@ -64,6 +64,7 @@ class LIBGTKMM2EXT_API Tabbable : public WindowProxy {
        virtual void show_window ();
 
        bool window_visible ();
+       bool tabbed() const;
 
        Gtk::Window* current_toplevel () const;
 
@@ -73,6 +74,8 @@ class LIBGTKMM2EXT_API Tabbable : public WindowProxy {
        XMLNode& get_state ();
        
        static std::string xml_node_name();
+
+       sigc::signal1<void,Tabbable&> StateChange;
        
   protected:
        bool delete_event_handler (GdkEventAny *ev);
@@ -92,7 +95,6 @@ class LIBGTKMM2EXT_API Tabbable : public WindowProxy {
        void hide_tab ();
        void tab_close_clicked ();
        void show_own_window (bool and_pack_it);
-       bool tabbed() const;
 };
 
 
index 342283ee802307697736f0b742ca61ecfecba5a9..97da6350509efa655391e33ab20ed78a54df97a0 100644 (file)
@@ -101,7 +101,7 @@ Tabbable::window_visible ()
                return false;
        }
 
-       return visible();
+       return _window->is_visible();
 }
 
 Window*
@@ -153,6 +153,7 @@ Tabbable::show_own_window (bool and_pack_it)
 
        _window->show_all ();
        _window->present ();
+       StateChange (*this);
 }
 
 Gtk::Notebook*
@@ -201,6 +202,7 @@ Tabbable::make_invisible ()
 {
        if (_window && (current_toplevel() == _window)) {
                _window->hide ();
+               StateChange (*this);
        } else {
                hide_tab ();
        }
@@ -254,6 +256,7 @@ Tabbable::attach ()
         */
 
        tab_requested_by_state = true;
+       StateChange (*this);
 }
 
 bool
@@ -285,6 +288,7 @@ Tabbable::hide_tab ()
 {
        if (tabbed()) {
                _parent_notebook->remove_page (_contents);
+               StateChange (*this);
        }
 }
 
@@ -296,6 +300,7 @@ Tabbable::show_tab ()
                        add_to_notebook (*_parent_notebook, _tab_title);
                }
                _parent_notebook->set_current_page (_parent_notebook->page_num (_contents));
+               StateChange (*this);
        }
 }
 
@@ -314,7 +319,7 @@ Tabbable::xml_node_name()
 bool
 Tabbable::tabbed () const
 {
-       return _parent_notebook && (_parent_notebook->page_num (_contents) >= 0);
+       return _parent_notebook && (_parent_notebook->page_num (_contents) > 0);
 }
 
 XMLNode&