// 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"
#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
// ----------------------------------------------------------------------------
wxSize wxChoicebook::GetChoiceSize() const
{
const wxSize sizeClient = GetClientSize(),
- sizeChoice = m_choice->GetBestSize();
+ sizeChoice = m_choice->GetBestFittingSize();
wxSize size;
if ( IsVertical() )
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 )
{
// 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;
}
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 )
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;
{
wxFAIL_MSG( _T("wxChoicebook::GetPageImage() not implemented") );
- return -1;
+ return wxNOT_FOUND;
}
bool wxChoicebook::SetPageImage(size_t WXUNUSED(n), int WXUNUSED(imageId))
// 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();
wxWindow *wxChoicebook::DoRemovePage(size_t page)
{
- const int page_count = GetPageCount();
+ const size_t page_count = GetPageCount();
wxWindow *win = wxBookCtrlBase::DoRemovePage(page);
if ( win )