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

    File:    Icon.ButtIsHeld.c
    Author:  Copyright  1994 Lenny
    Version: 0.01 (23 Nov 1994)
    Purpose: Returns Desk_bool_TRUE if a mouse button is held down.
    History: 0.01 (23 Nov 94) : Added 'Desk_Icon_ButtonIsHeld()'

*/

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

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

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

extern Desk_bool Desk_Icon_ButtonIsHeld(void)
/*
 *  Returns Desk_bool_TRUE if a mouse button is held down.
 *
 *  Usage : With inc/dec type icons where auto-repeat is required for an
 *          icon using a 3D effect, with a button type 'Click'.
 *          It prevents the annoying repeated indent-outdent effect
 *          produced when using a button type 'Auto-Repeat' with a 3D
 *          icon.
 *  It currently returns Desk_bool_TRUE, even if the pointer is no longer over the
 *  icon, provided the button is still held down.
 */
{
  Desk_mouse_block       mouse;

  Desk_Wimp_GetPointerInfo(&mouse);  /*  Get mouse button info  */

  return ((mouse.button.value & 0x07) != 0) ? Desk_bool_TRUE : Desk_bool_FALSE;

}

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