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

    File:    Window.GetCoords.c
    Author:  Copyright  1994 Lenny
    Version: 0.01 (20 Nov 1994)
    Purpose: Fill a 'Desk_convert_block' structure with the relevant info for
             the specified window.
    History: 0.01 (20 Nov 94) : Added 'Desk_Window_GetCoords()'

*/

/* --- LOAD HEADERS ------------------------------------------------------ */

/* --- DeskLib ----------------------------------------------------------- */
#include "Desk.WimpSWIs.h"          /* Low-level WIMP commands          */

#include "Desk.Coord.h"             /* OS - workarea coord conversion   */
#include "Desk.Window.h"

/* === FUNCTION DEFINITIONS ============================================== */

/* ----------------------------------------------------------------------- */

extern void Desk_Window_GetCoords(Desk_window_handle wh, Desk_convert_block *coords)
/*
 *  The coords 'Desk_convert_block' passed into this function is filled
 *  with the relevant info for window 'wh'.
 */
{
    Desk_window_state    wstate;

    Desk_Wimp_GetWindowState(wh, &wstate);
    coords->screenrect.min.x = wstate.openblock.screenrect.min.x;
    coords->screenrect.min.y = wstate.openblock.screenrect.min.y;
    coords->screenrect.max.x = wstate.openblock.screenrect.max.x;
    coords->screenrect.max.y = wstate.openblock.screenrect.max.y;
    coords->scroll.x = wstate.openblock.scroll.x;
    coords->scroll.y = wstate.openblock.scroll.y;
    /*  OR (?)  */
/*    memcpy(coords, &wstate.openblock, sizeof(Desk_convert_block));  */

}

/***************************************************************************/
