* compatibility with wxWdigets 2.9+: Handle MOUSE_CAPTURE_LOST event

* compatibility with wxWdigets 2.9+: SetClippingRegion -> SetDeviceClippingRegion

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1552 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2010-12-07 21:21:43 +00:00
parent 3df48aa489
commit 1ece54c899
2 changed files with 15 additions and 1 deletions
+13 -1
View File
@@ -419,11 +419,17 @@ void ImageSlicePreview::onMotion(wxMouseEvent& ev) {
}
}
void ImageSlicePreview::onLoseCapture(wxMouseCaptureLostEvent&) {
// We already test for wrong release with HasCapture()
// but stupid wxwidget people decided to throw assertion failures
}
BEGIN_EVENT_TABLE(ImageSlicePreview, wxControl)
EVT_PAINT (ImageSlicePreview::onPaint)
EVT_LEFT_DOWN (ImageSlicePreview::onLeftDown)
EVT_LEFT_UP (ImageSlicePreview::onLeftUp)
EVT_MOTION (ImageSlicePreview::onMotion)
EVT_MOUSE_CAPTURE_LOST(ImageSlicePreview::onLoseCapture)
END_EVENT_TABLE ()
@@ -471,7 +477,7 @@ void ImageSliceSelector::draw(DC& dc) {
{
wxRegion r(0,0,s.x,s.y);
r.Subtract(wxRect(border,border, s.x-2*border, s.y-2*border));
dc.SetClippingRegion(r);
dc.SetDeviceClippingRegion(r);
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(Color(191,191,191));
dc.SetLogicalFunction(wxAND);
@@ -646,6 +652,11 @@ void ImageSliceSelector::onMotion(wxMouseEvent& ev) {
}
}
void ImageSliceSelector::onLoseCapture(wxMouseCaptureLostEvent&) {
// We already test for wrong release with HasCapture()
// but stupid wxwidget people decided to throw assertion failures
}
// ----------------------------------------------------------------------------- : ImageSliceSelector : handles
bool ImageSliceSelector::onHandle(const wxMouseEvent& ev, int dx, int dy) const {
@@ -683,4 +694,5 @@ BEGIN_EVENT_TABLE(ImageSliceSelector, wxControl)
EVT_LEFT_UP (ImageSliceSelector::onLeftUp)
EVT_MOTION (ImageSliceSelector::onMotion)
EVT_SIZE (ImageSliceSelector::onSize)
EVT_MOUSE_CAPTURE_LOST(ImageSliceSelector::onLoseCapture)
END_EVENT_TABLE ()
+2
View File
@@ -139,6 +139,7 @@ class ImageSlicePreview : public wxControl {
void onLeftDown(wxMouseEvent&);
void onLeftUp (wxMouseEvent&);
void onMotion (wxMouseEvent&);
void onLoseCapture(wxMouseCaptureLostEvent&);
void onPaint(wxPaintEvent&);
void draw(DC& dc);
@@ -172,6 +173,7 @@ class ImageSliceSelector : public wxControl {
void onLeftDown(wxMouseEvent&);
void onLeftUp (wxMouseEvent&);
void onMotion (wxMouseEvent&);
void onLoseCapture(wxMouseCaptureLostEvent&);
void onPaint(wxPaintEvent&);
void onSize(wxSizeEvent&);