Salome HOME
a784283728e35b3d541da0aed0d1382c2ae3b48f
[modules/yacs.git] / src / genericgui / FormComponent.cxx
1 //  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
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.
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 #include "FormComponent.hxx"
20
21 //#define _DEVDEBUG_
22 #include "YacsTrace.hxx"
23
24 #include <QList>
25
26 using namespace std;
27
28 ComboBox::ComboBox(QWidget *parent)
29   : QComboBox(parent)
30 {
31 }
32
33 ComboBox::~ComboBox()
34 {
35 }
36     
37 void ComboBox::mousePressEvent(QMouseEvent *event)
38 {
39   emit mousePressed();
40   QComboBox::mousePressEvent(event);
41 }
42
43
44 FormComponent::FormComponent(QWidget *parent)
45 {
46   setupUi(this);
47
48   le_name->setReadOnly(true);
49
50   gridLayout3->removeWidget(cb_instance);
51   delete cb_instance;
52   cb_instance = new ComboBox(fr_component);
53   gridLayout3->addWidget(cb_instance, 1, 1, 1, 1);
54
55   gridLayout3->removeWidget(cb_container);
56   delete cb_container;
57   cb_container = new ComboBox(fr_component);
58   gridLayout3->addWidget(cb_container, 2, 1, 1, 1);
59
60   _checked = false;
61   QIcon icon;
62   icon.addFile("icons:icon_down.png");
63   icon.addFile("icons:icon_up.png",
64                 QSize(), QIcon::Normal, QIcon::On);
65   tb_component->setIcon(icon);
66   on_tb_component_toggled(false);
67 //   connect(tb_component, SIGNAL(toggled(bool)),
68 //           this, SLOT(on_tb_component_toggled(bool)));
69 }
70
71 FormComponent::~FormComponent()
72 {
73 }
74
75 void FormComponent::on_tb_component_toggled(bool checked)
76 {
77   //DEBTRACE("FormComponent::on_tb_component_toggled " << checked);
78   _checked = checked;
79   if (_checked) fr_component->show();
80   else fr_component->hide();
81 }