home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WSLIDER.HPP < prev    next >
C/C++ Source or Header  |  1996-10-18  |  6KB  |  197 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.  * WSlider -- Wrapper for the Windows 95 Slider control.
  14.  *
  15.  *
  16.  *   Events:
  17.  *
  18.  *       Scroll -- When the control has been scrolled.
  19.  *
  20.  *************************************************************************/
  21.  
  22. #ifndef _WSLIDER_HPP_INCLUDED
  23. #define _WSLIDER_HPP_INCLUDED
  24.  
  25. #ifndef _WNO_PRAGMA_PUSH
  26. #pragma pack(push,8);
  27. #pragma enum int;
  28. #endif
  29.  
  30. #ifndef _WCONTROL_HPP_INCLUDED
  31. #  include "wcontrol.hpp"
  32. #endif
  33. #ifndef _WSCROLLB_HPP_INCLUDED
  34. #  include "wscrollb.hpp"
  35. #endif
  36.  
  37. class WSlider;
  38.  
  39. struct WSliderEventData : public WScrollBarEventData {
  40. };
  41.  
  42. //
  43. // Slider styles
  44. //
  45.  
  46. #define WTBSDefault             ((WStyle)0x50000001L) // TBS_HORZ|TBS_BOTTOM|TBS_AUTOTICKS|WS_VISIBLE|WS_CHILD
  47. #define WTBSHorizontal          ((WStyle)0x00000000L) // TBS_HORZ
  48. #define WTBSRight               ((WStyle)0x00000000L) // TBS_RIGHT
  49. #define WTBSBottom              ((WStyle)0x00000000L) // TBS_BOTTOM
  50. #define WTBSAutoTicks           ((WStyle)0x00000001L) // TBS_AUTOTICKS
  51. #define WTBSVertical            ((WStyle)0x00000002L) // TBS_VERT
  52. #define WTBSLeft                ((WStyle)0x00000004L) // TBS_LEFT
  53. #define WTBSTop                 ((WStyle)0x00000004L) // TBS_TOP
  54. #define WTBSBoth                ((WStyle)0x00000008L) // TBS_BOTH
  55. #define WTBSNoTicks             ((WStyle)0x00000010L) // TBS_NOTICKS
  56. #define WTBSEnableSelRange      ((WStyle)0x00000020L) // TBS_ENABLESELRANGE
  57. #define WTBSFixedLength         ((WStyle)0x00000040L) // TBS_FIXEDLENGTH
  58. #define WTBSNoThumb             ((WStyle)0x00000080L) // TBS_NOTHUMB
  59.  
  60. struct WSliderFDXDataStruct {
  61.     WLong               position;
  62.     WRange              range;
  63. };
  64.  
  65. class WCMCLASS WSlider : public WControl {
  66.     WDeclareSubclass( WSlider, WControl );
  67.  
  68.     public:
  69.  
  70.         /**********************************************************
  71.          * Constructors and Destructors
  72.          *********************************************************/
  73.  
  74.         WSlider();
  75.     
  76.         ~WSlider();
  77.  
  78.         /**********************************************************
  79.          * Properties
  80.          *********************************************************/
  81.  
  82.         // ChannelRectangle
  83.  
  84.         WRect GetChannelRectangle();
  85.  
  86.         // FDXDataSource
  87.  
  88.         WBool SetFDXDataSource( WLong * fdxDataSource );
  89.         WBool SetFDXDataSource( WSliderFDXDataStruct * fdxDataSource );
  90.  
  91.         // LineSize
  92.  
  93.         WBool SetLineSize( WLong size=1 );
  94.         WLong GetLineSize();
  95.  
  96.         // NumTicks
  97.  
  98.         WLong GetNumTicks();
  99.  
  100.         // PageSize
  101.  
  102.         WBool SetPageSize( WLong size );
  103.         WLong GetPageSize();
  104.  
  105.         // Position
  106.  
  107.         WBool SetPosition( WLong pos );
  108.         WLong GetPosition();
  109.  
  110.         // Range
  111.  
  112.         WBool SetRange( const WRange & range, WBool redraw=TRUE );
  113.         WRange GetRange();
  114.  
  115.         // SelectedRange
  116.  
  117.         WBool SetSelectedRange( const WRange & range, WBool redraw=TRUE );
  118.         WRange GetSelectedRange();
  119.  
  120.         // ThumbRectangle
  121.  
  122.         WRect GetThumbRectangle();
  123.  
  124.         // TickFrequency
  125.  
  126.         WLong GetTickFrequency() const;
  127.         WBool SetTickFrequency( WLong frequency=1 );
  128.  
  129.         /**********************************************************
  130.          * Methods
  131.          *********************************************************/
  132.  
  133.         // Add Tick
  134.         WBool AddTick( WLong pos );
  135.  
  136.         // ClearSelectedRange
  137.  
  138.         WBool ClearSelectedRange( WBool redraw=TRUE );
  139.  
  140.         // DeleteAllTicks
  141.  
  142.         WBool DeleteAllTicks( WBool redraw=TRUE );
  143.  
  144.         /**********************************************************
  145.          * Item Properties
  146.          *********************************************************/
  147.  
  148.         // TickPosition
  149.  
  150.         WLong GetTickPosition( WShort tickIndex );
  151.         WLong GetTick ( WShort tickIndex );
  152.         
  153.         /**************************************************************
  154.          * Overrides
  155.          **************************************************************/
  156.  
  157.     protected:
  158.  
  159.         virtual WBool MakeWindow( WWindow * parent, WUInt id,
  160.                                   const WChar * className,
  161.                                   const WChar * title, const WRect & r,
  162.                                   WStyle wstyle, WStyle exStyle,
  163.                                   void * data=NULL );
  164.  
  165.     public:
  166.  
  167.         virtual const WChar * InitializeClass();
  168.  
  169.         virtual WStyle GetDefaultStyle() const;
  170.  
  171.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  172.                                    void * data=NULL );
  173.  
  174.         virtual WBool ProcessMessage( const WMessage & msg,
  175.                                       WLong & returns );
  176.     
  177.         virtual WBool FDXIn();
  178.  
  179.         virtual WBool FDXOut();
  180.  
  181.         /**************************************************************
  182.          * Data members
  183.          **************************************************************/
  184.  
  185.     private:
  186.         WLong *                 _fdxDataSource;
  187.         WSliderFDXDataStruct *  _fdxDataSourceStruct;
  188.         WLong                   _tickFrequency;
  189. };
  190.  
  191. #ifndef _WNO_PRAGMA_PUSH
  192. #pragma enum pop;
  193. #pragma pack(pop);
  194. #endif
  195.  
  196. #endif // _WSLIDER_HPP_INCLUDED
  197.