Fixed resizing problem with GTK 1.2.3 notebooks.
Added wxSizer test to controls sample. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4150 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -554,6 +554,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
|||||||
|
|
||||||
// --------------- TEST CODE ----------------------
|
// --------------- TEST CODE ----------------------
|
||||||
|
|
||||||
|
// layout constraints
|
||||||
|
|
||||||
panel = new wxPanel(m_notebook);
|
panel = new wxPanel(m_notebook);
|
||||||
panel->SetAutoLayout( true );
|
panel->SetAutoLayout( true );
|
||||||
|
|
||||||
@@ -576,7 +578,22 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
|||||||
wxButton *pMyButton2 = new wxButton(panel, -1, "Test Button 2" );
|
wxButton *pMyButton2 = new wxButton(panel, -1, "Test Button 2" );
|
||||||
pMyButton2->SetConstraints( c );
|
pMyButton2->SetConstraints( c );
|
||||||
|
|
||||||
m_notebook->AddPage(panel, "test layout");
|
m_notebook->AddPage(panel, "wxLayoutConstraint");
|
||||||
|
|
||||||
|
// sizer
|
||||||
|
|
||||||
|
panel = new wxPanel(m_notebook);
|
||||||
|
panel->SetAutoLayout( true );
|
||||||
|
|
||||||
|
wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
|
sizer->Add( new wxButton(panel, -1, "Test Button" ), 3, wxALL, 10 );
|
||||||
|
sizer->Add( 20,20, 1 );
|
||||||
|
sizer->Add( new wxButton(panel, -1, "Test Button 2" ), 3, wxGROW|wxALL, 10 );
|
||||||
|
|
||||||
|
panel->SetSizer( sizer );
|
||||||
|
|
||||||
|
m_notebook->AddPage(panel, "wxSizer");
|
||||||
|
|
||||||
// --------------- TEST CODE ----------------------
|
// --------------- TEST CODE ----------------------
|
||||||
|
|
||||||
|
@@ -124,21 +124,30 @@ 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 );
|
||||||
|
|
||||||
|
/* GTK 1.2 up to version 1.2.5 is broken so that we have to call allocate
|
||||||
|
here in order to make repositioning after resizing to take effect. */
|
||||||
|
if ((gtk_major_version == 1) &&
|
||||||
|
(gtk_minor_version == 2) &&
|
||||||
|
(gtk_micro_version < 6) &&
|
||||||
|
(win->m_wxwindow) &&
|
||||||
|
(GTK_WIDGET_REALIZED(win->m_wxwindow)))
|
||||||
|
{
|
||||||
|
gtk_widget_size_allocate( win->m_wxwindow, alloc );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "realize" from m_widget
|
// "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
|
static gint
|
||||||
gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
|
gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
|
||||||
{
|
{
|
||||||
if (g_isIdle)
|
if (g_isIdle)
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
|
/* GTK 1.2 up to version 1.2.5 is broken so that we have to call a queue_resize
|
||||||
|
here in order to make repositioning before showing to take effect. */
|
||||||
gtk_widget_queue_resize( win->m_widget );
|
gtk_widget_queue_resize( win->m_widget );
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@@ -124,21 +124,30 @@ 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 );
|
||||||
|
|
||||||
|
/* GTK 1.2 up to version 1.2.5 is broken so that we have to call allocate
|
||||||
|
here in order to make repositioning after resizing to take effect. */
|
||||||
|
if ((gtk_major_version == 1) &&
|
||||||
|
(gtk_minor_version == 2) &&
|
||||||
|
(gtk_micro_version < 6) &&
|
||||||
|
(win->m_wxwindow) &&
|
||||||
|
(GTK_WIDGET_REALIZED(win->m_wxwindow)))
|
||||||
|
{
|
||||||
|
gtk_widget_size_allocate( win->m_wxwindow, alloc );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "realize" from m_widget
|
// "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
|
static gint
|
||||||
gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
|
gtk_notebook_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
|
||||||
{
|
{
|
||||||
if (g_isIdle)
|
if (g_isIdle)
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
|
/* GTK 1.2 up to version 1.2.5 is broken so that we have to call a queue_resize
|
||||||
|
here in order to make repositioning before showing to take effect. */
|
||||||
gtk_widget_queue_resize( win->m_widget );
|
gtk_widget_queue_resize( win->m_widget );
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Reference in New Issue
Block a user