OpenWalnut  1.5.0dev
WPropertyStructWidget.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WPROPERTYSTRUCTWIDGET_H
26 #define WPROPERTYSTRUCTWIDGET_H
27 
28 #include <string>
29 #include <vector>
30 
31 #include <QAction>
32 #include <QCheckBox>
33 #include <QHBoxLayout>
34 
35 #include "core/common/WPropertyGroupBase.h"
36 #include "WPropertyWidget.h"
37 
38 /**
39  * Implements a property widget for arbitrary WPropStruct. It only needs the WPropertyGroupBase interface, so can be used for other props
40  * providing this interface. But this widget assumes that the number of props inside the group is fixed.
41  */
43 {
44  Q_OBJECT
45 public:
46  /**
47  * Constructor. Creates a new widget appropriate for the specified property.
48  *
49  * \param property the property to handle
50  * \param parent the parent widget.
51  * \param propertyGrid the grid used to layout the labels and property widgets
52  */
53  WPropertyStructWidget( WPropertyGroupBase::SPtr property, QGridLayout* propertyGrid, QWidget* parent = 0 );
54 
55  /**
56  * Destructor.
57  */
58  virtual ~WPropertyStructWidget();
59 
60 protected:
61  /**
62  * Called whenever the widget should update.
63  */
64  virtual void update();
65 
66  /**
67  * The struct property
68  */
70 
71  /**
72  * Layout used to position the label and the checkbox
73  */
74  QHBoxLayout m_layout;
75 
76 private:
77  /**
78  * List of widgets of thiss type
79  */
80  typedef std::vector< WPropertyWidget* > WidgetList;
81 
82  /**
83  * list of widgets maintained to forward update calls
84  */
86 };
87 
88 #endif // WPROPERTYSTRUCTWIDGET_H
89 
std::shared_ptr< WPropertyGroupBase > SPtr
Convenience typedef for a std::shared_ptr< WPropertyGroupBase >.
Implements a property widget for arbitrary WPropStruct.
virtual ~WPropertyStructWidget()
Destructor.
virtual void update()
Called whenever the widget should update.
QHBoxLayout m_layout
Layout used to position the label and the checkbox.
WPropertyGroupBase::SPtr m_struct
The struct property.
WidgetList m_widgets
list of widgets maintained to forward update calls
std::vector< WPropertyWidget * > WidgetList
List of widgets of thiss type.
WPropertyStructWidget(WPropertyGroupBase::SPtr property, QGridLayout *propertyGrid, QWidget *parent=0)
Constructor.
Class building the base for all widgets representing properties.