initial import
src/launcher.lisp
Sun Apr 5 17:36:46 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* initial import
--- old-qt.examples/src/launcher.lisp 1970-01-01 01:00:00.000000000 +0100
+++ new-qt.examples/src/launcher.lisp 2014-10-30 07:39:49.000000000 +0100
@@ -0,0 +1,29 @@
+(in-package :qt.examples)
+
+(defclass launcher (qt:widget)
+ ()
+ (:metaclass cxx:class))
+
+(defun make-launcer-button (function)
+ (let ((button (make-instance 'qt:push-button
+ :args (list (or (documentation function 'function)
+ (format nil "~A" function))))))
+ (qt:connect-function button "clicked()"
+ #'(lambda () (funcall function)))
+ button))
+
+
+(defmethod initialize-instance :after ((launcher launcher) &rest args)
+ (declare (ignore args))
+ (let ((layout (make-instance 'qt:vbox-layout :args (list launcher))))
+ (do-external-symbols (example :qt.examples)
+ (when (fboundp example)
+ (cxx:add-widget layout (make-launcer-button (symbol-function example)))))
+ (cxx:set-layout launcher layout)))
+
+(defun launcher ()
+ "Launch the Qt examples"
+ (qt:with-app
+ (let ((launcher (make-instance 'launcher)))
+ (cxx:show launcher)
+ (qt:exec))))