FifeGUI 0.3.0
A C++ GUI library designed for games.
radiobutton.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2004 - 2008 Olof Naessén and Per Larsson
3// SPDX-FileCopyrightText: 2013 - 2026 Fifengine contributors
4
5#ifndef INCLUDE_FIFECHAN_WIDGETS_RADIOBUTTON_HPP_
6#define INCLUDE_FIFECHAN_WIDGETS_RADIOBUTTON_HPP_
7
8// Standard library includes
9#include <map>
10#include <string>
11
12// Platform config include
13#include "fifechan/platform.hpp"
14
15// Project headers (subdirs before local)
16#include "fifechan/widgets/checkbox.hpp"
17
18namespace fcn
19{
30 class FIFEGUI_API RadioButton : public fcn::CheckBox
31 {
32 public:
33 RadioButton();
34
43 RadioButton(std::string const & caption, std::string const & group, bool selected = false);
44
45 ~RadioButton() override;
46
47 RadioButton(RadioButton const &) = delete;
48 RadioButton& operator=(RadioButton const &) = delete;
49 RadioButton(RadioButton&&) = delete;
50 RadioButton& operator=(RadioButton&&) = delete;
51
61 void setGroup(std::string const & group);
62
69 std::string const & getGroup() const;
70
71 // Inherited from CheckBox
72
73 void setSelected(bool selected) override; // cppcheck-suppress virtualCallInConstructor
74 void toggleSelected() override;
75
76 protected:
80 std::string mGroup;
81
85 using GroupMap = std::multimap<std::string, RadioButton*>;
86
90 using GroupIterator = GroupMap::iterator;
91
96 };
97} // namespace fcn
98
99#endif // INCLUDE_FIFECHAN_WIDGETS_RADIOBUTTON_HPP_
An implementation of a check box.
Definition checkbox.hpp:33
GroupMap::iterator GroupIterator
Typdef.
std::string const & getGroup() const
Gets the group the radio button belongs to.
void toggleSelected() override
Toggles the check box between being selected and not being selected.
std::multimap< std::string, RadioButton * > GroupMap
Typdef.
static GroupMap mGroupMap
Holds all available radio button groups.
void setSelected(bool selected) override
Sets the check box to be selected or not.
std::string mGroup
Holds the group of the radio button.
void setGroup(std::string const &group)
Sets the group the radio button should belong to.
Used replacement tokens by configure_file():