Module: duim-gadgets-internals Synopsis: DUIM gadgets Author: Scott McKay, Andy Armstrong Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. All rights reserved. License: Functional Objects Library Public License Version 1.0 Dual-license: GNU Lesser General Public License Warranty: Distributed WITHOUT WARRANTY OF ANY KIND /// Borders // Outline panes draw a dark (foreground) border around a pane define open abstract class // This stuff acts like , but manages only a single child (, , , , , ) sealed slot border-thickness :: = 1, init-keyword: thickness:; end class ; define method initialize (gadget :: , #key type: borders = #f) next-method(); border-type(gadget) := borders end method initialize; // Options can be any of the pane sizing options, plus THICKNESS: and TYPE: define macro with-border { with-border (#rest ?options:expression) ?child:body end } => { let _child = ?child; // child is a single expression make(, child: _child, ?options) } end macro with-border; define open generic draw-border (sheet :: , medium :: , type :: , left :: , top :: , right :: , bottom :: ) => (); define method draw-border (sheet :: , medium :: , type :: , left :: , top :: , right :: , bottom :: ) => () with-drawing-options (medium, brush: default-foreground(sheet)) draw-rectangle(medium, left, top, right, bottom, filled?: #f) end end method draw-border; /// Spacing // Spacing panes leaves whitespace (background) around a pane define open abstract class //--- Like , but manages only a single child (, , , , ) sealed slot border-thickness :: = 1, init-keyword: thickness:; end class ; define method border-type (pane :: ) => (type :: singleton(#f)) #f end method border-type; define method initialize (sheet :: , #key spacing) => () next-method(); when (spacing) border-thickness(sheet) := spacing end end method initialize; // Options can be any of the pane sizing options, plus THICKNESS: define macro with-spacing { with-spacing (#rest ?options:expression) ?child:body end } => { let _child = ?child; // child is a single expression make(, child: _child, ?options) } end macro with-spacing; /// Group boxes, aka labelled borders define open abstract class (, ) sealed slot group-box-label-position :: = #"top", init-keyword: label-position:; end class ; define macro grouping { grouping (?label:expression) ?child:body end } => { let _child = ?child; // child is a single expression make(, child: _child, label: ?label) } { grouping (?label:expression, #rest ?options:expression) ?child:body end } => { let _child = ?child; // child is a single expression make(, ?options, child: _child, label: ?label) } end macro grouping;