Next: , Previous: , Up: Native GUI Widgets   [Contents][Index]


50.3.6.3 Layouts

A SXEmacs layout is a one-dimensional array of glyphs. It is a widget for controlling the positioning of children underneath it. Through the use of nested layouts, a widget hierarchy can be created which can have the appearance of any standard dialog box or similar arrangement; all of this is counted as one "glyph" and could appear in many of the places that expect a single glyph. (There are also native layouts, but these are undocumented, as are their uses.)

A layout descriptor is an image instantiator, i.e., a vector of the form ‘[FORMAT KEY-1 VALUE-1 KEY-2 VALUE-2 ...]’ with format layout, and properties

:orientation

Specifies the orientation of the contained array of glyphs. The value must be one of the symbols horizontal or vertical.

:horizontally-justify

Specifies the horizontal justification of the items in the array. The value must be one of the symbols :right, :center, or :left.

:vertically-justify

Specifies the vertical justification of the items in the array. The value must be one of the symbols :top, :center, or :bottom.

:justify

Specifies justification. #### not understood.

:border

A glyph to place in the border. The value must be an image instantiator.

:items

The glyphs controlled by the layout. The value must be a list of image instantiators.

Here is the specification of the search dialog widget created by make-search-dialog in the dialog-items library, which makes use of recursive layouts.

(make-glyph
 `[layout
   :orientation horizontal
   :vertically-justify top
   :horizontally-justify center
   :border [string :data "Search"]
   :items
   ([layout :orientation vertical
            :justify top	; implies left also
            :items
            ([string :data "Search for:"]
     	[button :descriptor "Match Case"
     		:style toggle
     		:selected (not case-fold-search)
     		:callback (setq case-fold-search
     				(not case-fold-search))]
     	[button :descriptor "Regular Expression"
     		:style toggle
     		:selected search-dialog-regexp
     		:callback (setq search-dialog-regexp
     				(not search-dialog-regexp))]
     	[button :descriptor "Forwards"
     		:style radio
     		:selected search-dialog-direction
     		:callback (setq search-dialog-direction t)]
     	[button :descriptor "Backwards"
     		:style radio
     		:selected (not search-dialog-direction)
     		:callback (setq search-dialog-direction nil)]
     	)]
    [layout :orientation vertical
            :vertically-justify top
            :horizontally-justify right
            :items
            ([edit-field :width 15 :descriptor "" :active t
     		    :initial-focus t]
     	[button :width 10 :descriptor "Find Next"
     		:callback-ex
     		(lambda (image-instance event)
     		  (search-dialog-callback ,parent
     					  image-instance
     					  event))]
     	[button :width 10 :descriptor "Cancel"
     		:callback-ex
     		(lambda (image-instance event)
     		  (isearch-dehighlight)
     		  (delete-frame
     		   (event-channel event)))])])])

Next: , Previous: , Up: Native GUI Widgets   [Contents][Index]