#include <stdlib.h>

#include "Desk.Wimp.h"
#include "Desk.WimpSWIs.h"
#include "Desk.Icon.h"



extern int Desk_Icon_GetInteger(Desk_window_handle w, Desk_icon_handle i)
/*
 * Gets the given icon's text and returns it in the form of an integer
 * numeric value. 0 will be returned from any error/invalid text
 */
{
  Desk_icon_block istate;

  Desk_Wimp_eGetIconState(w, i, &istate);
  if (istate.flags.value & (Desk_icon_TEXT | Desk_icon_INDIRECTED))
    return(atoi(istate.data.indirecttext.buffer));

  return(0);
}
