#ifndef __SCROLLBARPANE_H
#define __SCROLLBARPANE_H

/*	ScrollbarPane.h								JJS 11/12/97

	This class implements a scroll bar.  See comments below for usage.

	NOTE: this scroll bar supports Smart Scroll, a system extension that fixes
	the Mac scroll bars so that they are proportionally sized (if you ever
	used an Apple IIGS or a NeXT, you know what I mean -- if not, see below).
	I encourage you to support this in your apps, but if you must refuse,
	comment out one #define in ScrollbarPane.cpp.
	
	Otherwise, you'll need to link a tiny API library into your app, which
	you can download from <http://www.kagi.com/authors/marc/SmartScroll.html>
	The library comes as C or Pascal source, or a precompiled library for
	PPC or 68K.  Really, get it -- you'll like it (and so will your users!).
	
*/

#include "Pane.h"

class ScrollbarPane : public Pane
{
  public:
	// constructor/destructor
	ScrollbarPane(WindowPtr);	// must pass the window it's attached to  :(
	~ScrollbarPane();
	
	// scrollbar adjustments
	virtual void FitFrame();
	virtual void HandleScroll( const short partCode );
	
	// draw the pane (assumes grafport coordinates are set up)
	virtual void Draw();

	// try to handle a click -- return 1 if handled
	virtual Boolean Click( const Point where, const long modifiers);

	// set range max -- should be the position of the *top* of the bottom page
	// (e.g., if last line is 100 and page size is 25, set max to 75)
	virtual void SetMaximum( const short max )
		{ if (mControl) SetControlMaximum(mControl, max); }

	// set current control value
	virtual void SetValue( const short val )
		{ if (mControl) SetControlValue(mControl, val); }

	// get current control value (position of top line in view)
	virtual short GetValue() const
		{ return (mControl ? GetControlValue(mControl) : 0); }

	// get current maximum (top line of last page)
	virtual short GetMaximum() const
		{ return (mControl ? GetControlMaximum(mControl) : 0); }

	// PUBLIC DATA:
	short mArrowRate, mPageRate;	// amount to change by arrow or page
	
	// PUBLIC CONSTANT:
	enum { kStdScrollbarSize = 16 };
	
  protected:
	ControlHandle mControl;
	WindowPtr	mWindowPtr;
};

#endif
