//	O.h
#ifndef _H_O
#define _H_O

//#include "O_p.h"
#include "O_COutline.h"
#include "O_CTopic.h"

extern	long gErr;

typedef OTLN_COutline				O_COutline;
typedef OTLN_CTopic					O_CTopic;
typedef OTLN_COutlineAndCTopic		O_TopicRef;
typedef OTLN_COutlineAndCTopicP		O_TopicRefP;
typedef OTLN_CBType					O_CBType;
typedef OTLN_CBDataP				O_CBDataP;
typedef OTLN_CTopicIndex			O_TopicIndex;		
typedef OTLN_CBData_MARQUEE			O_CBData_MARQUEE;

#define	O_Fake_Topic			(OTLN_TopicH)1
#define	O_TopicIndex_END		OTLN_CTopicIndex_END

#define	O_OutlineCellHeight(_o)	DH((_o)->OTLNi_outlineH)->cell_height
#define	O_TopicFirstChild(_t)	DH((_t)->OTLNpi_topicH)->daughters

typedef OTLN_COutlineIterateType			O_IterateType;
#define	O_Iterate_ALL						OTLN_COutlineIterate_ALL
#define	O_Iterate_SELECTED					OTLN_COutlineIterate_SELECTED
#define	O_Iterate_ONSCREEN					OTLN_COutlineIterate_ONSCREEN
#define	O_Iterate_CHILDREN					OTLN_COutlineIterate_CHILDREN

#define	O_CB_DRAW				OTLN_CB_DRAW
#define	O_CB_DRAG_REORDER		OTLN_CB_DRAG_REORDER
#define	O_CB_TWIRL				OTLN_CB_TWIRL
#define	O_CB_MARQUEE			OTLN_CB_MARQUEE
#define	O_CB_DUP_CUST_DATA		OTLN_CB_DUP_CUST_DATA
#define	O_CB_HIT_TEST			OTLN_CB_HIT_TEST
#define	O_CB_DISPOSE_CUST_DATA	OTLN_CB_DISPOSE_CUST_DATA
#define	O_CB_MARQUEE			OTLN_CB_MARQUEE
#define	O_CB_GET_FRAME			OTLN_CB_GET_FRAME
#define	O_CB_NUMTYPES			OTLN_CB_NUMTYPES

/*********************/
//	both
#define	O_ApplyToItems			OTLNm_ApplyToItems
#define	O_GetCustomData			OTLNm_GetCustomData
#define	O_SetCustomData			OTLNm_SetCustomData
#define	O_SetCallbackDispatch	OTLNm_SetCallbackDispatch

/*********************/
//	outlines
#define	O_InitOutline()			OTLNm_IOutline(&gErr, NULL)
#define	O_DisposeOutline		OTLNm_DisposeOutline

#define	O_GetRoot				OTLNm_GetRootTopic
#define	O_SetFontInfo			OTLNm_SetFontInfo

#define	O_GetRecent				OTLNm_GetRecent
#define	O_SetRecent				OTLNm_SetRecent

#define	O_GetCellHeight			OTLNm_GetCellHeight
#define	O_SetCellHeight			OTLNm_SetCellHeight

/*********************/
//	topics
#define	O_InitTopic()			OTLNm_ITopic(&gErr, NULL, "")
#define	O_DisposeTopic			OTLNm_DisposeTopic
#define	O_GetPaneFrame			OTLNm_GetPaneFrame

#define	O_IsTwirledDown			OTLNm_TwirledDown
#define	O_DrawTwirlieArrow		OTLNm_DrawTwirlieArrow

#define	O_Insert				OTLNm_Insert
#define	O_Remove				OTLNm_Remove
#define	O_Adopt					OTLNm_Adopt

#define	O_SetName				OTLNm_SetName
#define	O_GetName				OTLNm_GetName

#define	O_Select				OTLNm_Select
#define	O_SelectAll				OTLNm_SelectAll
#define	O_IsSelected			OTLNm_Selected

#define	O_GetParent				OTLNm_GetParent
#define	O_GetTopicIndex			OTLNm_GetTopicIndex
#define	O_Reorder				OTLNm_ReOrder
#define	O_GetNextSister			OTLNm_GetNextSister
#define	O_CountTopics			OTLNm_CountTopics
#define	O_GetIndTopic			OTLNm_GetIndTopic
#define	O_MoveChildren			OTLNm_MoveChildren

#define	O_HitTestFromHere		OTLNm_HitTestFromHere
#define	O_DrawFromHere			OTLNm_DrawFromHere
#define	O_CountVisCellsFromHere	OTLNm_CountVisibleCellsFromHere

typedef enum {
	O_kTwirl_NONE = -1,
	
	O_kTwirl_START, 

	O_kTwirl_UP_PRESSED	= O_kTwirl_START,
	O_kTwirl_1,
	O_kTwirl_2,
	O_kTwirl_3,
	O_kTwirl_4,
	O_kTwirl_5,
	O_kTwirl_DOWN_PRESSED, 

	O_kTwirl_END		= O_kTwirl_DOWN_PRESSED,
	
	O_kTwirl_UP, 
	O_kTwirl_DOWN, 
	
	O_kTwirl_NUMTYPES
} O_kTwirlType;

OSErr		O_PreAllocate(void);
OSErr		O_PostDispose(void);

OSErr		O_TwirlArrow(Rect *destRect, Boolean twirlDown);
OSErr		O_BlitTwirly(O_kTwirlType twirly, Rect *destRect);
void		O_HiliteTwirly(Rect *theRect, void *data, Boolean in, Boolean Last);


#endif