sptk2 logo
SPTK Home Page
CCheckButtons.h
1/*
2╔══════════════════════════════════════════════════════════════════════════════╗
3║ SIMPLY POWERFUL TOOLKIT (SPTK) ║
4╟──────────────────────────────────────────────────────────────────────────────╢
5║ copyright © 1999-2022 Alexey Parshin. All rights reserved. ║
6║ email alexeyp@gmail.com ║
7╚══════════════════════════════════════════════════════════════════════════════╝
8┌──────────────────────────────────────────────────────────────────────────────┐
9│ This library is free software; you can redistribute it and/or modify it │
10│ under the terms of the GNU Library General Public License as published by │
11│ the Free Software Foundation; either version 2 of the License, or (at your │
12│ option) any later version. │
13│ │
14│ This library is distributed in the hope that it will be useful, but │
15│ WITHOUT ANY WARRANTY; without even the implied warranty of │
16│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library │
17│ General Public License for more details. │
18│ │
19│ You should have received a copy of the GNU Library General Public License │
20│ along with this library; if not, write to the Free Software Foundation, │
21│ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. │
22│ │
23│ Please report all bugs and problems to alexeyp@gmail.com. │
24└──────────────────────────────────────────────────────────────────────────────┘
25*/
26
27#pragma once
28
29#include <FL/Fl_Check_Button.H>
30#include <sptk5/gui/CLayoutClient.h>
31#include <sptk5/gui/CRadioButtons.h>
32
33namespace sptk {
34
46class SP_EXPORT CCheckButton
47 : public Fl_Check_Button
48 , public CLayoutClient
49{
50
51protected:
55 void draw() override;
56
57public:
64 CCheckButton(const char* label, int layoutSize, CLayoutAlign layoutAlignment)
65 : Fl_Check_Button(0, 0, 10, 10, label)
66 , CLayoutClient(this, layoutSize, layoutAlignment)
67 {
68 }
69
75 int handle(int event) override;
76
83 bool preferredSize(int& w, int& h) override;
84};
85
92class SP_EXPORT CCheckButtons
93 : public CRadioButtons
94{
95 static void checkButtonsCallback(Fl_Widget*, void*);
96
97protected:
98 Fl_Button* createButton(const char* label, int sz = 10,
99 CLayoutAlign layoutAlignment = CLayoutAlign::TOP) override;
100
101public:
108 CCheckButtons(const char* label = nullptr, int layoutSize = 20,
109 CLayoutAlign layoutAlignment = CLayoutAlign::TOP);
110
111#ifdef __COMPATIBILITY_MODE__
120 CCheckButtons(int, int, int, int, const char* = 0);
121#endif
122
126 void getSelections(std::vector<uint64_t>& selection) const;
127
131 void setSelections(const std::vector<uint64_t>& selection);
132
137 Variant data() const override;
138
143 void data(const Variant& v) override;
144
148 CControlKind kind() const override
149 {
151 }
152
156 String className() const override
157 {
158 return "check_buttons";
159 }
160
164 static CLayoutClient* creator(const xdoc::SNode& node);
165};
169} // namespace sptk
The check button.
Definition: CCheckButtons.h:49
CCheckButton(const char *label, int layoutSize, CLayoutAlign layoutAlignment)
Definition: CCheckButtons.h:64
int handle(int event) override
bool preferredSize(int &w, int &h) override
void draw() override
A set of check buttons.
Definition: CCheckButtons.h:94
void data(const Variant &v) override
Fl_Button * createButton(const char *label, int sz=10, CLayoutAlign layoutAlignment=CLayoutAlign::TOP) override
void setSelections(const std::vector< uint64_t > &selection)
Variant data() const override
String className() const override
Definition: CCheckButtons.h:156
CControlKind kind() const override
Definition: CCheckButtons.h:148
static CLayoutClient * creator(const xdoc::SNode &node)
Creates chack buttons group based on the XML node information.
CCheckButtons(const char *label=nullptr, int layoutSize=20, CLayoutAlign layoutAlignment=CLayoutAlign::TOP)
void getSelections(std::vector< uint64_t > &selection) const
Definition: CLayoutClient.h:82
Radio buttons widget.
Definition: CRadioButtons.h:48
Definition: String.h:49
Definition: Variant.h:372
CControlKind
Control kind is the constant to report the internal SPTK RTTI.
Definition: CControl.h:50
CLayoutAlign
Definition: CLayoutClient.h:44
@ TOP
Align to the right.

Fri Oct 14 2022 09:58:31: SPTK 5.4.1