initial import
src/painter.lisp
Sun Apr 5 19:56:16 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* initial import
--- old-qt.core/src/painter.lisp 1970-01-01 01:00:00.000000000 +0100
+++ new-qt.core/src/painter.lisp 2014-11-11 13:37:20.000000000 +0100
@@ -0,0 +1,16 @@
+(in-package :qt)
+
+(defmacro with-painter ((painter paint-device) &body body)
+ "Binds a PAINTER instance for PAINT-DEVICE to PAINTER
+ during the evaulation of BODY.
+
+Makes sure the painter ends after BODY; thus prevening problems with
+still active and not yet garbage collected painters."
+ `(let ((,painter (make-instance 'painter :args (list ,paint-device))))
+ (assert (cxx:is-active ,painter)
+ (,painter)
+ "Painter ~A for ~A is not active"
+ ,painter ,paint-device)
+ (unwind-protect
+ (progn ,@body)
+ (cxx:end ,painter))))