Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYWidget.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2024> <EDF-DTG> <FRANCE>
3  * This file is part of Code_TYMPAN (R).
4  * Code_TYMPAN (R) is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * Code_TYMPAN (R) 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.
11  * See the GNU General Public License for more details.
12  * You should have received a copy of the GNU General Public License along
13  * with Code_TYMPAN (R). If not, see <https://www.gnu.org/licenses/>.
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:36
virtual ~TYWidget()
Definition: TYWidget.cpp:43
virtual void updateContent()=0
bool _locked
Definition: TYWidget.h:117
static QString getDisplayName(TYElement *pElt)
Definition: TYWidget.cpp:125
virtual void reject()
Definition: TYWidget.h:103
static int edit(TYElement *pElement, QWidget *pParent=NULL)
Definition: TYWidget.cpp:45