X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpanel.cpp;h=957385e0dbb82ae14c586e045a9c5ac1e0aa7cad;hb=6deafc9f236b90175a303944815f7c0eac1c95c1;hp=a9d581f5aae63a11150df2b2fd3ebcba81d6f624;hpb=7b070f07d7987396d8abe9cf45f1e8280886b20f;p=libs%2Fgltk.git diff --git a/source/panel.cpp b/source/panel.cpp index a9d581f..957385e 100644 --- a/source/panel.cpp +++ b/source/panel.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include "button.h" @@ -7,23 +7,26 @@ #include "dropdown.h" #include "entry.h" #include "grid.h" -#include "hslider.h" #include "image.h" #include "indicator.h" #include "label.h" #include "list.h" #include "panel.h" #include "part.h" +#include "progressbar.h" #include "row.h" +#include "slider.h" #include "stack.h" #include "toggle.h" -#include "vslider.h" using namespace std; namespace Msp { namespace GLtk { +TypeRegistry Panel::widget_registry; +bool Panel::widget_registry_init_done = false; + Panel::Panel(): layout(0) { @@ -104,6 +107,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; } @@ -151,7 +176,7 @@ int Panel::compute_delta(int pos, int dim, int origin_pos, int origin_dim, int n return 0; } -void Panel::on_geometry_change() +void Panel::on_size_change() { if(layout) layout->update(); @@ -159,6 +184,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 +196,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); @@ -181,34 +213,34 @@ Panel::Loader::Loader(Panel &p, map &m): wdg_map(m), last_widget(0) { - add_child_type