Page 317 Table of Contents Index Page 319
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 29. PANES

 
 ;; Define the sheet's repaint method to draw the button.
 (defmethod handle-repaint ((button sample-button-pane) region
                            &key medium &allow-other-keys)
   (let ((radius *sample-button-radius*)
         (half (round *sample-button-radius* 2)))
     ;; Larger circle with small one in the center.
     (draw-circle* medium radius radius radius
                   :filled nil)
     (draw-circle* medium radius radius half
                   :filled t)))

 ;;; Define the pane's compose-space method to always request the
 ;;; fixed size of the pane.
 (defmethod compose-space ((pane sample-button-pane))
   (make-space-requirement :width (* 2 *sample-button-radius*)
                           :height (* 2 *sample-button-radius*)))

The above code is enough to allow you to instantiate the button pane in an application frame.
It will fit in with the space composition protocol of, for example, an hbox-pane. It will display
itself as two nested circles.

The next step is to define the callbacks supported by this gadget, and the user interaction that
triggers them.
 
 ;; This default method is defined so that the callback can be invoked
 ;; on an arbitrary client value without error.
 (defmethod value-change-callback
            ((button sample-button-pane) client id value)
   (declare (ignore client id value)))

 ;; This event processing method defines the rather odd interaction
 ;; style of this button, to whit: it triggers the activate callback
 ;; whenever the mouse moves into it.
 (defmethod enter-region ((pane sample-button-pane) &key &allow-other-keys)
   (value-change-callback pane (gadget-client pane) (gadget-id pane) nil))


29.5.2 Defining Composite Panes

Minor issue: To be supplied. | ILA


Page 317 Table of Contents Index Page 319
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