UP | HOME

Date: [2020-12-01 Tue]

McCLIM

Table of Contents

1. McCLIM

  • Sheet: Windows and windows like objects
  • Panes: gadgets or widgets

The central element of CLIM is application-frame "(define-application-frame …)" Its syntax is similar to defclass because it also defines new class.

< Collapse code block> Expand code block
(define-application-frame hello−world ()
  ((greeting :initform "Hello World" :accessor greeting))
  (:pane (make-pane 'hellow-world-pane)))
DEFINE-HELLO−WORLD-COMMAND

With :pane, we define atop-level-pane that becomes the content of a fresh window that belongs to an application frame. The list given after the :pane option is a form which is evaluated when an instance of the hello-world class is created.

< Collapse code block> Expand code block
(defclass hello-world-pane (clim-stream-pane)
  ())
#<STANDARD-CLASS CLIM-USER::HELLO-WORLD-PANE>
< Collapse code block> Expand code block
(defmethod handle-repaint ((s hello-world-pane) region)
  (let ((w (bounding-rectangle-width s))
        (h (bounding-rectangle-height s)))
    (draw-rectangle* s 0 0 w h 
               :filled t 
               :ink (pane-background s))
    (draw-text* s (greeting *application-frame*)
          (floor w 2) (floor h 2)
          :align-x :center 
          :align-y :center)))
#<STANDARD-METHOD CLIM:HANDLE-REPAINT (HELLO-WORLD-PANE T) {1005B38D93}>

1.1. Panes vs Sheets

Panes and sheets as defined by the windowing substrate have in common that they are associatedwith a region on screen, a parent, and optional children. They differ in their usage of the inputand output capabilities. A sheet is passive and intended to be used by other, active components,while a pane already contains this active part. Forthis reason, panes are implemented as subclassesofbasic-sheetaugmenting the class with an activepart. For instance, a button-pane actively drawsits own button representation on its allotted screenarea and a click on the correct button area triggersa callback for the button. A composite pane laysout its child elements and requests them to drawthemselves onto specific screen regions

2. Frames

(Source)

  • frames = top-level window
  • displayed as top-level window (or embedded within other applications)
  • It controls a hiearchy of panes
  • keep track of lisp state variables that contain the state of the application

2.1. Constructing Application Frames

Before you can construct an actual instance of an application frame, you have to name it and define it by calling

define-application-frame (name superclasses slots &rest options)

This is a macro that helps you define a direct sub-class of the class standard-application-frame. The &rest options is where much of the action is because this is where one specifies command tables, panes for display, and the layout of the panes.

3. Panes

  • interactive objects = widgets, windows

Backlinks


You can send your feedback, queries here