17 #if !defined(__CINT__)
21 typedef Status X11Status_t;
23 typedef X11Status_t Status;
28 static const unsigned long gX11None = None;
30 static const unsigned long None = gX11None;
35 typedef unsigned long XID;
45 struct RXpmAttributes;
46 struct RXSetWindowAttributes;
77 XColor_t() { fPixel = 0; fRed = fGreen = fBlue = 0; fDefined = kFALSE; }
83 class TGX11 :
public TVirtualX {
86 Int_t fMaxNumberOfWindows;
89 Cursor fCursors[kNumCursors];
93 void ClearPixmap(Drawable *pix);
94 void CopyWindowtoPixmap(Drawable *pix, Int_t xpos, Int_t ypos);
95 void FindBestVisual();
96 void FindUsableVisual(RXVisualInfo *vlist, Int_t nitems);
97 void PutImage(Int_t offset, Int_t itran, Int_t x0, Int_t y0, Int_t nx,
98 Int_t ny, Int_t xmin, Int_t ymin, Int_t xmax, Int_t ymax,
99 UChar_t *image, Drawable_t
id);
100 void RemovePixmap(Drawable *pix);
101 void SetColor(
void *gc, Int_t ci);
102 void SetFillStyleIndex(Int_t style, Int_t fasi);
103 void SetInput(Int_t inp);
104 void SetMarkerType(Int_t type, Int_t n, RXPoint *xy);
105 void CollectImageColors(ULong_t pixel, ULong_t *&orgcolors, Int_t &ncolors,
107 void MakeOpaqueColors(Int_t percent, ULong_t *orgcolors, Int_t ncolors);
108 Int_t FindColor(ULong_t pixel, ULong_t *orgcolors, Int_t ncolors);
109 void ImgPickPalette(RXImage *image, Int_t &ncol, Int_t *&R, Int_t *&G, Int_t *&B);
112 void MapGCValues(GCValues_t &gval, ULong_t &xmask, RXGCValues &xgval, Bool_t tox = kTRUE);
113 void MapSetWindowAttributes(SetWindowAttributes_t *attr,
114 ULong_t &xmask, RXSetWindowAttributes &xattr);
115 void MapCursor(ECursor cursor, Int_t &xcursor);
116 void MapColorStruct(ColorStruct_t *color, RXColor &xcolor);
117 void MapPictureAttributes(PictureAttributes_t &attr, RXpmAttributes &xpmattr,
118 Bool_t toxpm = kTRUE);
119 void MapModifierState(UInt_t &state, UInt_t &xstate, Bool_t tox = kTRUE);
122 void MapEvent(Event_t &ev,
void *xev, Bool_t tox = kTRUE);
124 void MapEventMask(UInt_t &emask, UInt_t &xemask, Bool_t tox = kTRUE);
125 void MapKeySym(UInt_t &keysym, UInt_t &xkeysym, Bool_t tox = kTRUE);
131 Drawable fVisRootWin;
139 Float_t fCharacterUpX;
140 Float_t fCharacterUpY;
141 Float_t fTextMagnitude;
153 Bool_t AllocColor(Colormap cmap, RXColor *color);
154 void QueryColors(Colormap cmap, RXColor *colors, Int_t ncolors);
155 void *GetGC(Int_t which)
const;
156 XColor_t &GetColor(Int_t cid);
160 TGX11(
const TGX11 &org);
161 TGX11(
const char *name,
const char *title);
164 Bool_t Init(
void *display);
168 void CopyPixmap(Int_t wid, Int_t xpos, Int_t ypos);
169 void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode);
170 void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, Int_t *ic);
171 void DrawFillArea(Int_t n, TPoint *xy);
172 void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2);
173 void DrawPolyLine(Int_t n, TPoint *xy);
174 void DrawPolyMarker(Int_t n, TPoint *xy);
175 virtual void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn,
const char *text, ETextMode mode);
176 virtual void DrawText(Int_t, Int_t, Float_t, Float_t,
const wchar_t *, ETextMode) {}
177 void GetCharacterUp(Float_t &chupx, Float_t &chupy);
178 Int_t GetDoubleBuffer(Int_t wid);
179 void GetGeometry(Int_t wid, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h);
180 const char *DisplayName(
const char *dpyName = 0);
181 Handle_t GetNativeEvent()
const {
return (Handle_t) fXEvent; }
182 ULong_t GetPixel(Color_t cindex);
183 void GetPlanes(Int_t &nplanes);
184 void GetRGB(Int_t index, Float_t &r, Float_t &g, Float_t &b);
185 virtual void GetTextExtent(UInt_t &w, UInt_t &h,
char *mess);
186 virtual void GetTextExtent(UInt_t &, UInt_t &,
wchar_t *){}
187 Float_t GetTextMagnitude() {
return fTextMagnitude; }
188 Window_t GetWindowID(Int_t wid);
189 Bool_t HasTTFonts()
const {
return fHasTTFonts; }
190 Int_t InitWindow(ULong_t window);
191 Int_t AddWindow(ULong_t qwid, UInt_t w, UInt_t h);
192 Int_t AddPixmap(ULong_t pixid, UInt_t w, UInt_t h);
193 void RemoveWindow(ULong_t qwid);
194 void MoveWindow(Int_t wid, Int_t x, Int_t y);
195 Int_t OpenDisplay(
void *display);
196 Int_t OpenPixmap(UInt_t w, UInt_t h);
197 void QueryPointer(Int_t &ix, Int_t &iy);
198 Pixmap_t ReadGIF(Int_t x0, Int_t y0,
const char *file, Window_t
id=0);
199 Int_t RequestLocator(Int_t mode, Int_t ctyp, Int_t &x, Int_t &y);
200 Int_t RequestString(Int_t x, Int_t y,
char *text);
201 void RescaleWindow(Int_t wid, UInt_t w, UInt_t h);
202 Int_t ResizePixmap(Int_t wid, UInt_t w, UInt_t h);
203 void ResizeWindow(Int_t wid);
204 void SelectWindow(Int_t wid);
205 void SetCharacterUp(Float_t chupx, Float_t chupy);
206 void SetClipOFF(Int_t wid);
207 void SetClipRegion(Int_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h);
208 void SetCursor(Int_t win, ECursor cursor);
209 void SetDoubleBuffer(Int_t wid, Int_t mode);
210 void SetDoubleBufferOFF();
211 void SetDoubleBufferON();
212 void SetDrawMode(EDrawMode mode);
213 void SetFillColor(Color_t cindex);
214 void SetFillStyle(Style_t style);
215 void SetLineColor(Color_t cindex);
216 void SetLineType(Int_t n, Int_t *dash);
217 void SetLineStyle(Style_t linestyle);
218 void SetLineWidth(Width_t width);
219 void SetMarkerColor(Color_t cindex);
220 void SetMarkerSize(Float_t markersize);
221 void SetMarkerStyle(Style_t markerstyle);
222 void SetOpacity(Int_t percent);
223 void SetRGB(Int_t cindex, Float_t r, Float_t g, Float_t b);
224 void SetTextAlign(Short_t talign=11);
225 void SetTextColor(Color_t cindex);
226 virtual Int_t SetTextFont(
char *fontname, ETextSetMode mode);
227 virtual void SetTextFont(Font_t fontnumber);
228 void SetTextMagnitude(Float_t mgn=1) { fTextMagnitude = mgn;}
229 virtual void SetTextSize(Float_t textsize);
230 void Sync(Int_t mode);
231 void UpdateWindow(Int_t mode);
232 void Warp(Int_t ix, Int_t iy, Window_t
id = 0);
233 Int_t WriteGIF(
char *name);
234 void WritePixmap(Int_t wid, UInt_t w, UInt_t h,
char *pxname);
235 Window_t GetCurrentWindow()
const;
236 Int_t SupportsExtension(
const char *ext)
const;
239 void GetWindowAttributes(Window_t
id, WindowAttributes_t &attr);
240 void MapWindow(Window_t
id);
241 void MapSubwindows(Window_t
id);
242 void MapRaised(Window_t
id);
243 void UnmapWindow(Window_t
id);
244 void DestroyWindow(Window_t
id);
245 void DestroySubwindows(Window_t
id);
246 void RaiseWindow(Window_t
id);
247 void LowerWindow(Window_t
id);
248 void MoveWindow(Window_t
id, Int_t x, Int_t y);
249 void MoveResizeWindow(Window_t
id, Int_t x, Int_t y, UInt_t w, UInt_t h);
250 void ResizeWindow(Window_t
id, UInt_t w, UInt_t h);
251 void IconifyWindow(Window_t
id);
252 void ReparentWindow(Window_t
id, Window_t pid, Int_t x, Int_t y);
253 void SetWindowBackground(Window_t
id, ULong_t color);
254 void SetWindowBackgroundPixmap(Window_t
id, Pixmap_t pxm);
255 Window_t CreateWindow(Window_t parent, Int_t x, Int_t y,
256 UInt_t w, UInt_t h, UInt_t border,
257 Int_t depth, UInt_t clss,
258 void *visual, SetWindowAttributes_t *attr,
260 Int_t OpenDisplay(
const char *dpyName);
262 Display_t GetDisplay()
const;
263 Visual_t GetVisual()
const;
264 Int_t GetScreen()
const;
265 Int_t GetDepth()
const;
266 Colormap_t GetColormap()
const;
267 Atom_t InternAtom(
const char *atom_name, Bool_t only_if_exist);
268 Window_t GetDefaultRootWindow()
const;
269 Window_t GetParent(Window_t
id)
const;
270 FontStruct_t LoadQueryFont(
const char *font_name);
271 FontH_t GetFontHandle(FontStruct_t fs);
272 void DeleteFont(FontStruct_t fs);
273 GContext_t CreateGC(Drawable_t
id, GCValues_t *gval);
274 void ChangeGC(GContext_t gc, GCValues_t *gval);
275 void CopyGC(GContext_t org, GContext_t dest, Mask_t mask);
276 void DeleteGC(GContext_t gc);
277 Cursor_t CreateCursor(ECursor cursor);
278 void SetCursor(Window_t
id, Cursor_t curid);
279 Pixmap_t CreatePixmap(Drawable_t
id, UInt_t w, UInt_t h);
280 Pixmap_t CreatePixmap(Drawable_t
id,
const char *bitmap, UInt_t width,
281 UInt_t height, ULong_t forecolor, ULong_t backcolor,
283 unsigned char *GetColorBits(Drawable_t wid, Int_t x = 0, Int_t y = 0, UInt_t w = 0, UInt_t h = 0);
284 Pixmap_t CreatePixmapFromData(
unsigned char *bits, UInt_t width, UInt_t height);
285 Pixmap_t CreateBitmap(Drawable_t
id,
const char *bitmap,
286 UInt_t width, UInt_t height);
287 void DeletePixmap(Pixmap_t pmap);
288 Bool_t CreatePictureFromFile(Drawable_t
id,
const char *filename,
289 Pixmap_t &pict, Pixmap_t &pict_mask,
290 PictureAttributes_t &attr);
291 Bool_t CreatePictureFromData(Drawable_t
id,
char **data,
292 Pixmap_t &pict, Pixmap_t &pict_mask,
293 PictureAttributes_t &attr);
294 Bool_t ReadPictureDataFromFile(
const char *filename,
char ***ret_data);
295 void DeletePictureData(
void *data);
296 void SetDashes(GContext_t gc, Int_t offset,
const char *dash_list, Int_t n);
297 Bool_t ParseColor(Colormap_t cmap,
const char *cname, ColorStruct_t &color);
298 Bool_t AllocColor(Colormap_t cmap, ColorStruct_t &color);
299 void QueryColor(Colormap_t cmap, ColorStruct_t &color);
300 void FreeColor(Colormap_t cmap, ULong_t pixel);
301 Int_t EventsPending();
302 void NextEvent(Event_t &event);
303 void Bell(Int_t percent);
304 void CopyArea(Drawable_t src, Drawable_t dest, GContext_t gc,
305 Int_t src_x, Int_t src_y, UInt_t width, UInt_t height,
306 Int_t dest_x, Int_t dest_y);
307 void ChangeWindowAttributes(Window_t
id, SetWindowAttributes_t *attr);
308 void ChangeProperty(Window_t
id, Atom_t property, Atom_t type,
309 UChar_t *data, Int_t len);
310 void DrawLine(Drawable_t
id, GContext_t gc, Int_t x1, Int_t y1, Int_t x2, Int_t y2);
311 void ClearArea(Window_t
id, Int_t x, Int_t y, UInt_t w, UInt_t h);
312 Bool_t CheckEvent(Window_t
id, EGEventType type, Event_t &ev);
313 void SendEvent(Window_t
id, Event_t *ev);
314 void WMDeleteNotify(Window_t
id);
315 void SetKeyAutoRepeat(Bool_t on = kTRUE);
316 void GrabKey(Window_t
id, Int_t keycode, UInt_t modifier, Bool_t grab = kTRUE);
317 void GrabButton(Window_t
id, EMouseButton button, UInt_t modifier,
318 UInt_t evmask, Window_t confine, Cursor_t cursor,
319 Bool_t grab = kTRUE);
320 void GrabPointer(Window_t
id, UInt_t evmask, Window_t confine,
321 Cursor_t cursor, Bool_t grab = kTRUE,
322 Bool_t owner_events = kTRUE);
323 void SetWindowName(Window_t
id,
char *name);
324 void SetIconName(Window_t
id,
char *name);
325 void SetIconPixmap(Window_t
id, Pixmap_t pic);
326 void SetClassHints(Window_t
id,
char *className,
char *resourceName);
327 void SetMWMHints(Window_t
id, UInt_t value, UInt_t funcs, UInt_t input);
328 void SetWMPosition(Window_t
id, Int_t x, Int_t y);
329 void SetWMSize(Window_t
id, UInt_t w, UInt_t h);
330 void SetWMSizeHints(Window_t
id, UInt_t wmin, UInt_t hmin,
331 UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc);
332 void SetWMState(Window_t
id, EInitialState state);
333 void SetWMTransientHint(Window_t
id, Window_t main_id);
334 void DrawString(Drawable_t
id, GContext_t gc, Int_t x, Int_t y,
335 const char *s, Int_t len);
336 Int_t TextWidth(FontStruct_t font,
const char *s, Int_t len);
337 void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent);
338 void GetGCValues(GContext_t gc, GCValues_t &gval);
339 FontStruct_t GetFontStruct(FontH_t fh);
340 void FreeFontStruct(FontStruct_t fs);
341 void ClearWindow(Window_t
id);
342 Int_t KeysymToKeycode(UInt_t keysym);
343 void FillRectangle(Drawable_t
id, GContext_t gc, Int_t x, Int_t y,
345 void DrawRectangle(Drawable_t
id, GContext_t gc, Int_t x, Int_t y,
347 void DrawSegments(Drawable_t
id, GContext_t gc, Segment_t *seg, Int_t nseg);
348 void SelectInput(Window_t
id, UInt_t evmask);
349 Window_t GetInputFocus();
350 void SetInputFocus(Window_t
id);
351 Window_t GetPrimarySelectionOwner();
352 void SetPrimarySelectionOwner(Window_t
id);
353 void ConvertPrimarySelection(Window_t
id, Atom_t clipboard, Time_t when);
354 void LookupString(Event_t *event,
char *buf, Int_t buflen, UInt_t &keysym);
355 void GetPasteBuffer(Window_t
id, Atom_t atom, TString &text,
356 Int_t &nchar, Bool_t del);
357 void TranslateCoordinates(Window_t src, Window_t dest, Int_t src_x,
358 Int_t src_y, Int_t &dest_x, Int_t &dest_y, Window_t &child);
359 void GetWindowSize(Drawable_t
id, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h);
360 void FillPolygon(Window_t
id, GContext_t gc, Point_t *points, Int_t npnt);
361 void QueryPointer(Window_t
id, Window_t &rootw, Window_t &childw,
362 Int_t &root_x, Int_t &root_y, Int_t &win_x,
363 Int_t &win_y, UInt_t &mask);
364 void SetForeground(GContext_t gc, ULong_t foreground);
365 void SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n);
366 void Update(Int_t mode = 0);
367 Region_t CreateRegion();
368 void DestroyRegion(Region_t reg);
369 void UnionRectWithRegion(Rectangle_t *rect, Region_t src, Region_t dest);
370 Region_t PolygonRegion(Point_t *points, Int_t np, Bool_t winding);
371 void UnionRegion(Region_t rega, Region_t regb, Region_t result);
372 void IntersectRegion(Region_t rega, Region_t regb, Region_t result);
373 void SubtractRegion(Region_t rega, Region_t regb, Region_t result);
374 void XorRegion(Region_t rega, Region_t regb, Region_t result);
375 Bool_t EmptyRegion(Region_t reg);
376 Bool_t PointInRegion(Int_t x, Int_t y, Region_t reg);
377 Bool_t EqualRegion(Region_t rega, Region_t regb);
378 void GetRegionBox(Region_t reg, Rectangle_t *);
379 char **ListFonts(
const char *fontname, Int_t max, Int_t &count);
380 void FreeFontNames(
char **fontlist);
381 Drawable_t CreateImage(UInt_t width, UInt_t height);
382 void GetImageSize(Drawable_t
id, UInt_t &width, UInt_t &height);
383 void PutPixel(Drawable_t
id, Int_t x, Int_t y, ULong_t pixel);
384 void PutImage(Drawable_t
id, GContext_t gc, Drawable_t img,
385 Int_t dx, Int_t dy, Int_t x, Int_t y,
387 void DeleteImage(Drawable_t img);
388 void ShapeCombineMask(Window_t
id, Int_t x, Int_t y, Pixmap_t mask);
389 UInt_t ScreenWidthMM()
const;
391 void DeleteProperty(Window_t, Atom_t&);
392 Int_t GetProperty(Window_t, Atom_t, Long_t, Long_t, Bool_t, Atom_t,
393 Atom_t*, Int_t*, ULong_t*, ULong_t*,
unsigned char**);
394 void ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t);
395 void ConvertSelection(Window_t, Atom_t&, Atom_t&, Atom_t&, Time_t&);
396 Bool_t SetSelectionOwner(Window_t, Atom_t&);
397 void ChangeProperties(Window_t
id, Atom_t property, Atom_t type,
398 Int_t format, UChar_t *data, Int_t len);
399 void SetDNDAware(Window_t, Atom_t *);
400 void SetTypeList(Window_t win, Atom_t prop, Atom_t *typelist);
401 Window_t FindRWindow(Window_t win, Window_t dragwin, Window_t input,
int x,
int y,
int maxd);
402 Bool_t IsDNDAware(Window_t win, Atom_t *typelist);