/***********************************************************************
 *
 Copyright © 1995 - 1998, 3Com Corporation or its subsidiaries ("3Com").  
 All rights reserved.
   
 This software may be copied and used solely for developing products for 
 the Palm Computing platform and for archival and backup purposes.  Except 
 for the foregoing, no part of this software may be reproduced or transmitted 
 in any form or by any means or used to make any derivative work (such as 
 translation, transformation or adaptation) without express written consent 
 from 3Com.

 3Com reserves the right to revise this software and to make changes in content 
 from time to time without obligation on the part of 3Com to provide notification 
 of such revision or changes.  
 3COM MAKES NO REPRESENTATIONS OR WARRANTIES THAT THE SOFTWARE IS FREE OF ERRORS 
 OR THAT THE SOFTWARE IS SUITABLE FOR YOUR USE.  THE SOFTWARE IS PROVIDED ON AN 
 "AS IS" BASIS.  3COM MAKES NO WARRANTIES, TERMS OR CONDITIONS, EXPRESS OR IMPLIED, 
 EITHER IN FACT OR BY OPERATION OF LAW, STATUTORY OR OTHERWISE, INCLUDING WARRANTIES, 
 TERMS, OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND 
 SATISFACTORY QUALITY.

 TO THE FULL EXTENT ALLOWED BY LAW, 3COM ALSO EXCLUDES FOR ITSELF AND ITS SUPPLIERS 
 ANY LIABILITY, WHETHER BASED IN CONTRACT OR TORT (INCLUDING NEGLIGENCE), FOR 
 DIRECT, INCIDENTAL, CONSEQUENTIAL, INDIRECT, SPECIAL, OR PUNITIVE DAMAGES OF 
 ANY KIND, OR FOR LOSS OF REVENUE OR PROFITS, LOSS OF BUSINESS, LOSS OF INFORMATION 
 OR DATA, OR OTHER FINANCIAL LOSS ARISING OUT OF OR IN CONNECTION WITH THIS SOFTWARE, 
 EVEN IF 3COM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

 3Com, HotSync, Palm Computing, and Graffiti are registered trademarks, and 
 Palm III and Palm OS are trademarks of 3Com Corporation or its subsidiaries.

 IF THIS SOFTWARE IS PROVIDED ON A COMPACT DISK, THE OTHER SOFTWARE AND 
 DOCUMENTATION ON THE COMPACT DISK ARE SUBJECT TO THE LICENSE AGREEMENT 
 ACCOMPANYING THE COMPACT DISK.

 ******************************************************************************
 *
 * PROJECT:  Pilot
 * FILE:     Control.h
 * AUTHOR:	 Art Lamb: August 29, 1994
 *
 * DECLARER: UI
 *
 * DESCRIPTION:
 *	  This file defines check box structures and routines.
 *
 ***********************************************************************/
#ifndef __CONTROL_H__
#define __CONTROL_H__



typedef struct {
	Byte usable         :1;		// set if part of ui 
	Byte enabled        :1;		// set if interactable (not grayed out)
	Byte visible        :1;		// set if drawn (set internally)
	Byte on             :1;		// set if on (checked)
	Byte leftAnchor     :1;		// set if bounds expand to the right
	                           // clear if bounds expand to the left
   Byte frame          :3;
} ControlAttrType;


enum controlStyles {buttonCtl, pushButtonCtl, checkboxCtl, popupTriggerCtl,
							 selectorTriggerCtl, repeatingButtonCtl};
typedef enum controlStyles ControlStyleType;

enum buttonFrames {noButtonFrame, standardButtonFrame, boldButtonFrame,
						 rectangleButtonFrame};
typedef enum buttonFrames ButtonFrameType;


typedef struct {
	Word						id;
	RectangleType			bounds;
	CharPtr				   text;	
	ControlAttrType		attr;
	ControlStyleType		style;
	FontID					font;
	Byte						group;
} ControlType;


typedef ControlType * ControlPtr;



//----------------------------------------------------------
//	Control Functions
//----------------------------------------------------------

#ifdef __cplusplus
extern "C" {
#endif

extern void CtlDrawControl (const ControlPtr pControl)
							SYS_TRAP(sysTrapCtlDrawControl);

extern void CtlEraseControl (const ControlPtr pControl)
							SYS_TRAP(sysTrapCtlEraseControl);

extern void CtlHideControl (const ControlPtr pControl)
							SYS_TRAP(sysTrapCtlHideControl);

extern void CtlShowControl (const ControlPtr pControl)
							SYS_TRAP(sysTrapCtlShowControl);

extern Boolean CtlEnabled (const ControlPtr pControl)
							SYS_TRAP(sysTrapCtlEnabled);

extern void CtlSetEnabled (const ControlPtr pControl, const Boolean usable)
							SYS_TRAP(sysTrapCtlSetEnabled);

extern void CtlSetUsable (const ControlPtr pControl, const Boolean usable)
							SYS_TRAP(sysTrapCtlSetUsable);

extern SWord CtlGetValue (const ControlPtr pControl)
							SYS_TRAP(sysTrapCtlGetValue);

extern void CtlSetValue (const ControlPtr pControl, const SWord newValue)
							SYS_TRAP(sysTrapCtlSetValue);

extern CharPtr CtlGetLabel (const ControlPtr pControl)
							SYS_TRAP(sysTrapCtlGetLabel);

extern void CtlSetLabel (const ControlPtr pControl, const CharPtr newLabel)
							SYS_TRAP(sysTrapCtlSetLabel);

extern void CtlHitControl (const ControlPtr pControl)
							SYS_TRAP(sysTrapCtlHitControl);

extern Boolean CtlHandleEvent (const ControlPtr pControl, 
	const EventPtr pEvent)
							SYS_TRAP(sysTrapCtlHandleEvent);

extern Boolean CtlValidatePointer (const ControlPtr pControl)
							SYS_TRAP(sysTrapCtlValidatePointer);

extern ControlPtr CtlNewControl (VoidPtr *formPP, const Word ID, 
	const ControlStyleType style, const CharPtr textP, 
	const Word x, const Word y, const Word width, const Word height, 
	const FontID font, Byte group, Boolean leftAnchor)
							SYS_TRAP(sysTrapCtlNewControl);


#ifdef __cplusplus 
}
#endif


#endif //__CONTROL_H__



