X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpanel.cpp;h=97e13a2591b34dd9107f2dd65c22baa86750f676;hb=cfb830ca263defc307f9cfac74fb6771f6b7bfc6;hp=b9ddbf18b969d757bff20b2ca5a551bb1c3af869;hpb=91583e23889a7654fab6669821979b36c1819606;p=libs%2Fgltk.git diff --git a/source/panel.cpp b/source/panel.cpp index b9ddbf1..97e13a2 100644 --- a/source/panel.cpp +++ b/source/panel.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include "button.h" @@ -84,6 +84,9 @@ bool Panel::navigate(Navigation nav) origin_dim = abs(nav_x)*geom.h+abs(nav_y)*geom.w; } + if(pointer_grabbed && pointer_focus==input_focus) + return false; + Widget *sibling = find_next_child(origin_x, origin_y, origin_dim, nav_x, nav_y); if(!sibling && input_focus) { @@ -101,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; } @@ -156,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); @@ -165,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);