From: Dmitry Kalyanov Date: Tue, 17 Mar 2009 08:20:45 +0000 (+0300) Subject: improvements to toolbar-demo X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=225468bef574e2c7e49bd9485bcec16f95cbf3f2;p=cl-gtk2.git improvements to toolbar-demo --- diff --git a/gtk/gtk.demo.lisp b/gtk/gtk.demo.lisp index b924d57..8df755e 100644 --- a/gtk/gtk.demo.lisp +++ b/gtk/gtk.demo.lisp @@ -300,19 +300,23 @@ (gtk-main))) (defun test-toolbar () - (let* ((window (make-instance 'gtk-window :type :toplevel :title "Toolbar")) + (let* ((window (make-instance 'gtk-window :type :toplevel :title "Toolbar" :width-request 200 :height-request 100 :window-position :center)) (v-box (make-instance 'v-box)) - (toolbar (make-instance 'toolbar))) + (toolbar (make-instance 'toolbar :toolbar-style :icons :icon-size :small-toolbar :icon-size-set t)) + (l (make-instance 'label :label "Toolbar demo"))) (gobject:g-signal-connect window "destroy" (lambda (w) (gobject:release w) (gtk-main-quit))) (container-add window v-box) (box-pack-start v-box toolbar :expand nil) - (box-pack-start v-box (make-instance 'label :text "Label")) + (box-pack-start v-box l) (let ((b (make-instance 'tool-button :stock-id "gtk-connect"))) (g-signal-connect b "clicked" (lambda (b) - (format t "clicked on ~A~%" b) - (let ((d (make-instance 'message-dialog :message-type :info :text (format nil "clicked on ~A" b) :buttons :ok))) - (dialog-run d) - (object-destroy d)))) + (setf (tool-button-stock-id b) + (if (string= (tool-button-stock-id b) "gtk-connect") + (prog1 "gtk-disconnect" (setf (label-label l) "Disconnected")) + (prog1 "gtk-connect" (setf (label-label l) "Connected")))))) (toolbar-insert toolbar b -1)) + (toolbar-insert toolbar (make-instance 'separator-tool-item) -1) + (toolbar-insert toolbar (make-instance 'tool-button :stock-id "gtk-undo" :sensitive nil) -1) + (toolbar-insert toolbar (make-instance 'tool-button :stock-id "gtk-redo") -1) (gtk-widget-show-all window) (gtk-main))) \ No newline at end of file