resize fun

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1705 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-02-17 10:13:12 +00:00
parent dbdb39b2d0
commit f5eafd0e55
4 changed files with 16 additions and 22 deletions

View File

@@ -385,13 +385,13 @@ void wxDialog::SetSize( int width, int height )
void wxDialog::Centre( int direction ) void wxDialog::Centre( int direction )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid dialog" );
int x = 0; int x = 0;
int y = 0; int y = 0;
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2; if ((direction & wxHORIZONTAL) == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2; if ((direction & wxVERTICAL) == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
Move( x, y ); Move( x, y );
} }

View File

@@ -164,7 +164,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
gtk_window_set_title( GTK_WINDOW(m_widget), title ); gtk_window_set_title( GTK_WINDOW(m_widget), title );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
gtk_widget_set( m_widget, "GtkWindow::allow_shrink", TRUE, NULL ); gtk_window_set_policy( GTK_WINDOW(m_widget), 1, 1, 0 );
gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
GTK_SIGNAL_FUNC(gtk_frame_delete_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_frame_delete_callback), (gpointer)this );
@@ -313,13 +313,9 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
if ((m_width != old_width) || (m_height != old_height)) if ((m_width != old_width) || (m_height != old_height))
{ {
gtk_widget_set_usize( m_widget, m_width, m_height ); m_sizeSet = FALSE;
} }
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE; m_resizing = FALSE;
} }
@@ -335,8 +331,8 @@ void wxFrame::Centre( int direction )
int x = 0; int x = 0;
int y = 0; int y = 0;
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2; if ((direction & wxHORIZONTAL) == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2; if ((direction & wxVERTICAL) == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
Move( x, y ); Move( x, y );
} }
@@ -400,6 +396,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
gtk_widget_set_usize( m_widget, m_width, m_height ); gtk_widget_set_usize( m_widget, m_width, m_height );
gdk_window_resize( m_widget->window, m_width, m_height );
// this emulates the new wxMSW behaviour of placing all // this emulates the new wxMSW behaviour of placing all
// frame-subwindows (menu, toolbar..) on one native window // frame-subwindows (menu, toolbar..) on one native window

View File

@@ -385,13 +385,13 @@ void wxDialog::SetSize( int width, int height )
void wxDialog::Centre( int direction ) void wxDialog::Centre( int direction )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid dialog" );
int x = 0; int x = 0;
int y = 0; int y = 0;
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2; if ((direction & wxHORIZONTAL) == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2; if ((direction & wxVERTICAL) == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
Move( x, y ); Move( x, y );
} }

View File

@@ -164,7 +164,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
gtk_window_set_title( GTK_WINDOW(m_widget), title ); gtk_window_set_title( GTK_WINDOW(m_widget), title );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
gtk_widget_set( m_widget, "GtkWindow::allow_shrink", TRUE, NULL ); gtk_window_set_policy( GTK_WINDOW(m_widget), 1, 1, 0 );
gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
GTK_SIGNAL_FUNC(gtk_frame_delete_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_frame_delete_callback), (gpointer)this );
@@ -313,13 +313,9 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
if ((m_width != old_width) || (m_height != old_height)) if ((m_width != old_width) || (m_height != old_height))
{ {
gtk_widget_set_usize( m_widget, m_width, m_height ); m_sizeSet = FALSE;
} }
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE; m_resizing = FALSE;
} }
@@ -335,8 +331,8 @@ void wxFrame::Centre( int direction )
int x = 0; int x = 0;
int y = 0; int y = 0;
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2; if ((direction & wxHORIZONTAL) == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2; if ((direction & wxVERTICAL) == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
Move( x, y ); Move( x, y );
} }
@@ -400,6 +396,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
gtk_widget_set_usize( m_widget, m_width, m_height ); gtk_widget_set_usize( m_widget, m_width, m_height );
gdk_window_resize( m_widget->window, m_width, m_height );
// this emulates the new wxMSW behaviour of placing all // this emulates the new wxMSW behaviour of placing all
// frame-subwindows (menu, toolbar..) on one native window // frame-subwindows (menu, toolbar..) on one native window