Added knowledge of virtual size to wx(Scrolled)Windows, they can now
manage their own scrollbars with the help of a sizer or other user clues (SetVirtualSizeHints) without the need for an ancillary container. Added SetSizerAndFit convenience method. SetSizer now enables/disables AutoLayout automagically. Logic bugfix for scrollsub sample. Syntax bugfix in parser.y. Compiler warning fix in textctrl.cpp. Modified Files: docs/latex/wx/scrolwin.tex docs/latex/wx/sizer.tex docs/latex/wx/window.tex include/wx/scrolwin.h include/wx/sizer.h include/wx/window.h include/wx/generic/scrolwin.h include/wx/gtk/scrolwin.h samples/scrollsub/scrollsub.cpp src/common/parser.y src/common/sizer.cpp src/common/wincmn.cpp src/generic/scrlwing.cpp src/gtk/scrolwin.cpp src/msw/textctrl.cpp git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15210 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -174,6 +174,12 @@ void wxWindowBase::InitBase()
|
||||
m_hasCustomPalette = FALSE;
|
||||
#endif // wxUSE_PALETTE
|
||||
|
||||
m_virtualSize = wxDefaultSize;
|
||||
m_minVirtualWidth = -1;
|
||||
m_minVirtualHeight = -1;
|
||||
m_maxVirtualWidth = -1;
|
||||
m_maxVirtualHeight = -1;
|
||||
|
||||
// Whether we're using the current theme for this window (wxGTK only for now)
|
||||
m_themeEnabled = FALSE;
|
||||
}
|
||||
@@ -522,6 +528,40 @@ void wxWindowBase::SetSizeHints(int minW, int minH,
|
||||
m_maxHeight = maxH;
|
||||
}
|
||||
|
||||
void wxWindowBase::SetVirtualSizeHints( int minW, int minH,
|
||||
int maxW, int maxH )
|
||||
{
|
||||
m_minVirtualWidth = minW;
|
||||
m_maxVirtualWidth = maxW;
|
||||
m_minVirtualHeight = minH;
|
||||
m_maxVirtualHeight = maxH;
|
||||
|
||||
SetVirtualSize( GetClientSize() );
|
||||
}
|
||||
|
||||
void wxWindowBase::DoSetVirtualSize( int x, int y )
|
||||
{
|
||||
if( m_minVirtualWidth != -1 && m_minVirtualWidth > x ) x = m_minVirtualWidth;
|
||||
if( m_maxVirtualWidth != -1 && m_maxVirtualWidth < x ) x = m_maxVirtualWidth;
|
||||
if( m_minVirtualHeight != -1 && m_minVirtualHeight > y ) y = m_minVirtualHeight;
|
||||
if( m_maxVirtualHeight != -1 && m_maxVirtualHeight < y ) y = m_maxVirtualHeight;
|
||||
|
||||
m_virtualSize.SetWidth( x );
|
||||
m_virtualSize.SetHeight( y );
|
||||
}
|
||||
|
||||
wxSize wxWindowBase::DoGetVirtualSize() const
|
||||
{
|
||||
wxSize s( GetClientSize() );
|
||||
|
||||
if( m_virtualSize.GetWidth() != -1 )
|
||||
s.SetWidth( m_virtualSize.GetWidth() );
|
||||
if( m_virtualSize.GetHeight() != -1 )
|
||||
s.SetHeight( m_virtualSize.GetHeight() );
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// show/hide/enable/disable the window
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -1190,6 +1230,14 @@ void wxWindowBase::SetSizer(wxSizer *sizer, bool deleteOld)
|
||||
if (m_windowSizer && deleteOld) delete m_windowSizer;
|
||||
|
||||
m_windowSizer = sizer;
|
||||
|
||||
SetAutoLayout( sizer != 0 );
|
||||
}
|
||||
|
||||
void wxWindowBase::SetSizerAndFit(wxSizer *sizer, bool deleteOld)
|
||||
{
|
||||
SetSizer( sizer, deleteOld );
|
||||
sizer->SetSizeHints( (wxWindow*) this );
|
||||
}
|
||||
|
||||
bool wxWindowBase::Layout()
|
||||
@@ -1198,8 +1246,7 @@ bool wxWindowBase::Layout()
|
||||
if ( GetSizer() )
|
||||
{
|
||||
int w, h;
|
||||
GetClientSize(&w, &h);
|
||||
|
||||
GetVirtualSize(&w, &h);
|
||||
GetSizer()->SetDimension( 0, 0, w, h );
|
||||
}
|
||||
#if wxUSE_CONSTRAINTS
|
||||
|
Reference in New Issue
Block a user