- wxItemContainerImmutable::FindString unified (affects wxRadioBox, wxListBox,
wxComboBox and wxChoice)
- wxWindow::Fit() now works correctly for frames and dialogs too
+- added access to the border size between pages and controller in book
+ based controls (wxBookCtrlBase::Get/SetInternalBorder)
wxMSW:
// calculate the size of the control from the size of its page
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const = 0;
+ // get/set size of area between book control area and page area
+ inline unsigned int GetInternalBorder() const
+ {
+ return m_internalBorder;
+ }
+ void SetInternalBorder(unsigned int internalBorder)
+ {
+ m_internalBorder = internalBorder;
+ }
// operations
// ----------
// helper: get the next page wrapping if we reached the end
int GetNextPage(bool forward) const;
- // common part of all ctors
- void Init();
-
// Always rely on GetBestSize, which will look at all the pages
virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { }
-
// the array of all pages of this control
wxArrayPages m_pages;
// true if we must delete m_imageList
bool m_ownsImageList;
+private:
+
+ // common part of all ctors
+ void Init();
+
+ // internal border
+ unsigned int m_internalBorder;
DECLARE_NO_COPY_CLASS(wxBookCtrlBase)
};
{
m_imageList = NULL;
m_ownsImageList = false;
+
+#if defined(__WXWINCE__)
+ m_internalBorder = 1;
+#else
+ m_internalBorder = 5;
+#endif
}
bool
}
else // notebook is empty, no next page
{
- nPage = -1;
+ nPage = wxNOT_FOUND;
}
return nPage;
}
#endif // wxUSE_BOOKCTRL
-
#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
// ----------------------------------------------------------------------------
// 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;
}
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;
// 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();
#include "wx/imaglist.h"
#include "wx/settings.h"
-// ----------------------------------------------------------------------------
-// constants
-// ----------------------------------------------------------------------------
-
-// margin between the list and the page, should be bigger than wxStaticLine
-// size
-const wxCoord MARGIN = 5;
-
// ----------------------------------------------------------------------------
// various wxWidgets macros
// ----------------------------------------------------------------------------
// fall through
case wxLB_TOP:
- rectPage.y = sizeList.y + MARGIN;
+ rectPage.y = sizeList.y + GetInternalBorder();
// fall through
case wxLB_BOTTOM:
- rectPage.height -= sizeList.y + MARGIN;
+ rectPage.height -= sizeList.y + GetInternalBorder();
break;
case wxLB_LEFT:
- rectPage.x = sizeList.x + MARGIN;
+ rectPage.x = sizeList.x + GetInternalBorder();
// fall through
case wxLB_RIGHT:
- rectPage.width -= sizeList.x + MARGIN;
+ rectPage.width -= sizeList.x + GetInternalBorder();
break;
}
{
case wxLB_TOP:
rectLine.y = sizeNew.y + 1;
- rectLine.height = MARGIN - 2;
+ rectLine.height = GetInternalBorder() - 2;
break;
case wxLB_BOTTOM:
- rectLine.height = MARGIN - 2;
+ rectLine.height = GetInternalBorder() - 2;
rectLine.y = sizeClient.y - sizeNew.y - rectLine.height;
break;
case wxLB_LEFT:
rectLine.x = sizeNew.x + 1;
- rectLine.width = MARGIN - 2;
+ rectLine.width = GetInternalBorder() - 2;
break;
case wxLB_RIGHT:
- rectLine.width = MARGIN - 2;
+ rectLine.width = GetInternalBorder() - 2;
rectLine.x = sizeClient.x - sizeNew.x - rectLine.width;
break;
}
wxSize wxListbook::CalcSizeFromPage(const wxSize& sizePage) const
{
- // we need to add the size of the list control and the margin
+ // we need to add the size of the list control and the border between
const wxSize sizeList = GetListSize();
wxSize size = sizePage;
if ( IsVertical() )
{
- size.y += sizeList.y + MARGIN;
+ size.y += sizeList.y + GetInternalBorder();
}
else // left/right aligned
{
- size.x += sizeList.x + MARGIN;
+ size.x += sizeList.x + GetInternalBorder();
}
return size;
}
#endif // wxUSE_LISTBOOK
-