added GetBestSize() implementation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31025 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -221,6 +221,7 @@ public:
|
|||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
virtual bool MacClipGrandChildren() const { return true ; }
|
virtual bool MacClipGrandChildren() const { return true ; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// event handlers
|
// event handlers
|
||||||
#if defined(__WXMSW__) || defined(__WXMAC__)
|
#if defined(__WXMSW__) || defined(__WXMAC__)
|
||||||
@@ -231,7 +232,6 @@ protected:
|
|||||||
// by the user code
|
// by the user code
|
||||||
inline bool DoSendEvent(wxSplitterEvent& event);
|
inline bool DoSendEvent(wxSplitterEvent& event);
|
||||||
|
|
||||||
protected:
|
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
@@ -270,6 +270,11 @@ protected:
|
|||||||
// redraw the splitter if its "hotness" changed if necessary
|
// redraw the splitter if its "hotness" changed if necessary
|
||||||
void RedrawIfHotSensitive(bool isHot);
|
void RedrawIfHotSensitive(bool isHot);
|
||||||
|
|
||||||
|
// return the best size of the splitter equal to best sizes of its
|
||||||
|
// subwindows
|
||||||
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
|
|
||||||
wxSplitMode m_splitMode;
|
wxSplitMode m_splitMode;
|
||||||
wxWindow* m_windowOne;
|
wxWindow* m_windowOne;
|
||||||
wxWindow* m_windowTwo;
|
wxWindow* m_windowTwo;
|
||||||
|
@@ -860,6 +860,46 @@ bool wxSplitterWindow::DoSendEvent(wxSplitterEvent& event)
|
|||||||
return !GetEventHandler()->ProcessEvent(event) || event.IsAllowed();
|
return !GetEventHandler()->ProcessEvent(event) || event.IsAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxSize wxSplitterWindow::DoGetBestSize() const
|
||||||
|
{
|
||||||
|
// get best sizes of subwindows
|
||||||
|
wxSize size1, size2;
|
||||||
|
if ( m_windowOne )
|
||||||
|
size1 = m_windowOne->GetBestSize();
|
||||||
|
if ( m_windowTwo )
|
||||||
|
size2 = m_windowTwo->GetBestSize();
|
||||||
|
|
||||||
|
// sum them
|
||||||
|
//
|
||||||
|
// pSash points to the size component to which sash size must be added
|
||||||
|
int *pSash;
|
||||||
|
wxSize sizeBest;
|
||||||
|
if ( m_splitMode == wxSPLIT_VERTICAL )
|
||||||
|
{
|
||||||
|
sizeBest.y = wxMax(size1.y, size2.y);
|
||||||
|
sizeBest.x = wxMax(size1.x, m_minimumPaneSize) +
|
||||||
|
wxMax(size2.x, m_minimumPaneSize);
|
||||||
|
|
||||||
|
pSash = &sizeBest.x;
|
||||||
|
}
|
||||||
|
else // wxSPLIT_HORIZONTAL
|
||||||
|
{
|
||||||
|
sizeBest.x = wxMax(size1.x, size2.x);
|
||||||
|
sizeBest.y = wxMax(size1.y, m_minimumPaneSize) +
|
||||||
|
wxMax(size2.y, m_minimumPaneSize);
|
||||||
|
|
||||||
|
pSash = &sizeBest.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
// account for the border and the sash
|
||||||
|
int border = 2*GetBorderSize();
|
||||||
|
*pSash += GetSashSize();
|
||||||
|
sizeBest.x += border;
|
||||||
|
sizeBest.y += border;
|
||||||
|
|
||||||
|
return sizeBest;
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// wxSplitterWindow virtual functions: they now just generate the events
|
// wxSplitterWindow virtual functions: they now just generate the events
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user