home *** CD-ROM | disk | FTP | other *** search
- /*
- #### # # # #
- # # # # # The FreeWare C library for
- # # ## ### # # # # ### RISC OS machines
- # # # # # # # # # # # ___________________________________
- # # #### ### ## # # # #
- # # # # # # # # # # Please refer to the accompanying
- #### ### #### # # ##### # ### documentation for conditions of use
- ________________________________________________________________________
-
- File: Icon.printf.c
- Author: Copyright © 1992 Jason Williams
- Concept by Edouard Poor
- Version: 1.01 (14 Jul 1993)
- Purpose: Do a "printf" into an icon's indirected text string
- */
-
- #include <stdarg.h>
- #include <stdio.h>
- #include "string.h"
-
- #include "Wimp.h"
- #include "WimpSWIs.h"
-
- extern void Icon_printf(window_handle window, icon_handle icon,
- char *format, ...)
- {
- va_list argp;
- char temp[512]; /* Longer strings will break this call */
- icon_block istate;
-
- Wimp_GetIconState(window, icon, &istate);
- if (!istate.flags.data.indirected)
- return;
-
- va_start(argp,format);
- vsprintf(temp, format, argp);
- strncpy(istate.data.indirecttext.buffer, temp,
- istate.data.indirecttext.bufflen - 1);
- istate.data.indirecttext.buffer[istate.data.indirecttext.bufflen - 1] = 0;
- va_end(argp);
-
- Wimp_SetIconState(window, icon, 0, 0);
- }
-