X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/45e0dc94770d598a1cc84d83730d470dd1cfbcca..59c962bf54667cab735353b2ec3b7a2438464f22:/src/common/wincmn.cpp?ds=sidebyside diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index ce68b5ac34..643db6adf5 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -167,6 +167,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; } @@ -397,14 +401,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 +737,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 +1035,7 @@ void wxWindowBase::OnHelp(wxHelpEvent& event) #endif // wxUSE_HELP // ---------------------------------------------------------------------------- -// tooltips +// tooltipsroot.Replace("\\", "/"); // ---------------------------------------------------------------------------- #if wxUSE_TOOLTIPS @@ -1161,9 +1194,6 @@ bool wxWindowBase::Layout() GetClientSize(&w, &h); GetSizer()->SetDimension( 0, 0, w, h ); -#if defined __WXPM__ - OS2Layout(w, h); -#endif } else { @@ -1674,6 +1704,7 @@ void wxWindowBase::CaptureMouse() wxWindow *winOld = GetCapture(); if ( winOld ) { + ((wxWindowBase*) winOld)->DoReleaseMouse(); // save it on stack wxWindowNext *item = new wxWindowNext; item->win = winOld; @@ -1695,7 +1726,7 @@ void wxWindowBase::ReleaseMouse() if ( ms_winCaptureNext ) { - ms_winCaptureNext->win->CaptureMouse(); + ((wxWindowBase*)ms_winCaptureNext->win)->DoCaptureMouse(); wxWindowNext *item = ms_winCaptureNext; ms_winCaptureNext = item->next;