neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
radio_button.hpp
Go to the documentation of this file.
1// radio_button.hpp
2/*
3neogfx C++ App/Game Engine
4Copyright (c) 2015, 2020 Leigh Johnston. All Rights Reserved.
5
6This program is free software: you can redistribute it and / or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
23#include "button.hpp"
24
25namespace neogfx
26{
27 extern template class widget<i_radio_button>;
28 extern template class button<i_radio_button>;
29
31 {
33 public:
34 define_event(On, on)
35 define_event(Off, off)
36 private:
37 class disc : public widget<>
38 {
39 public:
40 disc(radio_button& aParent);
41 public:
42 size minimum_size(optional_size const& aAvailableSpace = optional_size{}) const override;
43 size maximum_size(optional_size const& aAvailableSpace = optional_size{}) const override;
44 };
45 public:
46 radio_button(std::string const& aText = std::string());
47 radio_button(i_widget& aParent, std::string const& aText = std::string());
48 radio_button(i_layout& aLayout, std::string const& aText = std::string());
49 protected:
51 public:
52 bool is_on() const override;
53 bool is_off() const override;
54 void set_on() override;
55 public:
56 const i_radio_button* next_button() const override;
57 i_radio_button* next_button() override;
58 bool any_siblings_on() const override;
59 public:
60 neogfx::size_policy size_policy() const override;
61 public:
62 rect element_rect(skin_element aElement) const override;
63 protected:
64 void paint(i_graphics_context& aGc) const override;
65 protected:
66 void mouse_entered(const point& aPosition) override;
67 void mouse_left() override;
68 protected:
69 void handle_clicked() override;
70 protected:
71 bool can_toggle() const override;
72 bool set_checked_state(const std::optional<bool>& aCheckedState) override;
73 private:
74 disc iDisc;
75 };
76}
void mouse_left() override
bool can_toggle() const override
neogfx::size_policy size_policy() const override
void set_on() override
radio_button(std::string const &aText=std::string())
void handle_clicked() override
radio_button(i_layout &aLayout, std::string const &aText=std::string())
radio_button(i_widget &aParent, std::string const &aText=std::string())
rect element_rect(skin_element aElement) const override
bool set_checked_state(const std::optional< bool > &aCheckedState) override
bool is_on() const override
void paint(i_graphics_context &aGc) const override
void mouse_entered(const point &aPosition) override
bool is_off() const override
i_radio_button * next_button() override
const i_radio_button * next_button() const override
neogfx::object_type object_type() const override
bool any_siblings_on() const override
#define meta_object(...)
Definition i_object.hpp:28
#define define_event(name, declName,...)
Definition event.hpp:200