/*---------------------------------------------------------------------
 * $Date: 1997-07-22 10:36:40 -0300 (Tue, 22 Jul 1997) $             $Revision: 1123 $
 *---------------------------------------------------------------------
 *          Copyright (c) 1996, Visual Edge Software Ltd.
 *
 * ALL  RIGHTS  RESERVED.  Permission  to  use,  copy,  modify,  and
 * distribute  this  software  and its documentation for any purpose
 * and  without  fee  is  hereby  granted,  provided  that the above
 * copyright  notice  appear  in  all  copies  and  that  both  that
 * copyright  notice and this permission notice appear in supporting
 * documentation,  and that  the name of Visual Edge Software not be
 * used  in advertising  or publicity  pertaining to distribution of
 * the software without specific, written prior permission. The year
 * included in the notice is the year of the creation of the work.
 *---------------------------------------------------------------------
 * UxBase.h
 * -------------
 * Definition of the class UxBase.
 *
 * This class is the base class for both UxInterface and
 * UxSwidget. It defines the functionality common between
 * Components (interfaces) and Ux C++ Convenience Library
 * Motif wrapper classes.
 *--------------------------------------------------------------------*/

#ifndef _UXBASECLASS_INCLUDED
#define _UXBASECLASS_INCLUDED

#ifdef __cplusplus

class UxBase 
{

   protected:
	swidget		UxThis;

   public:
	UXINLINE UxBase();
	UXINLINE ~UxBase();

	/* type conversion to swidget */
	UXINLINE operator swidget();
	UXINLINE operator swidget() const;

	/* type conversion to void* */
	/* equivalent to (void*) ((swidget) object) */
	UXINLINE operator void*();
	UXINLINE operator const void*() const;

	UXINLINE Widget GetWidget();
	UXINLINE int IsValidSwidget() const;
	UXINLINE swidget GetParent();

	UXINLINE int PopupInterface(grabtype grab = no_grab);
	UXINLINE int PopdownInterface();
	UXINLINE int DestroyInterface();
	UXINLINE swidget GetUxThis() const;

#ifndef XT_CODE

	/* set of functions only available in Ux mode */
	UXINLINE char* GetName() const;
        UXINLINE char* GetCreateManaged() const;
        UXINLINE void SetCreateManaged(const char* val);

	/* constraints supplied by the form and inherited by its kids */
	UXINLINE char *GetBottomAttachment() const;
	UXINLINE void SetBottomAttachment(const char *val);
	UXINLINE int GetBottomOffset() const;
	UXINLINE void SetBottomOffset(int val);
	UXINLINE int GetBottomPosition() const;
	UXINLINE void SetBottomPosition(int val);
	UXINLINE char *GetBottomWidget() const;
	UXINLINE void SetBottomWidget(const char *val);
	UXINLINE void SetBottomWidget(swidget val);
	UXINLINE char *GetLeftAttachment() const;
	UXINLINE void SetLeftAttachment(const char *val);
	UXINLINE int GetLeftOffset() const;
	UXINLINE void SetLeftOffset(int val);
	UXINLINE int GetLeftPosition() const;
	UXINLINE void SetLeftPosition(int val);
	UXINLINE char *GetLeftWidget() const;
	UXINLINE void SetLeftWidget(const char *val);
	UXINLINE void SetLeftWidget(swidget val);
	UXINLINE char *GetRightAttachment() const;
	UXINLINE void SetRightAttachment(const char *val);
	UXINLINE int GetRightOffset() const;
	UXINLINE void SetRightOffset(int val);
	UXINLINE int GetRightPosition() const;
	UXINLINE void SetRightPosition(int val);
	UXINLINE char *GetRightWidget() const;
	UXINLINE void SetRightWidget(const char *val);
	UXINLINE void SetRightWidget(swidget val);
	UXINLINE char *GetTopAttachment() const;
	UXINLINE void SetTopAttachment(const char *val);
	UXINLINE int GetTopOffset() const;
	UXINLINE void SetTopOffset(int val);
	UXINLINE int GetTopPosition() const;
	UXINLINE void SetTopPosition(int val);
	UXINLINE char *GetTopWidget() const; 
	UXINLINE void SetTopWidget(const char *val);
	UXINLINE void SetTopWidget(swidget val);
	UXINLINE char *GetResizable() const;
	UXINLINE void SetResizable(const char *val);

	/* constraints supplied by the frame and inherited by it's children */
	UXINLINE char * GetChildVerticalAlignment() const;
	UXINLINE void   SetChildVerticalAlignment(const char * val);
	UXINLINE int    GetChildHorizontalSpacing() const;
	UXINLINE void   SetChildHorizontalSpacing(int val);
	UXINLINE char * GetChildHorizontalAlignment() const;
	UXINLINE void   SetChildHorizontalAlignment(const char * val);
	UXINLINE char * GetChildType() const;
	UXINLINE void   SetChildType(const char * val);


	/* constraints supplied by the pane and inherited by it's children */
	UXINLINE char * GetSkipAdjust() const;
	UXINLINE void   SetSkipAdjust(const char * val);
	UXINLINE int    GetPaneMinimum() const;
	UXINLINE void   SetPaneMinimum(int val);
	UXINLINE int    GetPaneMaximum() const;
	UXINLINE void   SetPaneMaximum(int val);
	UXINLINE char * GetAllowResize() const;
	UXINLINE void   SetAllowResize(const char * val);

	/* supplied by both the pane and the rowcolumn */
	UXINLINE short  GetPositionIndex() const;
	UXINLINE void   SetPositionIndex(short val);


#ifdef DESIGN_TIME
	/* access to the convenience library used in DESIGN_TIME */
	int	GET_int(binptr object, const char *id) const;
	int	PUT_int(binptr object, const char *id, int val);
	char	GET_char(binptr object, const char *id) const;
	int	PUT_char(binptr object, const char *id, char val);
	long	GET_long(binptr object, const char *id) const;
	int	PUT_long(binptr object, const char *id, long val);
	double	GET_float(binptr object, const char *id) const;
	int	PUT_float(binptr object, const char *id, double val);
	stringTable GET_stringTable(binptr object, const char *id) const;
	int	GET_stringTable(binptr object, const char *id,
					stringTable val) const;
	voidFunction GET_voidFunction(binptr object, const char *id) const;
	int	PUT_voidFunction(binptr object, const char *id,
				voidFunction val);
	cardFunction GET_cardFunction(binptr object, const char *id) const;
	int PUT_cardFunction(binptr object, const char *id,
				cardFunction val);
	visualPointer GET_visualPointer(binptr object, const char *id) const;
	int	PUT_visualPointer(binptr object, const char *id,
				visualPointer val);
	XmTextSource GET_XmTextSource(binptr object, const char *id) const;
	int	PUT_XmTextSource(binptr object, const char *id,
				XmTextSource val);
	char	*GET_string(binptr object, const char *id) const;
	int	PUT_string(binptr object, const char *id, const char *val);
#else
	// access to the convenience library used in runtime
	inline char*	GetProp(const char *res) const;
	inline short	ShortGetProp(const char *res) const;
	inline int	SetProp(const char *res, XtArgVal v);
	inline char*	DDGetProp(const char *val) const;
	inline int	DDSetProp(const char *val, XtArgVal v);
#endif /* DESIGN_TIME */
#endif /* XT_CODE */
};




#ifndef DESIGN_TIME

inline UxBase::UxBase()
{
	UxThis = NULL;
}

inline UxBase::~UxBase()
{
}

inline UxBase::operator swidget()
{
	return UxThis;
}

inline UxBase::operator swidget() const
{
	return UxThis;
}

inline UxBase::operator void*()
{
	return (void *) UxThis;
}

inline UxBase::operator const void*() const
{
	return (const void *) UxThis;
}

inline Widget UxBase::GetWidget() 
{
	return UxGetWidget(UxThis);
}

inline int UxBase::IsValidSwidget() const
{
	return UxIsValidSwidget(UxThis);
}

inline swidget UxBase::GetParent() 
{
	return UxGetParent(UxThis);
}

inline int UxBase::PopupInterface (grabtype grab)
{
	return UxPopupInterface(UxThis, grab);
}

inline int UxBase::PopdownInterface()
{
	return UxPopdownInterface(UxThis);
}

inline int UxBase::DestroyInterface()
{
	return UxDestroyInterface(UxThis);
}


inline swidget UxBase::GetUxThis() const
{
	return UxThis;
}

#ifndef XT_CODE
inline char* UxBase::GetName() const
{
	return UxGetName(UxThis);
}

inline char* UxBase::GetCreateManaged() const
{
	return UxGetCreateManaged(UxThis);
}

inline void UxBase::SetCreateManaged(const char* val)
{
	UxPutCreateManaged (UxThis, (char*)val);
}

inline char* UxBase::GetProp(const char *res) const
{
	return (char*) UxGetProp(UxThis, (char *) res);
}

inline short UxBase::ShortGetProp(const char *res) const
{
	return UxShortGetProp(UxThis, (char *) res);
}

inline int UxBase::SetProp(const char * res, XtArgVal val)
{
	return UxPutProp(UxThis, (char *) res, val);
}

inline char* UxBase::DDGetProp(const char *val) const
{
	return (char*) UxDDGetProp(UxThis, (char *) val);
}

inline int UxBase::DDSetProp(const char *res, XtArgVal val)
{
	return UxDDPutProp(UxThis, (char *) res, val);
}

/* constraints supplied by the form and inherited by it kids */
inline char	*UxBase::GetBottomAttachment() const
{
	return DDGetProp(XmNbottomAttachment);
}

inline void	UxBase::SetBottomAttachment(const char *val)
{
	DDSetProp(XmNbottomAttachment, (XtArgVal) val);
}

inline int	UxBase::GetBottomOffset() const
{
	return (int) GetProp(XmNbottomOffset);
}

inline void	UxBase::SetBottomOffset(int val)
{
	SetProp(XmNbottomOffset, (XtArgVal) val);
}

inline int	UxBase::GetBottomPosition() const
{
	return (int) GetProp(XmNbottomPosition);
}

inline void	UxBase::SetBottomPosition(int val)
{
	SetProp(XmNbottomPosition, (XtArgVal) val);
}

inline char	*UxBase::GetBottomWidget() const
{
	return DDGetProp(XmNbottomWidget);
}

inline void	UxBase::SetBottomWidget(const char *val)
{
	DDSetProp(XmNbottomWidget, (XtArgVal) val);
}

inline void	UxBase::SetBottomWidget(swidget val)
{
	DDSetProp(XmNbottomWidget, (XtArgVal) val);
}

inline char	*UxBase::GetLeftAttachment() const
{
	return DDGetProp(XmNleftAttachment);
}

inline void	UxBase::SetLeftAttachment(const char *val)
{
	DDSetProp(XmNleftAttachment, (XtArgVal) val);
}

inline int	UxBase::GetLeftOffset() const
{
	return (int) GetProp(XmNleftOffset);
}

inline void	UxBase::SetLeftOffset(int val)
{
	SetProp(XmNleftOffset, (XtArgVal) val);
}

inline int	UxBase::GetLeftPosition() const
{
	return (int) GetProp(XmNleftPosition);
}

inline void	UxBase::SetLeftPosition(int val)
{
	SetProp(XmNleftPosition, (XtArgVal) val);
}

inline char	*UxBase::GetLeftWidget() const
{
	return DDGetProp(XmNleftWidget);
}

inline void	UxBase::SetLeftWidget(const char *val)
{
	DDSetProp(XmNleftWidget, (XtArgVal) val);
}

inline void	UxBase::SetLeftWidget(swidget val)
{
	DDSetProp(XmNleftWidget, (XtArgVal) val);
}

inline char	*UxBase::GetRightAttachment() const
{
	return DDGetProp(XmNrightAttachment);
}

inline void	UxBase::SetRightAttachment(const char *val)
{
	DDSetProp(XmNrightAttachment, (XtArgVal) val);
}

inline int	UxBase::GetRightOffset() const
{
	return (int) GetProp(XmNrightOffset);
}

inline void	UxBase::SetRightOffset(int val)
{
	SetProp(XmNrightOffset, (XtArgVal) val);
}

inline int	UxBase::GetRightPosition() const
{
	return (int) GetProp(XmNrightPosition);
}

inline void	UxBase::SetRightPosition(int val)
{
	SetProp(XmNrightPosition, (XtArgVal) val);
}

inline char	*UxBase::GetRightWidget() const
{
	return DDGetProp(XmNrightWidget);
}

inline void	UxBase::SetRightWidget(const char *val)
{
	DDSetProp(XmNrightWidget, (XtArgVal) val);
}

inline void	UxBase::SetRightWidget(swidget val)
{
	DDSetProp(XmNrightWidget, (XtArgVal) val);
}

inline char	*UxBase::GetTopAttachment() const
{
	return DDGetProp(XmNtopAttachment);
}

inline void	UxBase::SetTopAttachment(const char *val)
{
	DDSetProp(XmNtopAttachment, (XtArgVal) val);
}

inline int	UxBase::GetTopOffset() const
{
	return (int) GetProp(XmNtopOffset);
}

inline void	UxBase::SetTopOffset(int val)
{
	SetProp(XmNtopOffset, (XtArgVal) val);
}

inline int	UxBase::GetTopPosition() const
{
	return (int) GetProp(XmNtopPosition);
}

inline void	UxBase::SetTopPosition(int val)
{
	SetProp(XmNtopPosition, (XtArgVal) val);
}

inline char	*UxBase::GetTopWidget() const
{
	return DDGetProp(XmNtopWidget);
}

inline void	UxBase::SetTopWidget(const char *val)
{
	DDSetProp(XmNtopWidget,(XtArgVal) val);
}

inline void	UxBase::SetTopWidget(swidget val)
{
	DDSetProp(XmNtopWidget,(XtArgVal) val);
}

inline char	*UxBase::GetResizable() const
{
	return DDGetProp(XmNresizable);
}

inline void	UxBase::SetResizable(const char *val)
{
	DDSetProp(XmNresizable, (XtArgVal) val);
}

/* constraints supplied by the frame and inherited by it's children */
inline char *	UxBase::GetChildVerticalAlignment() const
{
	return DDGetProp(XmNchildVerticalAlignment);
}

inline void	UxBase::SetChildVerticalAlignment(const char * val)
{
	DDSetProp(XmNchildVerticalAlignment, ((XtArgVal)(val)));
};

inline int	UxBase::GetChildHorizontalSpacing() const
{
	return (int)DDGetProp(XmNchildHorizontalSpacing);
}

inline void	UxBase::SetChildHorizontalSpacing(int val)
{
	DDSetProp(XmNchildHorizontalSpacing, ((XtArgVal)(val)));
};

inline char *	UxBase::GetChildHorizontalAlignment() const
{
	return DDGetProp(XmNchildHorizontalAlignment);
}

inline void	UxBase::SetChildHorizontalAlignment(const char * val)
{
	DDSetProp(XmNchildHorizontalAlignment, ((XtArgVal)(val)));
};

inline char *	UxBase::GetChildType() const
{
	return DDGetProp(XmNchildType);
}

inline void	UxBase::SetChildType(const char * val)
{
	DDSetProp(XmNchildType, ((XtArgVal)(val)));
};

/* constraints supplied by the pane and inherited by it's children */
inline char *	UxBase::GetSkipAdjust() const
{
	return DDGetProp(XmNskipAdjust);
}

inline void	UxBase::SetSkipAdjust(const char * val)
{
	DDSetProp(XmNskipAdjust, ((XtArgVal)(val)));
};

inline int	UxBase::GetPaneMinimum() const
{
	return (int)DDGetProp(XmNpaneMinimum);
}

inline void	UxBase::SetPaneMinimum(int val)
{
	DDSetProp(XmNpaneMinimum, ((XtArgVal)(val)));
};

inline int	UxBase::GetPaneMaximum() const
{
	return (int)DDGetProp(XmNpaneMaximum);
}

inline void	UxBase::SetPaneMaximum(int val)
{
	DDSetProp(XmNpaneMaximum, ((XtArgVal)(val)));
};

inline char *	UxBase::GetAllowResize() const
{
	return DDGetProp(XmNallowResize);
}

inline void	UxBase::SetAllowResize(const char * val)
{
	DDSetProp(XmNallowResize, ((XtArgVal)(val)));
};


/* supplied by the pane and the rowcolumn */
inline short	UxBase::GetPositionIndex() const
{
	return (short)ShortGetProp(XmNpositionIndex);
}

inline void	UxBase::SetPositionIndex(short val)
{
	SetProp(XmNpositionIndex, ((XtArgVal)(val)));
};
#endif	/* XT_CODE */
#endif	/* ! DESIGN_TIME */
#endif	/* __cplusplus */
#endif	/* _UXBASECLASS_INCLUDED */
