X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpanel.cpp;h=97e13a2591b34dd9107f2dd65c22baa86750f676;hb=cfb830ca263defc307f9cfac74fb6771f6b7bfc6;hp=a9d581f5aae63a11150df2b2fd3ebcba81d6f624;hpb=2aa99730d8c3106deeac1186e057055604835752;p=libs%2Fgltk.git diff --git a/source/panel.cpp b/source/panel.cpp index a9d581f..97e13a2 100644 --- a/source/panel.cpp +++ b/source/panel.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include "button.h" @@ -104,6 +104,28 @@ bool Panel::navigate(Navigation nav) return true; } } + else if(nav==NAV_NEXT || nav==NAV_PREVIOUS) + { + vector::iterator i = find(nav_order, input_focus); + + if(nav==NAV_NEXT) + { + if(i!=nav_order.end()) + ++i; + if(i==nav_order.end()) + i = nav_order.begin(); + } + else + { + if(i==nav_order.begin()) + i = nav_order.end(); + --i; + } + + set_input_focus(*i); + + return true; + } return false; } @@ -159,6 +181,9 @@ void Panel::on_geometry_change() void Panel::on_child_added(Widget &wdg) { + if(wdg.get_input_type()!=INPUT_NONE) + nav_order.push_back(&wdg); + if(layout) { layout->add_widget(wdg); @@ -168,6 +193,10 @@ void Panel::on_child_added(Widget &wdg) void Panel::on_child_removed(Widget &wdg) { + vector::iterator i = std::remove(nav_order.begin(), nav_order.end(), &wdg); + if(i!=nav_order.end()) + nav_order.erase(i, nav_order.end()); + if(layout) { layout->remove_widget(wdg);