- while(!children.empty())
- delete children.front();
-}
-
-void Panel::add(Widget &wdg)
-{
- set_parent(wdg, this);
- children.push_back(&wdg);
-}
-
-void Panel::remove(Widget &wdg)
-{
- list<Widget *>::iterator i=find(children.begin(), children.end(), &wdg);
- if(i==children.end())
- throw InvalidState("That Widget is not in this Panel");
-
- if(&wdg==pointer_focus)
- set_pointer_focus(0, 0);
- if(&wdg==input_focus)
- set_input_focus(0);
-
- set_parent(wdg, 0);
- children.erase(i);
-}
-
-void Panel::raise(Widget &wdg)
-{
- list<Widget *>::iterator i=find(children.begin(), children.end(), &wdg);
- if(i==children.end())
- throw InvalidState("That Widget is not in this Panel");
-
- children.erase(i);
- children.push_back(&wdg);
-}
-
-void Panel::button_press(int x, int y, unsigned btn)
-{
- if(pointer_grab>0)
- {
- const Geometry &cgeom=pointer_focus->get_geometry();
- pointer_focus->button_press(x-cgeom.x, y-cgeom.y, btn);
- }
- else if(geom.is_inside_relative(x, y))
- {
- if(Widget *wdg=get_child_at(x, y))
- {
- set_pointer_focus(wdg, btn);
- set_input_focus(wdg);
-
- const Geometry &cgeom=wdg->get_geometry();
- wdg->button_press(x-cgeom.x, y-cgeom.y, btn);
- }
- }