-#include <algorithm>
+#include <msp/core/algorithm.h>
#include <msp/core/maputils.h>
#include <msp/core/refptr.h>
#include "button.h"
return true;
}
}
+ else if(nav==NAV_NEXT || nav==NAV_PREVIOUS)
+ {
+ vector<Widget *>::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;
}
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);
void Panel::on_child_removed(Widget &wdg)
{
+ vector<Widget *>::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);