/* 
 * Motif Tools Library, Version 2.0
 * $Id: XmtP.h,v 2.9 1994/07/04 03:03:50 david Exp $
 * 
 * Written by David Flanagan.
 * Copyright (c) 1992, 1993, 1994 by Dovetail Systems.
 * All Rights Reserved.  See the file COPYRIGHT for details.
 * This is not free software.  See the file SHAREWARE for details.
 * There is no warranty for this software.  See NO_WARRANTY for details.
 */

#ifndef _XmtP_h
#define _XmtP_h

/*
 * This header includes XmP.h and fixes problems with it
 * and handles 1.1 to 1.2 portability issues
 */

#include <Xmt/Xmt.h>
#include <Xm/XmP.h>

#if XmVersion == 1001
#include <Xm/Traversal.h>
#endif

#if XmVersion >= 1002
#include <Xm/PrimitiveP.h>
#include <Xm/GadgetP.h>
#include <Xm/ManagerP.h>
#endif


#if XmVersion == 1001
/* XmP.h uses NULL instead of None, resulting in a compiler warning */
#ifdef XtIsRealized
#undef XtIsRealized
#endif
#define XtIsRealized(widget) 					\
   (XtIsWidget(widget)  ?					\
      ((Widget)(widget))->core.window != None  :		\
      ((Object)(widget))->object.parent->core.window != None)

#endif  /* XmVersion 1001 */

/*
 * In Motif 1.1.0, and maybe other old 1.1 versions as well,
 * XmMenuProc and other XmRowColumn method types are not defined.
 * If needed, we define them here.
 */
#ifdef MISSING_METHOD_TYPES
#define XmMenuProc XtProc
#define XmArmAndActivate XtProc
#define XmMenuTrav XtProc
#endif

/*
 * Inheritance symbols not defined in Motif 1.1
 */
#if XmVersion == 1001
/* HP Motif does these inheritance symbols a little differently */
#if defined(HP_MOTIF) || defined(HP_NLS)
#ifndef XmInheritArmAndActivate
#define XmInheritArmAndActivate (XtActionProc) _XtInherit
#endif    
#ifndef  XmInheritMenuTraversalProc
#define  XmInheritMenuTraversalProc (XmMenuTraversalProc) _XtInherit
#endif    
#else  /* if not HP/Motif */
#ifndef XmInheritArmAndActivate
#define XmInheritArmAndActivate    (XmArmAndActivate) _XtInherit
#endif    
#ifndef XmInheritMenuTraversalProc
#define XmInheritMenuTraversalProc (XmMenuTrav) _XtInherit
#endif    
#ifndef XmInheritFocusMovedProc
#define XmInheritFocusMovedProc XtInheritFocusMovedProc
#endif    
#endif
#ifndef XmInheritMenuProc
#define XmInheritMenuProc          (XmMenuProc) _XtInherit
#endif    
#ifndef XmInheritBorderHighlight
#define XmInheritBorderHighlight   (XtWidgetProc) _XtInherit
#endif    
#ifndef XmInheritBorderUnhighlight
#define XmInheritBorderUnhighlight (XtWidgetProc) _XtInherit
#endif    
#endif

/*
 * An inheritance symbol omited from 1.2.0
 */
#if XmVersion == 1002
#ifndef XmInheritMenuTraversalProc    
#define XmInheritMenuTraversalProc (XmMenuTraversalProc) _XtInherit
#endif    
#endif

/*
 * Some internal functions' signatures changed between 1.1 and 1.2,
 * so define some wrapper macros that work correctly for either release.
 */
#if XmVersion <= 1001
#define _XmtConfigureObject(g, x, y, w, h, b)\
    _XmConfigureObject((RectObj)g, x, y, w, h, b)
#define _XmtResizeObject(g, w, h, bw) _XmResizeObject((RectObj)g, w, h, bw);
#define _XmtMoveObject(g, x, y) _XmMoveObject((RectObj)g, x, y);
#define _XmtRedisplayGadgets(w, e, r)\
    _XmRedisplayGadgets((CompositeWidget)w, (XExposeEvent *)e, r)
#else
#define _XmtConfigureObject(g,x,y,w,h,b) _XmConfigureObject(g, x, y, w, h, b)
#define _XmtResizeObject(g, w, h, bw) _XmResizeObject(g, w, h, bw);
#define _XmtMoveObject(g, x, y) _XmMoveObject(g, x, y);
#define _XmtRedisplayGadgets(w, e, r) _XmRedisplayGadgets(w, e, r)
#endif

    
#endif /* _XmtP_h */
