From b99f2dc7003bb37d414fd1bc223fbcd16f7fbee9 Mon Sep 17 00:00:00 2001 From: twanvl Date: Tue, 7 Dec 2010 21:43:55 +0000 Subject: [PATCH] * compatibility with wxWdigets 2.9+: SetClippingRegion -> SetDeviceClippingRegion * overload wxEVT_ERASE_BACKGROUND, to reduce flicker git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1555 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/gui/control/card_viewer.cpp | 3 ++- src/gui/control/card_viewer.hpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/control/card_viewer.cpp b/src/gui/control/card_viewer.cpp index 8669350c..c2acdf2b 100644 --- a/src/gui/control/card_viewer.cpp +++ b/src/gui/control/card_viewer.cpp @@ -88,7 +88,7 @@ void CardViewer::onPaint(wxPaintEvent&) { // dc.SetDeviceOrigin(-dx, -dy); wxRegion clip = GetUpdateRegion(); // clip.Offset(dx, dy); - dc.SetClippingRegion(clip); + dc.SetDeviceClippingRegion(clip); // draw if (!up_to_date) { up_to_date = true; @@ -150,4 +150,5 @@ Rotation CardViewer::getRotation() const { BEGIN_EVENT_TABLE(CardViewer, wxControl) EVT_PAINT (CardViewer::onPaint) + EVT_ERASE_BACKGROUND(CardViewer::onEraseBackground) END_EVENT_TABLE () diff --git a/src/gui/control/card_viewer.hpp b/src/gui/control/card_viewer.hpp index 37b03ed4..47019d61 100644 --- a/src/gui/control/card_viewer.hpp +++ b/src/gui/control/card_viewer.hpp @@ -24,7 +24,7 @@ DECLARE_EVENT_TYPE(EVENT_SIZE_CHANGE, ) /// A control to view a single card class CardViewer : public wxControl, public DataViewer { public: - CardViewer(Window* parent, int id, long style = 0); + CardViewer(Window* parent, int id, long style = wxBORDER_THEME); /// Get a dc to draw on the card outside onPaint /** May NOT be called while in onPaint/draw */ @@ -55,6 +55,7 @@ class CardViewer : public wxControl, public DataViewer { private: DECLARE_EVENT_TABLE(); + void onEraseBackground(wxEraseEvent&) {} void onPaint(wxPaintEvent&); Bitmap buffer; ///< Off-screen buffer we draw to