git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9876
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxPoint m_position;
wxList m_children;
wxPoint m_position;
wxList m_children;
+ wxSize GetMaxWindowSize( wxWindow *window );
wxSize GetMinWindowSize( 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 );
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 );
void wxSizer::Fit( wxWindow *window )
{
void wxSizer::Fit( wxWindow *window )
{
- window->SetSize( GetMinWindowSize( window ) );
+ wxSize size = FitSize( window );
+ window->SetSize( size );
void wxSizer::SetSizeHints( wxWindow *window )
{
void wxSizer::SetSizeHints( wxWindow *window )
{
- wxSize size( GetMinWindowSize( window ) );
+ wxSize size = FitSize( window );
window->SetSizeHints( size.x, size.y );
}
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() );
wxSize wxSizer::GetMinWindowSize( wxWindow *window )
{
wxSize minSize( GetMinSize() );
minSize.y+size.y-client_size.y );
}
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;
void wxSizer::SetDimension( int x, int y, int width, int height )
{
m_position.x = x;