Page 321 Table of Contents Index Page 323
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E



CHAPTER 30. GADGETS
 
 (defmethod highlight-button ((pane push-button-pane) medium)
   (with-bounding-rectangle* (left top right bottom) (sheet-region pane)
     (draw-rectangle* medium left top right bottom
                      :ink +flipping-ink+ :filled t)))

 ;; Compute the amount of space required by a PUSH-BUTTON-PANE
 (defmethod compose-space ((pane push-button-pane) &key width height)
   (multiple-value-bind (width height)
       (compute-gadget-label-size pane)
     (make-space-requirement :width width :height height)))

 ;; This gets invoked to draw the push button.
 (defmethod repaint-sheet ((pane push-button-pane) region)
   (declare (ignore region))
   (with-sheet-medium (medium pane)
     (let ((text (gadget-label pane))
           (text-style (slot-value pane 'text-style))
           (armed (slot-value pane 'armed))
           (region (sheet-region pane)))
       (multiple-value-call #'draw-rectangle*
                            medium (bounding-rectangle* (sheet-region pane))
                            :filled nil)
       (draw-text medium text (clim-utils::bounding-rectangle-center region)
                  :text-style text-style
                  :align-x ':center :align-y ':top)
       (when (eql armed ':button-press)
         (highlight-button pane medium)))))

 ;; When we enter the push button's region, arm it.
 (defmethod handle-event ((pane push-button-pane) (event pointer-enter-event))
   (with-slots (armed) pane
     (unless armed
       (setf armed t)
       (armed-callback pane (gadget-client pane) (gadget-id pane)))))

 ;; When we leave the push button's region, disarm it.
 (defmethod handle-event ((pane push-button-pane) (event pointer-exit-event))
   (with-slots (armed) pane
     (when armed
       (when (eql armed ':button-press)
         (highlight-button pane medium))
     (setf armed nil)
     (disarmed-callback pane (gadget-client pane) (gadget-id pane)))))

 ;; When the user presses a pointer button, ensure that the button
 ;; is armed, and highlight it.
 (defmethod handle-event ((pane push-button-pane) (event pointer-button-press-event))
   (with-slots (armed) pane
     (unless armed
       (setf armed ':button-press)


Page 321 Table of Contents Index Page 323
Chapters
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
A, B, C, D, E