home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C++ / Frameworks / MacZoop 1.1 / More Classes / ZScroller.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-01  |  2.0 KB  |  89 lines  |  [TEXT/CWIE]

  1. /*************************************************************************************************
  2. *
  3. *
  4. *            ObjectMacZapp        -- a standard Mac OOP application template
  5. *
  6. *
  7. *
  8. *            ZScroller.h            -- a window with scrollbars
  9. *
  10. *
  11. *
  12. *
  13. *
  14. *            © 1996, Graham Cox
  15. *
  16. *
  17. *
  18. *
  19. *************************************************************************************************/
  20.  
  21.  
  22. #pragma once
  23.  
  24. #ifndef __ZSCROLLER__
  25. #define    __ZSCROLLER__
  26.  
  27.  
  28. #include    "ZWindow.h"
  29.  
  30. /*
  31.  ZScroller is a window that has scrollbars in the usual way. The scrollBounds sets the size
  32.  of the area that the window can show- if this is ever less than the window content the
  33.  scrollbars will be disabled. The scale values set how many pixels to move in each direction
  34.  for each increment of the scrollbar. Override this class to implement scrolling windows with
  35.  REAL content.
  36. */
  37.  
  38.  
  39. class    ZScroller : public ZWindow
  40. {
  41. protected:
  42.     ControlHandle        theHBar;
  43.     ControlHandle        theVBar;
  44.     Rect                scrollBounds;
  45.     short                hScale;
  46.     short                vScale;
  47.     Boolean                hasHBar;
  48.     Boolean                hasVBar;
  49.  
  50. public:
  51.     
  52.     ZScroller(ZCommander* aBoss, short windID, Boolean hasHScroll, Boolean hasVScroll);
  53.     
  54.     virtual void    InitZWindow();
  55.     virtual void    Activate();
  56.     virtual void    Deactivate();
  57.     virtual void    Draw();
  58.     virtual void    DrawGrow();
  59.     virtual void    Click(Point mouse, short modifiers);
  60.     virtual void    SetSize(short width, short height);
  61.     virtual void    Zoom(short partCode);
  62.     virtual void    SetBounds(Rect* bounds);
  63.     virtual void    GetBounds(Rect* bounds);
  64.     virtual void    SetScrollAmount(short hAmount, short vAmount);
  65.     virtual void    GetPosition(short* hPosition, short* vPosition);
  66.     virtual void    ScrollTo(short hPosition, short vPosition);
  67.     virtual void    GetContentRect(Rect* aRect);
  68.     virtual void    ClickContent(Point mouse, short modifiers);
  69.     virtual void    Scroll(short dH, short dV);
  70.  
  71. protected:
  72.  
  73.     virtual void    CalculateControlParams();
  74.     virtual void    MakeScrollbars();
  75.     virtual void    MoveScrollbars();
  76.     virtual void    PostScroll();
  77.     virtual void    SetOriginToScroll();
  78.  
  79. public:
  80.  
  81.     virtual void    ScrollHandler(ControlHandle aCtl, short partCode);
  82. };
  83.  
  84.  
  85. #define        kStdScrollbarWidth        15
  86.  
  87.  
  88.  
  89. #endif