CanvasCV: CanvasCV-doxygen/src/canvascv/widgets/checkboxes.h Source File
CanvasCV  1.0.0
checkboxes.h
1 #ifndef CHECKBOXES_H
2 #define CHECKBOXES_H
3 
4 #include <future>
5 #include "compoundwidget.h"
6 #include "vframe.h"
7 
8 namespace canvascv
9 {
10 
11 class MatWidget;
12 
18 class CheckBoxes : public CompoundWidget
19 {
20 public:
21 
49  static std::shared_ptr<CheckBoxes> create(Layout &layoutVal,
50  std::vector<std::string> checkBoxNames,
52  const cv::Point &pos = cv::Point(0,0));
53 
61  void setChecked(int index, bool checked);
62 
70  bool isChecked(int index) const;
71 
79  std::string getTextAt(int index) const;
80 
82  size_t size() const;
83 
85  void setUserCB(Widget::CBUserSelection cbUserSelection);
86 
87  virtual const char *getType() const;
88 
89  static const char *type;
90 
91 protected:
92  friend class WidgetFactory;
93  template <class T> friend class WidgetFactoryT;
94 
95  CheckBoxes(const cv::Point &pos);
96 
97  void addCheckBox(const std::string &txt);
98 
99  virtual void recalcCompound();
100 
101 private:
102 
103  cv::Mat getCheckBoxNotSelected();
104  cv::Mat getCheckBoxSelected();
105 
106  std::shared_ptr<VFrame> frame;
107  std::vector<MatWidget*> drawings;
108  cv::Mat checkBoxNotSelected;
109  cv::Mat checkBoxSelected;
110  std::vector<bool> selections;
112 };
113 
114 }
115 
120 #endif // CHECKBOXES_H
virtual void recalcCompound()
recalcCompound
void setUserCB(Widget::CBUserSelection cbUserSelection)
cbUserSelection will be invoked per user selection
std::string getTextAt(int index) const
getTextAt
The WidgetFactory class.
Definition: widgetfactory.h:24
size_t size() const
return nunmber of check boxes in group
The CompoundWidget class.
Definition: compoundwidget.h:18
The CheckBoxes class.
Definition: checkboxes.h:18
bool isChecked(int index) const
isChecked
std::function< void(Widget *, int)> CBUserSelection
signature of a callback which gets a user selection
Definition: widget.h:48
This namespace holds all the classes of the CanvasCV library.
Definition: canvas.h:20
The Layout class.
Definition: layout.h:17
void setChecked(int index, bool checked)
setSelection
static std::shared_ptr< CheckBoxes > create(Layout &layoutVal, std::vector< std::string > checkBoxNames, Widget::CBUserSelection cbUserSelection=Widget::CBUserSelection(), const cv::Point &pos=cv::Point(0, 0))
create a check box widget
virtual const char * getType() const
getType is always implemented by derived to return the same static pointer per widget.
The WidgetFactoryT class.
Definition: widgetfactory.h:58