1 // Copyright (C) 2006-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "EditionContainer.hxx"
23 #include "YacsTrace.hxx"
25 #include "FormContainerDecorator.hxx"
26 #include "QtGuiContext.hxx"
27 #include "guiObservers.hxx"
29 #include "Message.hxx"
36 using namespace YACS::HMI;
37 using namespace YACS::ENGINE;
39 EditionContainer::EditionContainer(Subject* subject, QWidget* parent, const char* name):ItemEdition(subject, parent, name)
41 _wContainer = new FormContainerDecorator(getContainer(),this);
42 _wid->gridLayout1->addWidget(_wContainer);
43 connect(_wContainer, SIGNAL(resourceMousePressed()), this, SLOT(fillContainerPanel()));
44 connect(_wContainer->tb_container, SIGNAL(toggled(bool)), this, SLOT(fillContainerPanel())); // --- to update display of current selection
45 _wContainer->tb_container->toggle();
48 EditionContainer::~EditionContainer()
52 void EditionContainer::update(GuiEvent event, int type, Subject* son)
54 DEBTRACE("EditionContainer::update");
55 ItemEdition::update(event, type, son);
60 _wContainer->setName(son->getName());
68 void EditionContainer::fillContainerPanel()
70 DEBTRACE("EditionContainer::fillContainerPanel");
71 _wContainer->FillPanel(getContainer());
74 void EditionContainer::onApply()
76 DEBTRACE("EditionContainer::onApply");
78 if (!_wContainer->onApply())
81 Message mess(GuiContext::getCurrent()->_lastErrorMessage);
85 _isEdited = _isEdited || edited;
86 ItemEdition::onApply();
89 void EditionContainer::onCancel()
91 DEBTRACE("EditionContainer::onCancel");
92 _wContainer->onCancel();
93 ItemEdition::onCancel();
96 YACS::ENGINE::Container *EditionContainer::getContainer()
98 SubjectContainerBase *scont(dynamic_cast<SubjectContainerBase*>(_subject));
100 return scont->getContainer();