/[snow]/trunk/docs/widget-reference.html
ViewVC logotype

Diff of /trunk/docs/widget-reference.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2 by astalla, Wed Sep 30 20:06:52 2009 UTC revision 79 by astalla, Thu Apr 29 18:59:28 2010 UTC
# Line 7  Line 7 
7  <h1>Snow Widget Reference</h1>  <h1>Snow Widget Reference</h1>
8  <h3>Common properties</h3>  <h3>Common properties</h3>
9  These properties are available on every widget, unless stated otherwise.  These properties are available on every widget, unless stated otherwise.
10  <table border="1">  <hr />
11    <tr>  <h2><code>id</code></h2>
12      <th>Name</th>  <strong>Type:</strong> symbol<br />
13      <th style="width: 30%;">Type</th>  <strong>Description:</strong> This pseudo-property has several uses:
14      <th style="width: 30%;">Description</th>  <ul>
15      <th>Examples</th>    <li>if a lexical variable with the same name as the id exists, it will be assigned the widget.</li>
16      <th>Notes</th>    <li>if the widget is a container, a lexical variable with the same name as the id will be bound to the widget around the body of the container.</li>
17    </tr>    </li>
18    <tr>    <li>if a Java backing bean is used (as the value of *backing-bean*), and it has a property with the same name as the id, it will be injected the widget through the setter method of that property. The name of the id symbol will be translated from lisp-hyphenated-convention to javaCamelCasedConvention.</li>
19      <td style="text-align: center;"><strong><code>id</code></strong></td>  </ul>
20      <td style="text-align: center;">symbol</td>  <strong>Examples:</strong>
21      <td>Binds a lexical variable to the current widget locally to the widget body.</td>  <pre class="paste-area">
22      <td><pre class="paste-area">  (frame (:id foo) foo)
23  (frame (:id foo)  ==> #&lt;javax.swing.JFrame ...frame.toString()... {identityHashCode}&gt;
24    (print foo))</pre></td>  
25      <td>For containers only.</td>  (let (bar)
26    </tr>    (label :id bar)
27    <tr>    bar)
28      <td style="text-align: center;"><strong><code>layout-manager</code></strong></td>  ==> #&lt;javax.swing.JLabel ...label.toString()... {identityHashCode}&gt;</pre>
29      <td>  <hr />
30    <h2><code>layout-manager</code></h2>
31    <strong>Type:</strong> a member of the following set of values:
32        <ul>        <ul>
33          <li>one of :default, :mig, :border, :box, :flow</li>          <li>one of :default, :mig, :border, :box, :flow</li>
34          <li>a list whose car is one of the above and whose cdr are additional arguments</li>          <li>a list whose car is one of the above and whose cdr are additional arguments</li>
35          <li>a native Java layout manager.</li>          <li>a native Java layout manager.</li>
36        </ul>        </ul>
37      </td>  <strong>Description:</strong> Sets the policy for laying out the component's children. For containers only. If not specified, defaults to :default - which is the same as :mig, i.e., MiGLayout is used.<br />
38      <td>Sets the policy for laying out the component's children.</td>  <strong>Examples:</strong>
39      <td><pre class="paste-area">  <pre class="paste-area">
40  (panel (:layout-manager '(:box :y))  (panel (:layout-manager '(:box :y))
41    (label :text &quot;First Line&quot;)    (label :text &quot;First Line&quot;)
42    (label :text &quot;Second Line&quot;))</pre></td>    (label :text &quot;Second Line&quot;))</pre>
43      <td>For containers only.</td>  <hr />
44    </tr>  <h2><code>layout</code></h2>
45    <tr>  <strong>Type:</strong> string<br />
46      <td style="text-align: center;"><strong><code>layout</code></strong></td>  <strong>Description:</strong> Constraints used to control how the component is to be laid out in its container. The possible values and their meaning depend on the layout manager of the container.<br />
47      <td style="text-align: center;">string</td>  <strong>Examples:</strong>
48      <td>Constraints used to control how the component is to be laid out in its container. The possible values and their meaning depend on the layout manager of the container.</td>  <pre class="paste-area">
     <td><pre class="paste-area">  
49  (panel ()  (panel ()
50    (label :layout &quot;grow, wrap&quot;    (label :layout &quot;grow, wrap&quot; :text "hello")
51           :text "hello")    (label :text &quot;world&quot;))</pre>
52    (label :text &quot;world&quot;))</pre></td>  <hr />
53      <td><br /></td>  <h2><code>enabled-p</code></h2>
54    </tr>  <strong>Type:</strong> boolean<br />
55    <tr>  <strong>Description:</strong> Controls whether the widget is enabled (able to receive user input).
56      <td style="text-align: center;"><strong><code>enabled-p</code></strong></td>  <hr />
57      <td style="text-align: center;">boolean</td>  <h2><code>size</code></h2>
58      <td>Controls whether the widget is enabled (able to receive user input).</td>  <strong>Type:</strong> complex<br />
59      <td><br /></td>  <strong>Description:</strong> Sets the size of the widget. The size is represented as a complex number whose real part is the Width and imaginary part is the Height.<br />
60      <td><br /></td>  <strong>Example:</strong>
61    </tr>  <pre class="paste-area">(frame (:size #C(800 600)))</pre>
62    <tr>  <hr />
63      <td style="text-align: center;"><strong><code>size</code></strong></td>  <h2><code>label</code></h2>
64      <td style="text-align: center;">complex</td>  <strong>Type:</strong> a label widget.<br />
65      <td>Sets the size of the widget.</td>  <strong>Description:</strong> Connects a label to this widget. Typically, clicking on the label will bring focus on the widget.<br />
66      <td><pre class="paste-area">  <strong>Examples:</strong>
67  (frame (:size #C(800 600)))</pre></td>  <pre class="paste-area">
68      <td>The size is represented as a complex number whose real part is the Width and imaginary part is the Height.</td>  (let (lbl)
69    </tr>    (label :id lbl :text "User Name: ")
70  </table>    (text-field :label lbl))</pre>
71    Or, shorter, using an inline label:
72    <pre class="paste-area">
73    (text-field :label (label :text "User Name: "))</pre>
74    <hr />
75  <h3>Widgets</h3>  <h3>Widgets</h3>
76  Here's a summary of the widgets (GUI components) currently available in Snow. The &quot;C&quot; column indicates whether the widget is a container. You can follow the hyperlink on a widget's name to read about its properties.  Here's a summary of the widgets (GUI components) currently available in Snow. The &quot;C&quot; column indicates whether the widget is a container. You can follow the hyperlink on a widget's name to read about its properties.<br /><br />
77  <table border="1">  <table border="1">
78    <tr>    <tr>
79      <th rowspan="2">Name</th>      <th>Name</th>
80      <th rowspan="2">Description</th>      <th>Description</th>
81      <th rowspan="2">C</th>      <th>C</th>
82      <th>Backend</th>      <th>Examples</th>
83      <th rowspan="2">Examples</th>      <th>Notes</th>
     <th rowspan="2">Notes</th>  
   </tr>  
   <tr>  
     <th>Swing</th>  
84    </tr>    </tr>
85    <tr>    <tr>
86      <td style="text-align: center;"><strong><a href="#button_props"><code>button</code></a></strong></td>      <td style="text-align: center;"><strong><a href="#button_props"><code>button</code></a></strong></td>
87      <td>A button with text on it.</td>      <td>A button with text on it.</td>
88      <td><br /></td>      <td><br /></td>
     <td style="text-align: center;">Y</td>  
89      <td><pre class="paste-area">      <td><pre class="paste-area">
90  (button :text "Ok!")</pre></td>  (button :text "Ok!")</pre></td>
91      <td><br /></td>      <td><br /></td>
# Line 94  Here's a summary of the widgets (GUI com Line 94  Here's a summary of the widgets (GUI com
94      <td style="text-align: center;"><strong><code>check-box</code></strong></td>      <td style="text-align: center;"><strong><code>check-box</code></strong></td>
95      <td>A checkbox with optional text.</td>      <td>A checkbox with optional text.</td>
96      <td><br /></td>      <td><br /></td>
     <td style="text-align: center;">Y</td>  
97      <td><pre class="paste-area">      <td><pre class="paste-area">
98  (check-box :text "Enabled")</pre></td>  (check-box :text "Enabled")</pre></td>
99      <td><br /></td>      <td><br /></td>
# Line 103  Here's a summary of the widgets (GUI com Line 102  Here's a summary of the widgets (GUI com
102      <td style="text-align: center;"><strong><code>frame</code></strong></td>      <td style="text-align: center;"><strong><code>frame</code></strong></td>
103      <td>A top-level window.</td>      <td>A top-level window.</td>
104      <td style="text-align: center;">Y</td>      <td style="text-align: center;">Y</td>
     <td style="text-align: center;">Y</td>  
105      <td><pre class="paste-area">      <td><pre class="paste-area">
106  (frame (:title "A frame" :on-close :exit)  (frame (:title "A frame" :on-close :exit)
107    (label :text "push")    (label :text "push")
# Line 114  Here's a summary of the widgets (GUI com Line 112  Here's a summary of the widgets (GUI com
112      <td style="text-align: center;"><strong><code>label</code></strong></td>      <td style="text-align: center;"><strong><code>label</code></strong></td>
113      <td>Read-only text.</td>      <td>Read-only text.</td>
114      <td><br /></td>      <td><br /></td>
     <td style="text-align: center;">Y</td>  
115      <td><pre class="paste-area">      <td><pre class="paste-area">
116  (label :text "Hello")</pre></td>  (label :text "Hello")</pre></td>
117      <td><br /></td>      <td><br /></td>
# Line 123  Here's a summary of the widgets (GUI com Line 120  Here's a summary of the widgets (GUI com
120      <td style="text-align: center;"><strong><code>list-widget</code></strong></td>      <td style="text-align: center;"><strong><code>list-widget</code></strong></td>
121      <td>Displays a list of strings.</td>      <td>Displays a list of strings.</td>
122      <td><br /></td>      <td><br /></td>
     <td style="text-align: center;">Y</td>  
123      <td><pre class="paste-area">      <td><pre class="paste-area">
124  (list-widget :model (make-cons-list-model '("foo" "bar" "baz")))</pre></td>  (list-widget :model (make-cons-list-model '("foo" "bar" "baz")))</pre></td>
125      <td>Not named list to avoid clashing with the commonly used function by the same name in the COMMON-LISP package.</td>      <td>Not named list to avoid clashing with the commonly used function by the same name in the COMMON-LISP package.</td>
# Line 132  Here's a summary of the widgets (GUI com Line 128  Here's a summary of the widgets (GUI com
128      <td style="text-align: center;"><strong><code>panel</code></strong></td>      <td style="text-align: center;"><strong><code>panel</code></strong></td>
129      <td>A generic container for other components.</td>      <td>A generic container for other components.</td>
130      <td style="text-align: center;">Y</td>      <td style="text-align: center;">Y</td>
     <td style="text-align: center;">Y</td>  
131      <td><pre class="paste-area">      <td><pre class="paste-area">
132  (panel ()  (panel ()
133    (label :text "push")    (label :text "push")
# Line 143  Here's a summary of the widgets (GUI com Line 138  Here's a summary of the widgets (GUI com
138      <td style="text-align: center;"><strong><code>scroll</code></strong></td>      <td style="text-align: center;"><strong><code>scroll</code></strong></td>
139      <td>A container for a single child, providing scrollbar support.</td>      <td>A container for a single child, providing scrollbar support.</td>
140      <td style="text-align: center;">Y</td>      <td style="text-align: center;">Y</td>
     <td style="text-align: center;">Y</td>  
141      <td><pre class="paste-area">      <td><pre class="paste-area">
142  (scroll ()  (scroll ()
143    (text-area :text "very, very, ..., long text"))</pre></td>    (text-area :text "very, very, ..., long text"))</pre></td>
# Line 153  Here's a summary of the widgets (GUI com Line 147  Here's a summary of the widgets (GUI com
147      <td style="text-align: center;"><strong><code>text-area</code></strong></td>      <td style="text-align: center;"><strong><code>text-area</code></strong></td>
148      <td>Allows the user to enter multiple lines of text.</td>      <td>Allows the user to enter multiple lines of text.</td>
149      <td><br /></td>      <td><br /></td>
     <td style="text-align: center;">Y</td>  
150      <td><pre class="paste-area">      <td><pre class="paste-area">
151  (text-area :text "type something here")</pre></td>  (text-area :text "type something here")</pre></td>
152      <td><br /></td>      <td><br /></td>
# Line 162  Here's a summary of the widgets (GUI com Line 155  Here's a summary of the widgets (GUI com
155      <td style="text-align: center;"><strong><code>text-field</code></strong></td>      <td style="text-align: center;"><strong><code>text-field</code></strong></td>
156      <td>Allows the user to enter a single line of text.</td>      <td>Allows the user to enter a single line of text.</td>
157      <td><br /></td>      <td><br /></td>
     <td style="text-align: center;">Y</td>  
158      <td><pre class="paste-area">      <td><pre class="paste-area">
159  (text-field :text "type something here")</pre></td>  (text-field :text "type something here")</pre></td>
160      <td><br /></td>      <td><br /></td>
# Line 171  Here's a summary of the widgets (GUI com Line 163  Here's a summary of the widgets (GUI com
163      <td style="text-align: center;"><strong><code>tree</code></strong></td>      <td style="text-align: center;"><strong><code>tree</code></strong></td>
164      <td>Displays hierarchical data in the form of a tree with expandable/collapsible nodes.</td>      <td>Displays hierarchical data in the form of a tree with expandable/collapsible nodes.</td>
165      <td><br /></td>      <td><br /></td>
     <td style="text-align: center;">Y</td>  
166      <td><pre class="paste-area">      <td><pre class="paste-area">
167  (tree :model (make-cons-tree-model '("foo" ("bar" "baz"))))</pre></td>  (tree :model (make-cons-tree-model '("foo" ("bar" "baz"))))</pre></td>
168      <td><br /></td>      <td><br /></td>

Legend:
Removed from v.2  
changed lines
  Added in v.79

  ViewVC Help
Powered by ViewVC 1.1.5