X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2e36d5cf818d64c8abdb3da1861d233d774be139..8f5e92dbe5b8adca2af32da6d43165b1c78dacfd:/src/common/wincmn.cpp diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 24158367eb..6ffcaea012 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -152,6 +152,7 @@ void wxWindowBase::InitBase() m_constraints = (wxLayoutConstraints *) NULL; m_constraintsInvolvedIn = (wxWindowList *) NULL; m_windowSizer = (wxSizer *) NULL; + m_containingSizer = (wxSizer *) NULL; m_autoLayout = FALSE; #endif // wxUSE_CONSTRAINTS @@ -167,6 +168,10 @@ void wxWindowBase::InitBase() m_caret = (wxCaret *)NULL; #endif // wxUSE_CARET +#if wxUSE_PALETTE + m_hasCustomPalette = FALSE; +#endif // wxUSE_PALETTE + // Whether we're using the current theme for this window (wxGTK only for now) m_themeEnabled = FALSE; } @@ -253,6 +258,9 @@ wxWindowBase::~wxWindowBase() m_constraints = NULL; } + if ( m_containingSizer ) + m_containingSizer->Remove((wxWindow*)this); + if ( m_windowSizer ) delete m_windowSizer; @@ -397,14 +405,18 @@ void wxWindowBase::Centre(int direction) wxRect rect = wxGetClientDisplayRect(); wxSize size (rect.width,rect.height); +#ifndef __WXMGL__ // FIXME - temporary dirty hack!! if (posParent.x >= 0) // if parent is on the main display +#endif { if (xNew < 0) xNew = 0; else if (xNew+width > size.x) xNew = size.x-width-1; } +#ifndef __WXMGL__ // FIXME - temporary dirty hack!! if (posParent.y >= 0) // if parent is on the main display +#endif { if (yNew+height > size.y) yNew = size.y-height-1; @@ -729,6 +741,31 @@ bool wxWindowBase::SetFont(const wxFont& font) return TRUE; } +#if wxUSE_PALETTE + +void wxWindowBase::SetPalette(const wxPalette& pal) +{ + m_hasCustomPalette = TRUE; + m_palette = pal; + + // VZ: can anyone explain me what do we do here? + wxWindowDC d((wxWindow *) this); + d.SetPalette(pal); +} + +wxWindow *wxWindowBase::GetAncestorWithCustomPalette() const +{ + wxWindow *win = (wxWindow *)this; + while ( win && !win->HasCustomPalette() ) + { + win = win->GetParent(); + } + + return win; +} + +#endif // wxUSE_PALETTE + #if wxUSE_CARET void wxWindowBase::SetCaret(wxCaret *caret) { @@ -1002,7 +1039,7 @@ void wxWindowBase::OnHelp(wxHelpEvent& event) #endif // wxUSE_HELP // ---------------------------------------------------------------------------- -// tooltips +// tooltipsroot.Replace("\\", "/"); // ---------------------------------------------------------------------------- #if wxUSE_TOOLTIPS @@ -1548,6 +1585,11 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event ) { // don't translate these strings wxString port; + +#ifdef __WXUNIVERSAL__ + port = _T("Univ/"); +#endif // __WXUNIVERSAL__ + switch ( wxGetOsVersion() ) { case wxMOTIF_X: port = _T("Motif"); break; @@ -1575,7 +1617,7 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event ) wxMessageBox(wxString::Format( _T( - " wxWindows Library (%s port)\nVersion %u.%u.%u%s, compiled at %s %s\n Copyright (c) 1995-2001 wxWindows team" + " wxWindows Library (%s port)\nVersion %u.%u.%u%s, compiled at %s %s\n Copyright (c) 1995-2002 wxWindows team" ), port.c_str(), wxMAJOR_VERSION, @@ -1662,10 +1704,15 @@ struct WXDLLEXPORT wxWindowNext void wxWindowBase::CaptureMouse() { wxLogTrace(_T("mousecapture"), _T("CaptureMouse(0x%08x)"), this); - + wxWindow *winOld = GetCapture(); if ( winOld ) { + // I think this is correct, but not compatible with some ports +#if defined(__WXX11__) || defined(__WXMGL__) + ((wxWindowBase*) winOld)->DoReleaseMouse(); +#endif + // save it on stack wxWindowNext *item = new wxWindowNext; item->win = winOld; @@ -1687,8 +1734,13 @@ void wxWindowBase::ReleaseMouse() if ( ms_winCaptureNext ) { + // I think this is correct, but not compatible with some ports +#if defined(__WXX11__) || defined(__WXMGL__) + ((wxWindowBase*)ms_winCaptureNext->win)->DoCaptureMouse(); +#else ms_winCaptureNext->win->CaptureMouse(); - +#endif + wxWindowNext *item = ms_winCaptureNext; ms_winCaptureNext = item->next; delete item;