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

NAME

6       cdk_button - create and manage a curses button widget.
7

SYNOPSIS

9       cc [ flag ... ] file ...  -lcdk [ library ... ]
10
11       #include <cdk.h>
12
13       typedef void (*tButtonCallback)(struct SButton *button);
14
15       int activateCDKButton (
16                      CDKBUTTON *button,
17                      chtype * actions);
18
19       void destroyCDKButton (
20                      CDKBUTTON *button);
21
22       void drawCDKButton (
23                      CDKBUTTON *b,
24                      boolean box);
25
26       void eraseCDKButton (
27                      CDKBUTTON *button);
28
29       boolean getCDKButtonBox (
30                      CDKBUTTON *b);
31
32       chtype *getCDKButtonMessage (
33                      CDKBUTTON *b);
34
35       int injectCDKButtonbox (
36                      CDKBUTTON *buttonbox,
37                      chtype input);
38
39       CDKBUTTON *newCDKButton(
40                      CDKSCREEN *cdkscreen,
41                      int xpos,
42                      int ypos,
43                      char *message,
44                      tButtonCallback callback,
45                      boolean box,
46                      boolean shadow);
47
48       void setCDKButton(
49                      CDKBUTTON *b,
50                      char *message,
51                      boolean box);
52
53       void setCDKButtonBackgroundAttrib (
54                      CDKBUTTON *b,
55                      chtype attribute);
56
57       void setCDKButtonBackgroundColor (
58                      CDKBUTTON *b,
59                      char * color);
60
61       void setCDKButtonBox (
62                      CDKBUTTON *button,
63                      boolean box);
64
65       void setCDKButtonBoxAttribute (
66                      CDKBUTTON *b,
67                      chtype c);
68
69       void setCDKButtonHorizontalChar (
70                      CDKBUTTON *b,
71                      chtype c);
72
73       void setCDKButtonLLChar (
74                      CDKBUTTON *b,
75                      chtype c);
76
77       void setCDKButtonLRChar (
78                      CDKBUTTON *b,
79                      chtype c);
80
81       void setCDKButtonMessage (
82                      CDKBUTTON *b,
83                      char *message);
84
85       void setCDKButtonULChar (
86                      CDKBUTTON *b,
87                      chtype c);
88
89       void setCDKButtonURChar (
90                      CDKBUTTON *b,
91                      chtype c);
92
93       void setCDKButtonVerticalChar (
94                      CDKBUTTON *b,
95                      chtype c);
96
97       void moveCDKButton(
98                      CDKBUTTON *b,
99                      int xpos,
100                      int ypos,
101                      boolean relative,
102                      boolean refresh);
103
104       void positionCDKButton (
105                      CDKBUTTON *b);
106
107       void waitCDKButton (
108                      CDKBUTTON *button,
109                      char key);
110

DESCRIPTION

112       The Cdk button widget displays a message string and executes a callback
113       when the user presses enter or space.  As such, it is only useful on  a
114       screen  that  is being managed by some external screen traversal engine
115       such as traverseCDKScreen().  The button will be highlighted  when  the
116       widget has the focus.  The following functions create or manipulate the
117       Cdk button widget.
118

AVAILABLE FUNCTIONS

120       activateCDKButton
121            activates the button widget and lets the user  interact  with  the
122            widget.   The  parameter  button is a pointer to a non-NULL button
123            widget.  If the actions parameter is passed with a non-NULL value,
124            the  characters in the array will be injected into the widget.  To
125            activate the widget interactively  pass  in  a  NULL  pointer  for
126            actions.   If  the character entered into this widget is RETURN or
127            TAB then this function will return a value from 0 to the number of
128            buttons  -1,  representing  the button selected.  It will also set
129            the widget data exitType to vNORMAL.   If  the  character  entered
130            into this widget was ESCAPE then the widget will return a value of
131            -1 and the widget data exitType will be set to vESCAPE_HIT.
132
133       destroyCDKButton
134            removes the widget from the screen and frees  up  any  memory  the
135            object used.
136
137       drawCDKButton
138            draws  the  button  widget on the screen.  If the box parameter is
139            true, the widget is drawn with a box.
140
141       eraseCDKButton
142            removes the widget from the screen.  This  does  NOT  destroy  the
143            widget.
144
145       getCDKButtonBox
146            returns true if the widget will be drawn with a box around it.
147
148       getCDKButtonMessage
149            returns the contents of the button widget.
150
151       injectCDKButton
152            injects  a single character into the widget.  The parameter button
153            is a pointer to a non-NULL button widget.  The parameter character
154            is  the character to inject into the widget.  The return value and
155            side-effect (setting the widget data  exitType)  depend  upon  the
156            injected character:
157
158            RETURN or TAB
159                   this  function returns 0, representing the button selected.
160                   The widget data exitType is set to vNORMAL.
161
162            ESCAPE the function returns -1.  The widget data exitType  is  set
163                   to vESCAPE_HIT.
164
165            Otherwise
166                   unless  modified  by  preprocessing,  postprocessing or key
167                   bindings, the function returns -1.  The widget  data  exit‐
168                   Type is set to vEARLY_EXIT.
169
170       moveCDKButton
171            moves the given widget to the given position.  The parameters xpos
172            and ypos are the new position of the widget.  The  parameter  xpos
173            may  be  an  integer or one of the pre-defined values TOP, BOTTOM,
174            and CENTER.  The parameter ypos may be an integer or  one  of  the
175            pre-defined  values  LEFT, RIGHT, and CENTER.  The parameter rela‐
176            tive states whether the xpos/ypos pair is a relative  move  or  an
177            absolute move.  For example, if xpos = 1 and ypos = 2 and relative
178            = TRUE, then the widget would move one row down  and  two  columns
179            right.   If  the value of relative was FALSE then the widget would
180            move to the position (1,2).  Do not use the  values  TOP,  BOTTOM,
181            LEFT,  RIGHT,  or  CENTER when relative = TRUE.  (weird things may
182            happen).  The final parameter refresh is  a  boolean  value  which
183            states whether the widget will get refreshed after the move.
184
185       newCDKButton
186            creates a pointer to a buttonbox widget.  Parameters:
187
188            The screen parameter
189                 is the screen you wish this widget to be placed in.
190
191            xpos controls  the  placement  of  the object along the horizontal
192                 axis.  It may be an integer or one of the pre-defined  values
193                 LEFT, RIGHT, and CENTER.
194
195            ypos controls the placement of the object along the vertical axis.
196                 It be an integer or one of the pre-defined values  TOP,  BOT‐
197                 TOM, and CENTER.
198
199            message
200                 is  the message to display in the button window, formatted as
201                 described in cdk_display.
202
203            callback
204                 is an optional pointer to a callback function  that  will  be
205                 executed when the user activates the button by pressing space
206                 or enter.
207
208            box  is true if the widget should be drawn with a box around it.
209
210            shadow
211                 turns the shadow on or off around this widget.
212
213            If the widget  could  not  be  created  then  a  NULL  pointer  is
214            returned.
215
216       positionCDKButton
217            allows  the user to move the widget around the screen via the cur‐
218            sor/keypad keys.  See cdk_position (3) for key bindings.
219
220       setCDKButton
221            lets the programmer modify certain elements of an existing button‐
222            box  widget.  The parameter names correspond to the same parameter
223            names listed in the newCDKButton function.
224
225       setCDKButtonBackgroundAttrib
226            sets the  background  attribute  of  the  widget.   The  parameter
227            attribute is a curses attribute, e.g., A_BOLD.
228
229       setCDKButtonBackgroundColor
230            sets  the  background color of the widget.  The parameter color is
231            in the format of the Cdk format strings.  (See cdk_display).
232
233       setCDKButtonBox
234            sets true if the widget will be drawn with a box around it.
235
236       setCDKButtonBoxAttribute
237            sets the attribute of the box.
238
239       setCDKButtonHorizontalChar
240            sets the horizontal drawing character for the  box  to  the  given
241            character.
242
243       setCDKButtonLLChar
244            sets  the  lower left hand corner of the widget's box to the given
245            character.
246
247       setCDKButtonLRChar
248            sets the lower right hand corner of the widget's box to the  given
249            character.
250
251       setCDKButtonMessage
252            This sets the contents of the label widget.
253
254       setCDKButtonULChar
255            sets  the  upper left hand corner of the widget's box to the given
256            character.
257
258       setCDKButtonURChar
259            sets the upper right hand corner of the widget's box to the  given
260            character.
261
262       setCDKButtonVerticalChar
263            sets the vertical drawing character for the box to the given char‐
264            acter.
265

BUGS

267       Changing the Box attribute after the widget has been  created  probably
268       does  not  work  right.  None of the positioning/movement code has been
269       tested.
270

AUTHOR

272       Grant Edwards, Aspen Research Corporation
273

SEE ALSO

275       cdk(3),      cdk_binding(3),      cdk_display(3),      cdk_position(3),
276       cdk_process(3), cdk_screen(3), cdk_traverse(3)
277
278
279
280                                                                 cdk_button(3)
Impressum