/* This file is part of `mogul'
 * Copyright (c) 1995 David Deaven
 *
 * In the following, "you" and "You" refer to any entity other than 
 * the Microsoft corporation and its subsidiaries.  All rights are
 * reserved by the author in connection with Microsoft and its
 * subsidiaries.  The Microsoft Network is explicity denied the right
 * to copy, reproduce, or transmit this software.
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * $Author: deaven $
 * $Id: MogulP.h,v 2.0 1996/07/09 20:59:55 deaven Exp $
 */

#ifndef _MOGULP_H_
#define _MOGULP_H_

#include <X11/IntrinsicP.h>
#include <X11/CoreP.h>
#include "mogul.h"
#include "Mogul.h"

#define DEFAULT_WIDTH 320	/* initial width, pixels */
#define DEFAULT_HEIGHT 320	/* initial height, pixels */
#define FANCY_X_SHADE 1		/* use sophisticated algorithm */
#define RESOLUTION 2.0		/* maximum error in curve-drawing, pixels */

/* These are only used for Xlib-controlled applications */
#define BORDER_WIDTH 2		/* width of X-window border region */
#define DEFAULT_FONTNAME "fixed" /* font to use */

struct x11_instance {

  /* public (widget) values */
  unsigned int width, height;
  XFontStruct *font;
  MogulDevice device;		/* the device that plots this window */

  /* private dev_x11 values */
  Pixel foreground;
  Pixel background;
  int owned;			/* is the window created by dev_x11?  */
  int mapped;			/* has the window been mapped? */
  int speedy;
  int rendered;			/* set by Pend() */
  Color currentColor;		/* current color setting */
  int nvec, nvecmax;		/* number of vectors accumulated/allocated */
  int narc, narcmax;		/* number of arcs accumulated/allocated */
  double xmin;			/* minimum x value */
  double ymin;			/* minimum y value */
  double scale;			/* scale factor to get screen coordinates */
  double vdist;
  Pixmap pixmap;		/* used to rapidly display a pane */
  XPoint cur;			/* current point */
  XPoint *vec;			/* accumulated lines */
  XArc *arc;			/* accumulated lines */
  GC gc;

  /* private and static values (must be set by widget instantiation) */
  Display *display;
  Screen *screen;
  Window window;
  Colormap colormap;
};

typedef struct {
  struct x11_instance X;
} MogulPart;

typedef struct MogulRec_s {
  CorePart core;
  MogulPart mogul;
} MogulRec;

typedef struct {
  int empty;
} MogulClassPart;

typedef struct MogulClassRec_s {
  CoreClassPart core_class;	
  MogulClassPart mogul_class;
} MogulClassRec;

extern MogulClassRec mogulClassRec;

void ClearXInstance(struct x11_instance *W);
void ResizeXInstance(struct x11_instance *W);
void RedisplayXInstance(struct x11_instance *W);

#endif /* _MOGULP_H_ */
