home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WSCROLLB.HPP < prev    next >
C/C++ Source or Header  |  1996-10-18  |  8KB  |  247 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.  * WScrollBar -- Wrapper for the Windows 95 ScrollBar control.
  14.  *
  15.  *   Events:
  16.  *
  17.  *       Scroll -- When the control is scrolled.
  18.  *
  19.  *************************************************************************/
  20.  
  21. #ifndef _WSCROLLB_HPP_INCLUDED
  22. #define _WSCROLLB_HPP_INCLUDED
  23.  
  24. #ifndef _WNO_PRAGMA_PUSH
  25. #pragma pack(push,8);
  26. #pragma enum int;
  27. #endif
  28.  
  29. #ifndef _WCONTROL_HPP_INCLUDED
  30. #  include "wcontrol.hpp"
  31. #endif
  32.  
  33. class WScrollBar;
  34.  
  35. struct WScrollBarEventData : public WEventData {
  36.     WScrollDir      direction;
  37.     WScrollMessage  message;
  38.     WInt            position;
  39.     WWindowHandle   handle;
  40. };
  41.  
  42. //
  43. // Scrollbar styles
  44. //
  45.  
  46. #define WSBSHorizDefault ((WStyle)0x50000000L) // WS_VISIBLE|SBS_HORZ|WS_CHILD
  47. #define WSBSVertDefault  ((WStyle)0x50000001L) // WS_VISIBLE|SBS_VERT|WS_CHILD
  48. #define WSBSHorizontal   ((WStyle)0x00000000L) // SBS_HORZ
  49. #define WSBSVertical     ((WStyle)0x00000001L) // SBS_VERT
  50. #define WSBSAlignTop     ((WStyle)0x00000002L) // SBS_TOPALIGN
  51. #define WSBSAlignBottom  ((WStyle)0x00000004L) // SBS_BOTTOMALIGN
  52. #define WSBSAlignLeft    ((WStyle)0x00000002L) // SBS_LEFTALIGN
  53. #define WSBSAlignRight   ((WStyle)0x00000004L) // SBS_RIGHTALIGN
  54.  
  55. struct WScrollBarFDXDataStruct {
  56.     WInt                position;
  57.     WRange              range;
  58. };
  59.  
  60. class WCMCLASS WScrollBar : public WControl {
  61.     WDeclareSubclass( WScrollBar, WControl );
  62.  
  63.         /**********************************************************
  64.          * Constructors and Destructors
  65.          *********************************************************/
  66.     
  67.     protected:
  68.     
  69.         WScrollBar( WScrollDir dir );
  70.     
  71.     public:
  72.  
  73.         ~WScrollBar();
  74.  
  75.     public:
  76.  
  77.         /**********************************************************
  78.          * Properties
  79.          *********************************************************/
  80.  
  81.         // FDXDataSource
  82.  
  83.         WBool SetFDXDataSource( WInt * fdxDataSource );
  84.         WBool SetFDXDataSource( WScrollBarFDXDataStruct * fdxDataSource );
  85.  
  86.         // Direction
  87.  
  88.         WScrollDir GetDirection() const;
  89.  
  90.         // Increment
  91.  
  92.         WLong GetIncrement() const;
  93.         WBool SetIncrement( WLong increment );
  94.  
  95.         // Page size
  96.  
  97.         WBool SetPageSize ( const WInt & psize );
  98.         WInt  GetPageSize () const;
  99.  
  100.         // ScrollPosition
  101.  
  102.         WInt  GetScrollPosition() const;
  103.         WBool SetScrollPosition( WInt pos );
  104.     
  105.         // ScrollRange
  106.  
  107.         WRange GetScrollRange();
  108.         WBool  SetScrollRange( const WRange & range, WBool repaint = FALSE );
  109.  
  110.         // Step
  111.  
  112.         WLong GetStep() const;
  113.         WBool SetStep( WLong step );
  114.  
  115.         /**********************************************************
  116.          * Methods
  117.          *********************************************************/
  118.     
  119.         /**********************************************************
  120.          * Event Handlers
  121.          *********************************************************/
  122.     
  123.         WBool ScrollEventHandler( WWindow * window,
  124.                                   WScrollBarEventData * event );
  125.     
  126.         /**********************************************************
  127.          * Overrides
  128.          *********************************************************/
  129.     
  130.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  131.                                    void * data=NULL );
  132.  
  133.         virtual WBool ProcessMessage( const WMessage & msg,
  134.                                       WLong & returns );
  135.     
  136.         virtual const WChar * InitializeClass();
  137.  
  138.         virtual WBool FDXIn();
  139.  
  140.         virtual WBool FDXOut();
  141.  
  142.         virtual WBool SetScrollPosition( WScrollDir bar, WInt pos,
  143.                                          WBool redraw=TRUE );
  144.  
  145.         virtual WInt GetScrollPosition( WScrollDir bar );
  146.  
  147.         virtual WBool SetScrollRange( WScrollDir bar, const WRange & range,
  148.                                       WBool redraw=TRUE );
  149.  
  150.         virtual WRange GetScrollRange( WScrollDir bar ) const;
  151.  
  152.         /**********************************************************
  153.          * Data members
  154.          *********************************************************/
  155.     
  156.     private:
  157.     
  158.         WScrollDir                      _direction;
  159.         WLong                           _increment;
  160.         WLong                           _step;
  161.         WInt *                          _fdxDataSource;
  162.         WScrollBarFDXDataStruct *       _fdxDataSourceStruct;
  163. };
  164.     
  165. /*************************************************************************
  166.  *
  167.  * WVScrollBar -- Wrapper for the Windows 95 Vertical ScrollBar control.
  168.  *
  169.  *   Events:
  170.  *
  171.  *       Scroll -- When the control is scrolled.
  172.  *
  173.  *************************************************************************/
  174.  
  175. class WCMCLASS WVScrollBar : public WScrollBar {
  176.     WDeclareSubclass( WVScrollBar, WScrollBar );
  177.     
  178.     public:
  179.  
  180.         /**********************************************************
  181.          * Constructors and Destructors
  182.          *********************************************************/
  183.     
  184.         WVScrollBar();
  185.  
  186.         ~WVScrollBar();
  187.     
  188.         /**********************************************************
  189.          * Properties
  190.          *********************************************************/
  191.     
  192.         /**********************************************************
  193.          * Methods
  194.          *********************************************************/
  195.     
  196.         /**********************************************************
  197.          * Data members
  198.          *********************************************************/
  199.     
  200.         virtual WStyle GetDefaultStyle() const;
  201. };
  202.     
  203. /*************************************************************************
  204.  *
  205.  * WHScrollBar -- Wrapper for the Windows 95 Horizontal ScrollBar control.
  206.  *
  207.  *   Events:
  208.  *
  209.  *       Scroll -- When the control is scrolled.
  210.  *
  211.  *************************************************************************/
  212.  
  213. class WCMCLASS WHScrollBar : public WScrollBar {
  214.     WDeclareSubclass( WHScrollBar, WScrollBar );
  215.     
  216.     public:
  217.  
  218.         /**********************************************************
  219.          * Constructors and Destructors
  220.          *********************************************************/
  221.     
  222.         WHScrollBar();
  223.  
  224.         ~WHScrollBar();
  225.     
  226.         /**********************************************************
  227.          * Properties
  228.          *********************************************************/
  229.     
  230.         /**********************************************************
  231.          * Methods
  232.          *********************************************************/
  233.     
  234.         /**********************************************************
  235.          * Data members
  236.          *********************************************************/
  237.     
  238.         virtual WStyle GetDefaultStyle() const;
  239. };
  240.     
  241. #ifndef _WNO_PRAGMA_PUSH
  242. #pragma enum pop;
  243. #pragma pack(pop);
  244. #endif
  245.  
  246. #endif // _WSCROLLB_HPP_INCLUDED
  247.