acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
check_property.h
1// Creating by camilo with
2// property* system on 2024-06-06 21:20 <3ThomasBorregaardSorensen!!
3#pragma once
4
5
6#include "acme/prototype/data/property.h"
7#include "acme/prototype/data/signal.h"
8
9
10//#include "acme/prototype/prototype/payload.h"
12
13
14namespace data
15{
16 class check_property;
17
19 {
20 ::data::check_property & m_checkproperty;
21 ::data::property_change & m_propertychange;
22 auto & payload() {
23 return m_propertychange.m_payload;
24 }
25 auto & action_context() {
26 return m_propertychange.m_actioncontext;
27 }
28
29 };
30
31 using check_will_change = ::function < bool(check_change &) >;
32
33 using check_changed = ::function < void(check_change &) >;
34
35 //template < enum_id t_eid = (enum_id) id_check>
36 class CLASS_DECL_ACME check_property :
37 public ::data::property
38 {
39 protected:
40
41
42 ::data::property_will_change m_propertywillchange;
43 ::data::property_changed m_propertychanged;
44 ::data::signal < ::data::check_will_change > m_checkwillchangesignal;
45 ::data::signal < ::data::check_changed > m_checkchangedsignal;
46
47
48 void unhook_callbacks();
49 void hook_callbacks();
50
51 public:
52
53 check_property(::data::property_container * ppropertycontainer = nullptr, const ::atom & atom = {});
54 check_property(const ::data::property & property);
55 ~check_property();
56
57
58
59 // ::e_check get_echeck() const;
60 // virtual bool get_bcheck() const;
61 ::e_check echeck() const;
62
63 bool is_checked() const;
64
65 //bool is_checked() const;
66 bool operator ==(::e_check echeck) const { return this->echeck() == echeck; }
67
68 bool set(::e_check echeck, const ::action_context & actioncontext);
69 // bool toggle_check(const ::action_context & action_context)
70 // {
71 //
72 //
73 // }
74 //
75 //
76 // virtual bool on_check_will_change(::e_check echeck, const action_context & actioncontext);
77 // virtual void on_check_changed(::e_check echeck, const action_context & actioncontext);
78 //
79 // bool on_property_will_change(const ::atom & atom, const ::payload & payload, const ::action_context & context = {}) override;
80 // void on_property_changed(const ::atom & atom, const ::payload & payload, const ::action_context & context = {}) override;
81 //
82 // check_property::check_property(::property_container * ppropertycontainer, const ::atom & atom) :
83 // property_link(ppropertycontainer, atom)
84 // {
85 //
86 // }
87 //
88 //
89 // check_property::check_property(const check_property & checkproperty) :
90 // check_property(checkproperty.m_ppropertycontainer, checkproperty.id())
91 // {
92 //
93 //
94 // }
95 //
96 //
97 //
98 // check_property::~check_property()
99 // {
100 //
101 //
102 // }
103 //
104 //
105 // /* void check::set_check(bool bChecked, const ::action_context & context)
106 // {
107 //
108 // set_check((::enum_check) (bChecked ? ::e_check_checked : ::e_check_unchecked),context);
109 //
110 // }*/
111 //
112 //
113 // ::e_check check_property::get_echeck() const
114 // {
115 //
116 // return this->echeck();
117 //
118 // }
119 //
120 //
121 // bool check_property::get_bcheck() const
122 // {
123 //
124 // return this->bcheck();
125 //
126 // }
127 //
128 //
129 // ::e_check check_property::echeck() const
130 // {
131 //
132 // return get_property().as_echeck();
133 //
134 // }
135 //
136 //
137 // bool check_property::bcheck() const
138 // {
139 //
140 // return this->echeck() != e_check_unchecked;
141 //
142 // }
143 //
144 //
145 // bool check_property::is_checked() const
146 // {
147 //
148 // return this->bcheck();
149 //
150 // }
151 //
152 //
153 // bool check_property::set_check(::e_check echeck, const ::action_context & actioncontext)
154 // {
155 //
156 // return set_property(echeck, actioncontext);
157 //
158 // // if (!m_linkedpropertyCheck)
159 // // {
160 // //
161 // // return;
162 // //
163 // // }
164 // //
165 // // if(echeck != this->get_echeck())
166 // // {
167 // //
168 // // *m_linkedpropertyCheck = echeck;
169 // //
170 // // if (context.is_user_source())
171 // // {
172 // //
173 // // if (m_callbackOnCheck)
174 // // {
175 // //
176 // // m_callbackOnCheck(this);
177 // //
178 // // }
179 // //
180 // // }
181 // //
182 // // m_linkedpropertyCheck.notify_property_changed(context);
183 // //
184 // // }
185 //
186 // }
187 //
188
189 bool toggle(const ::action_context & context);
190
191 //
192 // bool check_property::on_check_will_change(::e_check echeck, const action_context & actioncontext)
193 // {
194 //
195 // return true;
196 //
197 // }
198 //
199 //
200 // void check_property::on_check_changed(::e_check echeck, const action_context & actioncontext)
201 // {
202 //
203 //
204 //
205 // }
206 //
207 //
208 // bool check_property::on_property_will_change(const ::atom & atom, const ::payload & payload, const ::action_context & actioncontext)
209 // {
210 //
211 // if(atom == id())
212 // {
213 //
214 // if(!on_check_will_change(atom, payload.as_echeck(), actioncontext))
215 // {
216 //
217 // return false;
218 //
219 // }
220 //
221 // }
222 //
223 // return true;
224 //
225 // }
226 //
227 //
228 // void check_property::on_property_changed(const ::atom & atom, const ::payload & payload, const ::action_context & actioncontext)
229 // {
230 //
231 // if(atom == id())
232 // {
233 //
234 // on_check_changed(payload.as_echeck(), actioncontext);
235 //
236 // }
237 //
238 // }
239
240 void set_check_property(const ::data::check_property & checkproperty);
241
242 //check_property & check() { return m_checkproperty; }
243
244 /*
245 //virtual bool on_property_will_change(property_container * pcontainer, const ::atom_array & atoma, const ::payload & payload, const ::action_context & actioncontext);
246 //virtual void on_property_changed(property_container * pcontainer, const ::atom_array & atoma, const ::payload & payload, const ::action_context & actioncontext);
247 */
248
249 bool on_check_will_change(::data::check_change & checkchange);
250 void on_check_changed(::data::check_change & checkchange);
251
252 add_signal_function_to_holder < ::data::check_will_change > check_will_change(::object * pobjectFunctionHolder);
253 add_signal_function_to_holder < ::data::check_changed > check_changed(::object * pobjectFunctionHolder);
254
255
256 bool operator == (const ::data::check_property & checkproperty) const;
257 bool operator == (const ::data::check_change & change) const;
258
259
260
261 //bool operator == (const check_property & checkproperty) const;
262
263
264 };
265
266
267} // namespace data
268
269
270
Definition check_property.h:38
Definition property_container.h:17
Definition _template_forward_declaration.h:297
Definition bbb_object.h:11
Definition check_property.h:19
Definition _.h:34