home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / WUPDOWN.HPP < prev    next >
C/C++ Source or Header  |  1996-10-18  |  6KB  |  169 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.  * WUpDown -- Wrapper for the Windows 95 UpDown control.
  14.  *
  15.  *
  16.  *   Events:
  17.  *
  18.  *       DeltaPosition --
  19.  *
  20.  *************************************************************************/
  21.  
  22. #ifndef _WUPDOWN_HPP_INCLUDED
  23. #define _WUPDOWN_HPP_INCLUDED
  24.  
  25. #ifndef _WNO_PRAGMA_PUSH
  26. #pragma pack(push,8);
  27. #pragma enum int;
  28. #endif
  29.  
  30. #ifndef _WTEXTBOX_HPP_INCLUDED
  31. #  include "wtextbox.hpp"
  32. #endif
  33. #ifndef _WCONTROL_HPP_INCLUDED
  34. #  include "wcontrol.hpp"
  35. #endif
  36.  
  37. typedef void WCMDEF (WObject::*WUpDownCallback)( WWindow *source,
  38.                                                   void *userdata );
  39.  
  40. //
  41. // UpDown styles
  42. //
  43.  
  44. #define WUDSDefault             ((WStyle)0x50000027L) // WS_VISIBLE|WS_CHILD|UDS_ARROWKEYS|UDS_WRAP|UDS_SETBUDDYINT|UDS_ALIGNRIGHT
  45.  
  46. #define WUDSWrap                ((WStyle)0x00000001L) // UDS_WRAP
  47. #define WUDSSetBuddyInt         ((WStyle)0x00000002L) // UDS_SETBUDDYINT
  48. #define WUDSAlignRight          ((WStyle)0x00000004L) // UDS_ALIGNRIGHT
  49. #define WUDSAlignLeft           ((WStyle)0x00000008L) // UDS_ALIGNLEFT
  50. #define WUDSAutoBuddy           ((WStyle)0x00000010L) // UDS_AUTOBUDDY
  51. #define WUDSArrowKeys           ((WStyle)0x00000020L) // UDS_ARROWKEYS
  52. #define WUDSHorz                ((WStyle)0x00000040L) // UDS_HORZ
  53. #define WUDSNoThousands         ((WStyle)0x00000080L) // UDS_NOTHOUSANDS
  54.  
  55. /* NOTE: The following styles we fake ourselves
  56.  * We assume that the style bits from
  57.  * 0x8000 to 0x1000 are not taken by any UDS_* values
  58.  */
  59. #define WUDSReadOnly            ((WStyle)0x00008000L) // UDS_READONLY
  60. #define WUDSLeftJustify         ((WStyle)0x00004000L) // UDS_LEFTJUSTIFY
  61. #define WUDSCenterJustify       ((WStyle)0x00002000L) // UDS_CENTERJUSTIFY
  62. #define WUDSRightJustify        ((WStyle)0x00001000L) // UDS_RIGHTJUSTIFY
  63.  
  64. struct WDeltaPositionEventData : public WEventData {
  65.     WInt                position;
  66.     WInt                delta;
  67. };
  68.  
  69. class WCMCLASS WUpDown : public WControl {
  70.     WDeclareSubclass( WUpDown, WControl );
  71.  
  72.     public:
  73.         /**********************************************************
  74.          * Constructors and Destructors
  75.          *********************************************************/
  76.  
  77.         WUpDown( WBool autoCreateEdit=FALSE );
  78.     
  79.         ~WUpDown();
  80.  
  81.         /**********************************************************
  82.          * Properties
  83.          *********************************************************/
  84.  
  85.         // Base -- the base (e.g. base 10, base 16) with which the value
  86.         //         is stored
  87.  
  88.         WBool SetBase( WShort base=10 );
  89.         WShort GetBase();
  90.  
  91.         // Buddy -- handle of the window which the updown control is
  92.         //          attached to
  93.  
  94.         WBool SetBuddy( WWindow * buddy );
  95.         WWindow * GetBuddy();
  96.  
  97.         // Increment -- increment by which the value increases each time
  98.  
  99.         WBool SetIncrement( WInt increment );
  100.         WInt GetIncrement();
  101.  
  102.         // Range
  103.  
  104.         WBool SetRange( const WRange & range );
  105.         WRange GetRange();
  106.  
  107.         // Value
  108.  
  109.         WBool SetValue( WShort value );
  110.         WShort GetValue();
  111.  
  112.         /**************************************************************
  113.          * Methods
  114.          **************************************************************/
  115.  
  116.         // CreateAutoEdit
  117.  
  118.         WTextBox * CreateAutoEdit();
  119.  
  120.         /**************************************************************
  121.          * Overrides
  122.          **************************************************************/
  123.  
  124.     protected:
  125.  
  126.         virtual WBool ProcessNotify( WUInt id, WNotify code,
  127.                                      WNotifyInfo info, WLong & returns );
  128.     
  129.     public:
  130.  
  131.         virtual const WChar * InitializeClass();
  132.  
  133.         virtual WStyle GetDefaultStyle() const;
  134.  
  135.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  136.                                    void * data=NULL );
  137.  
  138.         virtual WBool MakeWindow( WWindow * parent, WUInt id,
  139.                                   const WChar * className,
  140.                                   const WChar * title, const WRect & r,
  141.                                   WStyle wstyle, WStyle exStyle,
  142.                                   void * data=NULL );
  143.  
  144.         /**************************************************************
  145.          * Others
  146.          **************************************************************/
  147.  
  148.         WBool LocalMakeWindow( WUInt id, const char *, const char *,
  149.                                    const WRect & r, WStyle style, WStyle,
  150.                                    void * data );
  151.     
  152.         /**************************************************************
  153.          * Data members
  154.          **************************************************************/
  155.  
  156.     private:
  157.  
  158.         WBool           _autoCreateEdit;
  159.         WTextBox *      _editbox;
  160.         WInt            _increment;
  161. };
  162.  
  163. #ifndef _WNO_PRAGMA_PUSH
  164. #pragma enum pop;
  165. #pragma pack(pop);
  166. #endif
  167.  
  168. #endif // _WUPDOWN_HPP_INCLUDED
  169.