#ifndef _wbnode_h_
#define _wbnode_h_

#include "wb_include.h"

#define WNdestroy_all(widgetlist, flag) \
             HeadWidgetList = NULL    /* ??? Dummy this out for now ??? */

typedef void (*VOID_FUNCPTR) ();

/* Info for linked list of widgets created by the Widget Builder */
/* ------------------------------------------------------------- */
typedef struct _widgetNode {
  int  mmm_id;      /* the widget's ID when being written to a mail file    */
  int  parent_mmm_id; /* ID of widget's parent when read from a mail file   */
  char *id_name;    /* used internally by WB as a guaranteed unique name    */
  char *varName;    /* name of variable widget is assigned to in saved code */
  char *name;       /* unique name of widget for X, often gensym'ed         */
  char *type;       /* type of widget (e.g.: "button", "label", etc.)       */
  Widget widget;    /* pointer to the actual widget                         */
  Widget parent;    /* pointer to the widget's parent widget                */
  char *callback;   /* name of callback function for widget (written later) */
  char *font;       /* name of the font for the label of this widget        */
  char *string;     /* use for holding ptr to Ascii Text widget's XtNstring */
  struct menu_state *edit_states;  /* ptr to state for this nodes edit menu */
  XFontStruct *font_struct;        /* ptr to font info structure            */
  VOID_FUNCPTR prstr_func;         /* ptr to func to print widget properties*/
  struct _widgetNode *parent_node; /* ptr to parent widget's node in list   */
  struct _widgetNode *first_child; /* ptr to widget's first child in list   */
  struct _widgetNode *last_child;  /* ptr to widget's last child in list    */
  struct _widgetNode *popup;       /* ptr to widget's popup child node      */
  struct _widgetNode *next; /* ptr to next widget node in linked list       */
 } WidgetNode;

/* typedef struct _widgetNode WidgetNode; */

struct widgetusage {
  int button;
  int label;
  int video;
  int blankLine;
  int keyedMailField;
  int blankMailField;
  int vPaned;
  int box;
  int dialog;
  int composite;
  int scrollBar;
  int text;
  int form;
  int shell;
  int asciiText;
  int popup;
 };

extern struct widgetusage widgetsUsed;

/* Head and tail pointers to linked list of created Widgets */
extern WidgetNode *HeadWidgetList;



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

#ifdef __STDC__

extern void WN_set_mmm_id(WidgetNode *, int);
extern WidgetNode *add_widget_node(Widget, Widget, char *, VOID_FUNCPTR);
extern WidgetNode *find_widgets_node(Widget, WidgetNode *);
extern WidgetNode *get_widgetnode_by_mmm_id(int, WidgetNode *);

#else

extern void WN_set_mmm_id();
extern WidgetNode *add_widget_node();
extern WidgetNode *find_widgets_node();
extern WidgetNode *get_widgetnode_by_mmm_id();

#endif          /* end of  #ifdef _STDC_  */

/***************************************************************************/
#endif       /* end of ifndef _wbnode_h_  :: DO NOT WRITE BELOW THIS LINE. */
