Package: gtk
Class gtk:event-box
Superclassesgtk:bin, gtk:container, gtk:widget, gtk:buildable, gobject:object, common-lisp:standard-object, common-lisp:t Documented Subclasses
None
Direct SlotsDetails The gtk:event-box widget is a subclass of the gtk:bin class
which also has its own window.
It is useful since it allows you to catch events for widgets which do not
have their own window. Examples
(defun example-event-box ()
(gtk:within-main-loop
(let ((window (make-instance 'gtk:window
:type :toplevel
:title "Example Event Box"
:default-height 150
:border-width 24))
(eventbox (make-instance 'gtk:event-box))
(label (make-instance 'gtk:label
:ellipsize :end
:label
"Click here to quit this Example Event Box.")))
(g:signal-connect window "destroy"
(lambda (widget)
(declare (ignore widget))
(gtk:leave-gtk-main)))
;; Set the available events for the event box
(setf (gtk:widget-events eventbox) :button-press-mask)
;; Connect a signal handler to the eventbox
(g:signal-connect eventbox "button-press-event"
(lambda (widget event)
(declare (ignore widget event))
(gtk:widget-destroy window)))
;; Add the label to the event box and the event box to the window
(gtk:container-add eventbox label)
(gtk:container-add window eventbox)
;; Realize the event box
(gtk:widget-realize eventbox)
;; Set a new cursor for the event box
(setf (gdk:window-cursor (gtk:widget-window eventbox))
(gdk:cursor-new-from-name (gdk:display-default) "pointer"))
;; Show the window
(gtk:widget-show-all window)))) | Returned bySlot Access FunctionsInherited Slot Access FunctionsSee also |
2023-2-23