/*	XControls.h
 *
 *		The controls template. This defines a number of abstract
 *	classes from which my control library is derived
 */

/*  YAAF - Yet another application framework
 *  Copyright (C) 1997, 1998 William Edward Woody
 *  
 *  This library is free software; you can redistribute it
 *  and/or modify it under the terms of the GNU Library
 *  General Public License as published by the Free Software
 *  Foundation; either version 2 of the License, or any
 *  later version.
 *  
 *  This library is distributed in the hope that it will be
 *  useful, but WITHOUT ANY WARRANTY; without even the implied
 *  warranty of MERCHANTABIILITY or FITNESS FOR A PARTICULAR
 *  PURPOSE. See the GNU Library General Public License for
 *  more details.
 *  
 *  You should have received a copy of the GNU Library General
 *  Public License along with this library; if not, write to the
 *  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 *  Boston, MA 02111-1307, USA.
 *  
 *  To contact the author, either e-mail me at woody@pandawave.com, 
 *	or write to
 *  
 *          William Edward Woody
 *          In Phase Consulting
 *          1545 Ard Eevin Avenue
 *          Glendale, CA 91202
 *
 *	Or visit us on the web at http://www.pandawave.com
 */

#ifndef PandaWave_XCONTROLS
#define PandaWave_XCONTROLS

#include <XConfig.h>
#include <XView.h>

/************************************************************************/
/*																		*/
/*	Abstractions														*/
/*																		*/
/************************************************************************/

/*	@C"XGControl"
 *	@D"XGView"
 *	@H"XControls.h"
 *	@I
 *
 *		Basic control abstraction. A 'control' is basically a view
 *	which has a value. That value is then manipulated by the view's
 *	user interface.
 */

class XGControl : public XGView {
	public:
								XGControl(XGOwner *parent, XGSViewInitRecord &s);
								XGControl(XGOwner *parent, XGArgStream &s);
		virtual					~XGControl();
		
		/*
		 *	Control values
		 */
		
		// @G"Control Values"
		
		/*	@F"XGControl::GetValue" @I
		 *
		 *		Gets the value of this control. This is an abstract method
		 *	which needs to be overridden for controls.
		 */
		
		virtual long			GetValue() = 0;

		/*	@F"XGControl::SetValue" @I
		 *
		 *		Sets the value of this control. This is an abstract method
		 *	which needs to be overridden for controls.
		 */
		
		virtual void			SetValue(long) = 0;
	
	protected:

#if OPT_MACOS
		char					*StripAmperstand(char *out, const char *in);
#endif
};

/*	@C"XGSlider"
 *	@D"XGControl"
 *	@H"XControls.h"
 *	@I
 *
 *		This implements the abstraction of a range of controls
 *	which not only have a value, but an adjustable minimum and
 *	maximum value
 */

class XGSlider : public XGControl {
	public:
								XGSlider(XGOwner *parent, XGSViewInitRecord &s);
								XGSlider(XGOwner *parent, XGArgStream &s);
		virtual					~XGSlider();
		
		/*
		 *	Min/Max Values
		 */
		 
		// @G"Minimum/Maximum Values"
		
		/*	@F"XGControl::GetMinValue" @I
		 *
		 *		Gets minimum value allowed by this slider. This is an abstract method
		 *	which needs to be overridden for controls.
		 */
		
		virtual long			GetMinValue() = 0;

		/*	@F"XGControl::GetMaxValue" @I
		 *
		 *		Gets maximum value allowed by slider. This is an abstract method
		 *	which needs to be overridden for controls.
		 */
		
		virtual long			GetMaxValue() = 0;

		/*	@F"XGControl::SetMinValue" @I
		 *
		 *		Sets the minimum value allowed by slider. This is an abstract method
		 *	which needs to be overridden for controls.
		 */
		
		virtual void			SetMinValue(long) = 0;

		/*	@F"XGControl::SetMaxValue" @I
		 *
		 *		Sets the maximum value allowed by slider. This is an abstract method
		 *	which needs to be overridden for controls.
		 */
		
		virtual void			SetMaxValue(long) = 0;
};


#endif // PandaWave_XCONTROLS


