Fixes ::Fit() and ::SetSizeHints() to keep the dialog sized so that it will not grow outside the display area of the screen. NEcessary to fix the problems seen in wxAnyChoiceDialog() derived classes where the dialog grows too big to see the top or bottom of the dialog
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9876 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
3b59b26706
commit
65ba4113c6
@ -197,8 +197,10 @@ protected:
|
||||
wxPoint m_position;
|
||||
wxList m_children;
|
||||
|
||||
wxSize GetMaxWindowSize( wxWindow *window );
|
||||
wxSize GetMinWindowSize( wxWindow *window );
|
||||
|
||||
wxSize FitSize( wxWindow *window );
|
||||
|
||||
virtual void DoSetMinSize( int width, int height );
|
||||
virtual bool DoSetItemMinSize( wxWindow *window, int width, int height );
|
||||
virtual bool DoSetItemMinSize( wxSizer *sizer, int width, int height );
|
||||
|
@ -355,7 +355,8 @@ bool wxSizer::Remove( int pos )
|
||||
|
||||
void wxSizer::Fit( wxWindow *window )
|
||||
{
|
||||
window->SetSize( GetMinWindowSize( window ) );
|
||||
wxSize size = FitSize( window );
|
||||
window->SetSize( size );
|
||||
}
|
||||
|
||||
void wxSizer::Layout()
|
||||
@ -366,10 +367,24 @@ void wxSizer::Layout()
|
||||
|
||||
void wxSizer::SetSizeHints( wxWindow *window )
|
||||
{
|
||||
wxSize size( GetMinWindowSize( window ) );
|
||||
wxSize size = FitSize( window );
|
||||
window->SetSizeHints( size.x, size.y );
|
||||
}
|
||||
|
||||
wxSize wxSizer::GetMaxWindowSize( wxWindow *window )
|
||||
{
|
||||
wxSize sizeMax = wxGetDisplaySize();
|
||||
// make the max size a bit smaller than the screen, a window which takes
|
||||
// the entire screen doesn't look very nice neither
|
||||
sizeMax.x *= 9;
|
||||
sizeMax.x /= 10;
|
||||
|
||||
sizeMax.y *= 9;
|
||||
sizeMax.y /= 10;
|
||||
|
||||
return sizeMax;
|
||||
}
|
||||
|
||||
wxSize wxSizer::GetMinWindowSize( wxWindow *window )
|
||||
{
|
||||
wxSize minSize( GetMinSize() );
|
||||
@ -379,6 +394,20 @@ wxSize wxSizer::GetMinWindowSize( wxWindow *window )
|
||||
minSize.y+size.y-client_size.y );
|
||||
}
|
||||
|
||||
// Return a window size that will fit within the screens dimensions
|
||||
wxSize wxSizer::FitSize( wxWindow *window )
|
||||
{
|
||||
wxSize size = GetMinWindowSize( window );
|
||||
wxSize sizeMax = GetMaxWindowSize( window );
|
||||
|
||||
if ( size.x > sizeMax.x )
|
||||
size.x = sizeMax.x;
|
||||
if ( size.y > sizeMax.y )
|
||||
size.y = sizeMax.y;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
void wxSizer::SetDimension( int x, int y, int width, int height )
|
||||
{
|
||||
m_position.x = x;
|
||||
|
Loading…
Reference in New Issue
Block a user