/*
    ####             #    #     # #
    #   #            #    #       #          The FreeWare C library for 
    #   #  ##   ###  #  # #     # ###             RISC OS machines
    #   # #  # #     # #  #     # #  #   ___________________________________
    #   # ####  ###  ##   #     # #  #                                      
    #   # #        # # #  #     # #  #    Please refer to the accompanying
    ####   ### ####  #  # ##### # ###    documentation for conditions of use
    ________________________________________________________________________

    File:    Icon.ScreenPos.c
    Author:  Copyright  1994 Peter Gaunt
    Version: 1.00 (12 Mar 1994)
    Purpose: Get the position of an icon in screen coordinates.
*/

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


extern void Desk_Icon_ScreenPos(Desk_window_handle window,
                           Desk_icon_handle   icon,
                           Desk_wimp_rect     *rect)
{
  Desk_icon_block   istate;
  Desk_window_state wstate;

  Desk_Wimp_eGetWindowState( window, &wstate );
  Desk_Wimp_eGetIconState( window, icon, &istate );

  Desk_Coord_RectToScreen( &istate.workarearect,
                      (Desk_convert_block *) &wstate.openblock.screenrect );

  *rect = istate.workarearect;

}
