- else if(geom.is_inside_relative(x, y))
- {
- Widget *wdg=get_child_at(x, y);
- set_pointer_focus(wdg, 0);
- if(wdg)
- {
- const Geometry &cgeom=wdg->get_geometry();
- wdg->pointer_motion(x-cgeom.x, y-cgeom.y);
- }
- }
-}
-
-void Panel::pointer_leave()
-{
- set_pointer_focus(0, 0);
-}
-
-void Panel::key_press(unsigned key, unsigned mod, wchar_t ch)
-{
- if(input_focus)
- input_focus->key_press(key, mod, ch);
-}
-
-void Panel::key_release(unsigned key, unsigned mod)
-{
- if(input_focus)
- input_focus->key_release(key, mod);
-}
-
-void Panel::focus_out()
-{
- set_input_focus(0);
-}
-
-void Panel::child_hidden(Widget &wdg)
-{
- if(&wdg==pointer_focus)
- set_pointer_focus(0, 0);
-}
-
-void Panel::grab_pointer(Widget &wdg)
-{
- if(pointer_grab==0 || pointer_focus==&wdg)
- set_pointer_focus(&wdg, 255);
- else
- throw InvalidState("Pointer is already grabbed");
-}
-
-void Panel::ungrab_pointer(Widget &wdg)
-{
- if(pointer_focus==&wdg)
- set_pointer_focus(0, 0);
- else if(pointer_grab>0)
- throw Exception("Someone is trying to steal the pointer!");
-}
-
-void Panel::render_special(const Part &part) const
-{
- if(part.get_name()=="children")
- {
- for(ChildSeq::const_iterator i=children.begin(); i!=children.end(); ++i)
- if((*i)->is_visible())
- (*i)->render();
- }
-}
-
-void Panel::set_pointer_focus(Widget *wdg, int grab)
-{
- if(grab>0 && !wdg)
- throw InvalidParameterValue("Can't grab on null widget");
-
- if(wdg!=pointer_focus)
- {
- if(pointer_focus)
- pointer_focus->pointer_leave();
-
- pointer_focus=wdg;
-
- if(pointer_focus)
- pointer_focus->pointer_enter();
- }
-
- pointer_grab=grab;
-}
-
-void Panel::set_input_focus(Widget *wdg)
-{
- if(wdg!=input_focus)
- {
- if(input_focus)
- input_focus->focus_out();
-
- input_focus=wdg;
-
- if(input_focus)
- input_focus->focus_in();
- }
-}
-
-Widget *Panel::get_child_at(int x, int y)
-{
- for(ChildSeq::reverse_iterator i=children.rbegin(); i!=children.rend(); ++i)
- if((*i)->is_visible() && (*i)->get_geometry().is_inside(x, y))
- return *i;
-
- return 0;