-void wxDialog::Centre(int direction)
-{
- int x_offset,y_offset ;
- int display_width, display_height;
- int width, height, x, y;
- wxWindow *parent = GetParent();
- if ((direction & wxCENTER_FRAME) && parent)
- {
- parent->GetPosition(&x_offset,&y_offset) ;
- parent->GetSize(&display_width,&display_height) ;
- }
- else
- {
- wxDisplaySize(&display_width, &display_height);
- x_offset = 0 ;
- y_offset = 0 ;
- }
-
- GetSize(&width, &height);
- GetPosition(&x, &y);
-
- if (direction & wxHORIZONTAL)
- x = (int)((display_width - width)/2);
- if (direction & wxVERTICAL)
- y = (int)((display_height - height)/2);
-
- SetSize(x+x_offset, y+y_offset, width, height);
-}