X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e11f46363fedb4fd0d2a462a8060bb8dd679b2a0..eb69d46e705906142f5c814f31c892282f4b583c:/src/common/wincmn.cpp diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 5c39f36e9d..5f892e172d 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -121,8 +121,8 @@ wxWindowBase::wxWindowBase() m_maxWidth = m_maxHeight = -1; - // window is created enabled but it's not visible yet - m_isShown = false; + // window are created enabled and visible by default + m_isShown = m_isEnabled = true; // the default event handler is just this window @@ -186,12 +186,14 @@ wxWindowBase::wxWindowBase() #endif m_virtualSize = wxDefaultSize; - + m_minVirtualWidth = m_minVirtualHeight = m_maxVirtualWidth = m_maxVirtualHeight = -1; + m_windowVariant = wxWINDOW_VARIANT_NORMAL ; + // Whether we're using the current theme for this window (wxGTK only for now) m_themeEnabled = false; } @@ -621,6 +623,41 @@ void wxWindowBase::SetSizeHints(int minW, int minH, m_maxHeight = maxH; } +void wxWindowBase::SetWindowVariant( wxWindowVariant variant ) +{ + if ( m_windowVariant == variant ) + return ; + + m_windowVariant = variant ; + + DoSetWindowVariant( variant ) ; + return ; +} + +void wxWindowBase::DoSetWindowVariant( wxWindowVariant variant ) +{ + wxFont font = wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT ) ; + int size = font.GetPointSize() ; + switch ( variant ) + { + case wxWINDOW_VARIANT_NORMAL : + break ; + case wxWINDOW_VARIANT_SMALL : + font.SetPointSize( size * 3 / 4 ) ; + break ; + case wxWINDOW_VARIANT_MINI : + font.SetPointSize( size * 2 / 3 ) ; + break ; + case wxWINDOW_VARIANT_LARGE : + font.SetPointSize( size * 5 / 4 ) ; + break ; + default: + wxFAIL_MSG(_T("unexpected window variant")); + break ; + } + SetFont( font ) ; +} + void wxWindowBase::SetVirtualSizeHints( int minW, int minH, int maxW, int maxH ) { @@ -1466,6 +1503,9 @@ void wxWindowBase::DeleteRelatedConstraints() void wxWindowBase::SetSizer(wxSizer *sizer, bool deleteOld) { + if ( sizer == m_windowSizer) + return; + if ( deleteOld ) delete m_windowSizer;