39 #if defined(HX_INTERNAL_CLASS_WARN) 40 #undef HX_INTERNAL_CLASS_WARN 41 #define HX_INTERNAL_CLASS_WARN_HXCONNECTION 44 #pragma warning(disable:4996) 48 #ifndef HX_CONNECTION_H 49 #define HX_CONNECTION_H 51 #include <mclib/McDArray.h> 52 #include <mclib/McVec2i.h> 53 #include <xpand/hxdefs/HxInternalRules.h> 54 #include <hxcore/HxPort.h> 62 class QxConnectionGUIUpdater;
65 typedef int (*SourceCheck)(
void* userData, HxObject* src);
90 HxConnection(HxObject*,
const QString& name,
const QString& label);
99 HxConnection(HxObject*,
const QString& name,
const QString& label,
const McTypeInfo* t);
108 HxConnection(HxEditor* editor,
const QString& name,
const QString& label);
117 HxConnection(HxEditor* editor,
const QString& name,
const QString& label,
const McTypeInfo* t);
136 int validSource(HxObject* src);
146 virtual bool connect(HxObject* src);
153 void enableNotificationOnConnect(
bool flag);
160 bool isNotificationOnConnectEnabled()
const;
168 virtual void disconnect(
bool disconnectedDuringConnection=
false);
175 HxObject* getSource()
const;
186 McTypedObject* getSource(
const McTypeInfo* t)
const;
213 void setOptional(
bool inFlag);
224 HxINTERNAL
bool isEditable()
const;
231 void allowEditing(
bool onOff);
247 void setVisibility(
int cnxVisibility,
bool popupCnxItemVisibility=
true);
255 HxINTERNAL
bool isPopupCnxItemVisible()
const;
266 void setTightness(
bool onOff);
280 void addType(
const McTypeInfo* t);
299 void setSourceCheck(SourceCheck cb,
void* userData);
307 SourceCheck getSourceCheck(
void*& userData);
312 void sourceCheckChanged();
322 virtual int parse(Tcl_Interp* interpreter,
int argc,
char **argv);
329 virtual void saveState(FILE* fp);
336 virtual void getState(QString& state)
const;
349 virtual int setState(
const QString& state);
357 HxINTERNAL
virtual void drawConnection(QPainter* p, std::map<HxObject*, McDArray<std::pair<QPointF, QColor> > >& connectors);
368 HxINTERNAL
virtual int intersect(
int x,
int y);
373 HxINTERNAL
void feedback(QPainter*,
int x,
int y, HxObject*
object);
380 HxINTERNAL
void confirm(HxObject*
object);
387 HxINTERNAL
int mustBeDisplayedBeforeOtherPorts()
const;
394 HxINTERNAL QComboBox* getSourcesListCB()
const;
401 HxINTERNAL QToolButton* getGoToCurrentSourceBtn()
const;
409 HxINTERNAL
void setVisibleGoToCurrentSourceBtn(
bool visible);
417 HxINTERNAL
bool isVisibleGoToCurrentSourceBtn();
424 HxINTERNAL QxConnectionGUIUpdater* getGUIUpdater()
const;
431 virtual void setLabel(
const QString & text);
436 typedef McDArray<const McTypeInfo*> TypeInfoArray;
443 const TypeInfoArray& getValidTypes()
const;
450 virtual void initFrom(HxPort* refPort);
458 m_mustBeDisplayedBeforeOtherPorts = force;
461 HxINTERNAL
virtual void createExternal(HxObject *
object,
int buildWidget);
463 HxINTERNAL
virtual void removeExternal(HxObject *
object);
470 void setAcceptCyclicConnection(
const bool cyclicConnectionAccepted );
475 bool acceptCyclicConnection()
const;
482 HxINTERNAL
void setSaveConnection(
bool canSaveConnection );
489 HxINTERNAL
bool canSaveConnection()
const;
494 bool notificationOnConnectEnabled;
497 TypeInfoArray typeList;
499 SourceCheck sourceCheck;
505 bool m_connectionPopupItemVisibility;
511 unsigned int m_connectionLineVisibility:1;
519 virtual void createWidget(QWidget* w);
522 HxINTERNAL
static int defaultSourceCheck(
void* userData, HxObject* source);
529 bool m_mustBeDisplayedBeforeOtherPorts;
534 QxGuardedPtr<QComboBox> m_sourcesListCB;
539 QxGuardedPtr<QToolButton> m_goToCurrentSourceBtn;
544 bool m_showGoToCurrentSourceBtn;
549 static QIcon* s_goToCurrentSourceIcon;
559 QxConnectionGUIUpdater* m_guiUpdater;
564 virtual void guiCallback();
575 static QString addSurroundingQuotes(
const QString& str );
578 bool m_acceptCyclicConnection;
583 bool m_canSaveConnection;
588 TYPE* hxconnection_cast (
const HxConnection& connection) {
589 return static_cast<TYPE*
> (connection.
getSource(TYPE::getClassTypeId()));
599 #if defined(HX_INTERNAL_CLASS_WARN_HXCONNECTION) 600 #undef HX_INTERNAL_CLASS_WARN_HXCONNECTION 601 #define HX_INTERNAL_CLASS_WARN void setMustBeDisplayedBeforeOtherPorts(bool force=true)
Control if the connection gui must be displayed before the others ports.
Definition: HxConnection.h:457
Port representing inter-object connections.
Definition: HxConnection.h:78
Base class for compute modules.
Definition: HxCompModule.h:77
HxObject * getSource() const
Returns object the port is connected to.