CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkVTKPropertyWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkVTKPropertyWidget_h
22 #define __ctkVTKPropertyWidget_h
23 
24 // Qt includes
25 #include <QWidget>
26 
27 // CTK includes
28 #include "ctkColorPickerButton.h"
29 #include "ctkVTKObject.h"
30 #include "ctkVisualizationVTKWidgetsExport.h"
31 
32 class ctkVTKPropertyWidgetPrivate;
33 class vtkProperty;
34 
36 class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKPropertyWidget
37  : public QWidget
38 {
39  Q_OBJECT;
41  typedef QWidget Superclass;
42 
43  Q_FLAGS(GroupsState)
44 
45 
48  Q_PROPERTY(GroupsState groupsState READ groupsState WRITE setGroupsState )
49 
50 
53  Q_PROPERTY(ctkColorPickerButton::ColorDialogOptions colorDialogOptions READ colorDialogOptions WRITE setColorDialogOptions)
54 
55 public:
56  enum GroupState {
57  RepresentationVisible = 0x00001,
58  RepresentationCollapsed = 0x00002,
59  ColorVisible = 0x00010,
60  ColorCollapsed = 0x00020,
61  LightingVisible = 0x00100,
62  LightingCollapsed = 0x00200,
63  MaterialVisible = 0x01000,
64  MaterialCollapsed = 0x02000,
65  AllVisible = RepresentationVisible | ColorVisible | LightingVisible | MaterialVisible,
66  AllCollapsed = RepresentationCollapsed | ColorCollapsed | LightingCollapsed | MaterialCollapsed
67  };
68  Q_DECLARE_FLAGS(GroupsState, GroupState)
69 
70 
71  ctkVTKPropertyWidget(QWidget* parentWidget);
72 
74  ctkVTKPropertyWidget(vtkProperty* property, QWidget* parentWidget);
76 
77  vtkProperty* property()const;
78 
80  ctkVTKPropertyWidget::GroupsState groupsState()const;
82  void setGroupsState(ctkVTKPropertyWidget::GroupsState state);
83 
85  ctkColorPickerButton::ColorDialogOptions colorDialogOptions()const;
87  void setColorDialogOptions(ctkColorPickerButton::ColorDialogOptions options);
88 
89  virtual int representation()const;
90  virtual double pointSize()const;
91  virtual double lineWidth()const;
92  virtual bool frontfaceCulling()const;
93  virtual bool backfaceCulling()const;
94  virtual QColor color()const;
95  virtual double opacity()const;
96  virtual bool edgeVisibility()const;
97  virtual QColor edgeColor()const;
98  virtual bool lighting()const;
99  virtual int interpolation()const;
100  virtual bool shading()const;
101 
102 public Q_SLOTS:
103  virtual void setProperty(vtkProperty* property);
104 
105  virtual void setRepresentation(int newRepresentation);
106  virtual void setPointSize(double newPointSize);
107  virtual void setLineWidth(double newLineWidth);
108  virtual void setFrontfaceCulling(bool newFrontfaceCulling);
109  virtual void setBackfaceCulling(bool newBackfaceCulling);
110  virtual void setColor(const QColor& newColor);
111  virtual void setOpacity(double newOpacity);
112  virtual void setEdgeVisibility(bool newEdgeVisibility);
113  virtual void setEdgeColor(const QColor& newColor);
114  virtual void setLighting(bool newLighting);
115  virtual void setInterpolation(int newInterpolation);
116  virtual void setShading(bool newShading);
117 
118 protected Q_SLOTS:
119  void updateWidgetFromProperty();
120 
121 protected:
122  QScopedPointer<ctkVTKPropertyWidgetPrivate> d_ptr;
123 
124 private:
125  Q_DECLARE_PRIVATE(ctkVTKPropertyWidget);
126  Q_DISABLE_COPY(ctkVTKPropertyWidget);
127 };
128 
130 
131 #endif
Q_DECLARE_OPERATORS_FOR_FLAGS(ctkVTKDataSetModel::AttributeTypes)
#define QVTK_OBJECT
Define VTK/Qt event/slot connection utility methods. It is a convenient macro that declares and defin...
Definition: ctkVTKObject.h:222