/*
 * Copyright 1990 by Baylor College of Medicine ALL RIGHTS RESERVED. 
 *
 * This program is subject to a license agreement between 
 * Baylor College of Medicine and MIT. Any use inconsistent with
 * said license and any use by persons other than the faculty, 
 * students and staff at MIT or any use on a computer not operated 
 * as part of the Athena Computing Environment (ACE) is expressly 
 * prohibited.
 */
#ifndef _BROWSERP_H_
#define _BROWSERP_H_

#include <X11/CoreP.h>
#include <Xm/XmP.h>
#include "Browser.h"

typedef enum
{
	NotAsked,
	NoChildren,
	ShowChildren,
	HideChildren
} NodeState;

typedef struct _NodePart
{
	Node *parent;        /* pointer to parent node */
	Node *sibling;       /* pointer to next sibling node */
	Node *first_child;   /* pointer to first child node */
	Boolean visible;     /* if visible or not */
	Boolean selected;    /* if selected of not (highlighted) */
	int x_str;           /* x location at beginnig of string */
	int x;               /* x location of node in browser */
	int y;               /* y location of node in browser */
	int width;           /* width of node in browser */
	int height;          /* height of node in browser */
	int level;           /* tree level */
	NodeState state;     /* node state */
} NodePartRec;

typedef struct
{
	int dummy;
} BrowserClassPart;

typedef struct _BrowserClassRec
{
    CoreClassPart core_class;
	XmPrimitiveClassPart primitive_class;
    BrowserClassPart browser_class;
} BrowserClassRec;

extern BrowserClassRec browserClassRec;

typedef struct 
{   /* resources */
	int delay;
	int style;
	Node *root;         /* pointer to root node of tree */
	int v_spacing;      /* vertical spacing between lines */
	int h_spacing;      /* horizontal spacing between lines */
	int outline_indent; /* outline indention */
	Boolean show_node_tag;
	int margin_width;
	int margin_height;
	int policy;             /* browser selection policy */
	String child_marker;    /* child marker for browser items */
	XtCallbackList list_changed; 

	/* private */
	Time last_time;     /* holds last time for double click checking */
	GC normgc;          /* Normal GC for displaying a node */
	GC revgc;           /* reverse video GC for selected nodes */
	GC graygc;          /* gray GC for insensitive nodes */
	XFontStruct *font;
	Pixel foreground;
	int x;              /* temporary storage for X coord during recursion */
	int y;              /* temporary storage for Y coord during recursion */
	Node *current;      /* the currently selected node */
	int level;          /* pointer to current tree level (depth) */
	int max_width;      /* temporary storage for finding max width needed */
	int max_height;     /* temporary storage for finding max height needed */
	Tree *first_tree;   /* pointer to the first browser tree */
	Tree *current_tree; /* pointer to the currently selected tree */
} BrowserPart;

typedef struct _BrowserRec
{
    CorePart core;
	XmPrimitivePart manager;
    BrowserPart browser;
} BrowserRec;

#endif /* _BROWSERP_H_ */
