Last active
November 25, 2024 06:29
-
-
Save psilord/a8e1f28519ac6c09ff02cbdf0b58104a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; disable floating point traps | |
(eval-when (:load-toplevel :execute) | |
(sb-int:set-floating-point-modes :traps nil)) | |
(asdf:load-system :cl-cffi-gtk) | |
(defpackage :gtk-tutorial | |
(:use :gtk :gdk :gdk-pixbuf :gobject | |
:glib :gio :pango :cairo :cffi :common-lisp)) | |
(in-package :gtk-tutorial) | |
(defun example-simple-message () | |
(let ((response)) | |
(within-main-loop | |
(let ((dialog (make-instance 'gtk-message-dialog | |
:message-type :info | |
:buttons :ok | |
:text "Info Message Dialog" | |
:secondary-text | |
(format nil | |
"This is a message dialog of type ~ | |
:info with a secondary text.")))) | |
;; Signal handler for the dialog to handle the signal "destroy". | |
(g-signal-connect dialog "destroy" | |
(lambda (widget) | |
(declare (ignore widget)) | |
(leave-gtk-main))) | |
;; Signal handler for the dialog to handle the signal "response". | |
(g-signal-connect dialog "response" | |
(lambda (dialog response-id) | |
(setf response response-id) | |
(gtk-widget-destroy dialog))) | |
(gtk-widget-show dialog))) | |
(join-gtk-main) | |
(format t "Back from message dialog with response-id ~A~%" response))) | |
;; Now run it | |
(example-simple-message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment