int imageId = -1) = 0;
// set the currently selected page, return the index of the previously
- // selected one (or -1 on error)
+ // selected one (or wxNOT_FOUND on error)
//
// NB: this function will generate PAGE_CHANGING/ED events
virtual int SetSelection(size_t n) = 0;
void AdvanceSelection(bool forward = true)
{
int nPage = GetNextPage(forward);
- if ( nPage != -1 )
+ if ( nPage != wxNOT_FOUND )
{
// cast is safe because of the check above
SetSelection((size_t)nPage);
{
public:
wxBookCtrlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0,
- int nSel = -1, int nOldSel = -1)
+ int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND)
: wxNotifyEvent(commandType, winid)
{
m_nSel = nSel;
virtual wxEvent *Clone() const { return new wxBookCtrlEvent(*this); }
// accessors
- // the currently selected page (-1 if none)
+ // the currently selected page (wxNOT_FOUND if none)
int GetSelection() const { return m_nSel; }
void SetSelection(int nSel) { m_nSel = nSel; }
- // the page that was selected before the change (-1 if none)
+ // the page that was selected before the change (wxNOT_FOUND if none)
int GetOldSelection() const { return m_nOldSel; }
void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; }
// ------------------------------------------------------------------------
public:
// set the currently selected page, return the index of the previously
- // selected one (or -1 on error)
+ // selected one (or wxNOT_FOUND on error)
int SetSelection(size_t nPage);
// get the currently selected page
int GetSelection() const;
// accessors
// ---------
- // Find the position of the wxNotebookPage, -1 if not found.
+ // Find the position of the wxNotebookPage, wxNOT_FOUND if not found.
int FindPagePosition(wxNotebookPage* page) const;
// set the currently selected page, return the index of the previously
- // selected one (or -1 on error)
+ // selected one (or wxNOT_FOUND on error)
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
int SetSelection(size_t nPage);
// cycle thru the tabs
// ---------
// set the currently selected page, return the index of the previously
- // selected one (or -1 on error)
+ // selected one (or wxNOT_FOUND on error)
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); }
// get the currently selected page
// ---------
// set the currently selected page, return the index of the previously
- // selected one (or -1 on error)
+ // selected one (or wxNOT_FOUND on error)
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); }
// get the currently selected page
virtual size_t GetPageCount() const;
// set the currently selected page, return the index of the previously
- // selected one (or -1 on error)
+ // selected one (or wxNOT_FOUND on error)
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
int SetSelection(size_t nPage);
// get the currently selected page
bool SendPageChangingEvent(int nPage);
// sends the event about page change from old to new (or GetSelection() if
- // new is -1)
- void SendPageChangedEvent(int nPageOld, int nPageNew = -1);
+ // new is wxNOT_FOUND)
+ void SendPageChangedEvent(int nPageOld, int nPageNew = wxNOT_FOUND);
// wxBookCtrlBase overrides this method to return false but we do need
// focus because we have tabs
//
// Set the currently selected page, return the index of the previously
- // selected one (or -1 on error)
+ // selected one (or wxNOT_FOUND on error)
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
//
int SetSelection(size_t nPage);
// accessors
// ---------
// set the currently selected page, return the index of the previously
- // selected one (or -1 on error)
+ // selected one (or wxNOT_FOUND on error)
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); }
// get the currently selected page
{
NSTabViewItem *selectedItem = [GetNSTabView() selectedTabViewItem];
if(!selectedItem)
- return -1;
+ return wxNOT_FOUND;
return [GetNSTabView() indexOfTabViewItem:selectedItem];
}
// some page should be selected: either this one or the first one if there
// is still no selection
- int selNew = -1;
+ int selNew = wxNOT_FOUND;
if ( bSelect )
selNew = n;
- else if ( m_selection == -1 )
+ else if ( m_selection == wxNOT_FOUND )
selNew = 0;
if ( selNew != m_selection )
page->Hide();
- if ( selNew != -1 )
+ if ( selNew != wxNOT_FOUND )
SetSelection(selNew);
UpdateSize();
int sel = m_selection - 1;
if (page_count == 1)
sel = wxNOT_FOUND;
- else if ((page_count == 2) || (sel == -1))
+ else if ((page_count == 2) || (sel == wxNOT_FOUND))
sel = 0;
// force sel invalid if deleting current page - don't try to hide it
GetToolBar()->Realize();
}
- if (m_selection == -1)
+ if (m_selection == wxNOT_FOUND)
m_selection = 0;
if (GetPageCount() > 0)
{
int sel = m_selection;
- m_selection = -1;
+ m_selection = wxNOT_FOUND;
SetSelection(sel);
}
int sel = m_selection - 1;
if (page_count == 1)
sel = wxNOT_FOUND;
- else if ((page_count == 2) || (sel == -1))
+ else if ((page_count == 2) || (sel == wxNOT_FOUND))
sel = 0;
// force sel invalid if deleting current page - don't try to hide it
int wxNotebook::GetSelection() const
{
- wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") );
+ wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid notebook") );
return gtk_notebook_get_current_page( GTK_NOTEBOOK(m_widget) );
}
int wxNotebook::GetPageImage( size_t page ) const
{
- wxCHECK_MSG(page < GetPageCount(), -1, "invalid notebook index");
+ wxCHECK_MSG(page < GetPageCount(), wxNOT_FOUND, "invalid notebook index");
return GetNotebookPage(page)->m_imageIndex;
}
int wxNotebook::DoSetSelection( size_t page, int flags )
{
- wxCHECK_MSG(page < GetPageCount(), -1, "invalid notebook index");
+ wxCHECK_MSG(page < GetPageCount(), wxNOT_FOUND, "invalid notebook index");
int selOld = GetSelection();
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") );
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;
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") );
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);
}
else // nothing changes for the currently selected page
{
- nSelNew = -1;
+ nSelNew = wxNOT_FOUND;
//
// We still must refresh the current page: this needs to be done
m_pages[m_nSelection]->Refresh();
}
- if (nSelNew != -1)
+ if (nSelNew != wxNOT_FOUND)
{
//
// m_nSelection must be always valid so reset it before calling
// Some page should be selected: either this one or the first one if there is
// still no selection
//
- int nSelNew = -1;
+ int nSelNew = wxNOT_FOUND;
if (bSelect)
nSelNew = nPage;
else if ( m_nSelection == -1 )
nSelNew = 0;
- if (nSelNew != -1)
+ if (nSelNew != wxNOT_FOUND)
SetSelection(nSelNew);
InvalidateBestSize();
// some page should be selected: either this one or the first one if there
// is still no selection
- int selNew = -1;
+ int selNew = wxNOT_FOUND;
if ( bSelect )
selNew = nPage;
else if ( m_nSelection == -1 )
selNew = 0;
- if ( selNew != -1 )
+ if ( selNew != wxNOT_FOUND )
SetSelection( selNew );
InvalidateBestSize();
if (nOldSel == nSel)
return;
- if ( nOldSel != -1 )
+ if ( nOldSel != wxNOT_FOUND )
m_pages[nOldSel]->Show( false );
- if ( nSel != -1 )
+ if ( nSel != wxNOT_FOUND )
{
wxNotebookPage *pPage = m_pages[nSel];
if ( IsShownOnScreen() )