X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e2081a1b9962f3d58afce7b45845ba7956d3c20..c822ad5a5e30a21ca3340af644bf79804cf7c777:/include/wx/msw/dc.h diff --git a/include/wx/msw/dc.h b/include/wx/msw/dc.h index 9087250fe7..f28ffedd8d 100644 --- a/include/wx/msw/dc.h +++ b/include/wx/msw/dc.h @@ -102,7 +102,15 @@ public: virtual void SelectOldObjects(WXHDC dc); wxWindow *GetWindow() const { return m_canvas; } - void SetWindow(wxWindow *win) { m_canvas = win; } + void SetWindow(wxWindow *win) + { + m_canvas = win; + +#if wxUSE_PALETTE + // if we have palettes use the correct one for this window + InitializePalette(); +#endif // wxUSE_PALETTE + } WXHDC GetHDC() const { return m_hDC; } void SetHDC(WXHDC dc, bool bOwnsDC = FALSE) @@ -184,6 +192,17 @@ protected: int fillStyle = wxODDEVEN_RULE); +#if wxUSE_PALETTE + // MSW specific, select a logical palette into the HDC + // (tell windows to translate pixel from other palettes to our custom one + // and vice versa) + // Realize tells it to also reset the system palette to this one. + void DoSelectPalette(bool realize = FALSE); + + // Find out what palette our parent window has, then select it into the dc + void InitializePalette(); +#endif // wxUSE_PALETTE + // common part of DoDrawText() and DoDrawRotatedText() void DrawAnyText(const wxString& text, wxCoord x, wxCoord y);