Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Xdraw.h

Go to the documentation of this file.
00001 //     $Id: Xdraw.h,v 1.1.1.1 2001/01/04 01:01:12 burnett Exp $
00002 //  Author: T. Burnett, G. Barrand
00003 // Project: Event Display
00004 //
00005 // Generate 2-D drawing to an X11 window
00006 
00007 #ifndef MOTIFGUI__XDRAW_H
00008 #define MOTIFGUI__XDRAW_H
00009 
00010 #include "gui/Draw2D.h"
00011 
00012 #include <X11/Xlib.h>
00013 using namespace gui;
00014 
00015 class Xdraw : public Draw2D
00016 {
00017  public:
00018    // ----------Interface to instantiator----------------
00019 
00020    Xdraw(int xsize=500, int ysize=500);
00021    // constructor
00022    ~Xdraw();
00023 
00024    void setDisplay(Display*,Window);
00025    // call to set display window, etc. Must be called before drawing
00026 
00027    class Rectangle
00028    {
00029      public: float x,y,dx,dy;
00030    }; // this is the same as something in X. XRectangle???
00031 
00032    void setXorMode(int);
00033    void drawRect(const Rectangle &);
00034    // set XOR-mode, draw selection rectangle
00035 
00036    void resize (int xsize=0, int ysize=0);
00037    int xwin(float)const;
00038    int ywin(float)const;
00039    bool clip(float x, float y, int& x1, int& y1, int& x2, int& y2); 
00040    // functions that convert to screen coordinates
00041 
00042    float xnorm(int)const;
00043    float ynorm(int)const;
00044    // functions that convert to normalized coordinates
00045    //
00046 
00047    // -----------User interface (via View3D)-------------
00048    void draw_string(float x, float y, const char * title, int size=0);
00049    // draw a string at giveconst char *, int size= 0);
00050 
00051    void draw_string(const char* string, int size);
00052    // draw a string at current point
00053 
00054    void move_to(float, float);
00055    // move current point
00056 
00057    void line_to(float, float);
00058    // draw line from current point
00059 
00060    void draw_marker(float,float);
00061    // draw a marker at the point;
00062 
00063    virtual void fill_polygon(const float* xy, int npoints, Shading pattern);
00064 
00065    void flush();
00066 
00067    void set_quad(int quad, const char * title = 0, int selected=0);
00068    // define and clear viewport quadrant, optionally draw title and box
00069 
00070    void set_defaults();
00071    void set_line_style(int);
00072    void set_col_index(int);
00073 
00074  private:
00075    Display       *mydisplay;
00076    Window         mywindow;
00077    int            myscreen;
00078    float          lastx, lasty;
00079    int            flSingle, selected;
00080    GC           gc;  // graphics context
00081    class HRectangle
00082       {
00083     public:
00084       int x, y, dx, dy;
00085       //HRectangle(int _x, int _y, int _dx, int _dy)   { x=_x; y=_y; dx=_dx; dy=_dy; };
00086       };
00087 
00088    HRectangle currentQuad;
00089    HRectangle screen;
00090    HRectangle quadrant[4];
00091 
00092 
00093 };
00094 
00095 #endif
00096 

Generated at Wed Nov 21 12:20:55 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000