//	Zinc Application Framework - D_SPIN.HPP
//	COPYRIGHT (C) 1990-1999.  All Rights Reserved.
//	Zinc Software Incorporated.  Pleasant Grove, Utah  USA

#include <z_spin.hpp>
#include <z_button.hpp>
#include <z_str1.hpp>

enum ZafSpinState
{
	ZAF_SPIN_NONE,
	ZAF_SPIN_UP,
	ZAF_SPIN_DOWN
};

class ZAF_EXPORT ZafSpinButton : public ZafButton
{
public:
	ZafSpinButton(void);
	ZafSpinButton(const ZafSpinButton &copy);
	~ZafSpinButton();

	virtual ZafEventType Draw(const ZafEventStruct &event, ZafEventType ccode);
	virtual ZafEventType DrawShadow(ZafRegionStruct &region, int depth, ZafEventType ccode);
	virtual ZafEventType Event(const ZafEventStruct &event);
	virtual bool SetSupportObject(bool supportObject);

	// --- Class identification ---
	static ZafClassID classID;
	static ZafClassNameChar ZAF_FARDATA className[];
	virtual ZafClassID ClassID(void) const { return (classID); }
	virtual ZafClassName ClassName(void) const { return (className); }
	virtual bool IsA(ZafClassID compareID) const;
	virtual bool IsA(ZafClassName compareName) const;
	
protected:
	// --- Image support ---
	static char ZAF_FARDATA spinUpArrowName[];
	static char ZAF_FARDATA spinDownArrowName[];
	static ZafBitmapData *spinUpArrowBitmap;
	static ZafBitmapData *spinDownArrowBitmap;
	static void ImageAllocate(void);
	static void ImageFree(bool globalRequest = false);

	virtual ZafWindowObject *Duplicate(void) { return (new ZafSpinButton(*this)); }

private:
	int middle;
	ZafSpinState spinState;
};

