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

/**********************************************************************

  YAAF is Copyright 1997-1999 by William Woody.

  Redistribution and use in source and binary forms, with or without 
  modification, are permitted provided that the following conditions 
  are met:

  Redistributions of source code must retain the above copyright notice, 
  this list of conditions and the following disclaimer.

  Neither the name of the copyright holder or other contributors may
  be used to promote products derived from this software without
  specific written prior permission.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 
  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
  SOFTWARE.
  
  Contact:   woody@alumni.caltech.edu
  Web page:  http://www.pandawave.com/yaaf/

**********************************************************************/

#ifndef PandaWave_XCONTROLS
#define PandaWave_XCONTROLS

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

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

/*$	XGControl
 *
 *		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(XGView *parent, XGSViewInitRecord &s);
								XGControl(XGView *parent, XGArgStream &s);
		virtual					~XGControl();
		
		/*
		 *	Control values
		 */
		
		/*$	XGControl::GetValue
		 *
		 *		Gets the value of this control. This is an abstract method
		 *	which needs to be overridden for controls.
		 */
		
		virtual long			GetValue() = 0;

		/*$	XGControl::SetValue
		 *
		 *		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

#if OPT_WINOS
		void					SetControlFocus(HWND);
#endif
};

/*$	XGSlider
 *
 *		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(XGView *parent, XGSViewInitRecord &s);
								XGSlider(XGView *parent, XGArgStream &s);
		virtual					~XGSlider();
		
		/*
		 *	Min/Max Values
		 */
		 
		
		/*$	XGControl::GetMinValue
		 *
		 *		Gets minimum value allowed by this slider. This is an abstract method
		 *	which needs to be overridden for controls.
		 */
		
		virtual long			GetMinValue() = 0;

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

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

		/*$	XGControl::SetMaxValue
		 *
		 *		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


