home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / gcc / !GCC / patches / DeskLib / h / Kbd < prev    next >
Encoding:
Text File  |  1994-10-03  |  4.0 KB  |  125 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Kbd.h
  12.     Author:  Copyright © 1993 Jason Williams
  13.     Version: 1.01 (24 Jul 1993)
  14.     Purpose: Reading from the keyboard
  15.  
  16.     Mods:    24-07-93  JW  Added Kbd_GET
  17. */
  18.  
  19.  
  20. #ifndef __dl_kbd_h
  21. #define __dl_kbd_h
  22.  
  23. #ifndef __dl_core_h
  24. #include "core.h"
  25. #endif
  26.  
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30.  
  31.   /*  Kbd_Keydown(keynum)
  32.    *  Checks to see if the given key is currently depressed.
  33.    *  'keynum' is a negative INKEY number (as defined below)
  34.    *  Generally, it's use is for things like (eg) checking if CTRL is held
  35.    *  down when a click is made, as in:
  36.    *    if (Kbd_KeyDown(inkey_CTRL)) ...
  37.    */
  38. extern BOOL Kbd_KeyDown(int keynum);
  39.  
  40.  
  41. /*  In the DeskTop environment, you shouldn't ever need to read more than the
  42.  *  the following keys via this method (everything else should come in via WIMP
  43.  *  events). If you need other values, look up the Appendix on INKEY values
  44.  *  in the BBC BASIC Guide (mine has this on page 411)
  45.  */
  46.  
  47. typedef enum
  48. {
  49.   inkey_ADJUST       = -12,                       /* MOUSE 'Adjust' button   */
  50.   inkey_MENU         = -11,                       /* MOUSE 'Menu' button     */
  51.   inkey_SELECT       = -10,                       /* MOUSE 'Select' button   */
  52.  
  53.   inkey_RALT         = -9,                        /* Right ALT key           */
  54.   inkey_LALT         = -6,                        /* Left ALT key            */
  55.   inkey_ALT          = -3,                        /* Either/Both ALT keys    */
  56.  
  57.   inkey_RCTRL        = -8,                        /* Right CTRL key          */
  58.   inkey_LCTRL        = -5,                        /* Left CTRL key           */
  59.   inkey_CTRL         = -2,                        /* Either/Both CTRL keys   */
  60.  
  61.   inkey_RSHIFT       = -7,                        /* Right SHIFT key         */
  62.   inkey_LSHIFT       = -4,                        /* Left SHIFT key          */
  63.   inkey_SHIFT        = -1                         /* Either/Both SHIFT keys  */
  64. } kbd_neginkey;
  65.  
  66.  
  67.  
  68.   /*  Kbd_GET()
  69.    *  Returns the ASCII code of the next key pressed (this may be a key already
  70.    *  waiting in the keyboard buffer). (i.e. an OS_ReadC veneer)
  71.    *  This is similar to BASIC's GET command, hence the name.
  72.    */
  73. extern char Kbd_GET(void);
  74.  
  75.  
  76.  
  77. /****************************************************************************
  78.  
  79.   typedef kbd_modifiers
  80.  
  81.   For each modifier key, when the flag is TRUE it means that the key
  82.   is held down.
  83.  
  84. ****************************************************************************/
  85.  
  86.  
  87. typedef struct
  88. {
  89.   unsigned alt         : 1;
  90.   unsigned ctrl        : 1;
  91.   unsigned shift       : 1;
  92.   unsigned left_alt    : 1;
  93.   unsigned left_ctrl   : 1;
  94.   unsigned left_shift  : 1;
  95.   unsigned right_alt   : 1;
  96.   unsigned right_ctrl  : 1;
  97.   unsigned right_shift : 1;
  98.  
  99. } kbd_modifiers;
  100.  
  101.  
  102. /****************************************************************************
  103.  
  104.     kbd_modifiers Kbd_GetModifiers(BOOL detailed)
  105.  
  106.     Inputs:   detailed - normally FALSE, but set to TRUE if you want to
  107.                                know which (as in left or right) modifiers are
  108.                                held down.
  109.     Returns:  The status of the modifier keys (the left... and right...
  110.                 fields are only accurate when detailed = TRUE).
  111.     Purpose:  To find out the state of various modifier (shift) keys.
  112.                 This is useful when handling mouse clicks, and so on.
  113.  
  114. ****************************************************************************/
  115.  
  116.  
  117. extern kbd_modifiers Kbd_GetModifiers(BOOL detailed);
  118.  
  119.  
  120. #ifdef __cplusplus
  121.            }
  122. #endif
  123.  
  124. #endif
  125.