Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TPyDispatcher.h
Go to the documentation of this file.
1// Author: Enric Tejedor CERN 07/2020
2// Original PyROOT code by Wim Lavrijsen, LBL
3
4/*************************************************************************
5 * Copyright (C) 1995-2020, 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_TPyDispatcher
13#define ROOT_TPyDispatcher
14
15// ROOT
16#include "TObject.h"
17
18class TDNDData;
19class TEveDigitSet;
20class TEveElement;
21class TEveTrack;
22class TEveWindow;
23class TGFrame;
24class TGListTreeItem;
25class TGMdiFrame;
27class TGShutterItem;
28class TGLVEntry;
29class TGLViewerBase;
30class TGVFileSplitter;
31class TList;
32class TObject;
33class TPad;
34class TQCommand;
35class TSocket;
36class TVirtualPad;
37
38struct Event_t;
39
40// Python
41struct _object;
42typedef _object PyObject;
43
44/// Dispatcher for C++ callbacks into Python code.
45class TPyDispatcher : public TObject {
46public:
50 ~TPyDispatcher() override;
51
52public:
53 PyObject *DispatchVA(const char *format = 0, ...);
54 PyObject *DispatchVA1(const char *clname, void *obj, const char *format, ...);
55
56 // pre-defined dispatches, same as per TQObject::Emit(); note that
57 // Emit() maps exclusively to this set, so several builtin types (e.g.
58 // Int_t, Bool_t, Float_t, etc.) have been omitted here
59 PyObject *Dispatch() { return DispatchVA(0); }
60 PyObject *Dispatch(const char *param) { return DispatchVA("s", param); }
61 PyObject *Dispatch(Double_t param) { return DispatchVA("d", param); }
62 PyObject *Dispatch(Long_t param) { return DispatchVA("l", param); }
63 PyObject *Dispatch(Long64_t param) { return DispatchVA("L", param); }
64
65 // further selection of pre-defined, existing dispatches
66 PyObject *Dispatch(Bool_t param) { return DispatchVA("i", param); }
67 PyObject *Dispatch(char *param) { return DispatchVA("s", param); }
68 PyObject *Dispatch(const char *text, Int_t len) { return DispatchVA("si", text, len); }
69 PyObject *Dispatch(Int_t param) { return DispatchVA("i", param); }
70 PyObject *Dispatch(Int_t x, Int_t y) { return DispatchVA("ii", x, y); }
71 PyObject *Dispatch(ULong_t param) { return DispatchVA("k", param); }
72 // ULong_t also for Handle_t (and Window_t, etc. ... )
73
74 PyObject *Dispatch(Event_t *event) { return DispatchVA1("Event_t", event, 0); }
75 PyObject *Dispatch(Event_t *event, ULong_t wid) { return DispatchVA1("Event_t", event, "k", wid); }
76 PyObject *Dispatch(TEveDigitSet *qs, Int_t idx) { return DispatchVA1("TEveDigitSet", qs, "i", idx); }
77 PyObject *Dispatch(TEveElement *el) { return DispatchVA1("TEveElement", el, 0); }
78 PyObject *Dispatch(TEveTrack *et) { return DispatchVA1("TEveTrack", et, 0); }
79 PyObject *Dispatch(TEveWindow *window) { return DispatchVA1("TEveWindow", window, 0); }
80 PyObject *Dispatch(TGFrame *frame) { return DispatchVA1("TGFrame", frame, 0); }
81 PyObject *Dispatch(TGFrame *frame, Int_t btn) { return DispatchVA1("TGFrame", frame, "i", btn); }
83 {
84 return DispatchVA1("TGFrame", frame, "iii", btn, x, y);
85 }
87 {
88 return DispatchVA1("TGFrame", frame, "II", keysym, mask);
89 }
90 PyObject *Dispatch(TGListTreeItem *entry) { return DispatchVA1("TGListTreeItem", entry, 0); }
91 PyObject *Dispatch(TGListTreeItem *entry, UInt_t mask) { return DispatchVA1("TGListTreeItem", entry, "I", mask); }
93 {
94 return DispatchVA1("TGListTreeItem", entry, "II", keysym, mask);
95 }
96 PyObject *Dispatch(TGListTreeItem *entry, Int_t btn) { return DispatchVA1("TGListTreeItem", entry, "i", btn); }
98 {
99 return DispatchVA1("TGListTreeItem", entry, "iii", btn, x, y);
100 }
101 PyObject *Dispatch(TGLVEntry *entry, Int_t btn) { return DispatchVA1("TGLVEntry", entry, "i", btn); }
103 {
104 return DispatchVA1("TGLVEntry", entry, "iii", btn, x, y);
105 }
106 PyObject *Dispatch(TGLViewerBase *viewer) { return DispatchVA1("TGLViewerBase", viewer, 0); }
107 PyObject *Dispatch(TGLPhysicalShape *shape) { return DispatchVA1("TGLPhysicalShape", shape, 0); }
109 {
110 return DispatchVA1("TGLPhysicalShape", shape, "II", u1, u2);
111 }
112 PyObject *Dispatch(TGMdiFrame *frame) { return DispatchVA1("TGMdiFrame", frame, 0); }
113 PyObject *Dispatch(TGShutterItem *item) { return DispatchVA1("TGShutterItem", item, 0); }
114 PyObject *Dispatch(TGVFileSplitter *frame) { return DispatchVA1("TGVFileSplitter", frame, 0); }
115 PyObject *Dispatch(TList *objs) { return DispatchVA1("TList", objs, 0); }
116 PyObject *Dispatch(TObject *obj) { return DispatchVA1("TObject", obj, 0); }
117 PyObject *Dispatch(TObject *obj, Bool_t check) { return DispatchVA1("TObject", obj, "i", check); }
118 PyObject *Dispatch(TObject *obj, UInt_t state) { return DispatchVA1("TObject", obj, "I", state); }
120 {
121 return DispatchVA1("TObject", obj, "II", button, state);
122 }
123 PyObject *Dispatch(TSocket *sock) { return DispatchVA1("TSocket", sock, 0); }
124 PyObject *Dispatch(TVirtualPad *pad) { return DispatchVA1("TVirtualPad", pad, 0); }
125
126 PyObject *Dispatch(TPad *selpad, TObject *selected, Int_t event);
127 PyObject *Dispatch(Int_t event, Int_t x, Int_t y, TObject *selected);
130 PyObject *Dispatch(const char *name, const TList *attr);
131
132private:
133 PyObject *fCallable; //! callable object to be dispatched
134};
135
136#endif
_object PyObject
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:69
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:68
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t button
Option_t Option_t TPoint TPoint const char text
char name[80]
Definition TGX11.cxx:110
_object PyObject
Drag and drop data container.
Base-class for storage of digit collections; provides transformation matrix (TEveTrans),...
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
Visual representation of a track.
Definition TEveTrack.h:33
Abstract base-class for representing eve-windows.
Definition TEveWindow.h:210
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
Concrete physical shape - a GL drawable.
Base class for GL viewers.
This file contains the TGMdiFrame class.
Definition TGMdiFrame.h:42
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
The most important graphics class in the ROOT system.
Definition TPad.h:28
Dispatcher for C++ callbacks into Python code.
PyObject * Dispatch(TGMdiFrame *frame)
PyObject * Dispatch(TGLPhysicalShape *shape, UInt_t u1, UInt_t u2)
PyObject * Dispatch(TEveElement *el)
PyObject * Dispatch(TGListTreeItem *entry, Int_t btn)
TPyDispatcher & operator=(const TPyDispatcher &)
Assignment operator. Applies python object reference counting.
PyObject * Dispatch(TGFrame *frame, UInt_t keysym, UInt_t mask)
PyObject * DispatchVA1(const char *clname, void *obj, const char *format,...)
PyObject * Dispatch(TGLVEntry *entry, Int_t btn, Int_t x, Int_t y)
PyObject * Dispatch(TGFrame *frame)
PyObject * Dispatch(TGShutterItem *item)
PyObject * Dispatch(Long_t param)
PyObject * Dispatch(const char *text, Int_t len)
PyObject * Dispatch(TGLViewerBase *viewer)
PyObject * Dispatch(TGListTreeItem *entry, UInt_t keysym, UInt_t mask)
PyObject * Dispatch(TGLPhysicalShape *shape)
PyObject * Dispatch(Int_t param)
PyObject * Dispatch(TList *objs)
PyObject * Dispatch(const char *param)
PyObject * Dispatch(Bool_t param)
PyObject * Dispatch(Int_t x, Int_t y)
TPyDispatcher(PyObject *callable)
PyObject * Dispatch(TGVFileSplitter *frame)
~TPyDispatcher() override
Destructor. Reference counting for the held python object is in effect.
PyObject * Dispatch(ULong_t param)
PyObject * Dispatch(TObject *obj, UInt_t state)
PyObject * Dispatch(char *param)
PyObject * Dispatch(TObject *obj, UInt_t button, UInt_t state)
PyObject * Dispatch(TGFrame *frame, Int_t btn, Int_t x, Int_t y)
PyObject * Dispatch(TObject *obj, Bool_t check)
PyObject * Dispatch()
PyObject * Dispatch(TGListTreeItem *entry)
PyObject * Dispatch(Double_t param)
PyObject * Dispatch(Long64_t param)
PyObject * Dispatch(TGLVEntry *entry, Int_t btn)
PyObject * Dispatch(TObject *obj)
PyObject * Dispatch(Event_t *event)
PyObject * Dispatch(TEveTrack *et)
PyObject * Dispatch(TEveDigitSet *qs, Int_t idx)
PyObject * Dispatch(TGListTreeItem *entry, UInt_t mask)
PyObject * Dispatch(TGListTreeItem *entry, Int_t btn, Int_t x, Int_t y)
PyObject * Dispatch(Event_t *event, ULong_t wid)
PyObject * Dispatch(TGFrame *frame, Int_t btn)
PyObject * Dispatch(TEveWindow *window)
PyObject * fCallable
PyObject * Dispatch(TVirtualPad *pad)
PyObject * Dispatch(TSocket *sock)
PyObject * DispatchVA(const char *format=0,...)
The Command design pattern is based on the idea, that all editing in an application is done by creati...
Definition TQCommand.h:27
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:174