home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 19.ddi / OWLINC.PAK / SCROLLBA.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  3.3 KB  |  114 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows - (C) Copyright 1991, 1993 by Borland International
  3. //   include\owl\scrollba.h
  4. //   Defines class TScrollBar.  This defines the basic
  5. //   behavior of all scrollbar controls.
  6. //----------------------------------------------------------------------------
  7. #if !defined(__OWL_SCROLLBAR_H)
  8. #define __OWL_SCROLLBAR_H
  9.  
  10. #if !defined(__OWL_CONTROL_H)
  11.   #include <owl\control.h>
  12. #endif
  13.  
  14. //
  15. //  class TScrollBar
  16. //  ----- ----------
  17. //
  18. class _OWLCLASS TScrollBar : public TControl {
  19.   public:
  20.     TScrollBar(TWindow*        parent,
  21.                int             id,
  22.                int x, int y, int w, int h,
  23.                BOOL            isHScrollBar,
  24.                TModule*        module = 0);
  25.  
  26.     TScrollBar(TWindow* parent, int resourceId, TModule*   module = 0);
  27.  
  28.     //
  29.     // Virtual functions to interface to scrollbars & derived
  30.     //
  31.     virtual void  GetRange(int& min, int& max) const
  32.                     {::GetScrollRange(HWindow, SB_CTL, &min, &max);}
  33.     virtual int   GetPosition() const {return ::GetScrollPos(HWindow, SB_CTL);}
  34.     virtual void  SetRange(int min, int max)
  35.                     {::SetScrollRange(HWindow, SB_CTL, min, max, FALSE);}
  36.     virtual void  SetPosition(int thumbPos);
  37.     virtual int   DeltaPos(int delta);
  38.  
  39.     //
  40.     // Override TWindow virtual member functions
  41.     //
  42.     UINT          Transfer(void* buffer, TTransferDirection direction);
  43.  
  44.     //
  45.     // called by EvHScroll and EvVScroll response table handlers
  46.     //
  47.     // these routines all end up calling SetPosition()
  48.     //
  49.     virtual void  SBLineUp();
  50.     virtual void  SBLineDown();
  51.     virtual void  SBPageUp();
  52.     virtual void  SBPageDown();
  53.     virtual void  SBThumbPosition(int thumbPos);
  54.     virtual void  SBThumbTrack(int thumbPos);
  55.     virtual void  SBTop();
  56.     virtual void  SBBottom();
  57.     virtual void  SBEndScroll();
  58.  
  59.     //
  60.     // response table handlers that call above virtual functions in 
  61.     // response to messages sent by to us by TWindow::DispatchScroll()
  62.     //
  63.     void          EvHScroll(UINT scrollCode, UINT thumbPos, HWND hWndCtl);
  64.     void          EvVScroll(UINT scrollCode, UINT thumbPos, HWND hWndCtl);
  65.     
  66.   public:
  67.     int  LineMagnitude;
  68.     int  PageMagnitude;
  69.  
  70.   protected:
  71.     //
  72.     // Override TWindow virtual member functions
  73.     //
  74.     char far*     GetClassName();
  75.     void          SetupWindow();
  76.  
  77.   private:
  78.     //
  79.     // hidden to prevent accidental copying or assignment
  80.     //
  81.     TScrollBar(const TScrollBar&);
  82.     TScrollBar& operator=(const TScrollBar&);
  83.  
  84.   DECLARE_RESPONSE_TABLE(TScrollBar);
  85.   DECLARE_STREAMABLE(_OWLCLASS, TScrollBar, 1);
  86. };
  87.  
  88. //
  89. // scroll bar notification macros. methods are: void method()
  90. //
  91. // EV_SB_LINEDOWN(id, method)
  92. // EV_SB_LINEUP(id, method)
  93. // EV_SB_PAGEDOWN(id, method)
  94. // EV_SB_PAGEUP(id, method)
  95. // EV_SB_TOP(id, method)
  96. // EV_SB_BOTTOM(id, method)
  97. // EV_SB_THUMBPOSITION(id, method)
  98. // EV_SB_ENDSCROLL(id, method)
  99. // EV_SB_BEGINTRACK(id, method)
  100.  
  101. //
  102. //  struct TScrollBarData
  103. //  ------ --------------
  104. //
  105. //  TScrollBar transfer structure
  106. //
  107. struct TScrollBarData {
  108.   int  LowValue;
  109.   int  HighValue;
  110.   int  Position;
  111. };
  112.  
  113. #endif  // __OWL_SCROLLBAR_H
  114.