git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5833
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
here in order to make repositioning after resizing to take effect. */
if ((gtk_major_version == 1) &&
(gtk_minor_version == 2) &&
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_micro_version < 6) &&
+ (win->m_wxwindow) &&
+ (GTK_WIDGET_REALIZED(win->m_wxwindow)))
{
gtk_widget_size_allocate( win->m_wxwindow, alloc );
}
{
gtk_widget_size_allocate( win->m_wxwindow, alloc );
}
}
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxNotebook *win )
//-----------------------------------------------------------------------------
static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxNotebook *win )
{
page->m_client->SetFocus();
}
{
page->m_client->SetFocus();
}
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
return TRUE;
}
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
return TRUE;
}
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxNoteBook creation failed") );
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxNoteBook creation failed") );
m_parent->DoAddChild( this );
m_parent->DoAddChild( this );
- if (m_windowStyle & wxNB_RIGHT)
- gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_RIGHT );
- if (m_windowStyle & wxNB_LEFT)
- gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_LEFT );
- if (m_windowStyle & wxNB_BOTTOM)
- gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM );
+ if (m_windowStyle & wxNB_RIGHT)
+ gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_RIGHT );
+ if (m_windowStyle & wxNB_LEFT)
+ gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_LEFT );
+ if (m_windowStyle & wxNB_BOTTOM)
+ gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM );
gtk_signal_connect( GTK_OBJECT(m_widget), "key_press_event",
GTK_SIGNAL_FUNC(gtk_notebook_key_press_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(m_widget), "key_press_event",
GTK_SIGNAL_FUNC(gtk_notebook_key_press_callback), (gpointer)this );
{
wxCHECK_RET( m_widget != NULL, wxT("invalid notebook") );
{
wxCHECK_RET( m_widget != NULL, wxT("invalid notebook") );
- int sel = GetSelection();
int max = GetPageCount();
int max = GetPageCount();
+ if ( !max )
+ {
+ // nothing to do with empty notebook
+ return;
+ }
+
+ int sel = GetSelection();
- SetSelection( sel == max ? 0 : sel + 1 );
+ SetSelection( sel == max - 1 ? 0 : sel + 1 );
- SetSelection( sel == 0 ? max-1 : sel - 1 );
+ SetSelection( sel == 0 ? max - 1 : sel - 1 );
}
void wxNotebook::SetImageList( wxImageList* imageList )
}
void wxNotebook::SetImageList( wxImageList* imageList )
GList *child = gtk_container_children(GTK_CONTAINER(nb_page->m_box));
while (child)
GList *child = gtk_container_children(GTK_CONTAINER(nb_page->m_box));
while (child)
if (GTK_IS_PIXMAP(child->data))
if (GTK_IS_PIXMAP(child->data))
- {
- pixmapwid = GTK_WIDGET(child->data);
- break;
+ {
+ pixmapwid = GTK_WIDGET(child->data);
+ break;
- child = child->next;
- }
+ child = child->next;
+ }
/* We should have the pixmap widget now */
wxASSERT(pixmapwid != NULL);
if (image == -1)
/* We should have the pixmap widget now */
wxASSERT(pixmapwid != NULL);
if (image == -1)
/* If there's no new widget, just remove the old from the box */
gtk_container_remove(GTK_CONTAINER(nb_page->m_box), pixmapwid);
nb_page->m_image = -1;
/* If there's no new widget, just remove the old from the box */
gtk_container_remove(GTK_CONTAINER(nb_page->m_box), pixmapwid);
nb_page->m_image = -1;
{
if (position < 0)
SetSelection( GetPageCount()-1 );
{
if (position < 0)
SetSelection( GetPageCount()-1 );
SetSelection( position );
}
SetSelection( position );
}
void wxNotebook::ApplyWidgetStyle()
{
// TODO, font for labels etc
void wxNotebook::ApplyWidgetStyle()
{
// TODO, font for labels etc
SetWidgetStyle();
gtk_widget_set_style( m_widget, m_widgetStyle );
}
SetWidgetStyle();
gtk_widget_set_style( m_widget, m_widgetStyle );
}
here in order to make repositioning after resizing to take effect. */
if ((gtk_major_version == 1) &&
(gtk_minor_version == 2) &&
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_micro_version < 6) &&
+ (win->m_wxwindow) &&
+ (GTK_WIDGET_REALIZED(win->m_wxwindow)))
{
gtk_widget_size_allocate( win->m_wxwindow, alloc );
}
{
gtk_widget_size_allocate( win->m_wxwindow, alloc );
}
}
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxNotebook *win )
//-----------------------------------------------------------------------------
static gint gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxNotebook *win )
{
page->m_client->SetFocus();
}
{
page->m_client->SetFocus();
}
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
return TRUE;
}
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
return TRUE;
}
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxNoteBook creation failed") );
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxNoteBook creation failed") );
m_parent->DoAddChild( this );
m_parent->DoAddChild( this );
- if (m_windowStyle & wxNB_RIGHT)
- gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_RIGHT );
- if (m_windowStyle & wxNB_LEFT)
- gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_LEFT );
- if (m_windowStyle & wxNB_BOTTOM)
- gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM );
+ if (m_windowStyle & wxNB_RIGHT)
+ gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_RIGHT );
+ if (m_windowStyle & wxNB_LEFT)
+ gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_LEFT );
+ if (m_windowStyle & wxNB_BOTTOM)
+ gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM );
gtk_signal_connect( GTK_OBJECT(m_widget), "key_press_event",
GTK_SIGNAL_FUNC(gtk_notebook_key_press_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(m_widget), "key_press_event",
GTK_SIGNAL_FUNC(gtk_notebook_key_press_callback), (gpointer)this );
{
wxCHECK_RET( m_widget != NULL, wxT("invalid notebook") );
{
wxCHECK_RET( m_widget != NULL, wxT("invalid notebook") );
- int sel = GetSelection();
int max = GetPageCount();
int max = GetPageCount();
+ if ( !max )
+ {
+ // nothing to do with empty notebook
+ return;
+ }
+
+ int sel = GetSelection();
- SetSelection( sel == max ? 0 : sel + 1 );
+ SetSelection( sel == max - 1 ? 0 : sel + 1 );
- SetSelection( sel == 0 ? max-1 : sel - 1 );
+ SetSelection( sel == 0 ? max - 1 : sel - 1 );
}
void wxNotebook::SetImageList( wxImageList* imageList )
}
void wxNotebook::SetImageList( wxImageList* imageList )
GList *child = gtk_container_children(GTK_CONTAINER(nb_page->m_box));
while (child)
GList *child = gtk_container_children(GTK_CONTAINER(nb_page->m_box));
while (child)
if (GTK_IS_PIXMAP(child->data))
if (GTK_IS_PIXMAP(child->data))
- {
- pixmapwid = GTK_WIDGET(child->data);
- break;
+ {
+ pixmapwid = GTK_WIDGET(child->data);
+ break;
- child = child->next;
- }
+ child = child->next;
+ }
/* We should have the pixmap widget now */
wxASSERT(pixmapwid != NULL);
if (image == -1)
/* We should have the pixmap widget now */
wxASSERT(pixmapwid != NULL);
if (image == -1)
/* If there's no new widget, just remove the old from the box */
gtk_container_remove(GTK_CONTAINER(nb_page->m_box), pixmapwid);
nb_page->m_image = -1;
/* If there's no new widget, just remove the old from the box */
gtk_container_remove(GTK_CONTAINER(nb_page->m_box), pixmapwid);
nb_page->m_image = -1;
{
if (position < 0)
SetSelection( GetPageCount()-1 );
{
if (position < 0)
SetSelection( GetPageCount()-1 );
SetSelection( position );
}
SetSelection( position );
}
void wxNotebook::ApplyWidgetStyle()
{
// TODO, font for labels etc
void wxNotebook::ApplyWidgetStyle()
{
// TODO, font for labels etc
SetWidgetStyle();
gtk_widget_set_style( m_widget, m_widgetStyle );
}
SetWidgetStyle();
gtk_widget_set_style( m_widget, m_widgetStyle );
}