- int x, y, width, height, panel_width, panel_height, new_x, new_y;
-
- wxWindow *parent = (wxWindow *) GetParent ();
- if (!parent)
- return;
-
- parent->GetClientSize (&panel_width, &panel_height);
- GetSize (&width, &height);
- GetPosition (&x, &y);
-
- new_x = x;
- new_y = y;
-
- if (direction & wxHORIZONTAL)
- new_x = (int) ((panel_width - width) / 2);
-
- if (direction & wxVERTICAL)
- new_y = (int) ((panel_height - height) / 2);
-
- SetSize (new_x, new_y, width, height);
-}