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

KEY BINDINGS

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

SEE ALSO

483       cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3), cdk_screen(3)
484

NOTES

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