libAlgAudio  v1.99-440-g08538e5-dirty
The development library for AlgAudio framework.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UICheckbox.hpp
Go to the documentation of this file.
1 #ifndef UICHECKBOX_HPP
2 #define UICHECKBOX_HPP
3 /*
4 This file is part of AlgAudio.
5 
6 AlgAudio, Copyright (C) 2015 CeTA - Audiovisual Technology Center
7 
8 AlgAudio is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as
10 published by the Free Software Foundation, either version 3 of the
11 License, or (at your option) any later version.
12 
13 AlgAudio is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public License
19 along with AlgAudio. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #include "UIWidget.hpp"
22 #include "Theme.hpp"
23 
24 namespace AlgAudio{
25 
26 class UIHBox;
27 class UILabel;
28 class UIButton;
29 
30 class UICheckbox : public UIWidget{
31 public:
32  static std::shared_ptr<UICheckbox> Create(std::weak_ptr<Window> parent_window, std::string text);
34  void SetText(std::string);
35  void SetActive(bool a);
36  virtual void CustomDraw(DrawContext& c) override;
37  virtual void CustomResize(Size2D s) override;
38  virtual void OnChildRequestedSizeChanged() override;
39  inline bool GetActive() const {return active;}
40 private:
41  UICheckbox(std::weak_ptr<Window> parent_window, std::string text);
42  void Init();
43  void UpdateColors();
44  bool active = false;
45  std::string text;
46  std::shared_ptr<UIHBox> child_box;
47  std::shared_ptr<UIButton> child_button;
48  std::shared_ptr<UILabel> child_label;
49 };
50 
51 } // namespace AlgAudio
52 
53 #endif // UICHECKBOX_HPP
Definition: UIWidget.hpp:65
void SetText(std::string)
Definition: DrawContext.hpp:65
Definition: UICheckbox.hpp:30
static std::shared_ptr< UICheckbox > Create(std::weak_ptr< Window > parent_window, std::string text)
Signal< bool > on_toggled
Definition: UICheckbox.hpp:33
bool GetActive() const
Definition: UICheckbox.hpp:39
Definition: Alertable.hpp:26
virtual void CustomResize(Size2D s) override
void SetActive(bool a)
virtual void OnChildRequestedSizeChanged() override
virtual void CustomDraw(DrawContext &c) override
Definition: Utilities.hpp:40