Warning, file /include/root/TVirtualX.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TVirtualX
0013 #define ROOT_TVirtualX
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #include "TNamed.h"
0028 #include "TAttLine.h"
0029 #include "TAttFill.h"
0030 #include "TAttText.h"
0031 #include "TAttMarker.h"
0032 #include "GuiTypes.h"
0033
0034 #include <vector>
0035 #include <utility>
0036
0037
0038 R__EXTERN Atom_t gWM_DELETE_WINDOW;
0039 R__EXTERN Atom_t gMOTIF_WM_HINTS;
0040 R__EXTERN Atom_t gROOT_MESSAGE;
0041
0042 class TPoint;
0043 class TString;
0044 class TGWin32Command;
0045
0046 class TVirtualX : public TNamed, public TAttLine, public TAttFill, public TAttText, public TAttMarker {
0047
0048 public:
0049 enum EDrawMode { kCopy = 1, kXor, kInvert };
0050 enum EBoxMode { kHollow, kFilled };
0051 enum ETextMode { kClear, kOpaque };
0052 enum ETextSetMode { kCheck, kLoad };
0053
0054 protected:
0055 EDrawMode fDrawMode;
0056
0057 public:
0058 TVirtualX(): fDrawMode() {}
0059 TVirtualX(const char *name, const char *title);
0060 virtual ~TVirtualX() {}
0061
0062 virtual Bool_t Init(void *display = nullptr);
0063 virtual void ClearWindow();
0064 virtual void ClosePixmap();
0065 virtual void CloseWindow();
0066 virtual void CopyPixmap(Int_t wid, Int_t xpos, Int_t ypos);
0067 virtual void CreateOpenGLContext(Int_t wid=0);
0068 virtual void DeleteOpenGLContext(Int_t wid=0);
0069
0070
0071 virtual Double_t GetOpenGLScalingFactor();
0072 virtual Window_t CreateOpenGLWindow(Window_t parentID, UInt_t width, UInt_t height, const std::vector<std::pair<UInt_t, Int_t> > &format);
0073 virtual Handle_t CreateOpenGLContext(Window_t windowID, Handle_t sharedContext);
0074 virtual Bool_t MakeOpenGLContextCurrent(Handle_t ctx, Window_t windowID);
0075 virtual Handle_t GetCurrentOpenGLContext();
0076 virtual void FlushOpenGLBuffer(Handle_t ctx);
0077
0078 virtual void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode);
0079 virtual void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2,
0080 Int_t nx, Int_t ny, Int_t *ic);
0081 virtual void DrawFillArea(Int_t n, TPoint *xy);
0082 virtual void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2);
0083 virtual void DrawPolyLine(Int_t n, TPoint *xy);
0084 virtual void DrawPolyMarker(Int_t n, TPoint *xy);
0085 virtual void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text,
0086 ETextMode mode);
0087 virtual void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn, const wchar_t *text,
0088 ETextMode mode);
0089 virtual UInt_t ExecCommand(TGWin32Command *code);
0090 virtual void GetCharacterUp(Float_t &chupx, Float_t &chupy);
0091 EDrawMode GetDrawMode() { return fDrawMode; }
0092 virtual Int_t GetDoubleBuffer(Int_t wid);
0093 virtual void GetGeometry(Int_t wid, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h);
0094 virtual const char *DisplayName(const char * = nullptr);
0095 virtual Handle_t GetNativeEvent() const;
0096 virtual ULong_t GetPixel(Color_t cindex);
0097 virtual void GetPlanes(Int_t &nplanes);
0098 virtual void GetRGB(Int_t index, Float_t &r, Float_t &g, Float_t &b);
0099 virtual void GetTextExtent(UInt_t &w, UInt_t &h, char *mess);
0100 virtual void GetTextExtent(UInt_t &w, UInt_t &h, wchar_t *mess);
0101 virtual Int_t GetFontAscent() const;
0102 virtual Int_t GetFontAscent(const char *mess) const;
0103 virtual Int_t GetFontDescent() const;
0104 virtual Int_t GetFontDescent(const char *mess) const;
0105 virtual Float_t GetTextMagnitude();
0106 virtual Window_t GetWindowID(Int_t wid);
0107 virtual Bool_t HasTTFonts() const;
0108 virtual Int_t InitWindow(ULongptr_t window);
0109 virtual Int_t AddWindow(ULongptr_t qwid, UInt_t w, UInt_t h);
0110 virtual Int_t AddPixmap(ULongptr_t pixid, UInt_t w, UInt_t h);
0111 virtual void RemoveWindow(ULongptr_t qwid);
0112 virtual void MoveWindow(Int_t wid, Int_t x, Int_t y);
0113 virtual Int_t OpenPixmap(UInt_t w, UInt_t h);
0114 virtual void QueryPointer(Int_t &ix, Int_t &iy);
0115 virtual Pixmap_t ReadGIF(Int_t x0, Int_t y0, const char *file, Window_t id=0);
0116 virtual Int_t RequestLocator(Int_t mode, Int_t ctyp, Int_t &x, Int_t &y);
0117 virtual Int_t RequestString(Int_t x, Int_t y, char *text);
0118 virtual void RescaleWindow(Int_t wid, UInt_t w, UInt_t h);
0119 virtual Int_t ResizePixmap(Int_t wid, UInt_t w, UInt_t h);
0120 virtual void ResizeWindow(Int_t wid);
0121 virtual void SelectWindow(Int_t wid);
0122 virtual void SelectPixmap(Int_t qpixid);
0123 virtual void SetCharacterUp(Float_t chupx, Float_t chupy);
0124 virtual void SetClipOFF(Int_t wid);
0125 virtual void SetClipRegion(Int_t wid, Int_t x, Int_t y, UInt_t w, UInt_t h);
0126 virtual void SetCursor(Int_t win, ECursor cursor);
0127 virtual void SetDoubleBuffer(Int_t wid, Int_t mode);
0128 virtual void SetDoubleBufferOFF();
0129 virtual void SetDoubleBufferON();
0130 virtual void SetDrawMode(EDrawMode mode);
0131 void SetFillColor(Color_t cindex) override;
0132 void SetFillStyle(Style_t style) override;
0133 void SetLineColor(Color_t cindex) override;
0134 virtual void SetLineType(Int_t n, Int_t *dash);
0135 void SetLineStyle(Style_t linestyle) override;
0136 void SetLineWidth(Width_t width) override;
0137 void SetMarkerColor(Color_t cindex) override;
0138 void SetMarkerSize(Float_t markersize) override;
0139 void SetMarkerStyle(Style_t markerstyle) override;
0140 virtual void SetOpacity(Int_t percent);
0141 virtual void SetRGB(Int_t cindex, Float_t r, Float_t g, Float_t b);
0142 void SetTextAlign(Short_t talign=11) override;
0143 void SetTextColor(Color_t cindex) override;
0144 virtual Int_t SetTextFont(char *fontname, ETextSetMode mode);
0145 void SetTextFont(Font_t fontnumber) override;
0146 virtual void SetTextMagnitude(Float_t mgn);
0147 void SetTextSize(Float_t textsize) override;
0148 virtual void Sync(Int_t mode);
0149 virtual void UpdateWindow(Int_t mode);
0150 virtual void Warp(Int_t ix, Int_t iy, Window_t id = 0);
0151 virtual Int_t WriteGIF(char *name);
0152 virtual void WritePixmap(Int_t wid, UInt_t w, UInt_t h, char *pxname);
0153 virtual Window_t GetCurrentWindow() const;
0154 virtual Int_t SupportsExtension(const char *ext) const;
0155
0156
0157 virtual void GetWindowAttributes(Window_t id, WindowAttributes_t &attr);
0158 virtual void MapWindow(Window_t id);
0159 virtual void MapSubwindows(Window_t id);
0160 virtual void MapRaised(Window_t id);
0161 virtual void UnmapWindow(Window_t id);
0162 virtual void DestroyWindow(Window_t id);
0163 virtual void DestroySubwindows(Window_t id);
0164 virtual void RaiseWindow(Window_t id);
0165 virtual void LowerWindow(Window_t id);
0166 virtual void MoveWindow(Window_t id, Int_t x, Int_t y);
0167 virtual void MoveResizeWindow(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h);
0168 virtual void ResizeWindow(Window_t id, UInt_t w, UInt_t h);
0169 virtual void IconifyWindow(Window_t id);
0170 virtual Bool_t NeedRedraw(ULongptr_t tgwindow, Bool_t force);
0171 virtual void ReparentWindow(Window_t id, Window_t pid, Int_t x, Int_t y);
0172 virtual void SetWindowBackground(Window_t id, ULong_t color);
0173 virtual void SetWindowBackgroundPixmap(Window_t id, Pixmap_t pxm);
0174 virtual Window_t CreateWindow(Window_t parent, Int_t x, Int_t y,
0175 UInt_t w, UInt_t h, UInt_t border,
0176 Int_t depth, UInt_t clss,
0177 void *visual, SetWindowAttributes_t *attr,
0178 UInt_t wtype);
0179 virtual Int_t OpenDisplay(const char *dpyName);
0180 virtual void CloseDisplay();
0181 virtual Display_t GetDisplay() const;
0182 virtual Visual_t GetVisual() const;
0183 virtual Int_t GetScreen() const;
0184 virtual Int_t GetDepth() const;
0185 virtual UInt_t ScreenWidthMM() const;
0186 virtual Colormap_t GetColormap() const;
0187 virtual Atom_t InternAtom(const char *atom_name, Bool_t only_if_exist);
0188 virtual Window_t GetDefaultRootWindow() const;
0189 virtual Window_t GetParent(Window_t id) const;
0190 virtual FontStruct_t LoadQueryFont(const char *font_name);
0191 virtual FontH_t GetFontHandle(FontStruct_t fs);
0192 virtual void DeleteFont(FontStruct_t fs);
0193 virtual GContext_t CreateGC(Drawable_t id, GCValues_t *gval);
0194 virtual void ChangeGC(GContext_t gc, GCValues_t *gval);
0195 virtual void CopyGC(GContext_t org, GContext_t dest, Mask_t mask);
0196 virtual void DeleteGC(GContext_t gc);
0197 virtual Cursor_t CreateCursor(ECursor cursor);
0198 virtual void SetCursor(Window_t id, Cursor_t curid);
0199 virtual Pixmap_t CreatePixmap(Drawable_t id, UInt_t w, UInt_t h);
0200 virtual Pixmap_t CreatePixmap(Drawable_t id, const char *bitmap, UInt_t width,
0201 UInt_t height, ULong_t forecolor, ULong_t backcolor,
0202 Int_t depth);
0203 virtual Pixmap_t CreateBitmap(Drawable_t id, const char *bitmap,
0204 UInt_t width, UInt_t height);
0205 virtual void DeletePixmap(Pixmap_t pmap);
0206 virtual Bool_t CreatePictureFromFile(Drawable_t id, const char *filename,
0207 Pixmap_t &pict, Pixmap_t &pict_mask,
0208 PictureAttributes_t &attr);
0209 virtual Bool_t CreatePictureFromData(Drawable_t id, char **data,
0210 Pixmap_t &pict, Pixmap_t &pict_mask,
0211 PictureAttributes_t &attr);
0212 virtual Pixmap_t CreatePixmapFromData(unsigned char *bits, UInt_t width, UInt_t height);
0213 virtual Bool_t ReadPictureDataFromFile(const char *filename, char ***ret_data);
0214 virtual void DeletePictureData(void *data);
0215 virtual void SetDashes(GContext_t gc, Int_t offset, const char *dash_list,
0216 Int_t n);
0217 virtual Bool_t ParseColor(Colormap_t cmap, const char *cname, ColorStruct_t &color);
0218 virtual Bool_t AllocColor(Colormap_t cmap, ColorStruct_t &color);
0219 virtual void QueryColor(Colormap_t cmap, ColorStruct_t &color);
0220 virtual void FreeColor(Colormap_t cmap, ULong_t pixel);
0221 virtual Int_t EventsPending();
0222 virtual void NextEvent(Event_t &event);
0223 virtual void Bell(Int_t percent);
0224 virtual void CopyArea(Drawable_t src, Drawable_t dest, GContext_t gc,
0225 Int_t src_x, Int_t src_y, UInt_t width,
0226 UInt_t height, Int_t dest_x, Int_t dest_y);
0227 virtual void ChangeWindowAttributes(Window_t id, SetWindowAttributes_t *attr);
0228 virtual void ChangeProperty(Window_t id, Atom_t property, Atom_t type,
0229 UChar_t *data, Int_t len);
0230 virtual void DrawLine(Drawable_t id, GContext_t gc, Int_t x1, Int_t y1, Int_t x2, Int_t y2);
0231 virtual void ClearArea(Window_t id, Int_t x, Int_t y, UInt_t w, UInt_t h);
0232 virtual Bool_t CheckEvent(Window_t id, EGEventType type, Event_t &ev);
0233 virtual void SendEvent(Window_t id, Event_t *ev);
0234 virtual void DispatchClientMessage(UInt_t messageID);
0235 virtual void WMDeleteNotify(Window_t id);
0236 virtual void SetKeyAutoRepeat(Bool_t on = kTRUE);
0237 virtual void GrabKey(Window_t id, Int_t keycode, UInt_t modifier, Bool_t grab = kTRUE);
0238 virtual void GrabButton(Window_t id, EMouseButton button, UInt_t modifier,
0239 UInt_t evmask, Window_t confine, Cursor_t cursor,
0240 Bool_t grab = kTRUE);
0241 virtual void GrabPointer(Window_t id, UInt_t evmask, Window_t confine,
0242 Cursor_t cursor, Bool_t grab = kTRUE,
0243 Bool_t owner_events = kTRUE);
0244 virtual void SetWindowName(Window_t id, char *name);
0245 virtual void SetIconName(Window_t id, char *name);
0246 virtual void SetIconPixmap(Window_t id, Pixmap_t pix);
0247 virtual void SetClassHints(Window_t id, char *className, char *resourceName);
0248 virtual void SetMWMHints(Window_t id, UInt_t value, UInt_t funcs, UInt_t input);
0249 virtual void SetWMPosition(Window_t id, Int_t x, Int_t y);
0250 virtual void SetWMSize(Window_t id, UInt_t w, UInt_t h);
0251 virtual void SetWMSizeHints(Window_t id, UInt_t wmin, UInt_t hmin,
0252 UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc);
0253 virtual void SetWMState(Window_t id, EInitialState state);
0254 virtual void SetWMTransientHint(Window_t id, Window_t main_id);
0255 virtual void DrawString(Drawable_t id, GContext_t gc, Int_t x, Int_t y,
0256 const char *s, Int_t len);
0257 virtual Int_t TextWidth(FontStruct_t font, const char *s, Int_t len);
0258 virtual void GetFontProperties(FontStruct_t font, Int_t &max_ascent, Int_t &max_descent);
0259 virtual void GetGCValues(GContext_t gc, GCValues_t &gval);
0260 virtual FontStruct_t GetGCFont(GContext_t gc);
0261 virtual FontStruct_t GetFontStruct(FontH_t fh);
0262 virtual void FreeFontStruct(FontStruct_t fs);
0263 virtual void ClearWindow(Window_t id);
0264 virtual Int_t KeysymToKeycode(UInt_t keysym);
0265 virtual void FillRectangle(Drawable_t id, GContext_t gc, Int_t x, Int_t y,
0266 UInt_t w, UInt_t h);
0267 virtual void DrawRectangle(Drawable_t id, GContext_t gc, Int_t x, Int_t y,
0268 UInt_t w, UInt_t h);
0269 virtual void DrawSegments(Drawable_t id, GContext_t gc, Segment_t *seg, Int_t nseg);
0270 virtual void SelectInput(Window_t id, UInt_t evmask);
0271 virtual Window_t GetInputFocus();
0272 virtual void SetInputFocus(Window_t id);
0273 virtual Window_t GetPrimarySelectionOwner();
0274 virtual void SetPrimarySelectionOwner(Window_t id);
0275 virtual void ConvertPrimarySelection(Window_t id, Atom_t clipboard, Time_t when);
0276 virtual void LookupString(Event_t *event, char *buf, Int_t buflen, UInt_t &keysym);
0277 virtual void GetPasteBuffer(Window_t id, Atom_t atom, TString &text, Int_t &nchar,
0278 Bool_t del);
0279 virtual void TranslateCoordinates(Window_t src, Window_t dest, Int_t src_x,Int_t src_y,
0280 Int_t &dest_x, Int_t &dest_y, Window_t &child);
0281 virtual void GetWindowSize(Drawable_t id, Int_t &x, Int_t & overridey, UInt_t &w, UInt_t &h);
0282 virtual void FillPolygon(Window_t id, GContext_t gc, Point_t *points, Int_t npnt);
0283 virtual void QueryPointer(Window_t id, Window_t &rootw, Window_t &childw,
0284 Int_t &root_x, Int_t &root_y, Int_t &win_x,
0285 Int_t &win_y, UInt_t &mask);
0286 virtual void SetForeground(GContext_t gc, ULong_t foreground);
0287 virtual void SetClipRectangles(GContext_t gc, Int_t x, Int_t y, Rectangle_t *recs, Int_t n);
0288 virtual void Update(Int_t mode = 0);
0289 virtual Region_t CreateRegion();
0290 virtual void DestroyRegion(Region_t reg);
0291 virtual void UnionRectWithRegion(Rectangle_t *rect, Region_t src, Region_t dest);
0292 virtual Region_t PolygonRegion(Point_t *points, Int_t np, Bool_t winding);
0293 virtual void UnionRegion(Region_t rega, Region_t regb, Region_t result);
0294 virtual void IntersectRegion(Region_t rega, Region_t regb, Region_t result);
0295 virtual void SubtractRegion(Region_t rega, Region_t regb, Region_t result);
0296 virtual void XorRegion(Region_t rega, Region_t regb, Region_t result);
0297 virtual Bool_t EmptyRegion(Region_t reg);
0298 virtual Bool_t PointInRegion(Int_t x, Int_t y, Region_t reg);
0299 virtual Bool_t EqualRegion(Region_t rega, Region_t regb);
0300 virtual void GetRegionBox(Region_t reg, Rectangle_t *rect);
0301 virtual char **ListFonts(const char *fontname, Int_t max, Int_t &count);
0302 virtual void FreeFontNames(char **fontlist);
0303 virtual Drawable_t CreateImage(UInt_t width, UInt_t height);
0304 virtual void GetImageSize(Drawable_t id, UInt_t &width, UInt_t &height);
0305 virtual void PutPixel(Drawable_t id, Int_t x, Int_t y, ULong_t pixel);
0306 virtual void PutImage(Drawable_t id, GContext_t gc, Drawable_t img, Int_t dx, Int_t dy,
0307 Int_t x, Int_t y, UInt_t w, UInt_t h);
0308 virtual void DeleteImage(Drawable_t img);
0309 virtual unsigned char *GetColorBits(Drawable_t wid, Int_t x = 0, Int_t y = 0, UInt_t w = 0, UInt_t h = 0);
0310 virtual void ShapeCombineMask(Window_t id, Int_t x, Int_t y, Pixmap_t mask);
0311
0312
0313 virtual void DeleteProperty(Window_t, Atom_t&);
0314 virtual Int_t GetProperty(Window_t, Atom_t, Long_t, Long_t, Bool_t, Atom_t,
0315 Atom_t*, Int_t*, ULong_t*, ULong_t*, unsigned char**);
0316 virtual void ChangeActivePointerGrab(Window_t, UInt_t, Cursor_t);
0317 virtual void ConvertSelection(Window_t, Atom_t&, Atom_t&, Atom_t&, Time_t&);
0318 virtual Bool_t SetSelectionOwner(Window_t, Atom_t&);
0319 virtual void ChangeProperties(Window_t id, Atom_t property, Atom_t type,
0320 Int_t format, UChar_t *data, Int_t len);
0321 virtual void SetDNDAware(Window_t, Atom_t *);
0322 virtual void SetTypeList(Window_t win, Atom_t prop, Atom_t *typelist);
0323 virtual Window_t FindRWindow(Window_t win, Window_t dragwin, Window_t input, int x, int y, int maxd);
0324 virtual Bool_t IsDNDAware(Window_t win, Atom_t *typelist);
0325
0326 virtual void BeginModalSessionFor(Window_t window);
0327
0328 virtual Bool_t IsCmdThread() const { return kTRUE; }
0329
0330 virtual void MapGCFont(GContext_t, FontStruct_t);
0331
0332 static TVirtualX *&Instance();
0333
0334 ClassDefOverride(TVirtualX,0)
0335 };
0336
0337 #define gVirtualX (TVirtualX::Instance())
0338 R__EXTERN TVirtualX *(*gPtr2VirtualX)();
0339 R__EXTERN TVirtualX *gGXBatch;
0340
0341 #endif