Restored wxSizeEvent code form last week -> wxGLCanvas

probably broken again.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4027 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-10-16 20:07:16 +00:00
parent c4d83d0a59
commit 6d693bb4fc
11 changed files with 189 additions and 332 deletions

View File

@@ -60,7 +60,7 @@ public:
bool Destroy(); bool Destroy();
virtual bool Show( bool show ); virtual bool Show( bool show );
virtual void Centre( int direction = wxHORIZONTAL ); virtual void Centre( int direction = wxBOTH );
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0, virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,

View File

@@ -60,7 +60,7 @@ public:
bool Destroy(); bool Destroy();
virtual bool Show( bool show ); virtual bool Show( bool show );
virtual void Centre( int direction = wxHORIZONTAL ); virtual void Centre( int direction = wxBOTH );
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0, virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,

View File

@@ -112,6 +112,7 @@ void MyApp::InitTabView(wxNotebook* notebook, wxPanel* window)
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
5, animals, 5, animals,
2, wxRA_SPECIFY_ROWS); 2, wxRA_SPECIFY_ROWS);
c = new wxLayoutConstraints; c = new wxLayoutConstraints;
c->left.SameAs(radiobox, wxLeft); c->left.SameAs(radiobox, wxLeft);
c->height.AsIs(); c->height.AsIs();

View File

@@ -795,7 +795,6 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
event.SetEventObject( this ); event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
/*
// send size event to status bar // send size event to status bar
if (m_frameStatusBar) if (m_frameStatusBar)
{ {
@@ -803,7 +802,6 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
event2.SetEventObject( m_frameStatusBar ); event2.SetEventObject( m_frameStatusBar );
m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 ); m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
} }
*/
m_resizing = FALSE; m_resizing = FALSE;
} }

View File

@@ -124,7 +124,28 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height ); win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
if (win->GetAutoLayout()) win->Layout(); if (win->GetAutoLayout())
{
win->Layout();
}
}
//-----------------------------------------------------------------------------
// "realize" from m_widget
//-----------------------------------------------------------------------------
/* GTK 1.2 up to version 1.2.5 is broken so that we have to call a queue_resize
here in order to take repositioning before showing to take effect. */
static gint
gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
gtk_widget_queue_resize( win->m_widget );
return FALSE;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -213,6 +234,9 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
PostCreation(); PostCreation();
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
GTK_SIGNAL_FUNC(gtk_notebook_realized_callback), (gpointer) this );
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;

View File

@@ -393,7 +393,7 @@ gtk_myfixed_set_size (GtkMyFixed *myfixed,
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (myfixed)) if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (myfixed))
gtk_widget_queue_resize (widget); gtk_widget_queue_resize (widget);
break; return;
} }
} }
} }
@@ -602,16 +602,6 @@ gtk_myfixed_size_allocate (GtkWidget *widget,
myfixed = GTK_MYFIXED (widget); myfixed = GTK_MYFIXED (widget);
children = myfixed->children;
while (children)
{
child = children->data;
children = children->next;
gtk_myfixed_position_child (myfixed, child);
gtk_myfixed_allocate_child (myfixed, child);
}
widget->allocation = *allocation; widget->allocation = *allocation;
if (myfixed->shadow_type == GTK_MYSHADOW_NONE) if (myfixed->shadow_type == GTK_MYSHADOW_NONE)
@@ -632,6 +622,16 @@ gtk_myfixed_size_allocate (GtkWidget *widget,
gdk_window_move_resize( widget->window, x, y, w, h ); gdk_window_move_resize( widget->window, x, y, w, h );
gdk_window_move_resize( myfixed->bin_window, 0, 0, w, h ); gdk_window_move_resize( myfixed->bin_window, 0, 0, w, h );
} }
children = myfixed->children;
while (children)
{
child = children->data;
children = children->next;
gtk_myfixed_position_child (myfixed, child);
gtk_myfixed_allocate_child (myfixed, child);
}
} }
static void static void
@@ -666,56 +666,6 @@ gtk_myfixed_draw (GtkWidget *widget,
} }
} }
/*
static void
gtk_myfixed_draw_border (GtkMyFixed *myfixed)
{
GtkWidget *widget;
widget = GTK_WIDGET(myfixed);
if (myfixed->shadow_type == GTK_MYSHADOW_NONE)
return;
if (myfixed->shadow_type == GTK_MYSHADOW_OUT)
{
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
0, 0,
widget->allocation.width,
widget->allocation.height );
return;
}
if (myfixed->shadow_type == GTK_MYSHADOW_IN)
{
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_IN,
0, 0,
widget->allocation.width,
widget->allocation.height );
return;
}
if (myfixed->shadow_type == GTK_MYSHADOW_THIN)
{
GdkGC *gc;
gc = gdk_gc_new( widget->window );
gdk_gc_set_foreground( gc, &widget->style->black );
gdk_draw_rectangle( widget->window, gc, FALSE,
0, 0,
widget->allocation.width-1,
widget->allocation.height-1 );
gdk_gc_unref( gc );
return;
}
}
*/
static gint static gint
gtk_myfixed_expose (GtkWidget *widget, gtk_myfixed_expose (GtkWidget *widget,
GdkEventExpose *event) GdkEventExpose *event)
@@ -916,11 +866,12 @@ gtk_myfixed_adjust_allocations_recurse (GtkWidget *widget,
widget->allocation.x += data->dx; widget->allocation.x += data->dx;
widget->allocation.y += data->dy; widget->allocation.y += data->dy;
if (GTK_WIDGET_NO_WINDOW (widget) && if (GTK_WIDGET_NO_WINDOW (widget) && GTK_IS_CONTAINER (widget))
GTK_IS_CONTAINER (widget)) {
gtk_container_forall (GTK_CONTAINER (widget), gtk_container_forall (GTK_CONTAINER (widget),
gtk_myfixed_adjust_allocations_recurse, gtk_myfixed_adjust_allocations_recurse,
cb_data); cb_data);
}
} }
static void static void

View File

@@ -313,39 +313,6 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
#endif // GTK_MINOR_VERSION > 0 #endif // GTK_MINOR_VERSION > 0
//-----------------------------------------------------------------------------
// "size_allocate"
//-----------------------------------------------------------------------------
static void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT)
return;
if (win->m_sizeSet)
return;
win->m_sizeSet = TRUE;
/*
wxPrintf( "OnSize from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
wxPrintf( win->GetClassInfo()->GetClassName() );
wxPrintf( " %d %d %d %d\n", (int)alloc->x,
(int)alloc->y,
(int)alloc->width,
(int)alloc->height );
*/
wxSizeEvent event( win->GetSize(), win->GetId() );
event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event );
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// key event conversion routines // key event conversion routines
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -2069,13 +2036,6 @@ void wxWindow::PostCreation()
{ {
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
if (!m_isFrame)
{
/* frames have their own callback */
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_window_size_callback), (gpointer)this );
}
if (m_wxwindow) if (m_wxwindow)
{ {
if (!m_noExpose) if (!m_noExpose)
@@ -2164,14 +2124,9 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
m_y = y; m_y = y;
m_width = width; m_width = width;
m_height = height; m_height = height;
m_sizeSet = FALSE;
} }
else else
{ {
int old_width = m_width;
int old_height = m_height;
GtkMyFixed *myfixed = GTK_MYFIXED(m_parent->m_wxwindow); GtkMyFixed *myfixed = GTK_MYFIXED(m_parent->m_wxwindow);
if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0) if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0)
@@ -2220,19 +2175,19 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
m_y-border, m_y-border,
m_width+2*border, m_width+2*border,
m_height+border+bottom_border ); m_height+border+bottom_border );
if ((old_width != m_width) ||
(old_height != m_height))
{
m_sizeSet = FALSE;
}
} }
/* /*
wxPrintf( "OnSize sent from " );
if (GetClassInfo() && GetClassInfo()->GetClassName())
wxPrintf( GetClassInfo()->GetClassName() );
wxPrintf( " %d %d %d %d\n", (int)m_x, (int)m_y, (int)m_width, (int)m_height );
*/
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
*/
m_resizing = FALSE; m_resizing = FALSE;
} }

View File

@@ -795,7 +795,6 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
event.SetEventObject( this ); event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
/*
// send size event to status bar // send size event to status bar
if (m_frameStatusBar) if (m_frameStatusBar)
{ {
@@ -803,7 +802,6 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
event2.SetEventObject( m_frameStatusBar ); event2.SetEventObject( m_frameStatusBar );
m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 ); m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
} }
*/
m_resizing = FALSE; m_resizing = FALSE;
} }

View File

@@ -124,7 +124,28 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height ); win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
if (win->GetAutoLayout()) win->Layout(); if (win->GetAutoLayout())
{
win->Layout();
}
}
//-----------------------------------------------------------------------------
// "realize" from m_widget
//-----------------------------------------------------------------------------
/* GTK 1.2 up to version 1.2.5 is broken so that we have to call a queue_resize
here in order to take repositioning before showing to take effect. */
static gint
gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
gtk_widget_queue_resize( win->m_widget );
return FALSE;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -213,6 +234,9 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
PostCreation(); PostCreation();
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
GTK_SIGNAL_FUNC(gtk_notebook_realized_callback), (gpointer) this );
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;

View File

@@ -393,7 +393,7 @@ gtk_myfixed_set_size (GtkMyFixed *myfixed,
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (myfixed)) if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (myfixed))
gtk_widget_queue_resize (widget); gtk_widget_queue_resize (widget);
break; return;
} }
} }
} }
@@ -602,16 +602,6 @@ gtk_myfixed_size_allocate (GtkWidget *widget,
myfixed = GTK_MYFIXED (widget); myfixed = GTK_MYFIXED (widget);
children = myfixed->children;
while (children)
{
child = children->data;
children = children->next;
gtk_myfixed_position_child (myfixed, child);
gtk_myfixed_allocate_child (myfixed, child);
}
widget->allocation = *allocation; widget->allocation = *allocation;
if (myfixed->shadow_type == GTK_MYSHADOW_NONE) if (myfixed->shadow_type == GTK_MYSHADOW_NONE)
@@ -632,6 +622,16 @@ gtk_myfixed_size_allocate (GtkWidget *widget,
gdk_window_move_resize( widget->window, x, y, w, h ); gdk_window_move_resize( widget->window, x, y, w, h );
gdk_window_move_resize( myfixed->bin_window, 0, 0, w, h ); gdk_window_move_resize( myfixed->bin_window, 0, 0, w, h );
} }
children = myfixed->children;
while (children)
{
child = children->data;
children = children->next;
gtk_myfixed_position_child (myfixed, child);
gtk_myfixed_allocate_child (myfixed, child);
}
} }
static void static void
@@ -666,56 +666,6 @@ gtk_myfixed_draw (GtkWidget *widget,
} }
} }
/*
static void
gtk_myfixed_draw_border (GtkMyFixed *myfixed)
{
GtkWidget *widget;
widget = GTK_WIDGET(myfixed);
if (myfixed->shadow_type == GTK_MYSHADOW_NONE)
return;
if (myfixed->shadow_type == GTK_MYSHADOW_OUT)
{
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
0, 0,
widget->allocation.width,
widget->allocation.height );
return;
}
if (myfixed->shadow_type == GTK_MYSHADOW_IN)
{
gtk_draw_shadow( widget->style,
widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_IN,
0, 0,
widget->allocation.width,
widget->allocation.height );
return;
}
if (myfixed->shadow_type == GTK_MYSHADOW_THIN)
{
GdkGC *gc;
gc = gdk_gc_new( widget->window );
gdk_gc_set_foreground( gc, &widget->style->black );
gdk_draw_rectangle( widget->window, gc, FALSE,
0, 0,
widget->allocation.width-1,
widget->allocation.height-1 );
gdk_gc_unref( gc );
return;
}
}
*/
static gint static gint
gtk_myfixed_expose (GtkWidget *widget, gtk_myfixed_expose (GtkWidget *widget,
GdkEventExpose *event) GdkEventExpose *event)
@@ -916,11 +866,12 @@ gtk_myfixed_adjust_allocations_recurse (GtkWidget *widget,
widget->allocation.x += data->dx; widget->allocation.x += data->dx;
widget->allocation.y += data->dy; widget->allocation.y += data->dy;
if (GTK_WIDGET_NO_WINDOW (widget) && if (GTK_WIDGET_NO_WINDOW (widget) && GTK_IS_CONTAINER (widget))
GTK_IS_CONTAINER (widget)) {
gtk_container_forall (GTK_CONTAINER (widget), gtk_container_forall (GTK_CONTAINER (widget),
gtk_myfixed_adjust_allocations_recurse, gtk_myfixed_adjust_allocations_recurse,
cb_data); cb_data);
}
} }
static void static void

View File

@@ -313,39 +313,6 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
#endif // GTK_MINOR_VERSION > 0 #endif // GTK_MINOR_VERSION > 0
//-----------------------------------------------------------------------------
// "size_allocate"
//-----------------------------------------------------------------------------
static void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT)
return;
if (win->m_sizeSet)
return;
win->m_sizeSet = TRUE;
/*
wxPrintf( "OnSize from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
wxPrintf( win->GetClassInfo()->GetClassName() );
wxPrintf( " %d %d %d %d\n", (int)alloc->x,
(int)alloc->y,
(int)alloc->width,
(int)alloc->height );
*/
wxSizeEvent event( win->GetSize(), win->GetId() );
event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event );
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// key event conversion routines // key event conversion routines
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -2069,13 +2036,6 @@ void wxWindow::PostCreation()
{ {
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
if (!m_isFrame)
{
/* frames have their own callback */
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_window_size_callback), (gpointer)this );
}
if (m_wxwindow) if (m_wxwindow)
{ {
if (!m_noExpose) if (!m_noExpose)
@@ -2164,14 +2124,9 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
m_y = y; m_y = y;
m_width = width; m_width = width;
m_height = height; m_height = height;
m_sizeSet = FALSE;
} }
else else
{ {
int old_width = m_width;
int old_height = m_height;
GtkMyFixed *myfixed = GTK_MYFIXED(m_parent->m_wxwindow); GtkMyFixed *myfixed = GTK_MYFIXED(m_parent->m_wxwindow);
if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0) if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0)
@@ -2220,19 +2175,19 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
m_y-border, m_y-border,
m_width+2*border, m_width+2*border,
m_height+border+bottom_border ); m_height+border+bottom_border );
if ((old_width != m_width) ||
(old_height != m_height))
{
m_sizeSet = FALSE;
}
} }
/* /*
wxPrintf( "OnSize sent from " );
if (GetClassInfo() && GetClassInfo()->GetClassName())
wxPrintf( GetClassInfo()->GetClassName() );
wxPrintf( " %d %d %d %d\n", (int)m_x, (int)m_y, (int)m_width, (int)m_height );
*/
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
*/
m_resizing = FALSE; m_resizing = FALSE;
} }