iRoCS Toolbox  1.1.0
AbstractControlElement.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * This file belongs to the iRoCS Toolbox.
4  *
5  * Copyright (C) 2015 Thorsten Falk
6  *
7  * Image Analysis Lab, University of Freiburg, Germany
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  **************************************************************************/
24 
25 /*======================================================================*/
32 /*======================================================================*/
33 
34 #ifndef ABSTRACTCONTROLELEMENT_HH
35 #define ABSTRACTCONTROLELEMENT_HH
36 
37 #ifdef HAVE_CONFIG_H
38 #include <config.hh>
39 #endif
40 
41 #include <QtGui/QWidget>
42 
43 #include <string>
44 
45 class QHBoxLayout;
46 class QLabel;
47 class QCheckBox;
48 
49 class AbstractControlElement : public QWidget
50 {
51 
52  Q_OBJECT
53 
54 public:
55 
57  const QString& label, QWidget* parent = 0);
58  virtual ~AbstractControlElement();
59 
60  void setSwitchable(const bool switchable);
61  bool switchable() const;
62 
63  void setActive(const bool active);
64  bool isActive() const;
65 
66  QString label() const;
67  void setLabel(const QString& label);
68 
69  virtual std::string toStdString() const = 0;
70 
71  QWidget *labelWidget();
72  QWidget *controlWidget();
73 
74 signals:
75 
76  void activationStateChanged(bool);
77  void valueChanged();
78 
79 public slots:
80 
81  virtual void setValue(const std::string& value) = 0;
82 
83 protected:
84 
85  QHBoxLayout *p_labelLayout;
86  QHBoxLayout *p_controlLayout;
87 
88  QCheckBox* p_switch;
89  QLabel* p_label;
90 
91 private:
92 
93  QWidget *p_labelWidget;
94  QWidget *p_controlWidget;
95 
96 };
97 
98 #endif
AbstractControlElement(const QString &label, QWidget *parent=0)
virtual void setValue(const std::string &value)=0
virtual ~AbstractControlElement()
QWidget * controlWidget()
bool switchable() const
void setActive(const bool active)
void activationStateChanged(bool)
QString label() const
void setSwitchable(const bool switchable)
void setLabel(const QString &label)
virtual std::string toStdString() const =0