00001 #ifndef _unatdefs_hpp_
00002 #define _unatdefs_hpp_
00003
00004
00005 #ifdef WITH_GDK
00006 # include <gdk/gdk.h>
00007 #else
00008 # include <X11/X.h>
00009 #endif
00010
00011
00012
00013 #ifdef WITH_GDK
00014
00015 # define ANY any
00016 # define EXPOSE expose.area
00017 # define CONFIG configure
00018 # define BUTTON button
00019 # define KEY key
00020 # define MOTION motion
00021 # define CROSSING crossing
00022 # define PROPERTY property
00023 # define CLIENTMSG client
00024 # define DND dnd
00025
00026 # define MOTION_NOTIFY GDK_MOTION_NOTIFY
00027 # define BUTTON_PRESS GDK_BUTTON_PRESS
00028 # define BUTTON_RELEASE GDK_BUTTON_RELEASE
00029 # define KEY_PRESS GDK_KEY_PRESS
00030 # define KEY_RELEASE GDK_KEY_RELEASE
00031
00032
00033 # define POINTER_MOTION_MASK GDK_POINTER_MOTION_MASK
00034 # define BUTTON_MOTION_MASK GDK_BUTTON_MOTION_MASK
00035 # define BUTTON_PRESS_MASK GDK_BUTTON_PRESS_MASK
00036 # define BUTTON_RELEASE_MASK GDK_BUTTON_RELEASE_MASK
00037 # define KEY_PRESS_MASK GDK_KEY_PRESS_MASK
00038 # define KEY_RELEASE_MASK GDK_KEY_RELEASE_MASK
00039
00040
00041 # define SHIFT_MASK GDK_SHIFT_MASK
00042 # define LOCK_MASK GDK_LOCK_MASK
00043 # define CONTROL_MASK GDK_CONTROL_MASK
00044 # define MOD1_MASK GDK_MOD1_MASK
00045 # define MOD2_MASK GDK_MOD2_MASK
00046 # define MOD3_MASK GDK_MOD3_MASK
00047 # define MOD4_MASK GDK_MOD4_MASK
00048 # define MOD5_MASK GDK_MOD5_MASK
00049 # define BUTTON1_MASK GDK_BUTTON1_MASK
00050 # define BUTTON2_MASK GDK_BUTTON2_MASK
00051 # define BUTTON3_MASK GDK_BUTTON3_MASK
00052 # define BUTTON4_MASK GDK_BUTTON4_MASK
00053 # define BUTTON5_MASK GDK_BUTTON5_MASK
00054
00055
00056
00057 # define ALL_BUTTONS_MASK (BUTTON1_MASK|BUTTON2_MASK|BUTTON3_MASK|BUTTON4_MASK|BUTTON5_MASK)
00058 # define ALL_MODS_MASK (SHIFT_MASK|LOCK_MASK|CONTROL_MASK|MOD1_MASK|MOD2_MASK|MOD3_MASK|MOD4_MASK|MOD5_MASK)
00059
00060 #else
00061
00062 # define ANY xany
00063 # define EXPOSE xexpose
00064 # define CONFIG xconfigure
00065 # define BUTTON xbutton
00066 # define KEY xkey
00067 # define MOTION xmotion
00068 # define CROSSING xcrossing
00069 # define PROPERTY xproperty
00070 # define CLIENTMSG xclient
00071
00072 # define MOTION_NOTIFY MotionNotify
00073 # define BUTTON_PRESS ButtonPress
00074 # define BUTTON_RELEASE ButtonRelease
00075 # define KEY_PRESS KeyPress
00076 # define KEY_RELEASE KeyRelease
00077
00078 # define POINTER_MOTION_MASK PointerMotionMask
00079 # define BUTTON_MOTION_MASK ButtonMotionMask
00080 # define BUTTON_PRESS_MASK ButtonPressMask
00081 # define BUTTON_RELEASE_MASK ButtonReleaseMask
00082 # define KEY_PRESS_MASK KeyPressMask
00083 # define KEY_RELEASE_MASK KeyReleaseMask
00084
00085
00086 # define SHIFT_MASK ShiftMask
00087 # define LOCK_MASK LockMask
00088 # define CONTROL_MASK ControlMask
00089 # define MOD1_MASK Mod1Mask
00090 # define MOD2_MASK Mod2Mask
00091 # define MOD3_MASK Mod3Mask
00092 # define MOD4_MASK Mod4Mask
00093 # define MOD5_MASK Mod5Mask
00094 # define BUTTON1_MASK Button1Mask
00095 # define BUTTON2_MASK Button2Mask
00096 # define BUTTON3_MASK Button3Mask
00097 # define BUTTON4_MASK Button4Mask
00098 # define BUTTON5_MASK Button5Mask
00099
00100
00101
00102 # define ALL_BUTTONS_MASK (BUTTON1_MASK|BUTTON2_MASK|BUTTON3_MASK|BUTTON4_MASK|BUTTON5_MASK)
00103 # define ALL_MODS_MASK (SHIFT_MASK|LOCK_MASK|CONTROL_MASK|MOD1_MASK|MOD2_MASK|MOD3_MASK|MOD4_MASK|MOD5_MASK)
00104 #endif
00105
00106
00107
00108 #ifdef WITH_GDK
00109 # define GCValues GdkGCValues
00110 # define GCFUNCTION GDK_GC_FUNCTION
00111 # define GCFOREGROUND GDK_GC_FOREGROUND
00112 # define GCBACKGROUND GDK_GC_BACKGROUND
00113 # define GCFONT GDK_GC_FONT
00114 # define GCLINEWIDTH GDK_GC_LINE_WIDTH
00115 # define GCEXPOSURES GDK_GC_EXPOSURES
00116 # define SetCopyFunction(G) (G).function = GDK_COPY
00117 # define SetXorFunction(G) (G).function = GDK_XOR
00118 # define SetForeground(G,P) (G).foreground.pixel = (P)
00119 # define SetBackground(G,P) (G).background.pixel = (P)
00120 # define SetFont(G,F) (G).font = (F)
00121 # define SetGC(D,G,M,V) gdk_gc_set_values(G,V,(GdkGCValuesMask)(M))
00122 # define CreateGC(D,W,M,V) gdk_gc_new_with_values(W,V,(GdkGCValuesMask)(M))
00123 # define DestroyGC(D,G) g_object_unref(G)
00124 # define SetClipOrigin(D,G,X,Y) gdk_gc_set_clip_origin(G,X,Y)
00125 # define SetClipMask(D,G,M) gdk_gc_set_clip_mask(G,M)
00126 # define SetClipRectangle(D,G,R) \
00127 {gdk_gc_set_clip_origin(G,0,0); gdk_gc_set_clip_rectangle(G,R);}
00128
00129 #else
00130 # define GCValues XGCValues
00131 # define GCFUNCTION GCFunction
00132 # define GCFOREGROUND GCForeground
00133 # define GCBACKGROUND GCBackground
00134 # define GCFONT GCFont
00135 # define GCLINEWIDTH GCLineWidth
00136 # define GCEXPOSURES GCGraphicsExposures
00137 # define SetCopyFunction(G) (G).function = GXcopy
00138 # define SetXorFunction(G) (G).function = GXxor
00139 # define SetForeground(G,P) (G).foreground = (P)
00140 # define SetBackground(G,P) (G).background = (P)
00141 # define SetFont(G,F) (G).font = (F)->fid
00142 # define SetGC(D,G,M,V) XChangeGC(D,G,M,V)
00143 # define CreateGC(D,W,M,V) XCreateGC(D,W,M,V)
00144 # define DestroyGC(D,G) XFreeGC(D,G)
00145 # define SetClipOrigin(D,G,X,Y) XSetClipOrigin(D,G,X,Y)
00146 # define SetClipMask(D,G,M) XSetClipMask(D,G,M)
00147 # define SetClipRectangle(D,G,R) XSetClipRectangles(D,G,0,0,R,1,Unsorted)
00148 #endif
00149
00150
00151
00152 #ifdef WITH_GDK
00153 # define Flush(D) gdk_flush()
00154 # define getAtom(D,Name) gdk_atom_intern(Name,FALSE)
00155
00156 # define SetCursor(D,W,C) gdk_window_set_cursor(W,C)
00157 # define TextWidth(F,S,L) gdk_text_width(F,S,L)
00158 # define GrabPointer(D,Win,Own,M,Conf,Curs) gdk_pointer_grab(Win,Own,(GdkEventMask)(M),Conf,Curs,GDK_CURRENT_TIME)
00159 # define UngrabPointer(D) gdk_pointer_ungrab(GDK_CURRENT_TIME)
00160 # define DestroyWindow(D,W) gdk_window_destroy(W)
00161
00162 # define DrawPoint(D,Win,G,X,Y) gdk_draw_point(Win,G,X,Y)
00163 # define DrawLine(D,Win,G,X1,Y1,X2,Y2) gdk_draw_line(Win,G,X1,Y1,X2,Y2)
00164 # define DrawRect(D,Win,G,X,Y,W,H) gdk_draw_rectangle(Win,G,FALSE,X,Y,W,H)
00165 # define FillRect(D,Win,G,X,Y,W,H) gdk_draw_rectangle(Win,G,TRUE,X,Y,W,H)
00166
00167 # define GetImage(D,Win,X,Y,W,H) gdk_drawable_get_image(Win,X,Y,W,H)
00168 # define DestroyImage(I) gdk_image_destroy(I)
00169 # define DrawImage(D,Wn,G,I,Xs,Ys,Xd,Yd,W,H) gdk_draw_image(Wn,G,I,Xs,Ys,Xd,Yd,W,H)
00170 # define PutPixel(I,X,Y,P) gdk_image_put_pixel(I,X,Y,P)
00171 # define GetPixel(I,X,Y) gdk_image_get_pixel(I,X,Y)
00172
00173 # define AllocColor(D,Map,Col) gdk_colormap_alloc_color(Map,Col,false,true)
00174
00175 # define CreatePixmap(D,Win,W,H,Dep) gdk_pixmap_new(Win,W,H,Dep)
00176 # define DestroyPixmap(D,P) g_object_unref(P)
00177 # define CopyArea(D,G,Wns,Xs,Ys,W,H,Wnd,Xd,Yd) \
00178 gdk_draw_drawable(Wnd,G,Wns,Xs,Ys,Xd,Yd,W,H)
00179
00180 #else
00181 # define Flush(D) XFlush(D)
00182 # define getAtom(D,Name) XInternAtom(D,Name,False)
00183
00184 # define SetCursor(D,W,C) XDefineCursor(D,W,C)
00185 # define TextWidth(F,S,L) XTextWidth(F,S,L)
00186 # define GrabPointer(D,Win,Own,M,Conf,Curs) XGrabPointer(D,Win,Own,M,GrabModeAsync,GrabModeAsync,Conf,Curs,CurrentTime)
00187 # define UngrabPointer(D) XUngrabPointer(D,CurrentTime)
00188 # define DestroyWindow(D,W) XDestroyWindow(D,W)
00189
00190 # define DrawPoint(D,Win,G,X,Y) XDrawPoint(D,Win,G,int(X),int(Y))
00191 # define DrawLine(D,Win,G,X1,Y1,X2,Y2) XDrawLine(D,Win,G,int(X1),int(Y1),int(X2),int(Y2))
00192 # define DrawRect(D,Win,G,X,Y,W,H) XDrawRectangle(D,Win,G,int(X),int(Y),int(W),int(H))
00193 # define FillRect(D,Win,G,X,Y,W,H) XFillRectangle(D,Win,G,int(X),int(Y),int(W),int(H))
00194
00195 # define GetImage(D,Win,X,Y,W,H) XGetImage(D,Win,X,Y,W,H,AllPlanes,ZPixmap)
00196 # define DestroyImage(I) XDestroyImage(I)
00197 # define DrawImage(D,Wn,G,I,Xs,Ys,Xd,Yd,W,H) XPutImage(D,Wn,G,I,int(Xs),int(Ys),int(Xd),int(Yd),int(W),int(H))
00198 # define PutPixel(I,X,Y,P) XPutPixel(I,X,Y,P)
00199 # define GetPixel(I,X,Y) XGetPixel(I,X,Y)
00200
00201 # define AllocColor(D,Map,Col) XAllocColor(D,Map,Col)
00202
00203 # define CreatePixmap(D,Wn,W,H,Dep) XCreatePixmap(D,Wn,W,H,Dep)
00204 # define DestroyPixmap(D,P) XFreePixmap(D,P)
00205 # define CopyArea(D,G,Wns,Xs,Ys,W,H,Wnd,Xd,Yd) \
00206 XCopyArea(D,Wns,Wnd,G,int(Xs),int(Ys),int(W),int(H),int(Xd),int(Yd))
00207 #endif
00208
00209 #endif