On this page:
panel:  single<%>
active-child
panel:  single-mixin
after-new-child
container-size
place-children
panel:  single-window<%>
panel:  single-window-mixin
container-size
panel:  single%
panel:  single-pane%
panel:  dragable<%>
after-percentage-change
get-default-percentages
right-click-in-gap
set-percentages
get-percentages
get-vertical?
set-orientation
panel:  vertical-dragable<%>
panel:  horizontal-dragable<%>
panel:  dragable-mixin
after-new-child
on-subwindow-event
place-children
container-size
panel:  vertical-dragable-mixin
get-vertical?
panel:  horizontal-dragable-mixin
get-vertical?
panel:  vertical-dragable%
panel:  horizontal-dragable%
panel:  splitter<%>
panel:  splitter-mixin
split-vertical
split-horizontal
collapse
panel:  discrete-sizes<%>
set-orientation
get-orientation
panel:  discrete-child<%>
get-discrete-widths
get-discrete-heights
panel:  discrete-sizes-mixin
panel:  horizontal-discrete-sizes%
panel:  vertical-discrete-sizes%
panel:  dragable-container-size
panel:  dragable-place-children

24 Panel

interface

panel:single<%> : interface?

  implements: area-container<%>

method

(send a-panel:single active-child child)  void?

  child : (is-a?/c area<%>)
(send a-panel:single active-child)  (is-a?/c area<%>)
Sets the active child to be child

Returns the current active child.

mixin

panel:single-mixin : (class? . -> . class?)

  argument extends/implements: area-container<%>
  result implements: panel:single<%>
This mixin adds single panel functionality to an implementation of the area-container<%> interface.
Single panels place all of the children in the center of the panel, but allow only one child to be visible at a time. The active-child method controls which panel is currently active.
The show method is used to hide and show the children of a single panel.

method

(send a-panel:single after-new-child child)  void?

  child : (is-a?/c subarea<%>)
Hides this child by calling (send child show #f), unless this is the first child in which case it does nothing.

method

(send a-panel:single container-size)

  
exact-integer? exact-integer?
Returns the maximum width of all the children and the maximum height of all of the children.

Returns the positions for single panels and panes.

mixin

panel:single-window-mixin : (class? . -> . class?)

  argument extends/implements: panel:single<%>
 window<%>
  result implements: panel:single-window<%>

method

(send a-panel:single-window container-size info)

  
exact-integer? exact-integer?
  info : 
(listof (list/c exact-integer?
                exact-integer?
                boolean?
                boolean?))
Factors the border width into the size calculation.

Classes matching this interface implement a panel where the user can adjust the percentage of the space that each takes up. The user adjusts the size by clicking and dragging the empty space between the children.

method

(send a-panel:dragable after-percentage-change)  void?

This method is called when the user changes the percentage by dragging the bar between the children, or when a new child is added to the frame, but not when set-percentages is called.

Use get-percentages to find the current percentages.

method

(send a-panel:dragable get-default-percentages subwindow-count)

  (listof (and/c real? (between/c 0 1)))
  subwindow-count : exact-positive-integer?
Called when the number of children in the panel changes; the result is used as the initial percentages for each of the new windows.

The numbers in the result list must sum to 1.

method

(send a-panel:dragable right-click-in-gap evt    
  before    
  after)  void?
  evt : (is-a?/c mouse-event%)
  before : (is-a?/c subarea<%>)
  after : (is-a?/c subarea<%>)
This method is called when the user right-clicks in the space between two children. It receives the mouse event and the child before and after the gap where the user clicked.

method

(send a-panel:dragable set-percentages new-percentages)  void?

  new-percentages : (listof number?)
Call this method to set the percentages that each window takes up of the panel.

The argument, new-percentages must be a list of numbers that sums to 1. Its length must be equal to the number of children of the panel (see get-children) and each percentage must correspond to a number of pixels that is equal to or larger than the minimum width of the child, as reported by min-width.

method

(send a-panel:dragable get-percentages)  (listof number?)

Return the current percentages of the children.

method

(send a-panel:dragable get-vertical?)  boolean?

This method controls the behavior of the other overridden methods in mixins that implement this interface.

If it returns #t, the panel will be vertically aligned and if it returns #f, they will be horizontally aligned.

method

(send a-panel:dragable set-orientation horizontal?)  void?

  horizontal? : boolean?
Sets the orientation of the panel, switching it from behaving like a panel:horizontal-dragable<%> and panel:vertical-dragable<%>.

A panel that implements panel:vertical-dragable<%>. It aligns its children vertically.

A panel that implements panel:horizontal-dragable<%>. It aligns its children horizontally.

mixin

panel:dragable-mixin : (class? . -> . class?)

  argument extends/implements: window<%>
 area-container<%>
  result implements: panel:dragable<%>
This mixin adds the panel:dragable<%> functionality to a panel%.
It is not useful unless the get-vertical? method is overridden.

method

(send a-panel:dragable after-new-child child)  void?

  child : (is-a?/c subarea<%>)
Updates the number of percentages to make sure that it matches the number of children and calls after-percentage-change.

method

(send a-panel:dragable on-subwindow-event receiver    
  event)  boolean?
  receiver : (is-a?/c window<%>)
  event : (is-a?/c mouse-event%)
When the cursor is dragging the middle bar around, this method handles the resizing of the two panes.

method

(send a-panel:dragable place-children info 
  w 
  h) 
  (listof (list/c exact-integer? exact-integer? exact-integer? exact-integer?))
  info : (listof (list/c exact-integer? exact-integer?))
  w : exact-integer?
  h : exact-integer?
Places the children vertically in the panel, based on the percentages returned from get-percentages. Also leaves a little gap between each pair of children.

method

(send a-panel:dragable container-size info)

  
exact-integer? exact-integer?
  info : (listof (list/c exact-integer? exact-integer? any/c any/c))
Computes the minimum size the panel would have to be in order to have the current percentages (see get-percentages).

mixin

panel:vertical-dragable-mixin : (class? . -> . class?)

  argument extends/implements: panel:dragable<%>
  result implements: panel:vertical-dragable<%>
This mixin merely overrides the get-vertical? method of the panel:dragable-mixin to return #t.

method

(send a-panel:vertical-dragable get-vertical?)  boolean?

Returns #t.

mixin

panel:horizontal-dragable-mixin : (class? . -> . class?)

  argument extends/implements: panel:dragable<%>
  result implements: panel:vertical-dragable<%>
This mixin merely overrides the get-vertical? method of the panel:dragable-mixin to return #f.

method

(send a-panel:horizontal-dragable get-vertical?)  boolean?

Returns #f.

A panel that implements panel:splitter<%>. Children can be split horizonally or vertically.

mixin

panel:splitter-mixin : (class? . -> . class?)

  argument extends/implements: area-container<%>
 panel:dragable<%>
  result implements: panel:splitter<%>
This mixin allows panels to split their children either horizontally or vertically. Children that are split can be further split independant of any other splitting.

method

(send a-panel:splitter split-vertical canvas 
  maker) 
  (is-a?/c canvas<%>)
  canvas : (is-a?/c canvas<%>)
  maker : 
(-> (is-a?/c panel:splitter<%>)
    (is-a?/c canvas<%>))
Splits the canvas vertically by creating a new instance using maker. This splitter object is passed as the argument to maker and should be used as the parent field of the newly created canvas.

method

(send a-panel:splitter split-horizontal canvas 
  maker) 
  (is-a?/c canvas<%>)
  canvas : (is-a?/c canvas<%>)
  maker : 
(-> (is-a?/c panel:splitter<%>)
    (is-a?/c canvas<%>))
Similar to split-vertical but splits horizontally.

method

(send a-panel:splitter collapse canvas)  void

  canvas : (is-a?/c canvas<%>)
Removes the given canvas from the splitter hierarchy and collapses any split panes as necessary.

Classes implementing this interface support children with multiple fixed sizes. As the panel is resized, it calculates a set of sizes of its children that fills its available size and approtions the space accordingly using only one of the fixed sizes.
The strategy it uses is to try to give the largest of the sizes to children that appear later in the list of children (to the right horizontal and lower vertically). It does not try all possible combinations.
Each child that supports minimum sizes is expected to implement the panel:discrete-child<%> interface. Children that do not implement this interface are just treated like horizontal-panel% or vertical-panel% would treat them, with the exception of switchable-button%. In that case, the results of get-small-width and get-large-width are treated as the two fixed sizes for instances of that class.
Also note that, the orientation of the panel determines whether or not it treats heights or widths as described above. That is, when a panel is in vertical mode, it ignores the horizontal discrete sizes, and vice-versa.

method

(send a-panel:discrete-sizes set-orientation horizontal?)

  void?
  horizontal? : boolean?
Changes the orientation of the panel.

method

(send a-panel:discrete-sizes get-orientation)  boolean?

Returns the current orientation of the panel.

Classes that implement this method collaborate with panel:discrete-sizes<%> to indicate which fixed sizes they support.

method

(send a-panel:discrete-child get-discrete-widths)

  (listof exact-nonnegative-integer?)
Return a list of widths this class supports.

method

(send a-panel:discrete-child get-discrete-heights)

  (listof exact-nonnegative-integer?)
Return a list of heights this class supports.

mixin

panel:discrete-sizes-mixin : (class? . -> . class?)

  argument extends/implements: panel%
  result implements: panel:discrete-sizes<%>
 panel:discrete-child<%>
Provides an implementation of panel:discrete-sizes<%>.
It uses the sizes of its children to implement the panel:discrete-child<%> interface.

Calls set-orientation with #f during initialization.

procedure

(panel:dragable-container-size container-info    
  bar-thickness    
  vertical?)  
real? real?
  container-info : (listof (list/c real? real? boolean? boolean?))
  bar-thickness : real?
  vertical? : boolean?
Returns the minimum width and height for a panel:dragable<%> object where container-info (see container-size for more details on that argument) is the children’s info, and bar-thickness and vertical? indicate the properties of the panel.

This function is exported mostly for the test suite.

procedure

(panel:dragable-place-children container-info 
  width 
  height 
  percentages 
  bar-thickness 
  vertical?) 
  
(listof (list/c (integer-in 0 10000)
                (integer-in 0 10000)
                (integer-in 0 10000)
                (integer-in 0 10000)))
(listof (list/c (integer-in 0 10000)
                (integer-in 0 10000)))
  container-info : (listof (list/c real? real? boolean? boolean?))
  width : real?
  height : real?
  percentages : (listof (between/c 0 1))
  bar-thickness : real?
  vertical? : boolean?
Returns the geometry information for a dragable panel. The inputs are the container-info (see place-children for more info), the width and height of the window, the percentages for the spacing of the children, and a real and a boolean indicating the thickness of the bar between the child panels and whether or not this is a vertical panel, respectively.

This function is exported mostly for the test suite.