throw hierarchy_error("widget not in container");
}
-void Container::set_pointer_focus(Widget *wdg)
+void Container::set_pointer_focus(Widget *wdg, bool grab)
{
if(wdg!=pointer_focus)
{
pointer_focus->pointer_leave();
pointer_focus = wdg;
+ pointer_grabbed = grab;
if(pointer_focus)
pointer_focus->pointer_enter();
}
+ else
+ pointer_grabbed = grab;
}
void Container::set_input_focus(Widget *wdg)
{
if(!container.pointer_grabbed)
{
- container.set_pointer_focus(widget);
- container.pointer_grabbed = true;
+ container.set_pointer_focus(widget, true);
container.signal_grab_pointer.emit();
}
}
{
// XXX Should set to the widget under pointer
container.set_pointer_focus(0);
- container.pointer_grabbed = false;
container.signal_ungrab_pointer.emit();
}
}
void raise(Widget &);
protected:
- void set_pointer_focus(Widget *);
+ void set_pointer_focus(Widget *, bool = false);
void set_input_focus(Widget *);
public:
Widget *get_input_focus() const { return input_focus; }