X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/10cbb81eda8caf834dc9a5552801ac9ce87e9de1..9ca7505f1243ed1d2a2012caa09a52d41115c069:/src/common/wincmn.cpp diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index aa5c6d3865..74b2b50b6c 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -77,6 +77,10 @@ #include "wx/caret.h" #endif // wxUSE_CARET +#if wxUSE_SYSTEM_OPTIONS + #include "wx/sysopt.h" +#endif + // ---------------------------------------------------------------------------- // static data // ---------------------------------------------------------------------------- @@ -153,6 +157,8 @@ wxWindowBase::wxWindowBase() m_exStyle = m_windowStyle = 0; + m_backgroundStyle = wxBG_STYLE_SYSTEM; + #if wxUSE_CONSTRAINTS // no constraints whatsoever m_constraints = (wxLayoutConstraints *) NULL; @@ -191,6 +197,12 @@ wxWindowBase::wxWindowBase() m_maxVirtualHeight = wxDefaultCoord; m_windowVariant = wxWINDOW_VARIANT_NORMAL; +#if wxUSE_SYSTEM_OPTIONS + if ( wxSystemOptions::HasOption(wxWINDOW_DEFAULT_VARIANT) ) + { + m_windowVariant = (wxWindowVariant) wxSystemOptions::GetOptionInt( wxWINDOW_DEFAULT_VARIANT ) ; + } +#endif // Whether we're using the current theme for this window (wxGTK only for now) m_themeEnabled = false; @@ -478,7 +490,7 @@ void wxWindowBase::Centre(int direction) } // move the window to this position (keeping the old size but using - // SetSize() and not Move() to allow xNew and/or yNew to be -1) + // SetSize() and not Move() to allow xNew and/or yNew to be wxDefaultCoord) SetSize(xNew, yNew, width, height, wxSIZE_ALLOW_MINUS_ONE); } @@ -506,7 +518,7 @@ void wxWindowBase::FitInside() static bool wxHasRealChildren(const wxWindowBase* win) { int realChildCount = 0; - + for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst(); node; node = node->GetNext() ) @@ -648,7 +660,7 @@ void wxWindowBase::SetBestFittingSize(const wxSize& size) // Merge the size with the best size if needed wxSize best = GetBestFittingSize(); - + // If the current size doesn't match then change it if (GetSize() != best) SetSize(best); @@ -1015,7 +1027,7 @@ wxColour wxWindowBase::GetForegroundColour() const bool wxWindowBase::SetBackgroundColour( const wxColour &colour ) { - if ( colour == m_backgroundColour ) + if ( colour == m_backgroundColour ) return false; m_hasBgCol = colour.Ok(); @@ -1081,6 +1093,8 @@ bool wxWindowBase::SetFont(const wxFont& font) m_hasFont = font.Ok(); m_inheritFont = m_hasFont; + InvalidateBestSize(); + return true; } @@ -2075,10 +2089,10 @@ wxPoint wxWindowBase::ConvertPixelsToDialog(const wxPoint& pt) { int charWidth = GetCharWidth(); int charHeight = GetCharHeight(); - wxPoint pt2(-1, -1); - if (pt.x != -1) + wxPoint pt2 = wxDefaultPosition; + if (pt.x != wxDefaultCoord) pt2.x = (int) ((pt.x * 4) / charWidth); - if (pt.y != -1) + if (pt.y != wxDefaultCoord) pt2.y = (int) ((pt.y * 8) / charHeight); return pt2; @@ -2088,10 +2102,10 @@ wxPoint wxWindowBase::ConvertDialogToPixels(const wxPoint& pt) { int charWidth = GetCharWidth(); int charHeight = GetCharHeight(); - wxPoint pt2(-1, -1); - if (pt.x != -1) + wxPoint pt2 = wxDefaultPosition; + if (pt.x != wxDefaultCoord) pt2.x = (int) ((pt.x * charWidth) / 4); - if (pt.y != -1) + if (pt.y != wxDefaultCoord) pt2.y = (int) ((pt.y * charHeight) / 8); return pt2; @@ -2872,7 +2886,7 @@ wxAccStatus wxWindowAccessible::GetFocus(int* WXUNUSED(childId), wxAccessible** // Gets a variant representing the selected children // of this object. // Acceptable values: -// - a null variant (IsNull() returns TRUE) +// - a null variant (IsNull() returns true) // - a list variant (GetType() == wxT("list") // - an integer representing the selected child element, // or 0 if this object is selected (GetType() == wxT("long")