+void Panel::button_press(int x, int y, unsigned btn)
+{
+ if(pointer_grab>0)
+ pointer_focus->button_press(x-geom.x, y-geom.y, btn);
+ else if(geom.is_inside(x, y))
+ {
+ for(ChildSeq::iterator i=children.begin(); i!=children.end(); ++i)
+ if((*i)->get_geometry().is_inside(x-geom.x, y-geom.y))
+ {
+ (*i)->button_press(x-geom.x, y-geom.y, btn);
+ pointer_grab=btn;
+ }
+ }
+}
+
+void Panel::button_release(int x, int y, unsigned btn)
+{
+ if(pointer_grab>0)
+ {
+ pointer_focus->button_release(x-geom.x, y-geom.y, btn);
+
+ if(btn==pointer_grab)
+ {
+ pointer_grab=0;
+
+ for(ChildSeq::iterator i=children.begin(); i!=children.end(); ++i)
+ if((*i)->get_geometry().is_inside(x-geom.x, y-geom.y))
+ {
+ set_pointer_focus(*i);
+ break;
+ }
+ }
+ }
+ else if(geom.is_inside(x, y))
+ {
+ for(ChildSeq::iterator i=children.begin(); i!=children.end(); ++i)
+ if((*i)->get_geometry().is_inside(x-geom.x, y-geom.y))
+ (*i)->button_release(x-geom.x, y-geom.y, btn);
+ }
+}
+
+void Panel::pointer_motion(int x, int y)
+{
+ if(pointer_grab>0)
+ pointer_focus->pointer_motion(x-geom.x, y-geom.y);
+ else if(geom.is_inside(x, y))
+ {
+ bool found=false;
+ for(ChildSeq::iterator i=children.begin(); i!=children.end(); ++i)
+ if((*i)->get_geometry().is_inside(x-geom.x, y-geom.y))
+ {
+ set_pointer_focus(*i);
+ (*i)->pointer_motion(x-geom.x, y-geom.y);
+ found=true;
+ }
+
+ if(!found)
+ set_pointer_focus(0);
+ }
+}
+