home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WACCEL.HPP < prev    next >
C/C++ Source or Header  |  1996-10-18  |  4KB  |  120 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. #ifndef _WACCEL_HPP_INCLUDED
  12. #define _WACCEL_HPP_INCLUDED
  13.  
  14. #ifndef _WNO_PRAGMA_PUSH
  15. #pragma pack(push,8);
  16. #pragma enum int;
  17. #endif
  18.  
  19. #ifndef _WDEF_HPP_INCLUDED
  20. #  include "wdef.hpp"
  21. #endif
  22. #ifndef _WOBJECT_HPP_INCLUDED
  23. #  include "wobject.hpp"
  24. #endif
  25. #ifndef _WKEYDEFS_HPP_INCLUDED
  26. #  include "wkeydefs.hpp"
  27. #endif
  28. #ifndef _WRESID_HPP_INCLUDED
  29. #  include "wresid.hpp"
  30. #endif
  31.  
  32. class WWindow;
  33. class WMenu;
  34. class WAcceleratorReference;
  35.  
  36. enum WAcceleratorHandle   { NULLHACCEL = 0, LASTHACCEL = LAST_16TO32BIT };
  37.  
  38. class WCMCLASS WAcceleratorTable : public WObject {
  39.     WDeclareSubclass( WAcceleratorTable, WObject );
  40.  
  41.     public:
  42.  
  43.         /*************************************************************
  44.          * Constructors and destructors
  45.          *************************************************************/
  46.  
  47.         WAcceleratorTable();
  48.  
  49.         WAcceleratorTable( const WAcceleratorTable & table );
  50.  
  51.         WAcceleratorTable( WAcceleratorHandle handle,
  52.                            WBool destroyTable=FALSE );
  53.  
  54.         WAcceleratorTable( const WResourceID & id,
  55.                            WModuleHandle module=_ApplicationModule );
  56.  
  57.         ~WAcceleratorTable();
  58.  
  59.         /*************************************************************
  60.          * Properties
  61.          *************************************************************/
  62.  
  63.         // Handle
  64.  
  65.         WAcceleratorHandle GetHandle() const;
  66.  
  67.         /*************************************************************
  68.          * Methods
  69.          *************************************************************/
  70.  
  71.         // Add
  72.         //
  73.         //    Adds a new accelerator key to the accelerator table.
  74.         //    Note that this causes the old table to be destroyed
  75.         //    and a new one created.
  76.  
  77.         WBool Add( WKeyState state, WKeyPressCode code,
  78.                    WUShort accelID=0, WBool noInvert=FALSE );
  79.         WBool Add( const WAcceleratorTable & table );
  80.  
  81.         // AppendToMenuItems
  82.         //
  83.         //    Given a menu, adds accelerators to the captions for
  84.         //    the menuitems that correspond to accelerators in
  85.         //    the accelerator table.
  86.  
  87.         WBool AppendToMenuItems( WMenu *menu );
  88.  
  89.         // Clear
  90.  
  91.         void Clear();
  92.  
  93.         // Create
  94.  
  95.         WBool Create( const WAcceleratorTable & table );
  96.         WBool Create( WAcceleratorHandle handle, WBool destroyTable=FALSE );
  97.         WBool Create( const WResourceID & id, WModuleHandle module=_ApplicationModule );
  98.  
  99.         /**********************************************************
  100.          * Operators
  101.          *********************************************************/
  102.  
  103.         WAcceleratorTable & operator=( const WAcceleratorTable & t );
  104.  
  105.         /*************************************************************
  106.          * Data members
  107.          *************************************************************/
  108.  
  109.     private:
  110.  
  111.         WAcceleratorReference * _ref;
  112. };
  113.  
  114. #ifndef _WNO_PRAGMA_PUSH
  115. #pragma enum pop;
  116. #pragma pack(pop);
  117. #endif
  118.  
  119. #endif // _WACCEL_HPP_INCLUDED
  120.