home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / ikeyhdr.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  3.4 KB  |  96 lines

  1. #ifndef _IKEYHDR_
  2.   #define _IKEYHDR_
  3. /*******************************************************************************
  4. * FILE NAME: ikeyhdr.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     IKeyboardHandler                                                         *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   IBM Open Class Library                                                     *
  12. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  13. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *******************************************************************************/
  18. #include <ihandler.hpp>
  19. #include <ikeyevt.hpp>
  20.  
  21. #pragma pack(4)
  22.  
  23. class IKeyboardHandler : public IHandler {
  24. typedef IHandler
  25.   Inherited;
  26. public:
  27. /*------------------------------ Constructors --------------------------------*/
  28.   IKeyboardHandler     ( );
  29. virtual
  30.  ~IKeyboardHandler     ( );
  31.  
  32. protected:
  33. /*---------------------------- Event Dispatching -----------------------------*/
  34. virtual Boolean
  35.   dispatchHandlerEvent ( IEvent& event );
  36.  
  37. /*----------------------------- Event Processing -----------------------------*/
  38. virtual Boolean
  39.   scanCodeKeyPress     ( IKeyboardEvent& event ),
  40.   virtualKeyPress      ( IKeyboardEvent& event ),
  41.   characterKeyPress    ( IKeyboardEvent& event ),
  42.   key                  ( IKeyboardEvent& event );
  43.  
  44. private:
  45. unsigned long
  46.   fKeyStateFlag;
  47. char
  48.   fDiacriticKey;
  49. }; // IKeyboardHandler
  50.  
  51. #pragma info(nocpy)
  52.  
  53. template <class ATarget>
  54. class IKeyboardConnectionTo : public IKeyboardHandler {
  55. typedef IKeyboardHandler
  56.   Inherited;
  57. public:
  58. /*----------------------------- Type Definitions -----------------------------*/
  59. typedef Boolean  (ATarget::* KeyboardMemberFn)( IKeyboardEvent& );
  60.  
  61. /*------------------------------- Constructors -------------------------------*/
  62.   IKeyboardConnectionTo ( ATarget&           target,
  63.                           KeyboardMemberFn   characterKeyMemberFn );
  64. virtual
  65.  ~IKeyboardConnectionTo ( );
  66.  
  67. /*-------------------------- Function Registration ---------------------------*/
  68. IKeyboardConnectionTo<ATarget>
  69.  &setVirtualKeyMemberFn  ( KeyboardMemberFn virtualKeyMemberFn );
  70.  
  71. protected:
  72. /*----------------------------- Event Processing -----------------------------*/
  73. virtual Boolean
  74.   virtualKeyPress      ( IKeyboardEvent& event ),
  75.   characterKeyPress    ( IKeyboardEvent& event );
  76.  
  77. private:
  78. /*--------------------------------- Private ----------------------------------*/
  79. ATarget
  80.  &fTarget;
  81. KeyboardMemberFn
  82.   fConnectedCharacterKeyMember,
  83.   fConnectedVirtualKeyMember;
  84. }; // IKeyboardConnectionTo
  85.  
  86.  
  87. #ifndef __TEMPINC__
  88.   #include <ikeyhdr.c>
  89. #endif
  90.  
  91. #pragma info(restore)
  92.  
  93. #pragma pack()
  94.  
  95. #endif /* _IKEYHDR_ */
  96.