Version: 8.3.0
YACS::HMI::SceneInPortItem Class Reference

#include <SceneInPortItem.hxx>

Inheritance diagram for YACS::HMI::SceneInPortItem:
Collaboration diagram for YACS::HMI::SceneInPortItem:

Public Member Functions

 SceneInPortItem (QGraphicsScene *scene, SceneItem *parent, QString label, Subject *subject)
 
virtual ~SceneInPortItem ()
 
virtual void popupMenu (QWidget *caller, const QPoint &globalPos)
 
- Public Member Functions inherited from YACS::HMI::SceneDataPortItem
 SceneDataPortItem (QGraphicsScene *scene, SceneItem *parent, QString label, Subject *subject)
 
virtual ~SceneDataPortItem ()
 
virtual void setText (QString label)
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 
virtual void update (GuiEvent event, int type, Subject *son)
 
virtual SceneNodeItemgetParent ()
 
virtual void updateChildItems ()
 
virtual void updateLinks ()
 
virtual void shrinkExpandLink (bool se)
 
- Public Member Functions inherited from YACS::HMI::SceneObserverItem
 SceneObserverItem (QGraphicsScene *scene, SceneItem *parent, QString label, Subject *subject)
 
virtual ~SceneObserverItem ()
 
virtual void select (bool isSelected)
 
virtual void activateSelection (bool selected)
 
virtual SubjectgetSubject ()
 
virtual QString getToolTip ()
 
- Public Member Functions inherited from YACS::HMI::SceneItem
 SceneItem (QGraphicsScene *scene, SceneItem *parent, QString label)
 
virtual ~SceneItem ()
 
virtual QRectF boundingRect () const
 
virtual QRectF childrenBoundingRect () const
 
virtual void setTopLeft (QPointF topLeft)
 
virtual void checkGeometryChange ()
 
void setParent (SceneItem *parent)
 
void setEventPos (QPointF point)
 
virtual void shrinkExpandRecursive (bool isExpanding, bool fromHere, ShrinkMode theShrinkMode)
 
bool isAncestorShrinked ()
 
- Public Member Functions inherited from YACS::HMI::AbstractSceneItem
 AbstractSceneItem (QGraphicsScene *scene, SceneItem *parent, QString label)
 
virtual ~AbstractSceneItem ()
 
int getLevel ()
 
void setLevel ()
 
virtual void reorganize ()
 
virtual QString getLabel ()
 
virtual void addHeader ()
 
virtual void addProgressItem ()
 
virtual qreal getHeaderBottom ()
 
qreal getWidth ()
 
qreal getHeight ()
 
virtual void setWidth (qreal width)
 AbstractSceneItem cannot be resized (only ComposedNodeItem can) More...
 
virtual void setHeight (qreal height)
 AbstractSceneItem cannot be resized (only ComposedNodeItem can) More...
 
virtual void setGeometryOptimization (bool optimize)
 
SceneItemgetParent ()
 
- Public Member Functions inherited from YACS::HMI::GuiObserver
 GuiObserver ()
 
virtual ~GuiObserver ()
 
virtual void incrementSubjects (Subject *subject)
 
virtual void decrementSubjects (Subject *subject)
 
int getNbSubjects ()
 
bool isDestructible ()
 
- Public Member Functions inherited from YACS::HMI::ScenePortItem
 ScenePortItem (QString label)
 
virtual ~ScenePortItem ()
 

Protected Member Functions

void dragEnterEvent (QGraphicsSceneDragDropEvent *event)
 
void dragLeaveEvent (QGraphicsSceneDragDropEvent *event)
 
void dropEvent (QGraphicsSceneDragDropEvent *event)
 
virtual QColor getPenColor ()
 
virtual QColor getBrushColor ()
 

Protected Attributes

bool _dragOver
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::HMI::GuiObserver
static std::string eventName (GuiEvent event)
 
static void setEventMap ()
 
- Public Attributes inherited from YACS::HMI::SceneItem
bool _blocX
 
bool _blocY
 
- Static Protected Attributes inherited from YACS::HMI::GuiObserver
static std::map< int, std::string > _eventNameMap
 

Detailed Description

Definition at line 29 of file SceneInPortItem.hxx.

Constructor & Destructor Documentation

SceneInPortItem::SceneInPortItem ( QGraphicsScene scene,
SceneItem parent,
QString  label,
Subject subject 
)

Definition at line 40 of file SceneInPortItem.cxx.

References _dragOver.

42  : SceneDataPortItem(scene, parent, label, subject)
43 {
44  _dragOver = false;
45  setAcceptDrops(true);
46 }
SceneInPortItem::~SceneInPortItem ( )
virtual

Definition at line 48 of file SceneInPortItem.cxx.

References YACS::HMI::SceneDataPortItem::getParent().

49 {
50  if (SceneNodeItem* parent = getParent())
51  parent->removeInPortFromList(this);
52 }

Member Function Documentation

void SceneInPortItem::dragEnterEvent ( QGraphicsSceneDragDropEvent *  event)
protected

Definition at line 60 of file SceneInPortItem.cxx.

References _dragOver, and YACS::HMI::ItemMimeData::getSubject().

61 {
62  bool accepted = false;
63  const ItemMimeData *myData = dynamic_cast<const ItemMimeData*>(event->mimeData());
64  if (myData && myData->hasFormat("yacs/subjectOutPort"))
65  {
66  Subject *sub = myData->getSubject();
67  if (sub && (dynamic_cast<SubjectOutputPort*>(sub) ||
68  dynamic_cast<SubjectOutputDataStreamPort*>(sub)))
69  {
70  event->setAccepted(true);
71  _dragOver = true;
72  QGraphicsItem::update();
73  return;
74  }
75  }
76  event->setAccepted(accepted);
77 }
void SceneInPortItem::dragLeaveEvent ( QGraphicsSceneDragDropEvent *  event)
protected

Definition at line 79 of file SceneInPortItem.cxx.

References _dragOver.

80 {
81  Q_UNUSED(event);
82  _dragOver = false;
83  QGraphicsItem::update();
84 }
void SceneInPortItem::dropEvent ( QGraphicsSceneDragDropEvent *  event)
protected

Definition at line 86 of file SceneInPortItem.cxx.

References _dragOver, YACS::HMI::QtGuiContext::_mapOfSceneItem, YACS::HMI::ItemMimeData::getControl(), YACS::HMI::QtGuiContext::getQtCurrent(), YACS::HMI::SceneObserverItem::getSubject(), YACS::HMI::ItemMimeData::getSubject(), and YACS::HMI::SubjectDataPort::tryCreateLink().

87 {
88  Q_UNUSED(event);
89  _dragOver = false;
90  QGraphicsItem::update();
91 
92  const ItemMimeData *myData = dynamic_cast<const ItemMimeData*>(event->mimeData());
93  if (!myData) return;
94  if(!myData->hasFormat("yacs/subjectOutPort")) return;
95  Subject *sub = myData->getSubject();
96  if (!sub) return;
98  if (!item) return;
99  SceneOutPortItem* outItem = dynamic_cast<SceneOutPortItem*>(item);
100  if (!outItem) return;
101 
102  Subject *subFrom = outItem->getSubject();
103  Subject *subTo = this->getSubject();
104  SubjectDataPort* from = dynamic_cast<SubjectDataPort*>(subFrom);
105  SubjectDataPort* to = dynamic_cast<SubjectDataPort*>(subTo);
106  if (from && to)
107  if (!SubjectDataPort::tryCreateLink(from, to,myData->getControl()))
108  Message mess;
109 }
QColor SceneInPortItem::getBrushColor ( )
protectedvirtual

Reimplemented from YACS::HMI::SceneObserverItem.

Definition at line 121 of file SceneInPortItem.cxx.

References YACS::HMI::AbstractSceneItem::_brushColor, _dragOver, YACS::HMI::SceneObserverItem::_emphasized, YACS::HMI::AbstractSceneItem::_hiBrushColor, YACS::HMI::SceneItem::_hover, YACS::HMI::Resource::emphasizeBrushColor, and YACS::HMI::SceneItem::hoverColor().

122 {
123  if (_dragOver)
124  return _hiBrushColor;
125 
126  QColor color;
127  color = _brushColor;
128  if (isSelected())
129  color = _hiBrushColor;
130  if (_emphasized)
132  if (_hover)
133  color = hoverColor(color);
134  return color;
135 }
QColor SceneInPortItem::getPenColor ( )
protectedvirtual

Reimplemented from YACS::HMI::SceneItem.

Definition at line 111 of file SceneInPortItem.cxx.

References _dragOver, YACS::HMI::AbstractSceneItem::_hiPenColor, YACS::HMI::AbstractSceneItem::_penColor, and YACS::HMI::Resource::dragOver.

112 {
113  if (_dragOver)
114  return Resource::dragOver;
115  if (isSelected())
116  return _hiPenColor;
117  else
118  return _penColor;
119 }
void SceneInPortItem::popupMenu ( QWidget caller,
const QPoint &  globalPos 
)
virtual

Reimplemented from YACS::HMI::SceneItem.

Definition at line 54 of file SceneInPortItem.cxx.

References gui.GraphViewer::m, and YACS::HMI::InPortMenu::popupMenu().

55 {
56  InPortMenu m;
57  m.popupMenu(caller, globalPos);
58 }

Member Data Documentation

bool YACS::HMI::SceneInPortItem::_dragOver
protected

The documentation for this class was generated from the following files: