// due to unsigned type nPage is always >= 0
#define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((size_t(nPage)) < GetPageCount()))
#else
-#define IS_VALID_PAGE(nPage) ((size_t(nPage)) < GetPageCount())
+#define IS_VALID_PAGE(nPage) (((size_t)nPage) < GetPageCount())
#endif
// ----------------------------------------------------------------------------
{
public:
wxNotebookSpinBtn(wxNotebook *nb)
- : wxSpinButton(nb, -1,
+ : wxSpinButton(nb, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
nb->IsVertical() ? wxSP_VERTICAL : wxSP_HORIZONTAL)
{
};
BEGIN_EVENT_TABLE(wxNotebookSpinBtn, wxSpinButton)
- EVT_SPIN(-1, wxNotebookSpinBtn::OnSpin)
+ EVT_SPIN(wxID_ANY, wxNotebookSpinBtn::OnSpin)
END_EVENT_TABLE()
// ============================================================================
{
if ( !wxControl::Create(parent, id, pos, size, style,
wxDefaultValidator, name) )
- return FALSE;
+ return false;
m_sizePad = GetRenderer()->GetTabPadding();
CreateInputHandler(wxINP_HANDLER_NOTEBOOK);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
bool wxNotebook::SetPageText(size_t nPage, const wxString& strText)
{
- wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("invalid notebook page") );
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), false, _T("invalid notebook page") );
if ( strText != m_titles[nPage] )
{
}
}
- return TRUE;
+ return true;
}
int wxNotebook::GetPageImage(size_t nPage) const
bool wxNotebook::SetPageImage(size_t nPage, int nImage)
{
- wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("invalid notebook page") );
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), false, _T("invalid notebook page") );
- wxCHECK_MSG( m_imageList && nImage < m_imageList->GetImageCount(), FALSE,
+ wxCHECK_MSG( m_imageList && nImage < m_imageList->GetImageCount(), false,
_T("invalid image index in SetPageImage()") );
if ( nImage != m_images[nPage] )
RefreshTab(nPage);
}
- return TRUE;
+ return true;
}
wxNotebook::~wxNotebook()
if ( selOld != INVALID_PAGE )
{
- RefreshTab(selOld, TRUE /* this tab was selected */);
+ RefreshTab(selOld, true /* this tab was selected */);
m_pages[selOld]->Hide();
}
int imageId)
{
size_t nPages = GetPageCount();
- wxCHECK_MSG( nPage == nPages || IS_VALID_PAGE(nPage), FALSE,
+ wxCHECK_MSG( nPage == nPages || IS_VALID_PAGE(nPage), false,
_T("invalid notebook page in InsertPage()") );
// modify the data
if ( nPages == 0 )
{
// always select the first tab to have at least some selection
- bSelect = TRUE;
+ bSelect = true;
Relayout();
Refresh();
pPage->Hide();
}
- return TRUE;
+ return true;
}
bool wxNotebook::DeleteAllPages()
{
if ( !wxNotebookBase::DeleteAllPages() )
- return FALSE;
+ return false;
// clear the other arrays as well
m_titles.Clear();
Relayout();
- return TRUE;
+ return true;
}
wxNotebookPage *wxNotebook::DoRemovePage(size_t nPage)
wxMemoryDC dc;
dc.SelectObject(bmp);
dc.SetBackground(wxBrush(GetBackgroundColour(), wxSOLID));
- m_imageList->Draw(image, dc, 0, 0, wxIMAGELIST_DRAW_NORMAL, TRUE);
+ m_imageList->Draw(image, dc, 0, 0, wxIMAGELIST_DRAW_NORMAL, true);
dc.SelectObject(wxNullBitmap);
#else
bmp = *m_imageList->GetBitmap(image);
const wxSize indent = GetRenderer()->GetTabIndent();
if ( IsVertical() )
{
- rect.x += indent.y;
rect.y += indent.x;
+ if ( dir == wxLEFT )
+ {
+ rect.x += indent.y;
+ rect.width -= indent.y;
+ }
+ else // wxRIGHT
+ {
+ rect.width -= indent.y;
+ }
}
else // horz
{
wxSize sizeTab = CalcTabSize(page);
// we only need full relayout if the page size changes
- bool needsRelayout = FALSE;
+ bool needsRelayout = false;
if ( IsVertical() )
{
if ( sizeTab.y > m_heightTab )
{
- needsRelayout = TRUE;
+ needsRelayout = true;
m_heightTab = sizeTab.y;
}
{
// this case is special, get rid of it immediately: everything is
// visible and we don't need any spin buttons
- allTabsShown = TRUE;
+ allTabsShown = true;
// have to reset them manually as we don't call CalcLastVisibleTab()
m_firstVisible =
}
else // all tabs are visible, we don't need spin button
{
- if ( m_spinbtn )
+ if ( m_spinbtn && m_spinbtn -> IsShown() )
{
m_spinbtn->Hide();
}
wxSize old_client_size = GetClientSize();
wxControl::DoSetSize(x, y, width, height, sizeFlags);
-
+
wxSize new_client_size = GetClientSize();
-
+
if (old_client_size != new_client_size)
Relayout();
}
const wxString& strArg)
{
if ( action == wxACTION_NOTEBOOK_NEXT )
- SetSelection(GetNextPage(TRUE));
+ SetSelection(GetNextPage(true));
else if ( action == wxACTION_NOTEBOOK_PREV )
- SetSelection(GetNextPage(FALSE));
+ SetSelection(GetNextPage(false));
else if ( action == wxACTION_NOTEBOOK_GOTO )
SetSelection((int)numArg);
else
return wxControl::PerformAction(action, numArg, strArg);
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
break;
}
- if ( !!action )
+ if ( !action.IsEmpty() )
{
return consumer->PerformAction(action, page);
}
{
consumer->PerformAction(wxACTION_NOTEBOOK_GOTO, page);
- return FALSE;
+ return false;
}
}
{
HandleFocusChange(consumer);
- return FALSE;
+ return false;
}
bool wxStdNotebookInputHandler::HandleActivation(wxInputConsumer *consumer,
// we react to the focus change in the same way as to the [de]activation
HandleFocusChange(consumer);
- return FALSE;
+ return false;
}
void wxStdNotebookInputHandler::HandleFocusChange(wxInputConsumer *consumer)