X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f763782968b314d45c416e2066b9ae5cc56aa406..444d61ba4a97c6cb66101fb3455ebfc593175abf:/src/common/wincmn.cpp diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 4c5ebcc5da..5b677218c7 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -115,10 +115,6 @@ void wxWindowBase::InitBase() m_isShown = FALSE; m_isEnabled = TRUE; - // no client data (yet) - m_clientData = NULL; - m_clientDataType = wxClientData_None; - // the default event handler is just this window m_eventHandler = this; @@ -138,6 +134,11 @@ void wxWindowBase::InitBase() m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT); #endif // __WXMSW__ + // the colours/fonts are default for now + m_hasBgCol = + m_hasFgCol = + m_hasFont = FALSE; + // no style bits m_exStyle = m_windowStyle = 0; @@ -236,10 +237,6 @@ wxWindowBase::~wxWindowBase() delete m_windowValidator; #endif // wxUSE_VALIDATORS - // we only delete object data, not untyped - if ( m_clientDataType == wxClientData_Object ) - delete m_clientObject; - #if wxUSE_CONSTRAINTS // Have to delete constraints/sizer FIRST otherwise sizers may try to look // at deleted windows as they delete themselves. @@ -268,6 +265,12 @@ wxWindowBase::~wxWindowBase() if ( m_tooltip ) delete m_tooltip; #endif // wxUSE_TOOLTIPS + + // reset the dangling pointer our parent window may keep to us + if ( m_parent && m_parent->GetDefaultItem() == this ) + { + m_parent->SetDefaultItem(NULL); + } } bool wxWindowBase::Destroy() @@ -639,6 +642,8 @@ bool wxWindowBase::SetBackgroundColour( const wxColour &colour ) m_backgroundColour = colour; + m_hasBgCol = TRUE; + return TRUE; } @@ -649,6 +654,8 @@ bool wxWindowBase::SetForegroundColour( const wxColour &colour ) m_foregroundColour = colour; + m_hasFgCol = TRUE; + return TRUE; } @@ -680,6 +687,8 @@ bool wxWindowBase::SetFont(const wxFont& font) m_font = fontOk; + m_hasFont = TRUE; + return TRUE; } @@ -1271,7 +1280,7 @@ void wxWindowBase::SetConstraintSizes(bool recurse) while (node) { wxWindow *win = node->GetData(); - if ( !win->IsTopLevel() ) + if ( !win->IsTopLevel() && win->GetConstraints() ) win->SetConstraintSizes(); node = node->GetNext(); } @@ -1349,6 +1358,23 @@ void wxWindowBase::GetClientSizeConstraint(int *w, int *h) const GetClientSize(w, h); } +void wxWindowBase::AdjustForParentClientOrigin(int& x, int& y, int sizeFlags) +{ + // don't do it for the dialogs/frames - they float independently of their + // parent + if ( !IsTopLevel() ) + { + wxWindow *parent = GetParent(); + if ( !(sizeFlags & wxSIZE_NO_ADJUSTMENTS) && parent ) + { + wxPoint pt(parent->GetClientAreaOrigin()); + x += pt.x; + y += pt.y; + } + } +} + + void wxWindowBase::GetPositionConstraint(int *x, int *y) const { wxLayoutConstraints *constr = GetConstraints(); @@ -1448,51 +1474,6 @@ wxPoint wxWindowBase::ConvertDialogToPixels(const wxPoint& pt) return pt2; } -// ---------------------------------------------------------------------------- -// client data -// ---------------------------------------------------------------------------- - -void wxWindowBase::DoSetClientObject( wxClientData *data ) -{ - wxASSERT_MSG( m_clientDataType != wxClientData_Void, - wxT("can't have both object and void client data") ); - - if ( m_clientObject ) - delete m_clientObject; - - m_clientObject = data; - m_clientDataType = wxClientData_Object; -} - -wxClientData *wxWindowBase::DoGetClientObject() const -{ - // it's not an error to call GetClientObject() on a window which doesn't - // have client data at all - NULL will be returned - wxASSERT_MSG( m_clientDataType != wxClientData_Void, - wxT("this window doesn't have object client data") ); - - return m_clientObject; -} - -void wxWindowBase::DoSetClientData( void *data ) -{ - wxASSERT_MSG( m_clientDataType != wxClientData_Object, - wxT("can't have both object and void client data") ); - - m_clientData = data; - m_clientDataType = wxClientData_Void; -} - -void *wxWindowBase::DoGetClientData() const -{ - // it's not an error to call GetClientData() on a window which doesn't have - // client data at all - NULL will be returned - wxASSERT_MSG( m_clientDataType != wxClientData_Object, - wxT("this window doesn't have void client data") ); - - return m_clientData; -} - // ---------------------------------------------------------------------------- // event handlers // ---------------------------------------------------------------------------- @@ -1533,7 +1514,8 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event ) switch ( wxGetOsVersion() ) { case wxMOTIF_X: port = _T("Motif"); break; - case wxMACINTOSH: port = _T("Mac"); break; + case wxMAC: + case wxMAC_DARWIN: port = _T("Mac"); break; case wxBEOS: port = _T("BeOS"); break; case wxGTK: case wxGTK_WIN32: @@ -1556,14 +1538,19 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event ) wxMessageBox(wxString::Format( _T( - " wxWindows Library (%s port)\nVersion %u.%u.%u, compiled at %s %s\n Copyright (c) 1995-2000 wxWindows team" + " wxWindows Library (%s port)\nVersion %u.%u.%u%s, compiled at %s %s\n Copyright (c) 1995-2001 wxWindows team" ), port.c_str(), wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER, - __DATE__, - __TIME__ +#if wxUSE_UNICODE + L" (Unicode)", +#else + "", +#endif + __TDATE__, + __TTIME__ ), _T("wxWindows information"), wxICON_INFORMATION | wxOK,