/ src /
/src/launcher.lisp
1 ;;; Copyright 2009 Tobias Rautenkranz
2 ;;; License: X11 license
3
4 (in-package :qt.examples)
5
6 (defclass launcher (qt:widget)
7 ()
8 (:metaclass cxx:class))
9
10 (defun make-launcer-button (function)
11 (let ((button (make-instance 'qt:push-button
12 :args (list (or (documentation function 'function)
13 (format nil "~A" function))))))
14 (qt:connect (qt:get-signal button "clicked()")
15 #'(lambda () (funcall function)))
16 button))
17
18
19 (defmethod initialize-instance :after ((launcher launcher) &rest args)
20 (declare (ignore args))
21 (let ((layout (make-instance 'qt:vbox-layout :args (list launcher))))
22 (do-external-symbols (example :qt.examples)
23 (when (fboundp example)
24 (cxx:add-widget layout (make-launcer-button (symbol-function example)))))
25 (setf (cxx:layout launcher) layout)))
26
27 (defun launcher ()
28 "Launch the Qt examples"
29 (qt:with-app ()
30 (let ((launcher (make-instance 'launcher)))
31 (cxx:show launcher)
32 (qt:exec))))