iRoCS Toolbox  1.1.0
ChannelSelectionControlElement.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 #ifndef CHANNELSELECTIONCONTROLELEMENT_HH
26 #define CHANNELSELECTIONCONTROLELEMENT_HH
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.hh>
30 #endif
31 
33 
34 #include "ChannelSpecs.hh"
35 
36 #include <vector>
37 
38 class MultiChannelModel;
39 
40 class QComboBox;
41 
43 {
44 
45  Q_OBJECT
46 
47 public:
48 
50  const QString& label, MultiChannelModel *model,
51  ChannelSpecs::ChannelTypes channelTypes = ChannelSpecs::Any,
52  QWidget* parent = 0);
53 
55 
56  bool contains(std::string const &channelName) const;
57  bool contains(ChannelSpecs *channel) const;
58  int indexOf(ChannelSpecs *channel) const;
59  int nChannels() const;
60 
61  bool isEditable() const;
62  void setEditable(bool editable);
63 
65  ChannelSpecs *channel(int index) const;
66  ChannelSpecs *channel(std::string const &name) const;
67 
68  int value() const;
69  std::string toStdString() const;
70 
71 signals:
72 
73  void activated(int index);
74  void activated(const QString& text);
75  void currentIndexChanged(int index);
76  void currentIndexChanged(const QString& text);
77  void editTextChanged(const QString& text);
78  void editingFinished();
79  void highlighted(int index);
80  void highlighted(const QString& text);
81  void channelListEmpty(bool);
82 
83 public slots:
84 
85  void setValue(ChannelSpecs *channel);
86  void setValue(const int value);
87  void setValue(const std::string& value);
88 
89 private slots:
90 
91  void appendChannel(ChannelSpecs *channel);
92  void removeChannel(ChannelSpecs *channel);
93  void updateChannelNamesAndIcons();
94  void updateChannels();
95 
96 private:
97 
98  ChannelSpecs::ChannelTypes _channelTypes;
99  MultiChannelModel *p_model;
100  QComboBox* p_combobox;
101  std::vector<ChannelSpecs*> _channels;
102 
103 };
104 
105 #endif
void setEditable(bool editable)
ChannelSpecs * selectedChannel() const
int indexOf(ChannelSpecs *channel) const
void currentIndexChanged(int index)
Abstract horizontally layouted control element consisting of a label, the control widget(s) and a che...
void setValue(ChannelSpecs *channel)
ChannelSpecs * channel(int index) const
QString label() const
void editTextChanged(const QString &text)
ChannelSelectionControlElement(const QString &label, MultiChannelModel *model, ChannelSpecs::ChannelTypes channelTypes=ChannelSpecs::Any, QWidget *parent=0)
bool contains(std::string const &channelName) const
std::string toStdString() const
static ChannelTypes const Any
Definition: ChannelSpecs.hh:70