Version: 9.15.0
EditionContainer.cxx
Go to the documentation of this file.
1
// Copyright (C) 2006-2025 CEA, EDF
2
//
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.
7
//
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.
12
//
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
16
//
17
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18
//
19
20
#include "
EditionContainer.hxx
"
21
22
//#define _DEVDEBUG_
23
#include "
YacsTrace.hxx
"
24
25
#include "
FormContainerDecorator.hxx
"
26
#include "
QtGuiContext.hxx
"
27
#include "
guiObservers.hxx
"
28
#include "
Proc.hxx
"
29
#include "
Message.hxx
"
30
31
#include <cassert>
32
33
using namespace
std;
34
35
using namespace
YACS
;
36
using namespace
YACS::HMI
;
37
using namespace
YACS::ENGINE
;
38
39
EditionContainer::EditionContainer(
Subject
* subject,
QWidget
* parent,
const
char
* name):
ItemEdition
(subject, parent, name)
40
{
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();
46
}
47
48
EditionContainer::~EditionContainer
()
49
{
50
}
51
52
void
EditionContainer::update
(
GuiEvent
event,
int
type,
Subject
* son)
53
{
54
DEBTRACE
(
"EditionContainer::update"
);
55
ItemEdition::update
(event, type, son);
56
switch
(event)
57
{
58
case
RENAME
:
59
case
UPDATE
:
60
_wContainer
->
setName
(son->
getName
());
61
fillContainerPanel
();
62
break
;
63
default
:
64
;
65
}
66
}
67
68
void
EditionContainer::fillContainerPanel
()
69
{
70
DEBTRACE
(
"EditionContainer::fillContainerPanel"
);
71
_wContainer
->
FillPanel
(
getContainer
());
72
}
73
74
void
EditionContainer::onApply
()
75
{
76
DEBTRACE
(
"EditionContainer::onApply"
);
77
bool
edited =
true
;
78
if
(!
_wContainer
->
onApply
())
79
{
80
_isEdited
=
true
;
81
Message
mess(
GuiContext::getCurrent
()->_lastErrorMessage);
82
return
;
83
}
84
edited =
false
;
85
_isEdited
=
_isEdited
|| edited;
86
ItemEdition::onApply
();
87
}
88
89
void
EditionContainer::onCancel
()
90
{
91
DEBTRACE
(
"EditionContainer::onCancel"
);
92
_wContainer
->
onCancel
();
93
ItemEdition::onCancel
();
94
}
95
96
YACS::ENGINE::Container
*
EditionContainer::getContainer
()
97
{
98
SubjectContainerBase
*scont(
dynamic_cast<
SubjectContainerBase
*
>
(
_subject
));
99
YASSERT
(scont);
100
return
scont->
getContainer
();
101
}
EditionContainer.hxx
FormContainerDecorator.hxx
Message.hxx
Proc.hxx
QtGuiContext.hxx
YacsTrace.hxx
YASSERT
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
Definition:
YacsTrace.hxx:59
DEBTRACE
#define DEBTRACE(msg)
Definition:
YacsTrace.hxx:31
FormContainerDecorator
Definition:
FormContainerDecorator.hxx:41
FormContainerDecorator::FillPanel
void FillPanel(YACS::ENGINE::Container *container)
Definition:
FormContainerDecorator.cxx:61
FormContainerDecorator::onApply
bool onApply()
Definition:
FormContainerDecorator.cxx:72
FormContainerDecorator::onCancel
void onCancel()
Definition:
FormContainerDecorator.cxx:79
FormContainerDecorator::setName
void setName(const std::string &name)
Definition:
FormContainerDecorator.cxx:130
FormEditItem::_wid
WidEditItem * _wid
Definition:
FormEditItem.hxx:53
QWidget
YACS::ENGINE::Container
Definition:
Container.hxx:42
YACS::HMI::EditionContainer::~EditionContainer
virtual ~EditionContainer()
Definition:
EditionContainer.cxx:48
YACS::HMI::EditionContainer::onCancel
virtual void onCancel()
Definition:
EditionContainer.cxx:89
YACS::HMI::EditionContainer::update
virtual void update(GuiEvent event, int type, Subject *son)
Definition:
EditionContainer.cxx:52
YACS::HMI::EditionContainer::onApply
virtual void onApply()
Definition:
EditionContainer.cxx:74
YACS::HMI::EditionContainer::fillContainerPanel
virtual void fillContainerPanel()
Definition:
EditionContainer.cxx:68
YACS::HMI::EditionContainer::getContainer
YACS::ENGINE::Container * getContainer()
Definition:
EditionContainer.cxx:96
YACS::HMI::EditionContainer::_wContainer
FormContainerDecorator * _wContainer
Definition:
EditionContainer.hxx:53
YACS::HMI::GuiContext::getCurrent
static GuiContext * getCurrent()
Definition:
guiContext.hxx:67
YACS::HMI::ItemEditionBase::_subject
Subject * _subject
Definition:
ItemEdition.hxx:46
YACS::HMI::ItemEdition
Definition:
ItemEdition.hxx:54
YACS::HMI::ItemEdition::update
virtual void update(GuiEvent event, int type, Subject *son)
Definition:
ItemEdition.cxx:298
YACS::HMI::ItemEdition::onApply
virtual void onApply()
Definition:
ItemEdition.cxx:214
YACS::HMI::ItemEdition::_isEdited
bool _isEdited
Definition:
ItemEdition.hxx:75
YACS::HMI::ItemEdition::onCancel
virtual void onCancel()
Definition:
ItemEdition.cxx:235
YACS::HMI::Message
Definition:
Message.hxx:30
YACS::HMI::SubjectContainerBase
Definition:
guiObservers.hxx:417
YACS::HMI::SubjectContainerBase::getContainer
virtual YACS::ENGINE::Container * getContainer() const
Definition:
guiObservers.hxx:425
YACS::HMI::Subject
Definition:
guiObservers.hxx:118
YACS::HMI::Subject::getName
virtual std::string getName()
Definition:
guiObservers.cxx:160
guiObservers.hxx
YACS::ENGINE
Definition:
AbstractPoint.hxx:37
YACS::HMI
Definition:
commands.hxx:37
YACS::HMI::GuiEvent
GuiEvent
Definition:
guiObservers.hxx:83
YACS::HMI::RENAME
@ RENAME
Definition:
guiObservers.hxx:95
YACS::HMI::UPDATE
@ UPDATE
Definition:
guiObservers.hxx:90
YACS
Definition:
AlternateThreadPT.hxx:27
src
genericgui
EditionContainer.cxx
Copyright © 2006-2024 CEA, EDF