X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9c72cf7619064969b5c7f59cece74013789db4cf..82ec1f703513f5a09edfea7403481c23fe7b4d1e:/src/common/wincmn.cpp diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 08acc64556..66570d7882 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -200,6 +200,8 @@ wxWindowBase::wxWindowBase() m_virtualSize = wxDefaultSize; + m_scrollHelper = (wxScrollHelper *) NULL; + m_minVirtualWidth = m_maxVirtualWidth = wxDefaultCoord; m_minVirtualHeight = @@ -290,6 +292,18 @@ wxWindowBase::~wxWindowBase() wxASSERT_MSG( GetChildren().GetCount() == 0, wxT("children not destroyed") ); + // reset the top-level parent's default item if it is this widget + if ( m_parent ) + { + wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent((wxWindow*)this), + wxTopLevelWindow); + + if ( tlw && tlw->GetDefaultItem() == this ) + tlw->SetDefaultItem(NULL); + if ( tlw && tlw->GetTmpDefaultItem() == this ) + tlw->SetTmpDefaultItem(NULL); + } + // reset the dangling pointer our parent window may keep to us if ( m_parent ) { @@ -566,7 +580,7 @@ wxSize wxWindowBase::DoGetBestSize() const } -wxSize wxWindowBase::GetBestFittingSize() const +wxSize wxWindowBase::GetEffectiveMinSize() const { // merge the best size with the min size, giving priority to the min size wxSize min = GetMinSize(); @@ -580,14 +594,14 @@ wxSize wxWindowBase::GetBestFittingSize() const } -void wxWindowBase::SetBestFittingSize(const wxSize& size) +void wxWindowBase::SetInitialSize(const wxSize& size) { // Set the min size to the size passed in. This will usually either be // wxDefaultSize or the size passed to this window's ctor/Create function. SetMinSize(size); // Merge the size with the best size if needed - wxSize best = GetBestFittingSize(); + wxSize best = GetEffectiveMinSize(); // If the current size doesn't match then change it if (GetSize() != best) @@ -601,23 +615,6 @@ wxPoint wxWindowBase::GetClientAreaOrigin() const return wxPoint(0,0); } -// set the min/max size of the window -void wxWindowBase::DoSetSizeHints(int minW, int minH, - int maxW, int maxH, - int WXUNUSED(incW), int WXUNUSED(incH)) -{ - // setting min width greater than max width leads to infinite loops under - // X11 and generally doesn't make any sense, so don't allow it - wxCHECK_RET( (minW == wxDefaultCoord || maxW == wxDefaultCoord || minW <= maxW) && - (minH == wxDefaultCoord || maxH == wxDefaultCoord || minH <= maxH), - _T("min width/height must be less than max width/height!") ); - - m_minWidth = minW; - m_maxWidth = maxW; - m_minHeight = minH; - m_maxHeight = maxH; -} - void wxWindowBase::SetWindowVariant( wxWindowVariant variant ) { if ( m_windowVariant != variant ) @@ -663,6 +660,21 @@ void wxWindowBase::DoSetWindowVariant( wxWindowVariant variant ) SetFont(font); } +void wxWindowBase::DoSetSizeHints( int minW, int minH, + int maxW, int maxH, + int incW, int incH ) +{ + wxCHECK_RET( (minW == wxDefaultCoord || maxW == wxDefaultCoord || minW <= maxW) && + (minH == wxDefaultCoord || maxH == wxDefaultCoord || minH <= maxH), + _T("min width/height must be less than max width/height!") ); + + m_minWidth = minW; + m_maxWidth = maxW; + m_minHeight = minH; + m_maxHeight = maxH; +} + + void wxWindowBase::SetVirtualSizeHints( int minW, int minH, int maxW, int maxH ) { @@ -745,9 +757,10 @@ bool wxWindowBase::Enable(bool enable) } } -bool wxWindowBase::IsVisible() const +bool wxWindowBase::IsShownOnScreen() const { - return IsShown() && (GetParent() == NULL || GetParent()->IsVisible()); + return IsShown() && + (GetParent() == NULL || GetParent()->IsShownOnScreen()); } // ---------------------------------------------------------------------------- @@ -1025,7 +1038,7 @@ bool wxWindowBase::SetCursor(const wxCursor& cursor) { // setting an invalid cursor is ok, it means that we don't have any special // cursor - if ( m_cursor == cursor ) + if ( m_cursor.IsSameAs(cursor) ) { // no change return false; @@ -1146,12 +1159,12 @@ wxRect wxWindowBase::GetUpdateClientRect() const return rectUpdate; } -bool wxWindowBase::IsExposed(int x, int y) const +bool wxWindowBase::DoIsExposed(int x, int y) const { return m_updateRegion.Contains(x, y) != wxOutRegion; } -bool wxWindowBase::IsExposed(int x, int y, int w, int h) const +bool wxWindowBase::DoIsExposed(int x, int y, int w, int h) const { return m_updateRegion.Contains(x, y, w, h) != wxOutRegion; } @@ -2184,9 +2197,10 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event ) // don't translate these strings, they're for diagnostics purposes only wxString msg; msg.Printf(_T("wxWidgets Library (%s port)\n") - _T("Version %d.%d.%d%s%s, compiled at %s %s%s\n") + _T("Version %d.%d.%d%s%s, compiled at %s %s\n") + _T("Runtime version of toolkit used is %d.%d.%s\n") _T("Copyright (c) 1995-2006 wxWidgets team"), - wxPlatformInfo().GetPortIdName().c_str(), + wxPlatformInfo::Get().GetPortIdName().c_str(), wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER, @@ -2202,8 +2216,10 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event ) #endif __TDATE__, __TTIME__, + wxPlatformInfo::Get().GetToolkitMajorVersion(), + wxPlatformInfo::Get().GetToolkitMinorVersion(), #ifdef __WXGTK__ - wxString::Format(_T("\nagainst GTK+ %d.%d.%d. Runtime GTK+ version: %d.%d.%d"), GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION, gtk_major_version, gtk_minor_version, gtk_micro_version).c_str() + wxString::Format(_T("\nThe compile-time GTK+ version is %d.%d.%d."), GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION).c_str() #else wxEmptyString #endif @@ -2968,6 +2984,7 @@ wxAccStatus wxWindowAccessible::GetFocus(int* WXUNUSED(childId), wxAccessible** return wxACC_NOT_IMPLEMENTED; } +#if wxUSE_VARIANT // Gets a variant representing the selected children // of this object. // Acceptable values: @@ -2984,6 +3001,7 @@ wxAccStatus wxWindowAccessible::GetSelections(wxVariant* WXUNUSED(selections)) return wxACC_NOT_IMPLEMENTED; } +#endif // wxUSE_VARIANT #endif // wxUSE_ACCESSIBILITY