00001 #ifndef SXUIDESIGN_H_INCLUDED 00002 #define SXUIDESIGN_H_INCLUDED 00003 00004 #include <QGraphicsScene> 00005 #include "sxNetwork.h" 00006 00007 class sxUiComponent; 00008 00012 class SX_GUISDKEXPORT sxUiDesign : public QGraphicsScene, public sxNetwork 00013 { 00014 Q_OBJECT 00015 00016 class PrivateData; 00017 PrivateData * d_p; 00018 public: 00019 enum { 00020 ItemConnection, 00021 ItemPort, 00022 ItemComponent 00023 }; 00024 sxUiDesign(const QString& cap = QString(), QObject * parent = 0); 00025 virtual ~sxUiDesign(); 00026 sxInPort * CreateInputPort() const; 00027 sxOutPort * CreateOutputPort() const; 00028 sxConnection * CreateConnection(); 00029 sxComponent * CreateComponent(const QString& lname, 00030 int type, bool loadMode); 00031 void ExecutionStarted(); 00032 void ExecutionFinished(); 00033 void DisplayMessage(const QString& msg, sx::MessageType type = sx::RegularMessage); 00034 bool CloseWindowAfterExecution() const; 00035 bool SaveCustom(QDomElement & root); 00036 bool LoadCustom(const QDomElement & root); 00037 bool PromptRunPropertyDialog(); 00038 void PromptPropertyDialog(); 00039 00040 void SetModified(bool flag = true); 00041 bool IsModified() const; 00042 void NewDesign(bool askBeforeClear = true); 00043 void AddComponent(const QString& libname, int compId); 00044 bool RemoveAllComponents(bool ask = true); 00045 void RemoveComponent(sxUiComponent * comp); 00046 bool LoadDesign(const QString & fname); 00047 bool SaveDesign(); 00048 bool SaveDesignAs(const QString & fname); 00049 bool StartExecution(); 00050 bool StopExecution(); 00051 QRectF BoundingRect() const; 00052 QFont ItemFont(int itemId) const; 00053 void SetItemFont(int itemId, const QFont & f, bool upd = true); 00054 00055 protected: 00056 void CenterViews(qreal x, qreal y); 00057 void AdjustComponents(sxUiComponent * uicomp = 0); 00058 public slots: 00059 void captureToImage(qreal zoom); 00060 00061 signals: 00062 void designModified(bool flag); 00063 void startExecution(); 00064 void finishExecution(); 00065 void displayMessageRequested(const QString& msg, int type); 00066 }; 00067 00068 00069 #endif // SXUIDESIGN_H_INCLUDED