if (show && !m_sizeSet)
{
- // this yield call is required for a configure event
- // to be sent by GTK to its windows. this will among
- // others prompt all GtkScrolledWidgets to calculate
- // if they need scrollbars which in turn is required
- // for wxWindows to calculate the client size of its
- // windows.
-
- wxYield();
-
// by calling GtkOnSize here, we don't have to call
// either after showing the frame, which would entail
// much ugly flicker nor from within the size_allocate
if ((win->m_x == alloc->x) &&
(win->m_y == alloc->y) &&
(win->m_width == alloc->width) &&
- (win->m_height == alloc->height))
+ (win->m_height == alloc->height) &&
+ (win->m_sizeSet))
{
return;
}
static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
{
- if (win->GetAutoLayout()) win->Layout();
-
if ((win->m_x == alloc->x) &&
(win->m_y == alloc->y) &&
(win->m_width == alloc->width) &&
{
return;
}
-
+
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
}
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
- m_idHandler = gtk_signal_connect
- (
+ m_idHandler = gtk_signal_connect (
GTK_OBJECT(m_widget), "switch_page",
GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback),
- (gpointer)this
- );
+ (gpointer)this );
m_parent->AddChild( this );
if (m_pages.Number() == 0) return -1;
GtkNotebookPage *g_page = GTK_NOTEBOOK(m_widget)->cur_page;
+ if (!g_page) return -1;
wxNotebookPage *page = (wxNotebookPage *) NULL;
while (node)
{
page = (wxNotebookPage*)node->Data();
- if (page->m_page == g_page)
- break;
+
+ if ((page->m_page == g_page) || (page->m_page == (GtkNotebookPage*)NULL))
+ {
+ // page->m_page is NULL directly after gtk_notebook_append. gtk emits
+ // "switch_page" then and we ask for GetSelection() in the handler for
+ // "switch_page". otherwise m_page should never be NULL. all this
+ // might also be wrong.
+ break;
+ }
node = node->Next();
}
if (m_wxwindow) gtk_widget_destroy( m_wxwindow );
if (m_widget) gtk_widget_destroy( m_widget );
-
+
if (m_cursor) delete m_cursor;
DeleteRelatedConstraints();
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" );
- // Don't do anything for children of wxNotebook
- if (m_parent->m_wxwindow == NULL) return;
-
if (m_resizing) return; // I don't like recursions
m_resizing = TRUE;
- int old_width = m_width;
- int old_height = m_height;
-
- if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
- {
- if (x != -1) m_x = x;
- if (y != -1) m_y = y;
- if (width != -1) m_width = width;
- if (height != -1) m_height = height;
- }
- else
+ if (m_parent->m_wxwindow == NULL) // i.e. wxNotebook
{
+ // don't set the size for children of wxNotebook, just take the values.
m_x = x;
m_y = y;
m_width = width;
- m_height = height;
+ m_height = height;
}
-
- if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH)
+ else
{
- if (width == -1) m_width = 80;
- }
+ int old_width = m_width;
+ int old_height = m_height;
+
+ if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
+ {
+ if (x != -1) m_x = x;
+ if (y != -1) m_y = y;
+ if (width != -1) m_width = width;
+ if (height != -1) m_height = height;
+ }
+ else
+ {
+ m_x = x;
+ m_y = y;
+ m_width = width;
+ m_height = height;
+ }
- if ((sizeFlags & wxSIZE_AUTO_HEIGHT) == wxSIZE_AUTO_HEIGHT)
- {
- if (height == -1) m_height = 26;
- }
+ if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH)
+ {
+ if (width == -1) m_width = 80;
+ }
+
+ if ((sizeFlags & wxSIZE_AUTO_HEIGHT) == wxSIZE_AUTO_HEIGHT)
+ {
+ if (height == -1) m_height = 26;
+ }
- if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
- if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
+ if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
+ if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
+ if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
+ if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
- wxPoint pt( m_parent->GetClientAreaOrigin() );
- gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x, m_y+pt.y );
+ wxPoint pt( m_parent->GetClientAreaOrigin() );
+ gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x, m_y+pt.y );
- if ((old_width != m_width) || (old_height != m_height))
- gtk_widget_set_usize( m_widget, m_width, m_height );
+ if ((old_width != m_width) || (old_height != m_height))
+ gtk_widget_set_usize( m_widget, m_width, m_height );
+ }
m_sizeSet = TRUE;
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
- ProcessEvent( event );
+ GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE;
}
if (show && !m_sizeSet)
{
- // this yield call is required for a configure event
- // to be sent by GTK to its windows. this will among
- // others prompt all GtkScrolledWidgets to calculate
- // if they need scrollbars which in turn is required
- // for wxWindows to calculate the client size of its
- // windows.
-
- wxYield();
-
// by calling GtkOnSize here, we don't have to call
// either after showing the frame, which would entail
// much ugly flicker nor from within the size_allocate
if ((win->m_x == alloc->x) &&
(win->m_y == alloc->y) &&
(win->m_width == alloc->width) &&
- (win->m_height == alloc->height))
+ (win->m_height == alloc->height) &&
+ (win->m_sizeSet))
{
return;
}
static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
{
- if (win->GetAutoLayout()) win->Layout();
-
if ((win->m_x == alloc->x) &&
(win->m_y == alloc->y) &&
(win->m_width == alloc->width) &&
{
return;
}
-
+
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
}
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
- m_idHandler = gtk_signal_connect
- (
+ m_idHandler = gtk_signal_connect (
GTK_OBJECT(m_widget), "switch_page",
GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback),
- (gpointer)this
- );
+ (gpointer)this );
m_parent->AddChild( this );
if (m_pages.Number() == 0) return -1;
GtkNotebookPage *g_page = GTK_NOTEBOOK(m_widget)->cur_page;
+ if (!g_page) return -1;
wxNotebookPage *page = (wxNotebookPage *) NULL;
while (node)
{
page = (wxNotebookPage*)node->Data();
- if (page->m_page == g_page)
- break;
+
+ if ((page->m_page == g_page) || (page->m_page == (GtkNotebookPage*)NULL))
+ {
+ // page->m_page is NULL directly after gtk_notebook_append. gtk emits
+ // "switch_page" then and we ask for GetSelection() in the handler for
+ // "switch_page". otherwise m_page should never be NULL. all this
+ // might also be wrong.
+ break;
+ }
node = node->Next();
}
if (m_wxwindow) gtk_widget_destroy( m_wxwindow );
if (m_widget) gtk_widget_destroy( m_widget );
-
+
if (m_cursor) delete m_cursor;
DeleteRelatedConstraints();
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" );
- // Don't do anything for children of wxNotebook
- if (m_parent->m_wxwindow == NULL) return;
-
if (m_resizing) return; // I don't like recursions
m_resizing = TRUE;
- int old_width = m_width;
- int old_height = m_height;
-
- if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
- {
- if (x != -1) m_x = x;
- if (y != -1) m_y = y;
- if (width != -1) m_width = width;
- if (height != -1) m_height = height;
- }
- else
+ if (m_parent->m_wxwindow == NULL) // i.e. wxNotebook
{
+ // don't set the size for children of wxNotebook, just take the values.
m_x = x;
m_y = y;
m_width = width;
- m_height = height;
+ m_height = height;
}
-
- if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH)
+ else
{
- if (width == -1) m_width = 80;
- }
+ int old_width = m_width;
+ int old_height = m_height;
+
+ if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
+ {
+ if (x != -1) m_x = x;
+ if (y != -1) m_y = y;
+ if (width != -1) m_width = width;
+ if (height != -1) m_height = height;
+ }
+ else
+ {
+ m_x = x;
+ m_y = y;
+ m_width = width;
+ m_height = height;
+ }
- if ((sizeFlags & wxSIZE_AUTO_HEIGHT) == wxSIZE_AUTO_HEIGHT)
- {
- if (height == -1) m_height = 26;
- }
+ if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH)
+ {
+ if (width == -1) m_width = 80;
+ }
+
+ if ((sizeFlags & wxSIZE_AUTO_HEIGHT) == wxSIZE_AUTO_HEIGHT)
+ {
+ if (height == -1) m_height = 26;
+ }
- if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
- if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
+ if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
+ if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
+ if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
+ if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
- wxPoint pt( m_parent->GetClientAreaOrigin() );
- gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x, m_y+pt.y );
+ wxPoint pt( m_parent->GetClientAreaOrigin() );
+ gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x, m_y+pt.y );
- if ((old_width != m_width) || (old_height != m_height))
- gtk_widget_set_usize( m_widget, m_width, m_height );
+ if ((old_width != m_width) || (old_height != m_height))
+ gtk_widget_set_usize( m_widget, m_width, m_height );
+ }
m_sizeSet = TRUE;
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
- ProcessEvent( event );
+ GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE;
}