#ifndef _WX_DC_H_
#define _WX_DC_H_
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "dc.h"
#endif
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)
#endif
protected:
- virtual void DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
+ virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
int style = wxFLOOD_SURFACE);
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
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);
#endif
DECLARE_DYNAMIC_CLASS(wxDC)
+ DECLARE_NO_COPY_CLASS(wxDC)
};
// ----------------------------------------------------------------------------
public:
wxDCTemp(WXHDC hdc) { SetHDC(hdc); }
virtual ~wxDCTemp() { SetHDC((WXHDC)NULL); }
+
+private:
+ DECLARE_NO_COPY_CLASS(wxDCTemp)
};
#endif