Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef QROOTCANVAS_H
00015 #define QROOTCANVAS_H
00016
00017 #include <QWidget>
00018
00019
00020 #ifdef WIN32
00021
00022 #ifdef GO4_EXPORT
00023 #define GO4_CLASS_EXPORT __declspec(dllexport)
00024 #else
00025 #define GO4_CLASS_EXPORT __declspec(dllimport)
00026 #endif
00027
00028 #else
00029
00030 #define GO4_CLASS_EXPORT
00031
00032 #endif
00033
00034
00035 #ifdef WIN32
00036 #define QDESIGNER_WIDGET_EXPORT GO4_CLASS_EXPORT
00037 #else
00038 #include <QtDesigner/QDesignerExportWidget>
00039 #endif
00040
00041 #include "Rtypes.h"
00042 #include "Gtypes.h"
00043 #include "Buttons.h"
00044 #include "TVirtualX.h"
00045
00046 class TObject;
00047 class TMethod;
00048 class TObjLink;
00049 class TVirtualPad;
00050 class TPad;
00051 class TCanvas;
00052 class TBrowser;
00053 class TContextMenu;
00054 class TControlBar;
00055 class TList;
00056
00057 class QSignalMapper;
00058 class QMenu;
00059 class QAction;
00060 class QTimer;
00061
00069 class QDESIGNER_WIDGET_EXPORT QRootCanvas : public QWidget {
00070
00071 Q_OBJECT
00072
00073 enum { act_Update = 1, act_Resize = 2 };
00074
00075 public:
00076 QRootCanvas(QWidget *parent = 0);
00077 virtual ~QRootCanvas();
00078
00079 TCanvas* getCanvas() { return fCanvas;}
00080 int getRootWid() { return fRootWindowId;}
00081 void setMaskDoubleClick(bool on=true) { fMaskDoubleClick = on; }
00082
00083 bool showEventStatus() const;
00084 void setShowEventStatus(bool s);
00085
00086 signals:
00089 void SelectedPadChanged(TPad*);
00090
00092 void PadClicked(TPad*);
00093
00095 void PadDoubleClicked(TPad*);
00096
00097 void MenuCommandExecuted(TObject*, const char*);
00098
00099 void CanvasStatusEvent(const char*);
00100
00101 void CanvasDropEvent(QDropEvent*, TPad*);
00102
00103 void CanvasLeaveEvent();
00104
00105 void CanvasUpdated();
00106
00107 public slots:
00108
00109 void cd(Int_t subpadnumber=0);
00110 virtual void Browse(TBrowser *b);
00111 void Clear(Option_t *option="");
00112 void Close(Option_t *option="");
00113 virtual void Draw(Option_t *option="");
00114 virtual TObject *DrawClone(Option_t *option="");
00115 virtual TObject *DrawClonePad();
00116 virtual void EditorBar();
00117 void EnterLeave(TPad *prevSelPad, TObject *prevSelObj);
00118 void FeedbackMode(Bool_t set);
00119 void Flush();
00120 void UseCurrentStyle();
00121 void ForceUpdate();
00122 const char *GetDISPLAY();
00123 TContextMenu *GetContextMenu();
00124 Int_t GetDoubleBuffer();
00125 TControlBar *GetEditorBar();
00126 Int_t GetEvent();
00127 Int_t GetEventX();
00128 Int_t GetEventY();
00129 Color_t GetHighLightColor();
00130 TVirtualPad *GetPadSave();
00131 TObject *GetSelected() ;
00132 Option_t *GetSelectedOpt();
00133 TVirtualPad *GetSelectedPad();
00134 Bool_t GetShowEventStatus();
00135 Bool_t GetAutoExec();
00136 Size_t GetXsizeUser();
00137 Size_t GetYsizeUser();
00138 Size_t GetXsizeReal();
00139 Size_t GetYsizeReal();
00140 Int_t GetCanvasID();
00141 Int_t GetWindowTopX();
00142 Int_t GetWindowTopY();
00143 UInt_t GetWindowWidth();
00144 UInt_t GetWindowHeight();
00145 UInt_t GetWw();
00146 UInt_t GetWh();
00147 virtual void GetCanvasPar(Int_t &wtopx, Int_t &wtopy, UInt_t &ww, UInt_t &wh);
00148 virtual void HandleInput(EEventType button, Int_t x, Int_t y);
00149 Bool_t HasMenuBar();
00150 void Iconify();
00151 Bool_t IsBatch();
00152 Bool_t IsRetained();
00153 virtual void ls(Option_t *option="");
00154 void Modified(Bool_t=1);
00155 void MoveOpaque(Int_t set=1);
00156 Bool_t OpaqueMoving() ;
00157 Bool_t OpaqueResizing() ;
00158 virtual void Paint(Option_t *option="");
00159 virtual TPad *Pick(Int_t px, Int_t py, TObjLink *&pickobj);
00160 virtual TPad *Pick(Int_t px, Int_t py, TObject *prevSelObj);
00161 virtual void Resize(Option_t *option="");
00162 void ResizeOpaque(Int_t set=1);
00163 void SaveSource(const char *filename="", Option_t *option="");
00164 virtual void SetCursor(ECursor cursor);
00165 virtual void SetDoubleBuffer(Int_t mode=1);
00166 void SetWindowPosition(Int_t x, Int_t y);
00167 void SetWindowSize(UInt_t ww, UInt_t wh);
00168 void SetCanvasSize(UInt_t ww, UInt_t wh);
00169 void SetHighLightColor(Color_t col);
00170 void SetSelected(TObject *obj);
00171 void SetSelectedPad(TPad *pad);
00172 void Show();
00173 virtual void Size(Float_t xsizeuser=0, Float_t ysizeuser=0);
00174 void SetBatch(Bool_t batch=kTRUE);
00175 void SetRetained(Bool_t retained=kTRUE);
00176 void SetTitle(const char *title="");
00177 virtual void ToggleEventStatus();
00178 virtual void ToggleAutoExec();
00179 virtual void Update();
00180
00181 void executeMenu(int id);
00182 void processRepaintTimer();
00183
00184 protected:
00185
00186 virtual void dropEvent( QDropEvent *Event );
00187 virtual void dragEnterEvent( QDragEnterEvent *e );
00188 virtual void mousePressEvent( QMouseEvent *e );
00189 virtual void mouseReleaseEvent( QMouseEvent *e );
00190 virtual void resizeEvent( QResizeEvent *e );
00191 virtual void paintEvent( QPaintEvent *e );
00192 virtual void mouseDoubleClickEvent(QMouseEvent* e );
00193 virtual void mouseMoveEvent(QMouseEvent *e);
00194 virtual void leaveEvent(QEvent *e);
00195 virtual void closeEvent( QCloseEvent * e);
00196
00197 virtual QPaintEngine * paintEngine () const {return 0;}
00198
00199 void methodDialog(TObject* object, TMethod* method);
00200 QAction* addMenuAction(QMenu* menu, QSignalMapper* map, const QString& text, int id);
00201
00202 void actiavteRepaint(int act);
00203
00204 TCanvas* fCanvas;
00205 Int_t fRootWindowId;
00206 WId fQtWindowId;
00207 QTimer* fRepaintTimer;
00208 int fRepaintMode;
00209 private:
00210 bool fMaskDoubleClick;
00211 double fMousePosX;
00212 double fMousePosY;
00213
00214 TObject* fMenuObj;
00215 TList* fMenuMethods;
00216 bool fxShowEventStatus;
00217 };
00218
00219 #endif
00220
00221
00222
00223
00224
00225