(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