Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGWin32VirtualXProxy.h
Go to the documentation of this file.
1 // $Id: TGWin32VirtualXProxy.h,v 1.14 2006/05/15 13:31:01 rdm Exp $
2 // Author: Valeriy Onuchin 08/08/2003
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGWin32VirtualXProxy
13 #define ROOT_TGWin32VirtualXProxy
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TGWin32VirtualXProxy //
18 // //
19 // This class is the proxy interface to the Win32 graphics system. //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #include "TVirtualX.h"
24 
25 #include "TGWin32ProxyBase.h"
26 
27 class TGWin32;
28 
29 
30 class TGWin32VirtualXProxy: public TVirtualX , public TGWin32ProxyBase {
31 
32 friend class TGWin32;
33 
34 protected:
35  static TVirtualX *fgRealObject; // TGWin32 object
36 
37 public:
38  TGWin32VirtualXProxy() { fMaxResponseTime = 1000; fIsVirtualX = kTRUE; }
39  TGWin32VirtualXProxy(const char *name, const char *title) {}
40  virtual ~TGWin32VirtualXProxy() {}
41 
42  Bool_t Init(void *display=0);
43  void ClearWindow();
44  void ClosePixmap();
45  void CloseWindow();
46  void CopyPixmap(Int_t wid, Int_t xpos, Int_t ypos);
47  void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode);
48  void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, Int_t *ic);
49  void DrawFillArea(Int_t n, TPoint *xy);
50  void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2);
51  void DrawPolyLine(Int_t n, TPoint *xy);
52  void DrawPolyMarker(Int_t n, TPoint *xy);
53  void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode);
54  void DrawText(Int_t, Int_t, Float_t, Float_t, const wchar_t *, ETextMode){}
55  void GetCharacterUp(Float_t &chupx, Float_t &chupy);
56  EDrawMode GetDrawMode();
57  Int_t GetDoubleBuffer(Int_t wid);
58  void GetGeometry(Int_t wid, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h);
59  const char *DisplayName(const char * = 0);
60  Handle_t GetNativeEvent() const;
61  ULong_t GetPixel(Color_t cindex);
62  void GetPlanes(Int_t &nplanes);
63  void GetRGB(Int_t index, Float_t &r, Float_t &g, Float_t &b);
64  void GetTextExtent(UInt_t &w, UInt_t &h, char *mess);
65  void GetTextExtent(UInt_t &, UInt_t &, wchar_t *){}
66  Float_t GetTextMagnitude();
67  Window_t GetWindowID(Int_t wid);
68  Bool_t HasTTFonts() const;
69  Int_t InitWindow(ULong_t window);
70  void MoveWindow(Int_t wid, Int_t x, Int_t y);
71  Int_t OpenPixmap(UInt_t w, UInt_t h);
72  void QueryPointer(Int_t &ix, Int_t &iy);
73  void ReadGIF(Int_t x0, Int_t y0, const char *file);
74  Int_t RequestLocator(Int_t mode, Int_t ctyp, Int_t &x, Int_t &y);
75  Int_t RequestString(Int_t x, Int_t y, char *text);
76  void RescaleWindow(Int_t wid, UInt_t w, UInt_t h);
77  Int_t ResizePixmap(Int_t wid, UInt_t w, UInt_t h);
78  void ResizeWindow(Int_t wid);
79  void SelectWindow(Int_t wid);
80  void SetCharacterUp(Float_t chupx, Float_t chupy);
81  void SetClipOFF(Int_t wid);
82  void SetClipRegion(Int_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h);
83  void SetCursor(Int_t win, ECursor cursor);
84  void SetDoubleBuffer(Int_t wid, Int_t mode);
85  void SetDoubleBufferOFF();
86  void SetDoubleBufferON();
87  void SetDrawMode(EDrawMode mode);
88  void SetFillColor(Color_t cindex);
89  void SetFillStyle(Style_t style);
90  void SetFillAttributes();
91  void ResetAttFill(Option_t *option="");
92  Color_t GetFillColor() const;
93  Style_t GetFillStyle() const;
94  Bool_t IsTransparent() const;
95  void SetLineColor(Color_t cindex);
96  void SetLineType(Int_t n, Int_t *dash);
97  void SetLineStyle(Style_t linestyle);
98  void SetLineWidth(Width_t width);
99  void SetLineAttributes();
100  void ResetAttLine(Option_t *option="");
101  Color_t GetLineColor() const;
102  Style_t GetLineStyle() const;
103  Width_t GetLineWidth() const;
104  void SetMarkerColor(Color_t cindex);
105  void SetMarkerSize(Float_t markersize);
106  void SetMarkerStyle(Style_t markerstyle);
107  void ResetAttMarker(Option_t *toption="");
108  void SetMarkerAttributes();
109  Color_t GetMarkerColor() const;
110  Style_t GetMarkerStyle() const;
111  Size_t GetMarkerSize() const;
112  void SetOpacity(Int_t percent);
113  void SetRGB(Int_t cindex, Float_t r, Float_t g, Float_t b);
114  void SetTextAlign(Short_t talign=11);
115  void SetTextColor(Color_t cindex=1);
116  void SetTextAngle(Float_t tangle=0);
117  Int_t SetTextFont(char *fontname, ETextSetMode mode);
118  void SetTextFont(Font_t fontnumber=62);
119  void SetTextMagnitude(Float_t mgn);
120  void SetTextSize(Float_t textsize=1);
121  void SetTextSizePixels(Int_t npixels);
122  void SetTextAttributes();
123  void ResetAttText(Option_t *toption="");
124  Short_t GetTextAlign() const;
125  Float_t GetTextAngle() const;
126  Color_t GetTextColor() const;
127  Font_t GetTextFont() const;
128  Float_t GetTextSize() const;
129  void UpdateWindow(Int_t mode);
130  void Warp(Int_t ix, Int_t iy, Window_t id = 0);
131  Int_t WriteGIF(char *name);
132  void WritePixmap(Int_t wid, UInt_t w, UInt_t h, char *pxname);
133  void GetWindowAttributes(Window_t id, WindowAttributes_t &attr);
134  void MapWindow(Window_t id);
135  void MapSubwindows(Window_t id);
136  void MapRaised(Window_t id);
137  void UnmapWindow(Window_t id);
138  void DestroyWindow(Window_t id);
139  void DestroySubwindows(Window_t id);
140  void RaiseWindow(Window_t id);
141  void LowerWindow(Window_t id);
142  void MoveWindow(Window_t id, Int_t x, Int_t y);
143  void MoveResizeWindow(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h);
144  void ResizeWindow(Window_t id, UInt_t w, UInt_t h);
145  void IconifyWindow(Window_t id);
146  void ReparentWindow(Window_t id, Window_t pid, Int_t x, Int_t y);
147  void SetWindowBackground(Window_t id, ULong_t color);
148  void SetWindowBackgroundPixmap(Window_t id, Pixmap_t pxm);
149  Window_t CreateWindow(Window_t parent, Int_t x, Int_t y,
150  UInt_t w, UInt_t h, UInt_t border, Int_t depth, UInt_t clss,
151  void *visual, SetWindowAttributes_t *attr, UInt_t wtype);
152  Int_t OpenDisplay(const char *dpyName=0);
153  void CloseDisplay();
154  Display_t GetDisplay() const;
155  Visual_t GetVisual() const;
156  Int_t GetScreen() const;
157  Int_t GetDepth() const;
158  Colormap_t GetColormap() const;
159  Atom_t InternAtom(const char *atom_name, Bool_t only_if_exist);
160  Window_t GetDefaultRootWindow() const;
161  Window_t GetParent(Window_t id) const;
162  FontStruct_t LoadQueryFont(const char *font_name);
163  FontH_t GetFontHandle(FontStruct_t fs);
164  void DeleteFont(FontStruct_t fs);
165  GContext_t CreateGC(Drawable_t id, GCValues_t *gval);
166  void ChangeGC(GContext_t gc, GCValues_t *gval);
167  void CopyGC(GContext_t org, GContext_t dest, Mask_t mask);
168  void DeleteGC(GContext_t gc);
169  Cursor_t CreateCursor(ECursor cursor);
170  void SetCursor(Window_t id, Cursor_t curid);
171  Pixmap_t CreatePixmap(Drawable_t id, UInt_t w, UInt_t h);
172  Pixmap_t CreatePixmap(Drawable_t id, const char *bitmap, UInt_t width,
173  UInt_t height, ULong_t forecolor, ULong_t backcolor, Int_t depth);
174  Pixmap_t CreateBitmap(Drawable_t id, const char *bitmap, UInt_t width, UInt_t height);
175  void DeletePixmap(Pixmap_t pmap);
176  Bool_t CreatePictureFromFile(Drawable_t id, const char *filename,
177  Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr);
178  Bool_t CreatePictureFromData(Drawable_t id, char **data,
179  Pixmap_t &pict, Pixmap_t &pict_mask, PictureAttributes_t &attr);
180  Bool_t ReadPictureDataFromFile(const char *filename, char ***ret_data);
181  void DeletePictureData(void *data);
182  void SetDashes(GContext_t gc, Int_t offset, const char *dash_list, Int_t n);
183  Bool_t ParseColor(Colormap_t cmap, const char *cname, ColorStruct_t &color);
184  Bool_t AllocColor(Colormap_t cmap, ColorStruct_t &color);
185  void QueryColor(Colormap_t cmap, ColorStruct_t &color);
186  void FreeColor(Colormap_t cmap, ULong_t pixel);
187  void Bell(Int_t percent);
188  void CopyArea(Drawable_t src, Drawable_t dest, GContext_t gc, Int_t src_x,
189  Int_t src_y, UInt_t width, UInt_t height, Int_t dest_x, Int_t dest_y);
190  void ChangeWindowAttributes(Window_t id, SetWindowAttributes_t *attr);
191  void ChangeProperty(Window_t id, Atom_t property, Atom_t type, UChar_t *data, Int_t len);
192  void DrawLine(Drawable_t id, GContext_t gc, Int_t x1, Int_t y1, Int_t x2, Int_t y2);
193  void ClearArea(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h);
194  void WMDeleteNotify(Window_t id);
195  void SetKeyAutoRepeat(Bool_t on = kTRUE);
196  void GrabKey(Window_t id, Int_t keycode, UInt_t modifier, Bool_t grab = kTRUE);
197  void GrabButton(Window_t id, EMouseButton button, UInt_t modifier,
198  UInt_t evmask, Window_t confine, Cursor_t cursor, Bool_t grab = kTRUE);
199  void GrabPointer(Window_t id, UInt_t evmask, Window_t confine,
200  Cursor_t cursor, Bool_t grab = kTRUE, Bool_t owner_events = kTRUE);
201  void SetWindowName(Window_t id, char *name);
202  void SetIconName(Window_t id, char *name);
203  void SetIconPixmap(Window_t id, Pixmap_t pix);
204  void SetClassHints(Window_t id, char *className, char *resourceName);
205  void SetMWMHints(Window_t id, UInt_t value, UInt_t funcs, UInt_t input);
206  void SetWMPosition(Window_t id, Int_t x, Int_t y);
207  void SetWMSize(Window_t id, UInt_t w, UInt_t h);
208  void SetWMSizeHints(Window_t id, UInt_t wmin, UInt_t hmin,
209  UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc);
210  void SetWMState(Window_t id, EInitialState state);
211  void SetWMTransientHint(Window_t id, Window_t main_id);
212  void DrawString(Drawable_t id, GContext_t gc, Int_t x, Int_t y, const char *s, Int_t len);
213  Int_t TextWidth(FontStruct_t font, const char *s, Int_t len);
214  void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent);
215  void GetGCValues(GContext_t gc, GCValues_t &gval);
216  FontStruct_t GetFontStruct(FontH_t fh);
217  void FreeFontStruct(FontStruct_t fs);
218  void ClearWindow(Window_t id);
219  Int_t KeysymToKeycode(UInt_t keysym);
220  void FillRectangle(Drawable_t id, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h);
221  void DrawRectangle(Drawable_t id, GContext_t gc, Int_t x, Int_t y, UInt_t w, UInt_t h);
222  void DrawSegments(Drawable_t id, GContext_t gc, Segment_t *seg, Int_t nseg);
223  void SelectInput(Window_t id, UInt_t evmask);
224  Window_t GetInputFocus();
225  void SetInputFocus(Window_t id);
226  Window_t GetPrimarySelectionOwner();
227  void SetPrimarySelectionOwner(Window_t id);
228  void ConvertPrimarySelection(Window_t id, Atom_t clipboard, Time_t when);
229  void LookupString(Event_t *event, char *buf, Int_t buflen, UInt_t &keysym);
230  void GetPasteBuffer(Window_t id, Atom_t atom, TString &text, Int_t &nchar, Bool_t del);
231  void TranslateCoordinates(Window_t src, Window_t dest, Int_t src_x,
232  Int_t src_y, Int_t &dest_x, Int_t &dest_y, Window_t &child);
233  void GetWindowSize(Drawable_t id, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h);
234  void FillPolygon(Window_t id, GContext_t gc, Point_t *points, Int_t npnt);
235  void QueryPointer(Window_t id, Window_t &rootw, Window_t &childw,
236  Int_t &root_x, Int_t &root_y, Int_t &win_x, Int_t &win_y, UInt_t &mask);
237  void SetForeground(GContext_t gc, ULong_t foreground);
238  void SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n);
239  void Update(Int_t mode = 0);
240  Region_t CreateRegion();
241  void DestroyRegion(Region_t reg);
242  void UnionRectWithRegion(Rectangle_t *rect, Region_t src, Region_t dest);
243  Region_t PolygonRegion(Point_t *points, Int_t np, Bool_t winding);
244  void UnionRegion(Region_t rega, Region_t regb, Region_t result);
245  void IntersectRegion(Region_t rega, Region_t regb, Region_t result);
246  void SubtractRegion(Region_t rega, Region_t regb, Region_t result);
247  void XorRegion(Region_t rega, Region_t regb, Region_t result);
248  Bool_t EmptyRegion(Region_t reg);
249  Bool_t PointInRegion(Int_t x, Int_t y, Region_t reg);
250  Bool_t EqualRegion(Region_t rega, Region_t regb);
251  void GetRegionBox(Region_t reg, Rectangle_t *rect);
252  char **ListFonts(const char *fontname, Int_t max, Int_t &count);
253  void FreeFontNames(char **fontlist);
254  Drawable_t CreateImage(UInt_t width, UInt_t height);
255  void GetImageSize(Drawable_t id, UInt_t &width, UInt_t &height);
256  void PutPixel(Drawable_t id, Int_t x, Int_t y, ULong_t pixel);
257  void PutImage(Drawable_t id, GContext_t gc, Drawable_t img,
258  Int_t dx, Int_t dy, Int_t x, Int_t y, UInt_t w, UInt_t h);
259  void DeleteImage(Drawable_t img);
260  unsigned char *GetColorBits(Drawable_t wid, Int_t x, Int_t y, UInt_t width, UInt_t height);
261  Pixmap_t CreatePixmapFromData(unsigned char *bits, UInt_t width, UInt_t height);
262  Int_t AddWindow(ULong_t qwid, UInt_t w, UInt_t h);
263  void RemoveWindow(ULong_t qwid);
264  void ShapeCombineMask(Window_t id, Int_t x, Int_t y, Pixmap_t mask);
265 
266  void DeleteProperty(Window_t, Atom_t&);
267  Int_t GetProperty(Window_t, Atom_t, Long_t, Long_t, Bool_t, Atom_t,
268  Atom_t*, Int_t*, ULong_t*, ULong_t*, unsigned char**);
269  void ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t);
270  void ConvertSelection(Window_t, Atom_t&, Atom_t&, Atom_t&, Time_t&);
271  Bool_t SetSelectionOwner(Window_t, Atom_t&);
272  void ChangeProperties(Window_t id, Atom_t property, Atom_t type,
273  Int_t format, UChar_t *data, Int_t len);
274  void SetDNDAware(Window_t win, Atom_t *typelist);
275  void SetTypeList(Window_t win, Atom_t prop, Atom_t *typelist);
276  Window_t FindRWindow(Window_t win, Window_t dragwin, Window_t input, int x, int y, int maxd);
277  Bool_t IsDNDAware(Window_t win, Atom_t *typelist);
278 
279  Int_t EventsPending();
280  void NextEvent(Event_t & event);
281  Bool_t CheckEvent(Window_t id, EGEventType type, Event_t &ev);
282  void SendEvent(Window_t id, Event_t *ev);
283  Bool_t IsCmdThread() const;
284  Window_t GetCurrentWindow() const;
285 
286  static TVirtualX *RealObject();
287  static TVirtualX *ProxyObject();
288 };
289 
290 #endif