Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYWidget.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
23 #ifndef __TY_WIDGET__
24 #define __TY_WIDGET__
25 
26 #include <QWidget>
27 
28 class QString;
29 class TYElement;
30 
31 #define TY_DECL_METIER_WIDGET(classname) \
32 public: \
33  inline classname* getElement() const \
34  { \
35  return (classname*)_pElement; \
36  }
37 
42 class TYWidget : public QWidget
43 {
44  Q_OBJECT
45 
46  // Methodes
47 public:
52  TYWidget(TYElement* pElement, QWidget* parent = 0, const char* name = 0, Qt::WindowFlags f = QFlag(0));
56  virtual ~TYWidget();
57 
70  int static edit(TYElement* pElement, QWidget* pParent = NULL);
71 
80  static QString getDisplayName(TYElement* pElt);
81 
82  void setElement(TYElement* pElement)
83  {
84  _pElement = pElement;
85  }
86 
87 public slots:
91  virtual void updateContent() = 0;
92 
98  virtual void apply() = 0;
99 
103  virtual void reject() {}
104 
105 signals:
110  void modified();
111 
112 protected:
113  // sm++ donnee membre pour la correction du bug lie a la macro TY_DECL_METIER_WIDGET
115 
116  // booleen permettant de bloquer certains champs (en fonction du type d'objet)
117  bool _locked;
118 };
119 
120 #endif // __TY_WIDGET__
const char * name
classe de l'objet IHM pour un objet metier de type TYElement
Definition: TYWidget.h:43
TYElement * _pElement
Definition: TYWidget.h:114
void setElement(TYElement *pElement)
Definition: TYWidget.h:82
virtual void apply()=0
void modified()
TYWidget(TYElement *pElement, QWidget *parent=0, const char *name=0, Qt::WindowFlags f=QFlag(0))
Definition: TYWidget.cpp:34
virtual ~TYWidget()
Definition: TYWidget.cpp:41
virtual void updateContent()=0
bool _locked
Definition: TYWidget.h:117
static QString getDisplayName(TYElement *pElt)
Definition: TYWidget.cpp:118
virtual void reject()
Definition: TYWidget.h:103
static int edit(TYElement *pElement, QWidget *pParent=NULL)
Definition: TYWidget.cpp:43