guit  0.1
 All Classes Functions Variables Typedefs Enumerations Friends
gstates.hpp
1 //
2 // Mode props and models: show, enable and select
3 // guit GUI Toolkit
4 // Copyright © 2019 Eric Lecolinet. All rights reserved.
5 // http://www.telecom-paristech.fr/~elc
6 //
7 
8 #ifndef Guit_Mode_hpp
9 #define Guit_Mode_hpp
10 #include <gbool.hpp>
11 namespace guit {
12 
14 class GEnable : public GBool {
15 public:
16  GEnable();
17  GEnable(bool value);
18  GEnable(GString const& value);
19  GEnable* clone(bool copy_value) const override;
20 
22  auto operator~() {return GNumPropRef_<GEnable>(*this);}
23 
24  GEnable& operator=(bool value);
25  GEnable& operator=(const GBool&);
26  GEnable& operator=(GString const& value);
27 
28  using GType = GPropType_<GEnable,GBool>;
29  static GType& Type();
30  GType& type() const override {return Type();}
31 
32  void apply(Gadget*, GRender&, Specif) override;
33  void updateGadget(Gadget&) override;
34 };
35 
38 inline GEnable& Enable() {return *new GEnable();}
39 inline GEnable& Enable(bool value) {return *new GEnable(value);}
41 
42 
43 
45 class GShow : public GBool {
46 public:
47  GShow();
48  GShow(bool value);
49  GShow(GString const& value);
50  GShow* clone(bool copy_value) const override;
51 
53  auto operator~() {return GNumPropRef_<GShow>(*this);}
54 
55  GShow& operator=(bool value);
56  GShow& operator=(const GBool& value);
57  GShow& operator=(GString const& value);
58 
59  using GType = GPropType_<GShow,GBool>;
60  static GType& Type();
61  GType& type() const override {return Type();}
62 
63  void apply(Gadget*, GRender&, Specif) override;
64  void updateGadget(Gadget&) override;
65 };
66 
69 inline GShow& Show() {return *new GShow();}
70 inline GShow& Show(bool value) {return *new GShow(value);}
72 
73 
74 
77 class GCheck : public GBool {
78 public:
79  GCheck();
80  GCheck(bool value);
81  GCheck(GString const& value);
82  GCheck* clone(bool copy_value) const override;
83 
85  auto operator~() {return GNumPropRef_<GCheck>(*this);}
86 
87  GCheck& operator=(bool value);
88  GCheck& operator=(GBool const& prop);
89  GCheck& operator=(GString const& value);
90 
91  using GType = GPropType_<GCheck,GBool>;
92  static GType& Type();
93  GType& type() const override {return Type();}
94 
97  void apply(Gadget*, GRender&, Specif) override;
98  void updateGadget(Gadget&) override;
99  void addModes(GadgetModes&) override;
100  void removeModes(GadgetModes&) override;
102 };
103 
106 inline GCheck& Check() {return *new GCheck();}
107 inline GCheck& Check(bool value) {return *new GCheck(value);}
109 
110 }
111 #endif