00001
00002
00003
00004
00005
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
00019
00020 Xdraw(int xsize=500, int ysize=500);
00021
00022 ~Xdraw();
00023
00024 void setDisplay(Display*,Window);
00025
00026
00027 class Rectangle
00028 {
00029 public: float x,y,dx,dy;
00030 };
00031
00032 void setXorMode(int);
00033 void drawRect(const Rectangle &);
00034
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
00041
00042 float xnorm(int)const;
00043 float ynorm(int)const;
00044
00045
00046
00047
00048 void draw_string(float x, float y, const char * title, int size=0);
00049
00050
00051 void draw_string(const char* string, int size);
00052
00053
00054 void move_to(float, float);
00055
00056
00057 void line_to(float, float);
00058
00059
00060 void draw_marker(float,float);
00061
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
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;
00081 class HRectangle
00082 {
00083 public:
00084 int x, y, dx, dy;
00085
00086 };
00087
00088 HRectangle currentQuad;
00089 HRectangle screen;
00090 HRectangle quadrant[4];
00091
00092
00093 };
00094
00095 #endif
00096