Version: 8.3.0
YACS::HMI::SchemaContainerItem Class Reference

#include <SchemaContainerItem.hxx>

Inheritance diagram for YACS::HMI::SchemaContainerItem:
Collaboration diagram for YACS::HMI::SchemaContainerItem:

Public Member Functions

 SchemaContainerItem (SchemaItem *parent, QString label, Subject *subject)
 
virtual void update (GuiEvent event, int type, Subject *son)
 
void addComponentInstance (Subject *subject)
 
void popupMenu (QWidget *caller, const QPoint &globalPos)
 
- Public Member Functions inherited from YACS::HMI::SchemaItem
 SchemaItem (SchemaItem *parent, QString label, Subject *subject)
 
virtual ~SchemaItem ()
 
virtual void appendChild (SchemaItem *child)
 
virtual void removeChild (SchemaItem *child)
 
virtual void insertChild (int row, SchemaItem *child)
 
virtual SchemaItemchild (int row)
 
virtual int childCount () const
 
virtual int columnCount () const
 
virtual QVariant data (int column, int role) const
 
virtual Qt::ItemFlags flags (const QModelIndex &index)
 
virtual int row () const
 
virtual SchemaItemparent ()
 
virtual SubjectgetSubject ()
 
virtual void select (bool isSelected)
 
virtual void toggleState ()
 
QModelIndex modelIndex (int column=0)
 
virtual ItemMimeDatamimeData (ItemMimeData *mime)
 
virtual bool dropMimeData (const QMimeData *data, Qt::DropAction action)
 
virtual void reparent (SchemaItem *parent)
 
virtual void setCaseValue ()
 used in node derived classes More...
 
bool isEmphasized ()
 
void setEmphasize (bool emphasize)
 
- 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 ()
 

Protected Member Functions

virtual QVariant editionWhatsThis (int column) const
 
- Protected Member Functions inherited from YACS::HMI::SchemaItem
virtual QVariant editionToolTip (int column) const
 
virtual QVariant runToolTip (int column) const
 
virtual QVariant runWhatsThis (int column) const
 
virtual QString getMimeFormat ()
 
virtual void setExecState (int execState)
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::HMI::GuiObserver
static std::string eventName (GuiEvent event)
 
static void setEventMap ()
 
- Protected Attributes inherited from YACS::HMI::SchemaItem
QList< SchemaItem * > _childItems
 
QList< QVariant > _itemData
 
QList< QVariant > _itemDeco
 
QList< QVariant > _itemForeground
 
QList< QVariant > _itemBackground
 
QList< QVariant > _itemCheckState
 
QList< QVariant > _itemToolTip
 
QList< QVariant > _itemWhatsThis
 
QString _label
 
SchemaItem_parentItem
 
Subject_subject
 
int _execState
 
bool _emphasized
 
- Static Protected Attributes inherited from YACS::HMI::GuiObserver
static std::map< int, std::string > _eventNameMap
 

Detailed Description

Definition at line 29 of file SchemaContainerItem.hxx.

Constructor & Destructor Documentation

SchemaContainerItem::SchemaContainerItem ( SchemaItem parent,
QString  label,
Subject subject 
)

Definition at line 35 of file SchemaContainerItem.cxx.

References YACS::HMI::SchemaItem::_itemDeco, DEBTRACE, YACS::HMI::Subject::getName(), and YACS::HMI::YLabel.

36  : SchemaItem(parent, label, subject)
37 {
38  DEBTRACE("SchemaContainerItem::SchemaContainerItem " << subject->getName());
39  SubjectContainer *scont = dynamic_cast<SubjectContainer*>(subject);
40  DEBTRACE(scont);
41  _itemDeco.replace(YLabel, QIcon("icons:container.png"));
42 }

Member Function Documentation

void SchemaContainerItem::addComponentInstance ( Subject subject)

Definition at line 115 of file SchemaContainerItem.cxx.

References YACS::HMI::SchemaItem::childCount(), DEBTRACE, YACS::HMI::Subject::getName(), YACS::HMI::QtGuiContext::getQtCurrent(), YACS::HMI::QtGuiContext::getSchemaModel(), and YACS::HMI::SchemaItem::modelIndex().

Referenced by update().

116 {
117  DEBTRACE("SchemaContainersItem::addComponentInstance");
119  int nbsons = childCount();
120  model->beginInsertRows(modelIndex(), nbsons, nbsons);
121  SchemaComponentItem *item = new SchemaComponentItem(this,
122  subject->getName().c_str(),
123  subject);
124  model->endInsertRows();
125 }
QVariant SchemaContainerItem::editionWhatsThis ( int  column) const
protectedvirtual

Reimplemented from YACS::HMI::SchemaItem.

Definition at line 133 of file SchemaContainerItem.cxx.

134 {
135  return "<p>To edit the container properties, select the container and use the input panel. <a href=\"modification.html#property-page-for-container\">More...</a></p>";
136 }
void SchemaContainerItem::popupMenu ( QWidget caller,
const QPoint &  globalPos 
)
virtual

Reimplemented from YACS::HMI::SchemaItem.

Definition at line 127 of file SchemaContainerItem.cxx.

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

128 {
130  m.popupMenu(caller, globalPos);
131 }
void SchemaContainerItem::update ( GuiEvent  event,
int  type,
Subject son 
)
virtual

Reimplemented from YACS::HMI::SchemaItem.

Definition at line 44 of file SchemaContainerItem.cxx.

References YACS::HMI::QtGuiContext::_mapOfSchemaItem, YACS::HMI::ADDCHILDREF, addComponentInstance(), YACS::HMI::SchemaItem::childCount(), YACS::HMI::CUT, DEBTRACE, YACS::HMI::GuiObserver::eventName(), YACS::HMI::Subject::getName(), YACS::HMI::QtGuiContext::getQtCurrent(), YACS::HMI::SubjectReference::getReference(), YACS::HMI::QtGuiContext::getSchemaModel(), YACS::HMI::SchemaItem::getSubject(), YACS::HMI::SchemaItem::modelIndex(), YACS::HMI::PASTE, gui.CONNECTOR::ref(), YACS::HMI::SchemaItem::removeChild(), YACS::HMI::REMOVECHILDREF, YACS::HMI::SchemaItem::update(), and YASSERT.

Referenced by gui.graph.MyCanvas::customEvent().

45 {
46  DEBTRACE("SchemaContainerItem::update " << eventName(event) << " " << son->getName());
47  //SchemaItem::update(event, type, son);
48  switch (event)
49  {
51  {
52  DEBTRACE("ADDCHILDREF ");
54  SubjectReference *ref = dynamic_cast<SubjectReference*>(son);
55  YASSERT(ref);
56  DEBTRACE("ADDCHILDREF " << ref->getReference()->getName());
58  }
59  break;
60 
62  {
63  DEBTRACE("REMOVECHILDREF on " << getSubject()->getName());
65  SubjectReference *ref = dynamic_cast<SubjectReference*>(son);
66  YASSERT(ref);
67  DEBTRACE("REMOVECHILDREF " << ref->getReference()->getName());
69 
70  int position = toRemove->row();
71  model->beginRemoveRows(modelIndex(), position, position);
72  removeChild(toRemove);
73  model->endRemoveRows();
74  }
75  break;
76 
77  case YACS::HMI::CUT:
78  {
79  DEBTRACE("CUT on " << getSubject()->getName());
81  SubjectReference *ref = dynamic_cast<SubjectReference*>(son);
82  YASSERT(ref);
83  DEBTRACE("CUT " << ref->getReference()->getName());
85 
86  int position = toMove->row();
87  model->beginRemoveRows(modelIndex(), position, position);
88  removeChild(toMove);
89  model->endRemoveRows();
90  }
91  break;
92 
93  case YACS::HMI::PASTE:
94  {
95  DEBTRACE("PASTE on " << getSubject()->getName());
97  SubjectReference *ref = dynamic_cast<SubjectReference*>(son);
98  YASSERT(ref);
99  DEBTRACE("PASTE " << ref->getReference()->getName());
101 
102  int nbsons = childCount();
103  model->beginInsertRows(modelIndex(), nbsons, nbsons);
104  toPaste->reparent(this);
105  model->endInsertRows();
106  }
107  break;
108 
109  default:
110  SchemaItem::update(event, type, son);
111  ;
112  }
113 }

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