acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
text_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/geometry2d/_geometry2d.h"
7//#include "acme_context.h
8#include "acme/prototype/data/property.h"
9#include "acme/prototype/prototype/action_context.h"
11
13{
14
15 ::payload m_payload;
16 ::action_context m_actioncontext;
17
18};
19
20
21namespace data
22{
23
24 class text_property;
25
26 struct text_change
27 {
28 ::data::text_property & m_textproperty;
29 ::data::property_change & m_propertychange;
30 auto & payload() {
31 return m_propertychange.m_payload;
32 }
33 auto & action_context() {
34 return m_propertychange.m_actioncontext;
35 }
36 };
37 using text_will_change = ::function < bool(text_change & textchange) >;
38
39 using text_changed = ::function < void(text_change & textchange) >;
40
42
43 class CLASS_DECL_ACME text_property :
44 public ::data::property
45 {
46
47
48 protected:
49
50
51 ::data::property_will_change m_propertywillchange;
52 ::data::property_changed m_propertychanged;
53
54
55 ::comparable_array < ::data::text_will_change > m_textwillchangea;
56 ::comparable_array < ::data::text_changed > m_textchangeda;
57 //::comparable_array < insert_text > m_inserttexta;
58
59
60 void unhook_callbacks();
61 void hook_callbacks();
62
63
64 public:
65
66
67 text_property(::data::property_container * ppropertycontainer = nullptr, const ::atom & atom = {});
68 text_property(const ::data::property & property);
69 ~text_property();
70 //property * m_ppropertyText;
71
72
73 //text_prophandler(::data::property_container * ppropertycontainer = nullptr, const ::atom & atom = {});
74 //~text_handler();
75
76
77 void set_text_property(const ::data::text_property & textproperty);
78
79
80 //::text_property & text() { return m_textproperty; }
81
82 //virtual void get_text(string & str);
83
84
85 //virtual character_count get_text_length();
86 //virtual void get_text(char_pointer psz, character_count len);
87 //virtual void get_text(string & str, ::collection::index iBeg, ::collection::index iEnd);
88
89
90 //virtual void set_text(const ::scoped_string & scopedstr, const ::action_context & action_context);
91 //virtual void set_text(const ::scoped_string & scopedstr, character_count len, const ::action_context & action_context);
92
93
94
95 //virtual void _001GetSel(character_count & iBeg, character_count & iEnd);
96 //virtual void set_text_selection(character_count iBeg, character_count iEnd, const ::action_context & action_context = ::e_source_user);
97 //virtual void _001SetSelEnd(character_count iSelEnd, const ::action_context & action_context = ::e_source_user);
98
99
100 //virtual void get_selection_text(string & str);
101 //virtual void set_selection_text(const ::scoped_string & scopedstr, const ::action_context & action_context);
102
103
104 //virtual void get_text_selection(character_count &iSelStart, character_count &iSelEnd);
105
106
107 //virtual void MacroBegin();
108 //virtual void MacroEnd();
109
110
111 void insert_text(const ::scoped_string & scopedstr, bool bForceNewStep, const ::action_context & actioncontext);
112
113
114 //string as_string() const override;
115 //virtual string& string_reference();
117
118
119 //virtual bool edit_undo();
120
121
122 //virtual void get_text_composition_area(::i32_rectangle& rectangle);
123
124 ::comparable_array < ::data::text_will_change > & text_will_change();
125 ::comparable_array < ::data::text_changed > & text_changed();
126
127 /*virtual bool on_property_will_change(property_container * pcontainer, const ::atom_array & atoma, const ::payload & payload, const ::action_context & actioncontext);
128 virtual void on_property_changed(property_container * pcontainer, const ::atom_array & atoma, const ::payload & payload, const ::action_context & actioncontext);
129 */
130
131
132
133 bool on_text_will_change(text_change & textchange);
134 void on_text_changed(text_change & textchange);
135
136 //public:
137
138
139 //linked_property m_linkedpropertyCheck;
140 //::function < void(::user::check *) > m_callbackOnCheck;
141 //virtual public ::property_container
142
143
144 /*
145 virtual void get_text(string & str);
146
147
148 virtual character_count get_text_length();
149 virtual void get_text(char_pointer psz, character_count len);
150 virtual void get_text(string & str, ::collection::index iBeg, ::collection::index iEnd);
151
152
153 virtual void set_text(const ::scoped_string & scopedstr, const ::action_context & action_context);
154 virtual void set_text(const ::scoped_string & scopedstr, character_count len, const ::action_context & action_context);
155
156
157
158 virtual void _001GetSel(character_count & iBeg, character_count & iEnd);
159 virtual void set_text_selection(character_count iBeg, character_count iEnd, const ::action_context & action_context = ::e_source_user);
160 virtual void _001SetSelEnd(character_count iSelEnd, const ::action_context & action_context = ::e_source_user);
161
162
163 virtual void get_selection_text(string & str);
164 virtual void set_selection_text(const ::scoped_string & scopedstr, const ::action_context & action_context);
165
166
167 virtual void get_text_selection(character_count &iSelStart, character_count &iSelEnd);
168
169
170 virtual void MacroBegin();
171 virtual void MacroEnd();
172
173
174 virtual void insert_text(const ::scoped_string & scopedstr, bool bForceNewStep, const ::action_context& context);
175
176
177 string as_string() const override;
178 //virtual string& string_reference();
179 //inline string as_string() const { return m_propertyText->get_string(); }
180
181
182 virtual bool edit_undo();
183
184
185 //virtual void get_text_composition_area(::i32_rectangle& rectangle);
186 */
187
188 ::string as_text() const;
189 ::character_count selection_begin() const;
190 ::character_count selection_end() const;
191
192 ::string as_text(character_count iBegin, character_count iEnd) const;
193
194 bool set_selection_text(const ::scoped_string & scopedstrNewSelectionText, const ::action_context & actioncontext);
195
196 bool set_text(const ::scoped_string & scopedstrText, const ::action_context & actioncontext);
197
198 character_count get_size() const;
199
200 character_count get_text_length() const;
201
202 //void get_text(char_pointer psz, character_count len);
203
204
205 ::string get_text() const;
206
207 ::string get_text(character_count iBegin, character_count iEnd) const;
208
209 //void get_text(::string & str, character_count iBeg, character_count iEnd = -1) const;
210
211
212 void set_text(const ::scoped_string & scopedstrText, character_count iLen, const ::action_context & actioncontext);
213
214 text_property & operator = (const payload_action_context & payloadactioncontext);
215
216 void get_selection(character_count & iBegin, character_count & iEnd) const;
217
218
219 // character_count selection_begin() const
220 // {
221 //
222 // ::character_count iBegin;
223 //
224 // ::character_count iEnd;
225 //
226 // get_selection(iBegin, iEnd);
227 //
228 // return iBegin;
229 //
230 // }
231
232
233 // character_count selection_end() const
234 // {
235 //
236 // ::character_count iBegin;
237 //
238 // ::character_count iEnd;
239 //
240 // get_selection(iBegin, iEnd);
241 //
242 // return iEnd;
243 //
244 // }
245
246
247 void set_selection(character_count iBegin, character_count iEnd, const ::action_context & actioncontext);
248
249 /*
250 void set_text_selection(character_count iBeg, character_count iEnd, const ::action_context & action_context)
251 {
252
253 __UNREFERENCED_PARAMETER(iBeg);
254 __UNREFERENCED_PARAMETER(iEnd);
255 __UNREFERENCED_PARAMETER(action_context);
256
257 }
258
259
260 void text::get_text_selection(character_count & iBeg, character_count & iEnd)
261 {
262
263 __UNREFERENCED_PARAMETER(iBeg);
264 __UNREFERENCED_PARAMETER(iEnd);
265
266 }
267 */
268
269 void set_selection_begin(character_count iBegin, const ::action_context & actioncontext);
270
271 void set_selection_end(character_count iEnd, const ::action_context & actioncontext);
272 ::string get_selection_text() const;
273
274 /*
275 void text::MacroBegin()
276 {
277
278 }
279
280
281 void text::MacroEnd()
282 {
283
284 }
285
286
287 void text::insert_text(const ::scoped_string & scopedstr, bool bForceNewStep, const ::action_context& context)
288 {
289
290
291 }
292 */
293 /*
294 string as_string() const
295 {
296
297 return get_property().as_string();
298
299 }
300 */
301 /*
302 string& text::string_reference()
303 {
304
305 return m_linkedpropertyText->string_reference();
306
307 }
308
309
310
311 bool text::edit_undo()
312 {
313
314 return false;
315
316 }
317
318
319 void text::get_text_composition_area(::i32_rectangle& rectangle)
320 {
321
322
323 }
324
325 */
326
327 bool operator == (const text_property & textproperty) const;
328 bool operator == (const text_change & change) const;
329
330
331 };
332
333
334} // namespace data
335
336
337
Definition action_context.h:9
Definition property_container.h:17
Definition text_property.h:45
Definition payload.h:54
Definition _.h:34
Definition aaa_text_handler.h:25
Definition text_property.h:13