00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef QGO4WIDGET_H
00017 #define QGO4WIDGET_H
00018
00019 #include "qwidget.h"
00020 #include "qwidgetplugin.h"
00021
00022 class TObject;
00023 class TClass;
00024 class TPad;
00025 class TGo4Slot;
00026 class TGo4ViewPanel;
00027 class TGo4BrowserProxy;
00028 class TGo4AnalysisProxy;
00029
00030 class QT_WIDGET_PLUGIN_EXPORT QGo4Widget : public QWidget {
00031 Q_OBJECT
00032
00033 friend class TGo4MainWindow;
00034
00035 public:
00036 enum { service_DragEnter = 1,
00037 service_DropEvent = 2,
00038 service_CreateItem = 3,
00039 service_DrawItem = 4,
00040 service_EditItem = 5,
00041 service_ShowInfo = 6,
00042 service_EditInSlot = 7,
00043 service_SaveItem = 8,
00044 service_UpdateAnalysisItem = 9,
00045 service_StatusMessage = 15,
00046 service_CreateViewPanel = 17,
00047 service_BrowserItemRemote = 18,
00048 service_Browser = 19,
00049 service_SaveToMemory = 20,
00050 service_GetAnalysis = 21,
00051 service_AddEditorLink = 22,
00052 service_AddDirectLink = 23,
00053 service_AddLinkInSlot = 24,
00054 service_GetTopSlot = 25,
00055 service_AddEditorSlot = 26,
00056 service_SetLinkedName = 27,
00057 service_GetLinkedName = 28,
00058 service_GetLinkedName2 = 29,
00059 service_GetLinked0 = 30,
00060 service_GetLinked1 = 31,
00061 service_GetLinked2 = 32,
00062 service_RemoveLink = 33,
00063 service_RemoveAllLinks = 34,
00064 service_ObjectCreated = 35,
00065 service_ConnectPad = 36,
00066 service_LastActivePanel = 37,
00067 service_WhereItemDrawn = 38,
00068 service_UndrawItem = 39,
00069 service_General = 40,
00070 service_PanelTimer = 41,
00071 service_HelpWindow = 42,
00072 panel_Activated = 101,
00073 panel_Modified = 102,
00074 panel_Updated = 103,
00075 panel_ActiveUpdated = 104,
00076 panel_PadDeleted = 105,
00077 panel_Deleted = 106 };
00078
00079
00080
00081 QGo4Widget(QWidget * parent = 0, const char * name = 0, WFlags f = 0 );
00082 virtual ~QGo4Widget();
00083
00084 virtual bool IsAcceptDrag(const char* itemname, TClass* cl, int kind);
00085 virtual void DropItem(const char* itemname, TClass* cl, int kind);
00086 virtual void ResetWidget();
00087
00088 void ObjectCreatedByWidget(const char* itemname, TClass* cl);
00089
00090 void ProcessSignal(const char* linkname, bool assigned, TObject* obj, TGo4Slot* slot);
00091
00092 signals:
00093 void widgetService(QGo4Widget* editor, int serviceid, const char* str, void* par);
00094
00095 public slots:
00096 void ResetWidgetSlot();
00097
00098 protected:
00099 virtual void closeEvent(QCloseEvent* e);
00100 virtual void dragEnterEvent(QDragEnterEvent *e);
00101 virtual void dragMoveEvent(QDragMoveEvent* e);
00102 virtual void dropEvent(QDropEvent* e);
00103
00105 void AddLink(const char* itemname, const char* linkname);
00106
00108 void AddLink(TGo4Slot* slot, const char* linkname);
00109
00111 TGo4Slot* AddLink(const char* itemname, TGo4Slot* parent);
00112
00114 TGo4Slot* GetTopSlot(bool force = false);
00115
00117 TGo4Slot* AddSlot(const char* slotname);
00118
00120 void SetLinkedName(TGo4Slot* slot, const char* itemname);
00121
00123 const char* GetLinkedName(const char* linkname);
00124
00126 const char* GetLinkedName(TGo4Slot* slot);
00127
00128 TObject* GetLinked(const char* linkname, int updatelevel);
00129 void RemoveLink(const char* linkname, bool blockreset = true);
00130 void RemoveAllLinks(bool blockreset = true);
00131 void RemoveLinksMasked(const char* startedwith = 0, bool blockreset = true);
00132
00133 bool BrowserItemRemote(const char* itemname);
00134 TGo4BrowserProxy* Browser();
00135
00136 void StatusMessage(const char* message);
00137
00142 void AskToCreateObject(TClass* cl, int isremote);
00143 void ShowItemInfo(const char* itemname);
00144 TGo4ViewPanel* CreateViewPanel(int ndiv = 0);
00145 TGo4ViewPanel* DrawItem(const char* itemname, TGo4ViewPanel* panel = 0, TPad* pad = 0, bool activate = true, int updatelevel = -1);
00146 TGo4ViewPanel* WhereItemDrawn(const char* itemname);
00147 void HelpWindow(const char* filename, const char* filedir);
00148 void UndrawItem(const char* itemname);
00149 TGo4ViewPanel* LastActivePanel();
00150 void EditItem(const char* itemname);
00151 void EditObjectInSlot(TGo4Slot* slot);
00152 QString SaveObjectInMemory(const char* foldername, TObject* obj);
00153 bool SaveItemToFile(const char* itemname, const char* subfolder = 0);
00154 bool UpdateItemInAnalysis(const char* itemname, TObject* obj = 0);
00155 void InformThatObjectCreated(const char* itemname, TClass* cl);
00156 TGo4AnalysisProxy* GetAnalysis(const char* itemname = 0);
00157
00159 void ConnectPad(TPad* pad);
00160
00161 void CallServiceFunc(int id, const char* str = 0, void* par = 0);
00162 void ServiceCall(const char* name, void* par = 0);
00163
00164 virtual void requestedObjectCreated(const char* itemname, TClass* cl);
00165 virtual void linkedObjectUpdated(const char* linkname, TObject* obj);
00166 virtual void linkedObjectRemoved(const char* linkname);
00167 virtual void linkedUpdated(TGo4Slot* slot, TObject* obj);
00168 virtual void linkedRemoved(TGo4Slot* slot, TObject* obj);
00169
00170 void setCanDestroyWidget(bool on = true) { fCanDestroyWidget = on; }
00171
00172 void CallPanelFunc(int id, TPad* pad = 0);
00173
00174 void ShootResetWidget();
00175 void ShootCloseWidget();
00176
00177 bool IsUpdateBlocked() const { return fBlockUpdate; }
00178
00179 private:
00180 bool fWaitsForObjectCreation;
00181 bool fCanDestroyWidget;
00182 bool fResetWidgetShooted;
00183 bool fBlockUpdate;
00184
00185 TGo4BrowserProxy* fBrowserProxy;
00186 };
00187
00188 #endif
00189
00190