00001
00019 #ifndef GRPHICS_H
00020 #define GRPHICS_H
00021
00036 #include "sbgdefs.h"
00037 #include "sbgconst.h"
00038
00040 #define STATESIZE 13
00041
00042 #define line_color_index(fd,index) fd->Line_color_index(index)
00043 #define perimeter_color_index(fd,index) fd->Perimeter_color_index(index)
00044 #define fill_color_index(fd,index) fd->Fill_color_index(index)
00045 #define fill_color(fd,r,g,b) fd->Fill_color(r,g,b)
00046 #define text_color_index(fd,index) fd->Text_color_index(index)
00047 #define text_font_index(fd,index) fd->Text_font_index(index)
00048 #define character_height(fd,height) fd->Character_height(height)
00049 #define line_type(fd,style) fd->Line_type(style)
00050 #define interior_style(fd,style,edged) fd->Interior_style(style,edged)
00051 #define move2d(fd,x,y) fd->Move2d(x,y)
00052 #define draw2d(fd,x,y) fd->Draw2d(x,y)
00053 #define rectangle(fd,x1,y1,x2,y2) fd->Rectangle(x1,y1,x2,y2)
00054 #define text2d(fd,x,y,string,xform,more) fd->Text2d(x,y,string,xform,more)
00055 #define ellipse(fd,x_radius,y_radius,x_center,y_center,rotation) fd->Ellipse(x_radius,y_radius,x_center,y_center,rotation)
00056 #define destroy_window(fd) fd->Destroy_window()
00057 #define clear_view_surface(fd) fd->Clear_view_surface()
00058 #define vdc_extent(fd,xmin,ymin,xmax,ymax) fd->Vdc_extent(xmin,ymin,xmax,ymax)
00059 #define make_picture_current(fd) fd->Make_picture_current()
00060 #define set_click_handler(fd,handler) fd->Set_click_handler(handler)
00061 #define set_selection_handler(fd,handler) fd->Set_selection_handler(handler)
00062 #define set_key_handler(fd,handler) fd->Set_key_handler(handler)
00063 #define set_destroy_handler(fd,handler) fd->Set_destroy_handler(handler)
00064 #define clear_event_queue(fd) fd->Clear_event_queue()
00065 #define create_window(name,window_type,xpos,ypos,xsize,ysize,xmin,xmax,ymin,ymax,downon,moveon,upon,keyon) (*create_func)(name,window_type,xpos,ypos,xsize,ysize,xmin,xmax,ymin,ymax,downon,moveon,upon,keyon)
00066 #define overlap_picture_ops(update) (*overlap_func)(update)
00067 #define await_event(win,wait,type,event) (*await_event_func)(win,wait,type,event)
00068
00069 typedef void (*EVENT_HANDLER) (GRAPHICS_EVENT *);
00070
00071 typedef WINDOW (*WINCREATEFUNC) (const char *name,
00072 INT8 window_type,
00073 INT16 xpos,
00074 INT16 ypos,
00075 INT16 xsize,
00076 INT16 ysize,
00077 float xmin,
00078 float xmax,
00079 float ymin,
00080 float ymax,
00081 BOOL8 downon,
00082 BOOL8 moveon, BOOL8 upon, BOOL8 keyon);
00083
00084 extern WINCREATEFUNC create_func;
00085 extern void (*overlap_func) (BOOL8);
00086 extern WINDOW (*await_event_func) (WINDOW, BOOL8, INT8, GRAPHICS_EVENT *);
00087
00088
00101 class DLLSYM WINFD
00102 {
00103 public:
00104
00105
00106
00107 static WINDOW create(
00108 const char *name,
00109 INT8 window_type,
00110 INT16 xpos,
00111 INT16 ypos,
00112 INT16 xsize,
00113 INT16 ysize,
00114 float xmin,
00115 float xmax,
00116 float ymin,
00117 float ymax,
00118 BOOL8 downon,
00119 BOOL8 moveon,
00120 BOOL8 upon,
00121 BOOL8 keyon);
00122 WINFD();
00123 virtual ~ WINFD ();
00124
00125
00126 virtual void Line_color_index(COLOUR index);
00127
00128 virtual void Perimeter_color_index(COLOUR index);
00129
00130 virtual void Fill_color_index(COLOUR index);
00131 virtual void Fill_color(
00132 UINT8 red,
00133 UINT8 green,
00134 UINT8 blue);
00135
00136 virtual void Marker_color_index(COLOUR index);
00137
00138 virtual void Text_color_index(COLOUR index);
00139
00140 virtual void Text_font_index(INT16 index);
00141
00142 virtual void Character_height(float height);
00143 virtual void Line_type(
00144 INT16 style);
00145 virtual void Marker_type(
00146 INT16 type);
00147 virtual void Interior_style(
00148 INT16 style,
00149 INT16 edged);
00150 virtual void Marker_size(
00151 float size);
00152 virtual void Move2d(
00153 float x,
00154 float y);
00155 virtual void Draw2d(
00156 float x,
00157 float y);
00158 virtual void Rectangle(
00159 float x1,
00160 float y1,
00161 float x2,
00162 float y2);
00163 virtual void Text_alignment(
00164 INT32 h_select,
00165 INT32 v_select,
00166 float horiz,
00167 float vert);
00168 virtual void Polyline2d (
00169 float clist[],
00170 INT16 numpts,
00171 INT16 flags);
00172 virtual void Polygon2d (
00173 float clist[],
00174 INT16 numpts,
00175 INT16 flags);
00176 virtual void Polymarker2d (
00177 float clist[],
00178 INT16 numpts,
00179 INT16 flags);
00180 virtual void Text2d(
00181 float x,
00182 float y,
00183 const char *string,
00184 INT16 xform,
00185 INT16 more);
00186 void Append_text(
00187 const char *string,
00188 INT16 xform,
00189 INT16 more);
00190 virtual void Ellipse(
00191 float x_radius,
00192 float y_radius,
00193 float x_center,
00194 float y_center,
00195 float rotation);
00196 virtual void Arc(
00197 float x_radius,
00198 float y_radius,
00199 float x_center,
00200 float y_center,
00201 float start,
00202 float stop,
00203 float rotation,
00204 INT16 close_type);
00205
00206 virtual void Destroy_window();
00207
00208 virtual void Clear_view_surface();
00209
00210 virtual void Re_compute_colourmap();
00211 virtual void Vdc_extent(
00212 float xmin,
00213 float ymin,
00214 float xmax,
00215 float ymax);
00216 void Set_echo(
00217 ECHO_TYPE echo_type,
00218 float xorig,
00219 float yorig);
00220
00221 virtual void Make_picture_current();
00222
00223 friend void def_overlap_picture_ops(BOOL8 update);
00224
00225 virtual void Synchronize_windows(WINDOW fd2);
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235 INT16 get_fd() {
00236 return fd;
00237 }
00238
00239 void Set_selection_handler(
00240 EVENT_HANDLER handler);
00241 void Set_key_handler(
00242 EVENT_HANDLER handler);
00243 void Set_destroy_handler(
00244 EVENT_HANDLER handler);
00245 void Set_click_handler(
00246 EVENT_HANDLER handler);
00247
00248 virtual void Clear_event_queue();
00249
00250
00251 friend void add_event(
00252 GRAPHICS_EVENT *event);
00253
00254 friend GRAPHICS_EVENT *search_event_queue(INT16 &fd,
00255 INT8 event_type);
00256
00257 friend GRAPHICS_EVENT *search_single_queue(INT16 fd,
00258 INT8 event_type);
00259
00260 protected:
00261 EVENT_HANDLER click_handler;
00262
00263 EVENT_HANDLER selection_handler;
00264 EVENT_HANDLER key_handler;
00265
00266 EVENT_HANDLER destroy_handler;
00267 private:
00268 void get_lock() {
00269 }
00270 void get_lock_for_draw() {
00271 }
00272 void release_lock() {
00273 }
00274 void get_core_lock() {
00275 }
00276 void release_core_lock() {
00277 }
00278
00279 INT16 fd;
00280 BOOL8 used;
00281 BOOL8 downevent;
00282 BOOL8 moveevent;
00283 BOOL8 upevent;
00284 BOOL8 keyevent;
00285 GRAPHICS_EVENT *events;
00286 GRAPHICS_EVENT *lastevent;
00287 };
00288 #endif