home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / d / desklib / !DeskLib / h_doc / Kbd < prev    next >
Encoding:
Text File  |  1996-05-21  |  3.8 KB  |  117 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 Desk_Kbd_GET
  17. */
  18.  
  19.  
  20. #ifndef __Desk_Kbd_h
  21. #define __Desk_Kbd_h
  22.  
  23. #ifdef __cplusplus
  24.     extern "C" {
  25. #endif
  26.  
  27.  
  28. #ifndef __Desk_Core_h
  29. #include "Desk.Core.h"
  30. #endif
  31.  
  32.  
  33. extern Desk_bool Desk_Kbd_KeyDown(int keynum);
  34.   /*  Checks to see if the given key is currently depressed.
  35.    *  'keynum' is a negative INKEY number (as defined below)
  36.    *     or a value from 0..127 to scan a range od keys
  37.    *  Generally, it's use is for things like (eg) checking if CTRL is held
  38.    *  down when a click is made, as in:
  39.    *    if (Desk_Kbd_KeyDown(Desk_inkey_CTRL)) ...
  40.    */
  41.  
  42.  
  43. typedef enum
  44. {
  45.   Desk_inkey_ADJUST       = -12,                       /* MOUSE 'Adjust' button   */
  46.   Desk_inkey_MENU         = -11,                       /* MOUSE 'Menu' button     */
  47.   Desk_inkey_SELECT       = -10,                       /* MOUSE 'Select' button   */
  48.  
  49.   Desk_inkey_RALT         = -9,                        /* Right ALT key           */
  50.   Desk_inkey_LALT         = -6,                        /* Left ALT key            */
  51.   Desk_inkey_ALT          = -3,                        /* Either/Both ALT keys    */
  52.  
  53.   Desk_inkey_RCTRL        = -8,                        /* Right CTRL key          */
  54.   Desk_inkey_LCTRL        = -5,                        /* Left CTRL key           */
  55.   Desk_inkey_CTRL         = -2,                        /* Either/Both CTRL keys   */
  56.  
  57.   Desk_inkey_RSHIFT       = -7,                        /* Right SHIFT key         */
  58.   Desk_inkey_LSHIFT       = -4,                        /* Left SHIFT key          */
  59.   Desk_inkey_SHIFT        = -1                         /* Either/Both SHIFT keys  */
  60. } Desk_kbd_neginkey;
  61. /*
  62.  *  In the DeskTop environment, you shouldn't ever need to read more than these
  63.  *  keys via this method (everything else should come in via WIMP
  64.  *  events). If you need other values, look up the Appendix on INKEY values
  65.  *  in the BBC BASIC Guide (mine has this on page 411)
  66.  */
  67.  
  68.  
  69.  
  70. extern char Desk_Kbd_GET(void);
  71.   /*
  72.    *  Returns the ASCII code of the next key pressed (this may be a key already
  73.    *  waiting in the keyboard buffer). (i.e. an Desk_OS_ReadC veneer)
  74.    *  This is similar to BASIC's GET command, hence the name.
  75.    */
  76.  
  77.  
  78.  
  79. typedef struct
  80. {
  81.   unsigned alt         : 1;
  82.   unsigned ctrl        : 1;
  83.   unsigned shift       : 1;
  84.   unsigned Desk_left_alt    : 1;
  85.   unsigned Desk_left_ctrl   : 1;
  86.   unsigned Desk_left_shift  : 1;
  87.   unsigned Desk_right_alt   : 1;
  88.   unsigned Desk_right_ctrl  : 1;
  89.   unsigned Desk_right_shift : 1;
  90.   
  91. } Desk_kbd_modifiers;
  92. /*
  93. For each modifier key, when the flag is Desk_bool_TRUE it means that the key
  94. is held down.
  95. */
  96.  
  97.  
  98. extern Desk_kbd_modifiers Desk_Kbd_GetModifiers(Desk_bool detailed);
  99. /*
  100.     
  101.     Inputs:   detailed - normally Desk_bool_FALSE, but set to Desk_bool_TRUE if you want to
  102.                                know which (as in left or right) modifiers are
  103.                                held down.
  104.     Returns:  The status of the modifier keys (the left... and right...
  105.                 fields are only accurate when detailed = Desk_bool_TRUE).
  106.     Purpose:  To find out the state of various modifier (shift) keys.
  107.                 This is useful when handling mouse clicks, and so on.
  108. */
  109.  
  110.  
  111. #ifdef __cplusplus
  112. }
  113. #endif
  114.  
  115.  
  116. #endif
  117.