Package: gtk

Class gtk-event-box

Superclasses

gtk-bin, gtk-container, gtk-widget, gtk-buildable, g-object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

above-child
The above-child property of type :boolean (Read / Write)
Whether the event-trapping window of the eventbox is above the window of the child widget as opposed to below it.
Default value: false
visible-window
The visible-window property of type :boolean (Read / Write)
Whether the event box is visible, as opposed to invisible and only used to trap events.
Default value: true

Details

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.

Example

This example demonstrates the usage of a gtk-event-box widget - a label is created and set up so that a mouse-click on the label causes the program to exit.
(defun example-event-box ()
  (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))
                          (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))))    
 

Slot Access Functions

Inherited Slot Access Functions

See also

2021-12-22