GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
QGo4Widget.h
Go to the documentation of this file.
1 // $Id: QGo4Widget.h 1508 2015-06-10 10:18:42Z adamczew $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef QGO4WIDGET_H
15 #define QGO4WIDGET_H
16 
17 #include <QWidget>
18 
19 #include <QDragMoveEvent>
20 #include <QCloseEvent>
21 #include <QDropEvent>
22 #include <QDragEnterEvent>
23 #include <QIcon>
24 
25 class TObject;
26 class TClass;
27 class TPad;
28 class TGo4Slot;
29 class TGo4ViewPanel;
30 class TGo4BrowserProxy;
31 class TGo4ServerProxy;
32 class QMenu;
33 class QAction;
34 class QSignalMapper;
35 
36 #ifdef WIN32
37 
38 #ifdef GO4_EXPORT
39 #define GO4_CLASS_EXPORT __declspec(dllexport)
40 #else
41 #define GO4_CLASS_EXPORT __declspec(dllimport)
42 #endif
43 
44 #else
45 
46 #define GO4_CLASS_EXPORT
47 
48 #endif
49 
50 
51 #ifdef WIN32
52 class GO4_CLASS_EXPORT QGo4Widget : public QWidget {
53 #else
54 #include <QtDesigner/QDesignerExportWidget>
55 class QDESIGNER_WIDGET_EXPORT QGo4Widget : public QWidget {
56 #endif
57 
58  Q_OBJECT
59 
60  friend class TGo4MainWindow;
61 
62  public:
63  enum { service_DragEnter = 1,
64  service_DropEvent = 2,
65  service_CreateItem = 3,
66  service_DrawItem = 4,
67  service_EditItem = 5,
68  service_ShowInfo = 6,
69  service_EditInSlot = 7,
70  service_SaveItem = 8,
71  service_UpdateAnalysisItem = 9,
72  service_StatusMessage = 15,
73  service_CreateViewPanel = 17,
74  service_BrowserItemRemote = 18,
75  service_Browser = 19,
76  service_SaveToMemory = 20,
77  service_GetAnalysis = 21,
78  service_AddEditorLink = 22,
79  service_AddDirectLink = 23,
80  service_AddLinkInSlot = 24,
81  service_GetTopSlot = 25,
82  service_AddEditorSlot = 26,
83  service_SetLinkedName = 27,
84  service_GetLinkedName = 28,
85  service_GetLinkedName2 = 29,
86  service_GetLinked0 = 30,
87  service_GetLinked1 = 31,
88  service_GetLinked2 = 32,
89  service_RemoveLink = 33,
90  service_RemoveAllLinks = 34,
91  service_ObjectCreated = 35,
92  service_ConnectPad = 36,
93  service_LastActivePanel = 37,
94  service_WhereItemDrawn = 38,
95  service_UndrawItem = 39,
96  service_General = 40,
97  service_PanelTimer = 41,
98  service_HelpWindow = 42,
99  service_HotStart = 43,
100  panel_Activated = 101,
101  panel_Modified = 102,
102  panel_Updated = 103,
103  panel_ActiveUpdated = 104,
104  panel_PadDeleted = 105,
105  panel_Deleted = 106 };
106 
107  QGo4Widget(QWidget * parent = 0, const char * name = 0, Qt::WindowFlags f = 0 );
108  virtual ~QGo4Widget();
109 
110  virtual bool IsAcceptDrag(const char* itemname, TClass* cl, int kind);
111  virtual void DropItem(const char* itemname, TClass* cl, int kind);
112  virtual void ResetWidget();
113 
114  void ObjectCreatedByWidget(const char* itemname, TClass* cl);
115 
116  void ProcessSignal(const char* linkname, bool assigned, TObject* obj, TGo4Slot* slot);
117 
118  signals:
119  void widgetService(QGo4Widget* editor, int serviceid, const char* str, void* par);
120 
121  public slots:
122  void ResetWidgetSlot();
123  void CloseMDIParentSlot();
124 
125  protected:
126  virtual void closeEvent(QCloseEvent* e);
127  virtual void dragEnterEvent(QDragEnterEvent *e);
128  virtual void dragMoveEvent(QDragMoveEvent* e);
129  virtual void dropEvent(QDropEvent* e);
130 
132  void AddLink(const char* itemname, const char* linkname);
133 
135  void AddLink(TGo4Slot* slot, const char* linkname);
136 
138  TGo4Slot* AddLink(const char* itemname, TGo4Slot* parent);
139 
141  TGo4Slot* GetTopSlot(bool force = false);
142 
144  TGo4Slot* AddSlot(const char* slotname);
145 
147  void SetLinkedName(TGo4Slot* slot, const char* itemname);
148 
150  const char* GetLinkedName(const char* linkname);
151 
153  const char* GetLinkedName(TGo4Slot* slot);
154 
155  TObject* GetLinked(const char* linkname, int updatelevel);
156  void RemoveLink(const char* linkname, bool blockreset = true);
157  void RemoveAllLinks(bool blockreset = true);
158  void RemoveLinksMasked(const char* startedwith = 0, bool blockreset = true);
159 
160  bool BrowserItemRemote(const char* itemname);
162 
163  void StatusMessage(const QString& message);
164 
169  void AskToCreateObject(TClass* cl, int isremote);
170  void ShowItemInfo(const QString& itemname);
171  TGo4ViewPanel* CreateViewPanel(int ndiv = 0);
172  TGo4ViewPanel* DrawItem(const QString& itemname, TGo4ViewPanel* panel = 0, TPad* pad = 0, bool activate = true, int updatelevel = -1);
173  TGo4ViewPanel* WhereItemDrawn(const char* itemname);
174  void HelpWindow(const char* filename, const char* msg = 0);
175  void UndrawItem(const char* itemname);
176  TGo4ViewPanel* LastActivePanel();
177  void EditItem(const QString& itemname);
178  void EditObjectInSlot(TGo4Slot* slot);
179  QString SaveObjectInMemory(const char* foldername, TObject* obj);
180  bool SaveItemToFile(const char* itemname, const char* subfolder = 0);
181  bool UpdateItemInAnalysis(const char* itemname, TObject* obj = 0);
182  void InformThatObjectCreated(const char* itemname, TClass* cl);
183  TGo4ServerProxy* GetAnalysis(const char* itemname = 0);
184  void StartHotstart(const char* filename);
185 
187  void ConnectPad(TPad* pad);
188 
189  void CallServiceFunc(int id, const char* str = 0, void* par = 0);
190  void ServiceCall(const char* name, void* par = 0);
191 
192  virtual void requestedObjectCreated(const char* itemname, TClass* cl);
193  virtual void linkedObjectUpdated(const char* linkname, TObject* obj);
194  virtual void linkedObjectRemoved(const char* linkname);
195  virtual void linkedUpdated(TGo4Slot* slot, TObject* obj);
196  virtual void linkedRemoved(TGo4Slot* slot, TObject* obj);
197 
198  void setCanDestroyWidget(bool on = true) { fCanDestroyWidget = on; }
199 
200  void CallPanelFunc(int id, TPad* pad = 0);
201 
202  void ShootResetWidget();
203  void ShootCloseWidget(bool closeparent = false);
204 
205  bool IsUpdateBlocked() const { return fBlockUpdate; }
206 
207  private:
212 
214 };
215 
216 extern QAction* AddChkAction(QMenu* menu,
217  const QString& text, bool checked,
218  QObject* recv, const char* member);
219 
220 extern QAction* AddIdAction(QMenu* menu, QSignalMapper* map,
221  const QString& text, int id, int enabled = -1, int checked = -1);
222 
223 extern QAction* AddIdAction(QMenu* menu, QSignalMapper* map,
224  const QIcon& icon, const QString& text, int id, int enabled = -1, int checked = -1);
225 
226 QAction* SetIdAction(QSignalMapper* map, int id, int enabled = -1, int checked = -1);
227 
228 
229 #endif
QAction * AddChkAction(QMenu *menu, const QString &text, bool checked, QObject *recv, const char *member)
Definition: QGo4Widget.cpp:407
QAction * AddIdAction(QMenu *menu, QSignalMapper *map, const QString &text, int id, int enabled=-1, int checked=-1)
Definition: QGo4Widget.cpp:419
void StatusMessage(const QString &mess)
bool fBlockUpdate
indicates that reset widget timer is shoot
Definition: QGo4Widget.h:211
void HelpWindow(const char *filename, const char *msg=0)
void setCanDestroyWidget(bool on=true)
Definition: QGo4Widget.h:198
#define GO4_CLASS_EXPORT
Definition: QGo4Widget.h:46
QAction * SetIdAction(QSignalMapper *map, int id, int enabled=-1, int checked=-1)
Definition: QGo4Widget.cpp:435
TGo4BrowserProxy * Browser()
bool fResetWidgetShooted
indicate that widget can be destroyed
Definition: QGo4Widget.h:210
bool fCanDestroyWidget
Definition: QGo4Widget.h:209
bool fWaitsForObjectCreation
Definition: QGo4Widget.h:208
TGo4BrowserProxy * fBrowserProxy
set when automatic reset must be blocked
Definition: QGo4Widget.h:213
virtual void closeEvent(QCloseEvent *ce)
bool IsUpdateBlocked() const
Definition: QGo4Widget.h:205
string msg
Definition: go4init.py:11