3 * Copyright (C) 1998-2001 A.J. van Os; Released under GPL
14 vUpdateIcon(wimp_w tWindow
, wimp_icon
*pIcon
)
21 wimpt_noerr(wimp_update_wind(&r
, &bMore
));
23 (void)wimp_ploticon(pIcon
);
24 wimpt_noerr(wimp_get_rectangle(&r
, &bMore
));
26 } /* end of vUpdateIcon */
29 vUpdateRadioButton(wimp_w tWindow
, wimp_i tIconNumber
, BOOL bSelected
)
33 wimpt_noerr(wimp_get_icon_info(tWindow
, tIconNumber
, &tIcon
));
37 ((tIcon
.flags
& wimp_ISELECTED
) == wimp_ISELECTED
)) {
38 /* No update needed */
41 wimpt_noerr(wimp_set_icon_state(tWindow
, tIconNumber
,
42 bSelected
? wimp_ISELECTED
: 0, wimp_ISELECTED
));
43 vUpdateIcon(tWindow
, &tIcon
);
44 } /* end of vUpdateRadioButton */
47 * vUpdateWriteable - update a writeable icon with a string
50 vUpdateWriteable(wimp_w tWindow
, wimp_i tIconNumber
, char *szString
)
56 fail(szString
== NULL
);
58 NO_DBG_DEC(tIconNumber
);
61 wimpt_noerr(wimp_get_icon_info(tWindow
, tIconNumber
, &tIcon
));
62 NO_DBG_HEX(tIcon
.flags
);
63 if ((tIcon
.flags
& (wimp_ITEXT
|wimp_INDIRECT
)) !=
64 (wimp_ITEXT
|wimp_INDIRECT
)) {
65 werr(1, "Icon %d must be indirected text", (int)tIconNumber
);
68 strncpy(tIcon
.data
.indirecttext
.buffer
,
70 tIcon
.data
.indirecttext
.bufflen
- 1);
71 /* Ensure the caret is behind the last character of the text */
72 wimpt_noerr(wimp_get_caret_pos(&tCaret
));
73 if (tCaret
.w
== tWindow
&& tCaret
.i
== tIconNumber
) {
74 iLen
= strlen(tIcon
.data
.indirecttext
.buffer
);
75 if (tCaret
.index
!= iLen
) {
77 wimpt_noerr(wimp_set_caret_pos(&tCaret
));
80 wimpt_noerr(wimp_set_icon_state(tWindow
, tIconNumber
, 0,0));
81 vUpdateIcon(tWindow
, &tIcon
);
82 } /* end of vUpdateWriteable */
85 * vUpdateWriteableNumber - update a writeable icon with a number
88 vUpdateWriteableNumber(wimp_w tWindow
, wimp_i tIconNumber
, int iNumber
)
92 (void)sprintf(szTmp
, "%d", iNumber
);
93 vUpdateWriteable(tWindow
, tIconNumber
, szTmp
);
94 } /* end of vUpdateWriteableNumber */