1cdk_fselect(3)             Library Functions Manual             cdk_fselect(3)
2
3
4

NAME

6       cdk_fselect - curses file selector widget.
7

SYNOPSIS

9       cc [ flag ... ] file ...  -lcdk [ library ... ]
10
11       #include <cdk.h>
12
13       char *activateCDKFselect (
14                      CDKFSELECT *fselect,
15                      chtype *actions);
16
17       void deleteFileCB (
18                      EObjectType objectType,
19                      void *object,
20                      void *clientData);
21
22       void destroyCDKFselect (
23                      CDKFSELECT *fselect);
24
25       void drawCDKFselect (
26                      CDKFSELECT *fselect,
27                      boolean box);
28
29       void eraseCDKFselect (
30                      CDKFSELECT *fselect);
31
32       boolean getCDKFselectBox (
33                      CDKFSELECT *fselect);
34
35       char **getCDKFselectContents (
36                      CDKFSELECT *widget,
37                      int *size);
38
39       int getCDKFselectCurrentItem (
40                      CDKFSELECT *widget);
41
42       char *getCDKFselectDirAttribute (
43                      CDKFSELECT *fselect);
44
45       char **getCDKFselectDirContents (
46                      CDKFSELECT *fselect,
47                      int *count);
48
49       char *getCDKFselectDirectory (
50                      CDKFSELECT *fselect);
51
52       char *getCDKFselectFileAttribute (
53                      CDKFSELECT *fselect);
54
55       chtype getCDKFselectFillerChar (
56                      CDKFSELECT *fselect);
57
58       chtype getCDKFselectHighlight (
59                      CDKFSELECT *fselect);
60
61       char *getCDKFselectLinkAttribute (
62                      CDKFSELECT *fselect);
63
64       char *getCDKFselectSocketAttribute (
65                      CDKFSELECT *fselect);
66
67       char *injectCDKFselect (
68                      CDKFSELECT *fselect,
69                      chtype input);
70
71       void moveCDKFselect (
72                      CDKFSELECT *fselect,
73                      int xpos,
74                      int ypos,
75                      boolean relative,
76                      boolean refresh);
77
78       CDKFSELECT *newCDKFselect (
79                      CDKSCREEN *cdkscreen,
80                      int xpos,
81                      int ypos,
82                      int height,
83                      int width,
84                      const char *title,
85                      const char *label,
86                      chtype fieldAttribute,
87                      chtype fillerCharacter,
88                      chtype highlight,
89                      const char *dirAttribute,
90                      const char *fileAttribute,
91                      const char *linkAttribute,
92                      const char *sockAttribute,
93                      boolean box,
94                      boolean shadow);
95
96       void positionCDKFselect (
97                      CDKFSELECT *fselect);
98
99       void setCDKFselect (
100                      CDKFSELECT *fselect,
101                      const char *directory,
102                      chtype fieldAttribute,
103                      chtype fillerCharacter,
104                      chtype highlight,
105                      const char *dirAttribute,
106                      const char *fileAttribute,
107                      const char *linkAttribute,
108                      const char *sockAttribute,
109                      boolean box);
110
111       void setCDKFselectBackgroundAttrib (
112                      CDKFSELECT *fselect,
113                      chtype attribute);
114
115       void setCDKFselectBackgroundColor (
116                      CDKFSELECT *fselect,
117                      const char * color);
118
119       void setCDKFselectBox (
120                      CDKFSELECT *fselect,
121                      boolean box);
122
123       void setCDKFselectBoxAttribute (
124                      CDKFSELECT *fselect,
125                      chtype character);
126
127       void setCDKFselectContents (
128                      CDKFSELECT *widget,
129                      CDK_CONST char **list,
130                      int listSize);
131
132       void setCDKFselectCurrentItem (
133                      CDKFSELECT *widget,
134                      int item);
135
136       void setCDKFselectDirAttribute (
137                      CDKFSELECT *fselect,
138                      const char *attribute);
139
140       int setCDKFselectDirContents (
141                      CDKFSELECT *fselect);
142
143       int setCDKFselectDirectory (
144                      CDKFSELECT *fselect,
145                      const char *directory);
146
147       void setCDKFselectFileAttribute (
148                      CDKFSELECT *fselect,
149                      const char *attribute);
150
151       void setCDKFselectFillerChar (
152                      CDKFSELECT *fselect,
153                      chtype filler);
154
155       void setCDKFselectHighlight (
156                      CDKFSELECT *fselect,
157                      chtype highlight);
158
159       void setCDKFselectHorizontalChar (
160                      CDKFSELECT *fselect,
161                      chtype character);
162
163       void setCDKFselectLLChar (
164                      CDKFSELECT *fselect,
165                      chtype character);
166
167       void setCDKFselectLRChar (
168                      CDKFSELECT *fselect,
169                      chtype character);
170
171       void setCDKFselectLinkAttribute (
172                      CDKFSELECT *fselect,
173                      const char *attribute);
174
175       void setCDKFselectSocketAttribute (
176                      CDKFSELECT *fselect,
177                      const char *attribute);
178
179       void setCDKFselectULChar (
180                      CDKFSELECT *fselect,
181                      chtype character);
182
183       void setCDKFselectURChar (
184                      CDKFSELECT *fselect,
185                      chtype character);
186
187       void setCDKFselectVerticalChar (
188                      CDKFSELECT *fselect,
189                      chtype character);
190

DESCRIPTION

192       The  Cdk  file  selector widget creates a widget which allows a user to
193       interact with the Unix file system.  This widget  allows  the  user  to
194       traverse  the  file system and even delete files.  (See NOTES below for
195       more information)
196

AVAILABLE FUNCTIONS

198       activateCDKFselect
199            activates the file selector widget and lets the user interact with
200            the widget.
201
202            ·   The parameter fselect is a pointer to a non-NULL file selector
203                widget.
204
205            ·   If the actions parameter is passed with a non-NULL value,  the
206                characters in the array will be injected into the widget.
207
208                To  activate  the  widget interactively pass in a NULL pointer
209                for actions.
210
211            If the character entered into this widget is RETURN  or  TAB  then
212            this  function  will  return a char * representing the information
213            typed into the widget and the widget data exitType will be set  to
214            vNORMAL.
215
216            If  the character entered was ESCAPE then the function will return
217            NULL pointer and the widget data exitType is set to vESCAPE_HIT.
218
219       deleteFileCB
220            Prompts the user to confirm, and deletes the current item  in  the
221            file-list.
222
223       destroyCDKFselect
224            removes  the  widget  from  the screen and frees memory the object
225            used.
226
227       drawCDKFselect
228            draws the fselect widget on the screen.   If  the  box  option  is
229            true, the widget is drawn with a box.
230
231       eraseCDKFselect
232            removes  the  widget  from  the screen.  This does NOT destroy the
233            widget.
234
235       getCDKFselectBox
236            returns true if the widget will be drawn with a box around it.
237
238       getCDKFselectContents
239            returns the directory-contents (which are formatted), and sets the
240            number of entries via the size parameter.
241
242       getCDKFselectCurrentItem
243            returns the current position in the scroll-widget.
244
245       getCDKFselectDirAttribute
246            returns  the  attribute  that  directories  are  drawn with in the
247            scrolling region of the widget.
248
249       getCDKFselectDirContents
250            returns the list of files and the corresponding count as  a  side-
251            effect.  If no files are found, this function returns zero, other‐
252            wise one.
253
254       getCDKFselectDirectory
255            returns the current directory of the widget.
256
257       getCDKFselectFileAttribute
258            returns the attribute that plain  files  are  drawn  with  in  the
259            scrolling region of the widget.
260
261       getCDKFselectFillerChar
262            returns  the  character  being used as the filler character in the
263            entry field portion of the widget.
264
265       getCDKFselectHighlight
266            returns the attribute of the highlight bar of the  scrolling  list
267            portion of the widget.
268
269       getCDKFselectLinkAttribute
270            returns  the  attribute  that symbolic links are drawn with in the
271            scrolling region of the widget.
272
273       getCDKFselectSocketAttribute
274            returns the attribute that sockets are drawn with in the scrolling
275            region of the widget.
276
277       injectCDKFselect
278            injects a single character into the widget.  The parameter fselect
279            is a pointer to a non-NULL file selector  widget.   The  parameter
280            character  is the character to inject into the widget.  The return
281            value and side-effect (setting the widget  data  exitType)  depend
282            upon the injected character:
283
284            RETURN or TAB
285                   the  function returns a char * representing the information
286                   typed into the widget.  The widget data exitType is set  to
287                   vNORMAL.
288
289            ESCAPE the function returns a NULL pointer.  The widget data exit‐
290                   Type is set to vESCAPE_HIT.
291
292            Otherwise
293                   unless modified by  preprocessing,  postprocessing  or  key
294                   bindings,  the function returns a NULL pointer.  The widget
295                   data exitType is set to vEARLY_EXIT.
296
297       moveCDKFselect
298            moves the given widget to the given position.
299
300            ·   The parameters xpos and ypos are the new position of the  wid‐
301                get.
302
303            ·   The parameter xpos may be an integer or one of the pre-defined
304                values TOP, BOTTOM, and CENTER.
305
306            ·   The parameter ypos may be an integer or one of the pre-defined
307                values LEFT, RIGHT, and CENTER.
308
309            ·   The  parameter relative states whether the xpos/ypos pair is a
310                relative move or an absolute move.
311
312                For example, if xpos = 1 and ypos = 2  and  relative  =  TRUE,
313                then the widget would move one row down and two columns right.
314                If the value of relative was FALSE, then the widget would move
315                to  the  position  (1,2).   Do not use the values TOP, BOTTOM,
316                LEFT, RIGHT, or CENTER when relative =  TRUE.   (weird  things
317                may happen).
318
319            ·   The  final  parameter  refresh is a boolean value which states
320                whether the widget will get refreshed after the move.
321
322       newCDKFselect
323            creates an fselect widget and returns a pointer  to  it.   Parame‐
324            ters:
325
326            ·   The  screen parameter is the screen you wish this widget to be
327                placed in.
328
329            ·   The parameter xpos controls the placement of the object  along
330                the  horizontal axis.  This parameter may be an integer or one
331                of the pre-defined values LEFT, RIGHT, and CENTER.
332
333            ·   ypos controls the placement of the object along  the  vertical
334                axis.   It  may  be an integer value or one of the pre-defined
335                values TOP, BOTTOM, and CENTER.
336
337            ·   height and width control the height and width of  the  widget.
338                If you provide a value of zero for either of the height or the
339                width, the widget will be created  with  the  full  width  and
340                height  of  the  screen.  If you provide a negative value, the
341                widget will be created the full  height  or  width  minus  the
342                value provided.
343
344            ·   title  is the string which will be displayed at the top of the
345                widget.  The title can be more than one line; just  provide  a
346                carriage return character at the line break.
347
348            ·   label is the text to use as the label of the file selector.
349
350            ·   fieldAttribute  is the attribute of the entry field at the top
351                of the widget;
352
353            ·   fillerCharacter is the filler character for the entry field.
354
355            ·   highlight is the highlight attribute on the scrolling list.
356
357            ·   dirAttribute, fileAttribute, linkAttribute  and  sockAttribute
358                are  the  attributes of directories, files, links, and sockets
359                found in the directory list.
360
361            ·   box is true if the widget should be drawn with  a  box  around
362                it.
363
364            ·   shadow turns the shadow on or off around this widget.
365
366            If  the  widget  could  not  be  created  then  a  NULL pointer is
367            returned.
368
369       positionCDKFselect
370            allows the user to move the widget around the screen via the  cur‐
371            sor/keypad keys.  See cdk_position (3) for key bindings.
372
373       setCDKFselect
374            lets the programmer modify certain elements of an existing fselect
375            widget.  The parameter names  correspond  to  the  same  parameter
376            names listed in the newCDKFselect function.
377
378       setCDKFselectBackgroundAttrib
379            sets  the  background  attribute  of  the  widget.   The parameter
380            attribute is a curses attribute, e.g., A_BOLD.
381
382       setCDKFselectBackgroundColor
383            sets the background color of the widget.  The parameter  color  is
384            in the format of the Cdk format strings.  See cdk_display (3).
385
386       setCDKFselectBox
387            sets whether the widget will be drawn with a box around it.
388
389       setCDKFselectBoxAttribute
390            sets the attribute of the box.
391
392       setCDKFselectContents
393            sets the contents of the widget.
394
395       setCDKFselectCurrentItem
396            set the current position in the scroll-widget.
397
398       setCDKFselectDirAttribute
399            sets  the  attribute  that  directories  will be drawn with in the
400            scrolling region of  the  widget.   setCDKFselectDirContents  This
401            creates a list of the files in the current directory.  See getCDK‐
402            FselectDirContents.
403
404       setCDKFselectDirectory
405            sets the current directory of the widget.
406
407       setCDKFselectFileAttribute
408            sets the attribute that plain files will  be  drawn  with  in  the
409            scrolling region of the widget.
410
411       setCDKFselectFillerChar
412            sets  the character to use when drawing the entry field portion of
413            the widget.
414
415       setCDKFselectHighlight
416            sets the attribute of the highlight bar of the scrolling list por‐
417            tion of the widget.
418
419       setCDKFselectHorizontalChar
420            sets  the  horizontal  drawing  character for the box to the given
421            character.
422
423       setCDKFselectLLChar
424            sets the lower left hand corner of the widget's box to  the  given
425            character.
426
427       setCDKFselectLRChar
428            sets  the lower right hand corner of the widget's box to the given
429            character.
430
431       setCDKFselectLinkAttribute
432            sets the attribute that symbolic links will be drawn with  in  the
433            scrolling region of the widget.
434
435       setCDKFselectSocketAttribute
436            sets  the  attribute  that  sockets  will  be  drawn  with  in the
437            scrolling region of the widget.
438
439       setCDKFselectULChar
440            sets the upper left hand corner of the widget's box to  the  given
441            character.
442
443       setCDKFselectURChar
444            sets  the upper right hand corner of the widget's box to the given
445            character.
446
447       setCDKFselectVerticalChar
448            sets the vertical drawing character for the box to the given char‐
449            acter.
450

KEY BINDINGS

452       When  the  widget  is  activated there are several default key bindings
453       which will help the user enter or manipulate the  information  quickly.
454       Since  this widget is built from both the scrolling list widget and the
455       entry field widget, the key bindings are the same  for  the  respective
456       fields.  The extra key bindings are listed below.
457
458         ┌────────────────┬─────────────────────────────────────────────────┐
459Key             Action                                          
460         ├────────────────┼─────────────────────────────────────────────────┤
461         ├────────────────┼─────────────────────────────────────────────────┤
462         │CTRL-^          │ Displays statistics about the current filename. │
463         ├────────────────┼─────────────────────────────────────────────────┤
464         │Tab             │ Tries to complete the current filename.         │
465         ├────────────────┼─────────────────────────────────────────────────┤
466         │Up Arrow        │ Scrolls the scrolling list up one line.         │
467         ├────────────────┼─────────────────────────────────────────────────┤
468         │Down Arrow      │ Scrolls the scrolling list down one line.       │
469         ├────────────────┼─────────────────────────────────────────────────┤
470         │Page Up         │ Scrolls the scrolling list up one page.         │
471         ├────────────────┼─────────────────────────────────────────────────┤
472         │CTRL-B          │ Scrolls the scrolling list up one page.         │
473         ├────────────────┼─────────────────────────────────────────────────┤
474         │Page Down       │ Scrolls the scrolling list down one page.       │
475         ├────────────────┼─────────────────────────────────────────────────┤
476         │CTRL-F          │ Scrolls the scrolling list down one page.       │
477         ├────────────────┼─────────────────────────────────────────────────┤
478         │Return          │ Returns  the filename in the entry field of the │
479         │                │ file selector.  It also sets  the  widget  data │
480         │                │ exitType to vNORMAL.                            │
481         ├────────────────┼─────────────────────────────────────────────────┤
482         │Escape          │ Exits  the  widget  and returns a NULL pointer. │
483         │                │ It  also  sets  the  widget  data  exitType  to │
484         │                │ vESCAPE_HIT.                                    │
485         └────────────────┴─────────────────────────────────────────────────┘

SEE ALSO

487       cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3), cdk_screen(3)
488

NOTES

490       This  widget  is  created from the scrolling list widget, and the entry
491       field widget.  This is a good example on how to build your own  widgets
492       using the base widgets provided in this distribution.  In order for you
493       to delete files using the file selector, you  must  add  the  following
494       call  into your program.  (the character X is the character you wish to
495       use to tell the file selector you want to delete a file.)
496            bindCDKObject (vSCROLL,  fselect->filelist,  X,  deleteFile,  fse‐
497            lect);
498       where  fselect  is a pointer to the object.  This was originally turned
499       on, but I thought it better to put the control of file deletion  on  an
500       'as-need' basis.
501
502
503
504                                                                cdk_fselect(3)
Impressum