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

NAME

6       cdk_util - Cdk utility functions
7

SYNOPSIS

9       cc [ flag ... ] file ...  -lcdk [ library ... ]
10
11       #include <cdk.h>
12
13       int CDKgetDirectoryContents (
14                      char *directory,
15                      char ***list);
16
17       int CDKreadFile (
18                      char *filename,
19                      char ***info);
20
21       void alignxy ( WINDOW *window,
22                      int *xpos,
23                      int *ypos,
24                      int boxWidth,
25                      int boxHeight);
26
27       chtype *char2Chtype (
28                      char *string,
29                      int *length,
30                      int *align);
31
32       EDisplayType char2DisplayType (
33                      char *string);
34
35       int checkForLink (
36                      char *line,
37                      char *filename);
38
39       char *chtype2String (
40                      chtype *string);
41
42       void deleteCursesWindow (
43                      WINDOW *window);
44
45       void eraseCursesWindow (
46                      WINDOW *window);
47
48       int getListIndex (
49                      CDKSCREEN *screen,
50                      char *title,
51                      char **list,
52                      int listSize,
53                      boolean numbers);
54
55       char *getString ("
56                      CDKSCREEN *screen,
57                      char *title,
58                      char *label,
59                      char *init);
60
61       int justifyString (
62                      int fieldWidth,
63                      int mesglen,
64                      int justify);
65
66       int mode2Filetype (
67                      mode_t fileMode);
68
69       void moveCursesWindow (
70                      WINDOW *window,
71                      int xdiff,
72                      int ydiff);
73
74       int popupDialog (
75                      CDKSCREEN *screen,
76                      char **mesg,
77                      int mesgCount,
78                      char **buttons,
79                      int buttonCount);
80
81       void popupLabel (
82                      CDKSCREEN *win,
83                      char **mesg,
84                      int count);
85
86       void popupLabelAttrib (
87                      CDKSCREEN *win,
88                      char **mesg,
89                      int count,
90                      chtype attribute);
91
92       char *selectFile (
93                      CDKSCREEN *screen,
94                      char *title);
95
96       int setWidgetDimension (
97                      int parentDim,
98                      int proposedDim,
99                      int adjustment);
100
101       void stripWhiteSpace (
102                      EStripType stripType,
103                      char *string);
104
105       int viewFile ( CDKSCREEN *screen,
106                      char *title,
107                      char *filename,
108                      char **buttons,
109                      int buttonCount);
110
111       int viewInfo ( CDKSCREEN *screen,
112                      char *title,
113                      char **info,
114                      int size,
115                      char **buttons,
116                      int buttonCount,
117                      boolean interpret);
118

DESCRIPTION

120       These  are  utility  functions that one may use to initialize, build or
121       customize widgets.
122

AVAILABLE FUNCTIONS

124       CDKgetDirectoryContents
125            opens and reads the contents of the given directory,  filling  the
126            array  list  with  the  sorted  contents of the directory.  If the
127            directory cannot be opened then it returns a value of -1.
128
129       CDKreadFile
130            Read the file filename, load the contents into a dynamically allo‐
131            cated  array, storing its address via info.  It returns the number
132            of lines read if the file could be opened, -1 otherwise.
133
134       alignxy
135            Aligns a box on the given window with the height and width  given.
136            See  cdk_position  (3)  for  the interpretation of the xpos, ypos,
137            boxWidth and boxHeight, parameters.
138
139       char2Chtype
140            Translate a character string with embedded format  markers  (e.g.,
141            "</X/Y>Blah  Blah")  to  a null-terminated array of chtype's.  The
142            length of the array is stored via the length parameter.  The align
143            parameter   contains   justification  information  (LEFT,  CENTER,
144            RIGHT).  The caller is responsible for freeing the result.
145
146       char2DisplayType
147            Lookup the given name in string and return the equivalent  display
148            type.  See also cdk_display (3).
149
150       checkForLink
151            Check if the given line is of the form
152            <F=filename>
153
154            If so, extract the filename from the line, storing it in the file‐
155            name buffer (which must hold  at  least  CDK_PATHMAX  characters).
156            Return nonzero if a filename is extracted.
157
158       chtype2String
159            Extract the characters and formatting information from a null-ter‐
160            minated array of chtype's string.  A dynamically allocated  string
161            is returned.
162
163       deleteCursesWindow
164            Safely  delete  a  given  window,  i.e., first check if the window
165            parameter is nonnull.
166
167       eraseCursesWindow
168            Safely erase a given window,  i.e.,  first  check  if  the  window
169            parameter is nonnull.
170
171       getListIndex
172            Display  a  scrollable list of strings in a dialog, allow the user
173            to select one.   Return  the  index  in  the  list  of  the  value
174            selected.   The  list  parameter  contains the strings to display;
175            there are listSize strings in the list.  If numbers is  true,  the
176            displayed list items will be numbered.
177
178       getString
179            pops  up an entry widget with a title supplied by the value of the
180            title parameter, a label supplied by the label parameter,  and  an
181            initial  value supplied by the initialValue parameter.  It returns
182            a pointer to the value typed in or NULL if the widget  was  exited
183            early.
184
185       justifyString
186            Given  a  string  length mesglen, the available field width field‐
187            Width and a justification type justify, return the number of char‐
188            acters by which to shift the string.
189
190       mode2Filetype
191            Given  a  file protection mode fileMode, return ignoring the file-
192            type bits, i.e., ignoring the corresponding permissions data.
193
194       moveCursesWindow
195            Move a given window by the amounts in xdiff and ydiff.
196
197       popupDialog
198            creates a quick pop-up dialog box.  Pass in  the  message  in  the
199            mesg  parameter,  the size of the message in the mesgCount parame‐
200            ter, the button labels in the buttons parameter and the number  of
201            buttons in the buttonCount parameter.  The dialog box will be cen‐
202            tered on the screen.
203
204       popupLabel
205            creates a quick pop-up label widget.  The message and the size  of
206            the  message  are  passed  in  via  the  mesg and count parameters
207            respectively.  The label widget waits until the user hits a  char‐
208            acter and is centered on the screen.
209
210       popupLabelAttrib
211            Display a simple dialog with a list of count message strings mesg.
212            Use the given attribute for the background of the dialog.
213
214       selectFile
215            Display a file-selection dialog.  Return the selected filename, or
216            null  if  none  is  selected.   The caller should free the return-
217            value.
218
219       setWidgetDimension
220            This is a helper function used to set the height/width of  a  wid‐
221            get:
222
223            -  If  the  proposed  dimension  proposedDim  is FULL or zero, the
224               return value will be parentDim.
225
226            -  If the proposed dimension proposedDim is positive,
227
228               -  and it is larger than parentDim, return proposedDim,
229
230               -  otherwise return proposedDim plus adjustment.
231
232            -  If the proposed dimension proposedDim is negative,  the  return
233               value will be parentDim plus proposedDim.
234
235            -  Otherwise, the return value will be proposedDim.
236
237       stripWhiteSpace
238            Strip  whitespace  from the front and/or back of the given string.
239            The stripType parameter  controls  the  type  of  stripping  done:
240            vFRONT, vBACK or vBOTH.
241
242       viewFile
243            Read  the file specified by filename and display it in a CDKVIEWER
244            window.  The title, buttons and buttonCount  are  applied  to  the
245            CDKVIEWER  window.  The viewer shows the contents of the file sup‐
246            plied by the filename value.  The buttons on the file  viewer  are
247            supplied  by  the  buttons parameter.  It returns the index of the
248            button selected, or -1 if the file does not exist or if the widget
249            was exited early.
250
251               ┌────────────────┬─────────────────────────────────────┐
252Strip_Type      Result                              
253               ├────────────────┼─────────────────────────────────────┤
254               ├────────────────┼─────────────────────────────────────┤
255               │vFRONT          │ This  tells  the function to remove │
256               │                │ all of the  white  space  from  the │
257               │                │ front of the given string.          │
258               ├────────────────┼─────────────────────────────────────┤
259               │vBACK           │ This  tells  the function to remove │
260               │                │ all of the  white  space  from  the │
261               │                │ back of the given string.           │
262               ├────────────────┼─────────────────────────────────────┤
263               │vBOTH           │ This  tells  the function to remove │
264               │                │ all of the white  space  from  both │
265               │                │ the front and the back of the given │
266               │                │ string.                             │
267               └────────────────┴─────────────────────────────────────┘
268       viewInfo
269            Display the list of strings in info in a  CDKVIEWER  window.   The
270            number  of  strings is given by size.  The title, buttons and but‐
271            tonCount are applied to the CDKVIEWER window.
272

SEE ALSO

274       cdk_dialog (3), cdk_display (3), cdk_position (3), cdk_misc (3).
275
276
277
278                                                                   cdk_util(3)
Impressum