X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a290fa5a7deebe9d96c0c0089d18e27d4bd9b624..daebb84bff054d3833baca58a5dc506de56c64a1:/src/univ/notebook.cpp diff --git a/src/univ/notebook.cpp b/src/univ/notebook.cpp index c515179ccd..1d8c16355c 100644 --- a/src/univ/notebook.cpp +++ b/src/univ/notebook.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: univ/notebook.cpp +// Name: src/univ/notebook.cpp // Purpose: wxNotebook implementation // Author: Vadim Zeitlin // Modified by: @@ -17,14 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "univnotebook.h" -#endif - -#ifdef __VMS -#pragma message disable unscomzer -#endif - #include "wx/wxprec.h" #ifdef __BORLANDC__ @@ -48,7 +40,7 @@ // 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 // ---------------------------------------------------------------------------- @@ -144,7 +136,7 @@ bool wxNotebook::Create(wxWindow *parent, wxString wxNotebook::GetPageText(size_t nPage) const { - wxCHECK_MSG( IS_VALID_PAGE(nPage), _T(""), _T("invalid notebook page") ); + wxCHECK_MSG( IS_VALID_PAGE(nPage), wxEmptyString, _T("invalid notebook page") ); return m_titles[nPage]; } @@ -174,7 +166,7 @@ bool wxNotebook::SetPageText(size_t nPage, const wxString& strText) int wxNotebook::GetPageImage(size_t nPage) const { - wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, _T("invalid notebook page") ); + wxCHECK_MSG( IS_VALID_PAGE(nPage), wxNOT_FOUND, _T("invalid notebook page") ); return m_images[nPage]; } @@ -213,7 +205,7 @@ wxNotebook::~wxNotebook() int wxNotebook::SetSelection(size_t nPage) { - wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, _T("invalid notebook page") ); + wxCHECK_MSG( IS_VALID_PAGE(nPage), wxNOT_FOUND, _T("invalid notebook page") ); if ( (size_t)nPage == m_sel ) { @@ -473,7 +465,7 @@ void wxNotebook::DoDrawTab(wxDC& dc, const wxRect& rect, size_t n) m_imageList->Draw(image, dc, 0, 0, wxIMAGELIST_DRAW_NORMAL, true); dc.SelectObject(wxNullBitmap); #else - bmp = *m_imageList->GetBitmap(image); + bmp = m_imageList->GetBitmap(image); #endif } @@ -658,14 +650,14 @@ bool wxNotebook::IsVertical() const wxDirection wxNotebook::GetTabOrientation() const { long style = GetWindowStyle(); - if ( style & wxNB_BOTTOM ) + if ( style & wxBK_BOTTOM ) return wxBOTTOM; - else if ( style & wxNB_RIGHT ) + else if ( style & wxBK_RIGHT ) return wxRIGHT; - else if ( style & wxNB_LEFT ) + else if ( style & wxBK_LEFT ) return wxLEFT; - // wxNB_TOP == 0 so we don't have to test for it + // wxBK_TOP == 0 so we don't have to test for it return wxTOP; } @@ -745,8 +737,16 @@ wxRect wxNotebook::GetTabsPart() const 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 { @@ -1127,7 +1127,7 @@ void wxNotebook::UpdateSpinBtn() } else // all tabs are visible, we don't need spin button { - if ( m_spinbtn ) + if ( m_spinbtn && m_spinbtn -> IsShown() ) { m_spinbtn->Hide(); } @@ -1245,7 +1245,7 @@ void wxNotebook::ScrollLastTo(int page) wxSize wxNotebook::DoGetBestClientSize() const { // calculate the max page size - wxSize size(0, 0); + wxSize size; size_t count = GetPageCount(); if ( count ) @@ -1285,9 +1285,9 @@ void wxNotebook::DoSetSize(int x, int y, 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(); } @@ -1423,4 +1423,3 @@ void wxStdNotebookInputHandler::HandleFocusChange(wxInputConsumer *consumer) } #endif // wxUSE_NOTEBOOK -