home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / WBUTTON.HPP < prev    next >
C/C++ Source or Header  |  1996-10-18  |  5KB  |  151 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. /*************************************************************************
  12.  *
  13.  * WButton -- Base class for the Windows 95 button controls.
  14.  *
  15.  *
  16.  *   Events:
  17.  *
  18.  *       Click --
  19.  *
  20.  *       DoubleClick --
  21.  *
  22.  *************************************************************************/
  23.  
  24. #ifndef _WBUTTON_HPP_INCLUDED
  25. #define _WBUTTON_HPP_INCLUDED
  26.  
  27. #ifndef _WNO_PRAGMA_PUSH
  28. #pragma pack(push,8);
  29. #pragma enum int;
  30. #endif
  31.  
  32. #ifndef _WCONTROL_HPP_INCLUDED
  33. #  include "wcontrol.hpp"
  34. #endif
  35.  
  36. #include "wevent.hpp"
  37.  
  38. enum WButtonStateValues {
  39.     WBStateNotChecked = 0x00000000,
  40.     WBStateNotSet = WBStateNotChecked,
  41.  
  42.     WBStateChecked = 0x00000001,
  43.     WBStateSet = WBStateChecked,
  44.  
  45.     WBStateIndeterminate = 0x00000002,
  46.     WBStatePushed = 0x00000004, /* BST_PUSHED  */
  47.     WBStateFocus = 0x00000008 /*  BST_FOCUS */
  48.     
  49. };
  50. typedef WULong WButtonState;
  51.  
  52.  
  53. //
  54. // Button styles
  55. //
  56.  
  57. #define WBSDefault              ((WStyle)0x50000000L)  // WS_VISIBLE|WS_CHILD
  58. #define WBSRightButton          ((WStyle)0x00000020L)  // BS_RIGHTBUTTON
  59. #define WBSIcon                 ((WStyle)0x00000040L)  // BS_ICON
  60. #define WBSBitmap               ((WStyle)0x00000080L)  // BS_BITMAP
  61. #define WBSLeft                 ((WStyle)0x00000100L)  // BS_LEFT
  62. #define WBSRight                ((WStyle)0x00000200L)  // BS_RIGHT
  63. #define WBSCenter               ((WStyle)0x00000300L)  // BS_CENTER
  64. #define WBSTop                  ((WStyle)0x00000400L)  // BS_TOP
  65. #define WBSBottom               ((WStyle)0x00000800L)  // BS_BOTTOM
  66. #define WBSVCenter              ((WStyle)0x00000C00L)  // BS_VCENTER
  67. #define WBSPushLike             ((WStyle)0x00001000L)  // BS_PUSHLIKE
  68. #define WBSMultiline            ((WStyle)0x00002000L)  // BS_MULTILINE
  69. #define WBSNotify               ((WStyle)0x00004000L)  // BS_NOTIFY
  70. #define WBSFlat                 ((WStyle)0x00008000L)  // BS_FLAT
  71.  
  72. // Types of button
  73. // Note: These style are mutually exclusive
  74.  
  75. #define WBSPushButton           ((WStyle)0x00000000L)  // BS_PUSHBUTTON
  76. #define WBSDefPushButton        ((WStyle)0x00000001L)  // BS_DEFPUSHBUTTON
  77. #define WBSCheckBox             ((WStyle)0x00000002L)  // BS_CHECKBOX
  78. #define WBSAutoCheckBox         ((WStyle)0x00000003L)  // BS_AUTOCHECKBOX
  79. #define WBSRadioButton          ((WStyle)0x00000004L)  // BS_RADIOBUTTON
  80. #define WBSThreeState           ((WStyle)0x00000005L)  // BS_3STATE
  81. #define WBS3State               ((WStyle)0x00000005L)  // BS_3STATE
  82. #define WBSAutoThreeState       ((WStyle)0x00000006L)  // BS_AUTO3STATE
  83. #define WBSAuto3State           ((WStyle)0x00000006L)  // BS_AUTO3STATE
  84. #define WBSAutoRadioButton      ((WStyle)0x00000009L)  // BS_AUTORADIOBUTTON
  85. #define WBSOwnerDraw            ((WStyle)0x0000000BL)  // BS_OWNERDRAW
  86. #define WBSGroupBox             ((WStyle)0x00000007L)  // BS_GROUPBOX
  87.  
  88. class WCMCLASS WButton : public WControl {
  89.     WDeclareSubclass( WButton, WControl )
  90.  
  91.     public:
  92.  
  93.         /**********************************************************
  94.          * Constructors and destructors
  95.          *********************************************************/
  96.  
  97.         WButton();
  98.  
  99.         ~WButton();
  100.  
  101.         /**************************************************************
  102.          * Properties
  103.          **************************************************************/
  104.  
  105.         // AutoSize
  106.  
  107.         virtual WBool SetAutoSize( WBool on );
  108.         virtual WBool GetAutoSize() const;
  109.  
  110.         /**************************************************************
  111.          * Methods
  112.          **************************************************************/
  113.  
  114.         // AutoSize
  115.         //
  116.         //      Invoked when autosizing needs to be done
  117.  
  118.         virtual WBool AutoSize();
  119.     
  120.         /**************************************************************
  121.          * Overrides
  122.          **************************************************************/
  123.  
  124.         virtual const WChar * InitializeClass();
  125.  
  126.         virtual WStyle GetDefaultStyle() const;
  127.  
  128.         virtual WBool ProcessCommand( WUInt id, WNotify code,
  129.                                       WNotifyInfo info, WLong & returns );
  130.     
  131.         virtual WBool SetText( const WString & text );
  132.  
  133.         virtual WBool SetFont( const WFont & font, WBool preserveSize=TRUE );
  134.  
  135.         virtual WBool WantsDragMessage( WULong whichButton ) const;
  136.  
  137.         /**************************************************************
  138.          * Data members
  139.          **************************************************************/
  140.  
  141.     private:
  142.         WBool       _autoSize;
  143. };
  144.  
  145. #ifndef _WNO_PRAGMA_PUSH
  146. #pragma enum pop;
  147. #pragma pack(pop);
  148. #endif
  149.  
  150. #endif // _WBUTTON_HPP_INCLUDED
  151.