home *** CD-ROM | disk | FTP | other *** search
- #include "Wimp.h"
- #include "WimpSWIs.h"
- #include "Coord.h"
- #include "Icon.h"
-
- #include "string.h"
-
-
- extern void Icon_SetText(window_handle w, icon_handle i, char *text)
- /*
- * Copies the text string into the icon's indirected string buffer (and redraws)
- * If unable to set the text (incorrect icon type), it returns quietly
- * If text passed in is a NULL pointer, sets icon text to " "
- */
- {
- icon_block istate;
- char temp[2] = " ";
-
- if (text == NULL)
- text = temp;
-
- Wimp_GetIconState(w, i, &istate);
- if (istate.flags.value & (icon_TEXT | icon_INDIRECTED))
- {
- /* Indirected text icon, so set text field - ensure no buffer overflow */
- strncpy(istate.data.indirecttext.buffer, text,
- istate.data.indirecttext.bufflen - 1);
- istate.data.indirecttext.buffer[istate.data.indirecttext.bufflen-1] = 0;
-
- Wimp_SetIconState(w, i, 0, 0);
- }
- }
-