CLIM Panes

part of Common Lisp Interface Manager (CLIM) by Jason Kantz

Questions

  • What are panes?
  • What are some of the different kinds of panes available?
  • How are panes constructed?
  • How does one define the layout of panes within an application frame?

    Reading

  • Using the :panes and :layouts Options

    panes

    Kinds of Panes

    Constructing Panes

    Using the :panes and :layouts options within define-application-frame

    (defun press (button) (accepting-values (*query-io* :own-window t) (format *query-io* "~A" arg)))
    (defun squeeze (button) (accepting-values (*query-io* :own-window t) (format *query-io* "~A" arg)))
    
    (define-application-frame buttons	;name
        ()					;superclasses
      ()					;slots
      ;; options
      (:panes (button 
    	   (horizontally ()
    	     (make-pane 'push-button :label "squeeze" :activate-callback #'squeeze)
    	     (make-pane 'push-button :label "press" :activate-callback #'press))) 
    	  (application			;pane name 
    	   :application))		;pane type ... :application is an extended-stream-pane
      (:layouts (default			;layout name
    	     (vertically ()		;layout macros
    	       (1/8 button) (7/8 application)))
    	    (alternate			;layout name
    	     (horizontally ()		;layout macros
    	       (1/8 button) (7/8 application)))))
     

    Laying Out Panes

    You can change between layouts with something like this:

    (let* ((layouts (frame-all-layouts *application-frame*))
           (old-layout (frame-current-layout *application-frame*))
           (new-layout (or (second (member old-layout layouts))
    		       (car layouts))))
      (setf (frame-current-layout *application-frame*) new-layout)) 

    Exercises

  • At the top-level, make and run the buttons application frame.
  • From the top-level, change the layout of the buttons application frame while it is running.

    Next: Drawing Text and Graphics