Added a examples of virtual size use for setting scrollbars
both 'manually' and via sizer layout to scroll sample. Tweaked it for various 2.4 idioms that have arisen since it was written. Replaced GenericScrolledWin's DoSetVirtualSize, it really is needed for everything to work for both the user and lib. Don't call it from default scrolledwindow OnSize handlers unless AutoLayout is enabled though, and use the larger of best and client size. Hopefully this will fix any earlier troubles this caused with M. Purged (many) stray tabs &co from sizer.cpp Changed DoGetBestSize to return wxDefaultSize when no useful best size can be determined. If GetBestSize is intended to return the minimum undistorted size a window can take, we must be able to discriminate between valid and 'best guess' sizes, else the best guess windows can only grow. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17776 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -299,6 +299,9 @@ public:
|
||||
// set window size to wrap around its children
|
||||
virtual void Fit();
|
||||
|
||||
// set virtual size to satisfy children
|
||||
virtual void FitInside();
|
||||
|
||||
// set min/max size of the window
|
||||
virtual void SetSizeHints( int minW, int minH,
|
||||
int maxW = -1, int maxH = -1,
|
||||
@@ -342,6 +345,17 @@ public:
|
||||
virtual void DoSetVirtualSize( int x, int y );
|
||||
virtual wxSize DoGetVirtualSize() const; // { return m_virtualSize; }
|
||||
|
||||
// Return the largest of ClientSize and BestSize (as determined
|
||||
// by a sizer, interior children, or other means)
|
||||
|
||||
virtual wxSize GetBestVirtualSize() const
|
||||
{
|
||||
wxSize client( GetClientSize() );
|
||||
wxSize best( GetBestSize() );
|
||||
|
||||
return wxSize( wxMax( client.x, best.x ), wxMax( client.y, best.y ) );
|
||||
}
|
||||
|
||||
// window state
|
||||
// ------------
|
||||
|
||||
|
Reference in New Issue
Block a user