Mercurial > hg > xemacs-beta
comparison man/widget.texi @ 2028:2ba4f06a264d
[xemacs-hg @ 2004-04-19 08:02:27 by stephent]
texi doc improvements <87zn98wg4q.fsf@tleepslib.sk.tsukuba.ac.jp>
author | stephent |
---|---|
date | Mon, 19 Apr 2004 08:02:38 +0000 |
parents | 8d350b095c21 |
children | 1094d6d400fb |
comparison
equal
deleted
inserted
replaced
2027:71477bc21fe8 | 2028:2ba4f06a264d |
---|---|
38 | 38 |
39 @node Introduction, User Interface, Top, Top | 39 @node Introduction, User Interface, Top, Top |
40 @comment node-name, next, previous, up | 40 @comment node-name, next, previous, up |
41 @section Introduction | 41 @section Introduction |
42 | 42 |
43 Most graphical user interface toolkits, such as Motif and XView, provide | 43 @c XEmacs changes to reflect history, native widgets, and GTK |
44 Most graphical user interface toolkits, since Motif and XView, provide | |
44 a number of standard user interface controls (sometimes known as | 45 a number of standard user interface controls (sometimes known as |
45 `widgets' or `gadgets'). Emacs doesn't really support anything like | 46 `widgets' or `gadgets'). Historically, Emacs didn't support anything like |
46 this, except for an incredible powerful text ``widget''. On the other | 47 this, except for its incredible powerful text ``widget''. However, |
47 hand, Emacs does provide the necessary primitives to implement many | 48 since XEmacs 21.4, XEmacs has supported ``native'' widgets (GUI controls |
48 other widgets within a text buffer. The @code{widget} package | 49 implemented as Lisp APIs in C for the MS Windows, Motif, Athena, and GTK |
49 simplifies this task. | 50 toolkits) and libglade (GUI controls with an XML API for the GTK |
50 | 51 toolkit). On the other hand, Emacs does provide the necessary |
51 The basic widgets are: | 52 primitives to implement many other widgets within a text buffer, and of |
53 course this is the only way to implement self-contained controls in a | |
54 text terminal. The @code{widget} package simplifies this task. | |
55 | |
56 Examples of some basic widgets include: | |
52 | 57 |
53 @table @code | 58 @table @code |
54 @item link | 59 @item link |
55 Areas of text with an associated action. Intended for hypertext links | 60 Areas of text with an associated action. Intended for hypertext links |
56 embedded in text. | 61 embedded in text. |
81 list. Each list item is itself a widget. | 86 list. Each list item is itself a widget. |
82 @end table | 87 @end table |
83 | 88 |
84 Now of what possible use can support for widgets be in a text editor? | 89 Now of what possible use can support for widgets be in a text editor? |
85 I'm glad you asked. The answer is that widgets are useful for | 90 I'm glad you asked. The answer is that widgets are useful for |
86 implementing forms. A @dfn{form} in emacs is a buffer where the user is | 91 implementing forms. A @dfn{form} in Emacs is a buffer where the user is |
87 supposed to fill out a number of fields, each of which has a specific | 92 supposed to fill out a number of fields, each of which has a specific |
88 meaning. The user is not supposed to change or delete any of the text | 93 meaning. The user is not supposed to change or delete any of the text |
89 between the fields. Examples of forms in Emacs are the @file{forms} | 94 between the fields. Examples of forms in Emacs are the @file{forms} |
90 package (of course), the customize buffers, the mail and news compose | 95 package (of course), the customize buffers, the mail and news compose |
91 modes, and the @sc{html} form support in the @file{w3} browser. | 96 modes, and the @sc{html} form support in the @file{w3} browser. |
98 More complex fields than just editable text are supported. | 103 More complex fields than just editable text are supported. |
99 @item | 104 @item |
100 You can give the user immediate feedback if he enters invalid data in a | 105 You can give the user immediate feedback if he enters invalid data in a |
101 text field, and sometimes prevent entering invalid data. | 106 text field, and sometimes prevent entering invalid data. |
102 @item | 107 @item |
103 You can have fixed sized fields, thus allowing multiple field to be | 108 You can have fixed sized fields, thus allowing multiple fields to be |
104 lined up in columns. | 109 lined up in columns. |
105 @item | 110 @item |
106 It is simple to query or set the value of a field. | 111 It is simple to query or set the value of a field. |
107 @item | 112 @item |
108 Editing happens in buffer, not in the mini-buffer. | 113 Editing happens in a normal buffer, not in the mini-buffer. |
109 @item | 114 @item |
110 Packages using the library get a uniform look, making them easier for | 115 Packages using the library get a uniform look-and-feel, making them easier for |
111 the user to learn. | 116 the user to learn. |
112 @item | 117 @item |
113 As support for embedded graphics improve, the widget library will | 118 As support for embedded graphics has improved, the widget library will |
114 extended to support it. This means that your code using the widget | 119 extended to support it. This means that your code using the widget |
115 library will also use the new graphic features by automatic. | 120 library will also use the new graphic features automatically. |
121 @item | |
122 A widget specification is implemented as a class, and new subclasses can | |
123 be derived from any class, by restricting or extending the behavior. | |
116 @end enumerate | 124 @end enumerate |
117 | 125 |
118 In order to minimize the code that is loaded by users who does not | 126 In order to minimize the code that is loaded by users who does not |
119 create any widgets, the code has been split in two files: | 127 create any widgets, the code has been split in two files: |
120 | 128 |
121 @table @file | 129 @table @file |
122 @item widget.el | 130 @item widget.el |
123 This will declare the user variables, define the function | 131 This declares the user variables, defines the function |
124 @code{define-widget}, and autoload the function @code{widget-create}. | 132 @code{define-widget}, and autoloads the function @code{widget-create}. |
125 @item wid-edit.el | 133 @item wid-edit.el |
126 Everything else is here, there is no reason to load it explicitly, as | 134 Everything else is here. Do not load it explicitly, as |
127 it will be autoloaded when needed. | 135 it will be autoloaded when needed. |
128 @end table | 136 @end table |
129 | 137 |
130 @node User Interface, Programming Example, Introduction, Top | 138 @node User Interface, Programming Example, Introduction, Top |
131 @comment node-name, next, previous, up | 139 @comment node-name, next, previous, up |
166 @b{( )} A Final One. | 174 @b{( )} A Final One. |
167 | 175 |
168 @b{[Apply Form]} @b{[Reset Form]} | 176 @b{[Apply Form]} @b{[Reset Form]} |
169 @end example | 177 @end example |
170 | 178 |
171 The top level widgets in is example are tagged @samp{Name}, | 179 The top level widgets in this example are tagged @samp{Name}, |
172 @samp{Choose}, @samp{Address}, @samp{_other work_}, @samp{Numbers}, | 180 @samp{Choose}, @samp{Address}, @samp{_other work_}, @samp{Numbers}, |
173 @samp{Select multiple}, @samp{Select one}, @samp{[Apply Form]}, and | 181 @samp{Select multiple}, @samp{Select one}, @samp{[Apply Form]}, and |
174 @samp{[Reset Form]}. There are basically two thing the user can do within | 182 @samp{[Reset Form]}. There are basically two thing the user can do within |
175 a form, namely editing the editable text fields and activating the | 183 a form, namely editing the editable text fields and activating the |
176 buttons. | 184 buttons. |