Hi,

Attached patch wraps classes wxOverlay and Wx::DCOverlay (from overlay.h).

I was hunting around for a way to have temporary lines drawn on wxMAC - e.g. drag the mouse and have a bounding rectangle drawn. ( you don't get the logical functions to redraw back to the original on wxMAC).

I found that wxPython wraps these classes and they are just what you need (on all platforms) if you are interested in drawing apps.

I think I'm doing the right thing with CLONE and DESTROY - but I'm not so sure to commit directly.

Mark
Index: GDI.xs
===================================================================
--- GDI.xs      (revision 2772)
+++ GDI.xs      (working copy)
@@ -45,6 +45,7 @@
 INCLUDE: XS/Icon.xs
 INCLUDE: XS/Cursor.xs
 INCLUDE_COMMAND: $^X -MExtUtils::XSpp::Cmd -e xspp -- -t typemap.xsp XS/DC.xs
+INCLUDE: XS/Overlay.xs
 INCLUDE: XS/Pen.xs
 INCLUDE: XS/Brush.xs
 INCLUDE: XS/Image.xs
Index: typemap
===================================================================
--- typemap     (revision 2772)
+++ typemap     (working copy)
@@ -265,6 +265,8 @@
 wxAutoBufferedPaintDC * O_WXOBJECT_THR
 wxMirrorDC *            O_WXOBJECT_THR
 wxSVGFileDC *           O_WXOBJECT_THR
+wxOverlay *             O_NON_WXOBJECT_THR
+wxDCOverlay *           O_NON_WXOBJECT_THR
 wxDCClipper *           O_NON_WXOBJECT_THR
 
 wxTaskBarIcon *         O_WXOBJECT
Index: typemap.tmpl
===================================================================
--- typemap.tmpl        (revision 2772)
+++ typemap.tmpl        (working copy)
@@ -265,6 +265,8 @@
 wxAutoBufferedPaintDC * O_WXOBJECT_THR
 wxMirrorDC *            O_WXOBJECT_THR
 wxSVGFileDC *           O_WXOBJECT_THR
+wxOverlay *             O_NON_WXOBJECT_THR
+wxDCOverlay *           O_NON_WXOBJECT_THR
 wxDCClipper *           O_NON_WXOBJECT_THR
 
 wxTaskBarIcon *         O_WXOBJECT
Index: XS/Overlay.xs
===================================================================
--- XS/Overlay.xs       (revision 0)
+++ XS/Overlay.xs       (revision 0)
@@ -0,0 +1,100 @@
+#############################################################################
+## Name:        XS/Overlay.xs
+## Purpose:     XS for Wx::Overlay
+## Author:      Mark Dootson
+## Modified by:
+## Created:     31/01/2010
+## RCS-ID:      $Id:$
+## Copyright:   (c) 2010 Mattia Barbon
+## Licence:     This program is free software; you can redistribute it and/or
+##              modify it under the same terms as Perl itself
+#############################################################################
+
+#include <wx/dc.h>
+#include <wx/window.h>
+#include <wx/overlay.h>
+
+#if WXPERL_W_VERSION_GE( 2, 8, 0 )
+
+MODULE=Wx PACKAGE=Wx::Overlay
+
+wxOverlay*
+new( CLASS )
+    SV* CLASS
+  CODE:
+    RETVAL = new wxOverlay();
+  OUTPUT:
+    RETVAL
+
+static void
+wxOverlay::CLONE()
+  CODE:
+    wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
+
+## // thread OK
+void
+wxOverlay::DESTROY()
+  CODE:
+    wxPli_thread_sv_unregister( aTHX_ "Wx::Overlay", THIS, ST(0) );
+    delete THIS;
+
+void
+wxOverlay::Reset()
+
+
+MODULE=Wx PACKAGE=Wx::DCOverlay
+
+# DECLARE_OVERLOAD( woly, Wx::Overlay )
+
+wxDCOverlay*
+wxDCOverlay::new( ... )
+  PPCODE:
+    BEGIN_OVERLOAD()
+        MATCH_REDISP( wxPliOvl_woly_wdc, newDefault )
+        MATCH_REDISP( wxPliOvl_woly_wdc_n_n_n_n, newLong )
+    END_OVERLOAD( Wx::DCOverlay::new )
+
+wxDCOverlay*
+newDefault( CLASS, overlay, dc )
+    SV* CLASS
+    wxOverlay* overlay
+    wxWindowDC* dc
+  CODE:
+    RETVAL = new wxDCOverlay( *overlay, dc);
+  OUTPUT:
+    RETVAL
+
+wxDCOverlay*
+newLong( CLASS, overlay, dc, x, y, width, height )
+    SV* CLASS
+    wxOverlay* overlay
+    wxWindowDC* dc
+    int x
+    int y
+    int width
+    int height
+  CODE:
+    RETVAL = new wxDCOverlay( *overlay, dc, x, y, width, height);
+  OUTPUT:
+    RETVAL
+
+static void
+wxDCOverlay::CLONE()
+  CODE:
+    wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );
+
+## // thread OK
+void
+wxDCOverlay::DESTROY()
+  CODE:
+    wxPli_thread_sv_unregister( aTHX_ "Wx::DCOverlay", THIS, ST(0) );
+    delete THIS;
+
+void
+wxDCOverlay::Clear()
+
+#endif
+
+
+
+

Reply via email to