aboutsummaryrefslogtreecommitdiff
path: root/vendor/x11iraf/obm/docs/gui.doc/servercom.html
blob: 16c4c24e055c3c379a7a9e9eb6ad4f816ffe1a73 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<h1><A NAME="serverReset">serverReset</A></h1>
<p>
The "reset-server" command is implemented as a special case in ServerEvaluate.
After doing a true reset ServerEvaluate calls Tcl_Eval to evaluate the full
message which still contains the reset-server command. We want to ignore
this the second time, so we treat the command here as a no-op.
<p>
Usage:
<p>
<pre>
        reset-server
</pre>
<p>
Note: for reset-server to be recognized by ServerEvaluate and really reset
things, it must be the first command in a message to the server.
<p>
<h1><A NAME="appInitialize>appInitialize</A></h1>
<p>
TCL command to initialize the server for a new application, setting the
application name and loading the application resources.
<p>
Usage:	
<p>
<pre>
        appInitialize appname, appclass, resources
</pre>
<p>
<h1><A NAME ="createObjects">createObjects</A></h1>
<p>
TCL command to create the tree of UI objects comprising the user interface.
The object tree is defined by a string valued resource. If no resource is
named the default "objects" resource will be used.
<p>
Usage:
<p>
<pre>
        createObjects [resource-name]
</pre>
<h1><A NAME="destroyObject">destroyObject</A></h1>
<p>
Destroy an object and all of its children.
<p>
Usage:	
<pre>
        destroyObject object-name
</pre>
<p>
<h1><A NAME="activate">activate</A></h1>
Activate the user interface. When called the first time the user interface
is created and activated, thereafter the UI is merely reactivated (e.g.
mapped if unmapped).
<p>
Usage:	
<p>
<pre>
        activate
</pre>
<p>
<h1><A NAME="deactivate">deactivate</A></h1>
<p>
Deactivate the user interface. Optionally unmaps the UI and calls the Obm
client back to let it know that the UI has been deactivated.
<p>
Usage:
<p>
<pre>
        deactivate [unmap]
</pre>
<p>
<h1><A NAME="getResource">getResource</A></h1>
<p>
Get the string value of the specified application resource (window
system parameter). This allows use of the resource mechanism to supply
default values for GUI parameters.
<p>
Usage:
<p>
<pre>
        value = getResource resource-name [class [default-value]]
</pre>
<p>
In the simplest case one merely requests a resource by name and the
string value is returned as the function value. If the resource has
an entry in the fallback resources for the application (appInitialize
resource list) then a value is guaranteed to be returned.
<p>
If the Class name for the resource is given then a class default value
will be returned if no entry is found for the name resource instance. This
is useful when there are a number of resources of the same type (same class).
If most or all resources in the same class have the same default value one
need only make one entry for the Class in the application defaults resource
list. It is up to the application developer to define the class name of a
resource - the class name can be any string. Examples are "Font", "Cursor",
etc. By convention the first character of a class name is capitalized, while
instance names begin with a lower case letter.
<p>
If there is an entry for the named resource in the resource list passed to
appInitialize then a value string is guaranteed to be returned. This will be
either the appInitialize default, or a value specified by the system or the
user in an X resources file. If one is not certain a default value is defined
somewhere, a default value should be specified in the getResource call as
shown above.
<p>
See also getResources, used to get multiple resources in one call.
<p>
<h1><A NAME="getResources">getResources</A></h1>
<p>
Get the string values of a list of resources.
<p>
Usage:
<p>
<pre>
        getResources resource-list
</pre>
<p>
e.g.
<pre>
        getResources {
            { resource [variable class [default-value]]] }
            { resource [variable class [default-value]]] }
            (etc.)
        }
</pre>
<p>
<h1><A NAME="createMenu">createMenu, editMenu</A></h1>
<p>
Create or modify a menu. The editMenu function is an alias for createMenu.
<p>
Usage:
<pre>
        createMenu menu-name parent item-list
</pre>
<p>
e.g.,
<pre>
        createMenu menu-name parent {
            { label function data [options...] }
            { label function data [options...] }
            (etc.)
        }
</pre>
<p>
where
<p>
<pre>
        menu-name is the object name for the menu popup shell
        parent    is the parent widget of the menu shell
        label     is a menu item label
        function  is the function to be performed when the menu
        item      is selected, e.g., f.exec, f.data, f.space, or f.line.
        data      is function dependent data
        options   are option-name option-value pairs, as specified
                  below.
</pre>
<p>
In the item list the fields label and option-value may be any Tcl expression.
Expressions are evaluated in the server context. The data field is a Tcl
script to be executed when the menu item is selected.
<p>
Options are specified as "option option-value". The menu item options are
as follows.
<p>
<pre>
        bitmap       A bitmap to be displayed left justified in the label field
                     (e.g. to indicate a parameter setting).
        sensitive    Specifies whether the menu item is active (sensitive=true)
                     or inactive (sensitive=false, item grayed out).
        accelerator  Specifies an input translation (accelerator, e.g.,
                     keyboard event) which can be used to execute the
                     menu item.
</pre>
<p>
The option-value field may be any Tcl expression.
<p>
Example:
<p>
<pre>
        createMenu fileMenu toplevel {
            { "File Menu" f.title}
            { Open f.exec openFile}
            { Save f.exec saveFile}
            { Load f.menu loadMenu}
            { no-label f.line }
            { Quit f.exec "send client Quit" }
        }
</pre>
<p>
The first createMenu is called for a given menu the menu is created, added
to the menu list, and all window system widgets are created for the menu.
Subsequent calls will result in only the changed parts of the menu being
altered provided the changes are not great. Hence this routine can be called
to efficiently modify a menu when minor runtime changes occur, e.g., an
item label or action changes, the item value changes state, and so on,
without need for the GUI code to know how to make the necessary detailed
changes to the widgets used to implement the menu.
<p>
<h1><A NAME="destroyMenu">destroyMenu</A></h1>
<p>
Destroy a menu. This can be used to free up the resources used by a
menu, e.g., if the menu is not expected to be needed again for a while.
<p>
Usage:
<p>
<pre>
        destroyMenu menu-name
</pre>
<p>
<h1><A NAME="createBitmap">createBitmap</A></h1>
<p>
Create a named bitmap. This replaces any old bitmap of the same name. The
new bitmap is cached in server memory; when a widget bitmap resource is set,
the bitmap cache will be searched for the named bitmap before asking Xlib
to find the bitmap.
<p>
Usage:
<p>
<pre>
        createBitmap name width height data
</pre>
<p>
e.g., 
<p>
<pre>
        createBitmap foo 16 16 {
            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,
            0x60,0x03,0x20,0x02,0x60,0x03,0xc0,0x01,0x00,0x00,0x00,0x00,
            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }
<p>
<h1><A NAME="createCursor">createCursor</A></h1>
<p>
Create a cursor from bitmap data. The cursor is entered into the server's
cursor cache and will override any existing entry of the same name.
<p>
Usage:
<p>
<pre>
        createCursor name source mask fg_color bg_color x_hot y_hot
</pre>
<p>
e.g., 
<p>
<pre>
        createCursor foo bitmap1 bitmap2 black white 8 8
</pre>
<p>
The named bitmaps must be created first with createBitmap.
<p>
<h1><A NAME="createPixmap">createPixmap</A></h1>
<p>
Create a named pixmap. This replaces any old pixmap of the same name. The
new pixmap is cached in server memory; when a widget pixmap resource is set,
the pixmap cache will be searched for the named pixmap before asking Xlib
to find the pixmap.
<p>
Usage:
<p>
<pre>
        createPixmap name width height depth fg_color bg_color data
</pre>
<p>
e.g., 
<p>
<pre>
        createPixmap foo 16 16 8 black white {
            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,
            0x60,0x03,0x20,0x02,0x60,0x03,0xc0,0x01,0x00,0x00,0x00,0x00,
            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }
</pre>
<p>
<h1><A NAME="print">print</A></h1>
<p>
Print a string on the standard output. This is used mainly for debugging
user interfaces.
<p>
Usage:
<p>
<pre>
        print arg [arg ...]
</pre>
<p>
<h1><A NAME="send">send</A></h1>
<p>
Send a message to an object. The object interprets the message and returns
a function value as the string result of the TCL command.
<p>
Usage
<p>
<pre>
        send &lt;object&gt; &lt;message&gt;
</pre>
<p>
<h1><A NAME="postActivateCallback">postActivateCallback</A></h1>
<p>
Post a callback procedure to be called when the UI is activated. The UI is
activated when it is first downloaded to server, but it may also be
activated (reactivated) after the application has exited and is later
restarted, or when the UI is deactivated and reactivated. Note 
that the UI state vis-a-vis the external world (client application) may
no longer be accurate after it has been idle for a time and then reactivated.
<p>
Usage:
<p>
<pre>
        postActivateCallback &lt;procedure&gt;
</pre>
<p>
<p>
<h1><A NAME="postTimedCallback">postTimedCallback</A></h1>
<p>
Post a callback to call the named procedure back after a specified delay
in milliseconds.
<p>
Usage:
<p>
<pre>
        id = postTimedCallback procedure msec [client-data]
</pre>
<p>
After the specified delay the user callback procedure will be called with
client_data (if given) as the single argument. Only one call will be made;
the client must repost the callback in each call if the procedure is to be
repeatedly executed.
<p>
An ID value is returned which may be passed to deleteTimedCallback to delete
the timer.
<p>
<h1><A NAME="deleteTimedCallback">deleteTimedCallback</A></h1>
<p>
Delete a timer callback procedure. This procedure is typically used to
break a timer loop, where the timer procedure repeatedly reposts itself at
the end of each interval.
<p>
Usage:
<p>
<pre>
        deleteTimedCallback id
</pre>
<p>
The ID string is returned by postTimedCallback when a timer is posted.
<p>
<h1><A NAME="postWorkCallback">postWorkCallback</A></h1>
<p>
Post a callback for a procedure to be called when the server is idle.
Work procedures are used to perform computations in the background while
the user interface remains active and able to respond to input events.
This works only if the user work procedure does its job in small increments,
doing only a small amount of processing in each call. The work procedure
will be called repeatedly until it returns a status indicating that it has
finished its task.
<p>
Usage:
<p>
<pre>
        id = postWorkCallback procedure [client-data]
</pre>
<p>
When the server has nothing else to do the user work procedure will be
called with client_data (if given) as the single argument. The work procedure
should return the string "done" when all processing is finished, or any other
string if the procedure is to be called again.
<p>
An ID value is returned which may be passed to deleteWorkCallback to delete
the work procedure.
<p>
<h1><A NAME="deleteWorkCallback">deleteWorkCallback</A></h1>
<p>
Delete a work callback procedure.
<p>
Usage:
<p>
<pre>
        deleteWorkCallback id
</pre>
<p>
The ID string is returned by postWorkCallback when a work procedure is posted.