]> git.tdb.fi Git - libs/gltk.git/commitdiff
Add an event handler to allow containers to reach to focus changes
authorMikko Rasa <tdb@tdb.fi>
Sun, 8 Sep 2019 15:32:19 +0000 (18:32 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 8 Sep 2019 15:32:19 +0000 (18:32 +0300)
source/container.cpp
source/container.h

index a0d1fd748fc7abb3f353babe6a655a4345759515..23227331139edab708849e8a63379d78ef5835d1 100644 (file)
@@ -151,12 +151,10 @@ void Container::set_input_focus(Widget *wdg)
                        input_focus->focus_out();
 
                input_focus = wdg;
+               on_input_focus_changed(input_focus);
 
                if(input_focus)
-               {
-                       raise(*wdg);
                        input_focus->focus_in();
-               }
        }
 }
 
@@ -356,6 +354,12 @@ void Container::on_reparent()
        }
 }
 
+void Container::on_input_focus_changed(Widget *wdg)
+{
+       if(wdg)
+               raise(*wdg);
+}
+
 
 Container::Child::Child(Container &c, Widget *w):
        container(c),
index f68d81fcee59c85afbfa1f0ed74d4c59a7cff6a7..3117236daa7463d80961604732de717c778e59f8 100644 (file)
@@ -92,6 +92,7 @@ protected:
        virtual void on_reparent();
        virtual void on_child_added(Widget &) { }
        virtual void on_child_removed(Widget &) { }
+       virtual void on_input_focus_changed(Widget *);
 };
 
 } // namespace GLtk