throw InvalidState("That Widget is not in this Panel");
}
+Widget *Panel::get_final_input_focus() const
+{
+ if(Panel *panel=dynamic_cast<Panel *>(input_focus))
+ {
+ Widget *focus=panel->get_final_input_focus();
+ if(focus)
+ return focus;
+ }
+ return input_focus;
+}
+
void Panel::button_press(int x, int y, unsigned btn)
{
if(pointer_grabbed)
if(Widget *wdg=get_child_at(x, y))
{
set_pointer_focus(wdg);
- set_input_focus(wdg);
+ if(wdg->is_focusable())
+ set_input_focus(wdg);
}
Container::button_press(x, y, btn);
}
void Panel::Child::request_focus()
{
- static_cast<Panel &>(container).set_input_focus(widget);
+ Panel &panel=static_cast<Panel &>(container);
+ panel.set_input_focus(widget);
+ if(panel.parent && panel.visible)
+ panel.set_focus();
}
void Panel::Child::grab_pointer()
Panel(const Resources &);
void raise(Widget &);
+ Widget *get_input_focus() const { return input_focus; }
+ Widget *get_final_input_focus() const;
virtual void button_press(int, int, unsigned);
virtual void button_release(int, int, unsigned);
const Style *style;
State state;
bool visible;
+ bool focusable;
Container *parent;
std::string tooltip;
void set_visible(bool);
bool is_visible() const { return visible; }
+ void set_focusable(bool);
+ bool is_focusable() const { return focusable; }
void set_focus();
void render() const;