
/* delicon.c
 *
 * Wimp function library
 *  Joseph Heenan, 1998.
 *
 * Deletes an icon and forces a redraw of the relevant window area
 *
 *
 * $Log: delicon,v $
 * Revision 1.3  1998/07/08 19:11:17  joseph
 * Changed to force a redraw of the area the icon occupied, because
 * the wimp doesn't automatically do this.
 *
 * Revision 1.2  1998/05/10 20:13:10  jogu
 * Added names to file headers
 * Added implicit cast for frontend_taskname to wimp_report_error
 *   (it defines 'name' without 'const')
 *
 * Revision 1.1.1.1  1998/05/10 19:56:03  jogu
 * WimpCLib V1.00 (created from newshound c.wimpc rev 1.2)
 *
 *
 */

#include <stdlib.h>
#include <string.h>
#include <stdarg.h>

#include "swis.h"
#include "wimplib.h"

#include "wimpclib.h"

int wimpc_deleteicon( int window, int icon, int delete )
{
  WimpSetIconStateBlock state;
  WimpGetIconStateBlock block;

  state.window_handle = window;
  state.icon_handle   = icon;
  state.EOR_word      = delete ? WimpIcon_Deleted : 0;
  state.clear_word    = WimpIcon_Deleted;

  E_CHECK_RETURN( -1, wimp_set_icon_state( &state ) );

  /* force a redraw of the window area under the icon, because the wimp doesn't do it automatically */
  block.window_handle = window;
  block.icon_handle   = icon;

  E_CHECK_RETURN( -1, wimp_get_icon_state( &block ) );
  E_CHECK_RETURN( -1, wimp_force_redraw( window,
      block.icon.bbox.xmin, block.icon.bbox.ymin,
      block.icon.bbox.xmax, block.icon.bbox.ymax ) );

  return 0;
}

