if (notebook->m_skipNextPageChangeEvent)
{
- // this event was programatically generated by ChangeSelection() and thus must
+ // this event was programmatically generated by ChangeSelection() and thus must
// be skipped
notebook->m_skipNextPageChangeEvent = false;
// make wxNotebook::GetSelection() return the correct (i.e. consistent
// with wxBookCtrlEvent::GetSelection()) value even though the page is
// not really changed in GTK+
- notebook->m_selection = page;
+ notebook->SetSelection(page);
}
else
{
// make wxNotebook::GetSelection() return the correct (i.e. consistent
// with wxBookCtrlEvent::GetSelection()) value even though the page is
// not really changed in GTK+
- notebook->m_selection = page;
+ notebook->SetSelection(page);
notebook->SendPageChangedEvent(old);
}
if ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab))
{
int sel = notebook->GetSelection();
- if (sel == -1)
+ if (sel == wxNOT_FOUND)
return TRUE;
wxGtkNotebookPage *nb_page = notebook->GetNotebookPage(sel);
wxCHECK_MSG( nb_page, FALSE, wxT("invalid selection in wxNotebook") );
// wxNotebook
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxBookCtrlBase)
-
BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase)
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
END_EVENT_TABLE()
m_padding = 0;
m_inSwitchPage = false;
- m_imageList = NULL;
- m_selection = -1;
m_themeEnabled = true;
}
int wxNotebook::GetSelection() const
{
- wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );
+ wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid notebook") );
- if ( m_selection == -1 )
+ if ( m_selection == wxNOT_FOUND )
{
GList *nb_pages = GTK_NOTEBOOK(m_widget)->children;
gpointer cur = notebook->cur_page;
if ( cur != NULL )
{
- wxConstCast(this, wxNotebook)->m_selection =
- g_list_index( nb_pages, cur );
+ const_cast<wxNotebook *>(this)->
+ SetSelection(g_list_index( nb_pages, cur ));
}
}
}
int wxNotebook::DoSetSelection( size_t page, int flags )
{
- wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );
+ wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid notebook") );
wxCHECK_MSG( page < m_pagesData.GetCount(), -1, wxT("invalid notebook index") );
}
/* Only cases 3) and 4) left */
- wxASSERT( m_imageList != NULL ); /* Just in case */
+ wxASSERT( HasImageList() ); /* Just in case */
/* Construct the new pixmap */
- const wxBitmap *bmp = m_imageList->GetBitmapPtr(image);
+ const wxBitmap *bmp = GetImageList()->GetBitmapPtr(image);
GdkPixmap *pixmap = bmp->GetPixmap();
GdkBitmap *mask = NULL;
if ( bmp->GetMask() )
wxNotebookPage *wxNotebook::DoRemovePage( size_t page )
{
- if ( m_selection != -1 && (size_t)m_selection >= page )
+ if ( m_selection != wxNOT_FOUND && (size_t)m_selection >= page )
{
// the index will become invalid after the page is deleted
- m_selection = -1;
+ m_selection = wxNOT_FOUND;
}
wxNotebookPage *client = wxNotebookBase::DoRemovePage(page);
if (imageId != -1)
{
- wxASSERT( m_imageList != NULL );
+ wxASSERT( HasImageList() );
- const wxBitmap *bmp = m_imageList->GetBitmapPtr(imageId);
+ const wxBitmap *bmp = GetImageList()->GetBitmapPtr(imageId);
GdkPixmap *pixmap = bmp->GetPixmap();
GdkBitmap *mask = NULL;
if ( bmp->GetMask() )