+ 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);