Beispiel #1
0
/*
 * vUpdateWriteable - update a writeable icon with a string
 */
void
vUpdateWriteable(window_handle tWindow, icon_handle tIconNumber,
	const char *szString)
{
	icon_block	tIcon;
	caret_block	tCaret;
	int		iLen;

	fail(szString == NULL);

	NO_DBG_DEC(tIconNumber);
	NO_DBG_MSG(szString);

	Error_CheckFatal(Wimp_GetIconState(tWindow, tIconNumber, &tIcon));
	NO_DBG_HEX(tIcon.flags);
	if (!tIcon.flags.data.text || !tIcon.flags.data.indirected) {
		werr(1, "Icon %d must be indirected text", (int)tIconNumber);
		return;
	}
	strncpy(tIcon.data.indirecttext.buffer,
		szString,
		tIcon.data.indirecttext.bufflen - 1);
	/* Ensure the caret is behind the last character of the text */
	Error_CheckFatal(Wimp_GetCaretPosition(&tCaret));
	if (tCaret.window == tWindow && tCaret.icon == tIconNumber) {
		iLen = strlen(tIcon.data.indirecttext.buffer);
		if (tCaret.index != iLen) {
			tCaret.index = iLen;
			Error_CheckFatal(Wimp_SetCaretPosition(&tCaret));
		}
	}
	Error_CheckFatal(Wimp_SetIconState(tWindow, tIconNumber, 0, 0));
	vUpdateIcon(tWindow, &tIcon);
} /* end of vUpdateWriteable */
Beispiel #2
0
void msgwin_monitor_close(void)
{
  textwin_free(MsgWindows[msg_win_monitor].tw);
  MsgWindows[msg_win_monitor].tw = NULL;
  MsgWindows[msg_win_monitor].Flags = 0;
  if (LastCaret.WHandle != -1)
  {
    Wimp_SetCaretPosition(LastCaret.WHandle, LastCaret.IHandle, LastCaret.offx, LastCaret.offy, LastCaret.height, LastCaret.index);
    LastCaret.WHandle = -1;
  }
}
Beispiel #3
0
static void LoadFile( const char *name, int type )
{
    caret_block cb;

    strcpy( loadname, name );
    InventSaveFilename( name, savename, type );

    if ( Icon_GetShade( wh, igicon_SAVENAME ) )
    {
        Icon_Unshade( wh, igicon_SAVENAME );
        Icon_Unshade( wh, igicon_SAVE );
        Icon_Unshade( wh, igicon_DRAGGABLE );
    }
    else
        Wimp_SetIconState( wh, igicon_SAVENAME, 0, 0 );/* just redraw it */

    cb.window = wh;
    cb.icon = igicon_SAVENAME;
    cb.offset.x = -1;
    cb.offset.y = -1;
    cb.height = -1;
    cb.index = strlen( savename );
    Wimp_SetCaretPosition( &cb );
}