X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/61c083e7818114734695cb26aa006098a86e62c3..e191ee875133b476d005f2b35eec43e8281dbac2:/src/generic/choicbkg.cpp diff --git a/src/generic/choicbkg.cpp b/src/generic/choicbkg.cpp index c40ba14fe4..26f6759282 100644 --- a/src/generic/choicbkg.cpp +++ b/src/generic/choicbkg.cpp @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "choicebook.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -35,17 +31,6 @@ #include "wx/imaglist.h" #include "wx/settings.h" -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// margin between the choice and the page -#if defined(__WXWINCE__) -const wxCoord MARGIN = 1; -#else -const wxCoord MARGIN = 5; -#endif - // ---------------------------------------------------------------------------- // various wxWidgets macros // ---------------------------------------------------------------------------- @@ -123,7 +108,7 @@ wxChoicebook::Create(wxWindow *parent, wxSize wxChoicebook::GetChoiceSize() const { const wxSize sizeClient = GetClientSize(), - sizeChoice = m_choice->GetBestSize(); + sizeChoice = m_choice->GetBestFittingSize(); wxSize size; if ( IsVertical() ) @@ -142,9 +127,9 @@ wxSize wxChoicebook::GetChoiceSize() const wxRect wxChoicebook::GetPageRect() const { - const wxSize sizeChoice = m_choice->GetSize(); + const wxSize sizeChoice = m_choice->GetBestFittingSize(); - wxPoint pt(0, 0); + wxPoint pt; wxRect rectPage(pt, GetClientSize()); switch ( GetWindowStyle() & wxCHB_ALIGN_MASK ) { @@ -153,19 +138,19 @@ wxRect wxChoicebook::GetPageRect() const // fall through case wxCHB_TOP: - rectPage.y = sizeChoice.y + MARGIN; + rectPage.y = sizeChoice.y + GetInternalBorder(); // fall through case wxCHB_BOTTOM: - rectPage.height -= sizeChoice.y + MARGIN; + rectPage.height -= sizeChoice.y + GetInternalBorder(); break; case wxCHB_LEFT: - rectPage.x = sizeChoice.x + MARGIN; + rectPage.x = sizeChoice.x + GetInternalBorder(); // fall through case wxCHB_RIGHT: - rectPage.width -= sizeChoice.x + MARGIN; + rectPage.width -= sizeChoice.x + GetInternalBorder(); break; } @@ -207,8 +192,8 @@ void wxChoicebook::OnSize(wxSizeEvent& event) break; } - m_choice->Move(posChoice.x, posChoice.y); - m_choice->SetSize(sizeChoice.x, sizeChoice.y); + m_choice->Move(posChoice); + m_choice->SetSize(sizeChoice); // resize the currently shown page if ( m_selection != wxNOT_FOUND ) @@ -221,17 +206,17 @@ void wxChoicebook::OnSize(wxSizeEvent& event) wxSize wxChoicebook::CalcSizeFromPage(const wxSize& sizePage) const { - // we need to add the size of the choice control and the margin + // we need to add the size of the choice control and the border between const wxSize sizeChoice = GetChoiceSize(); wxSize size = sizePage; if ( IsVertical() ) { - size.y += sizeChoice.y + MARGIN; + size.y += sizeChoice.y + GetInternalBorder(); } else // left/right aligned { - size.x += sizeChoice.x + MARGIN; + size.x += sizeChoice.x + GetInternalBorder(); } return size; @@ -258,7 +243,7 @@ int wxChoicebook::GetPageImage(size_t WXUNUSED(n)) const { wxFAIL_MSG( _T("wxChoicebook::GetPageImage() not implemented") ); - return -1; + return wxNOT_FOUND; } bool wxChoicebook::SetPageImage(size_t WXUNUSED(n), int WXUNUSED(imageId)) @@ -350,16 +335,16 @@ wxChoicebook::InsertPage(size_t n, // 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); InvalidateBestSize(); @@ -368,7 +353,7 @@ wxChoicebook::InsertPage(size_t n, wxWindow *wxChoicebook::DoRemovePage(size_t page) { - const int page_count = GetPageCount(); + const size_t page_count = GetPageCount(); wxWindow *win = wxBookCtrlBase::DoRemovePage(page); if ( win )