acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
aaa_text_handler.h
1// Created by camilo on 2024-06-10 22:08 <3ThomasBorregaardSorensen!!
2#pragma once
3
4
5//#include "acme/prototype/geometry2d/_geometry2d.h"
6//#include "acme_context.h
7#include "acme/prototype/data/text_property.h"
8#include "acme/prototype/data/property.h"
9#include "acme/prototype/prototype/action_context.h"
11
12//struct payload_action_context
13//{
14//
15//
16// ::payload m_payload;
17// ::action_context m_actioncontext;
18//
19//};
20
21namespace data
22{
23
25{
26 ::data::text_property & m_textproperty;
27 ::data::property_change & m_propertychange;
28 auto & payload() {
29 return m_propertychange.m_payload;
30 }
31 auto & action_context() {
32 return m_propertychange.m_actioncontext;
33 }
34};
35using text_will_change = ::function < bool(text_change & textchange) >;
36
37using text_changed = ::function < void(text_change & textchange) >;
38
40
41
42 class CLASS_DECL_ACME text_handler :
44 {
45 //public:
46
47
48
49
50 protected:
51
52
53 ::data::property_will_change m_propertywillchange;
54 ::data::property_changed m_propertychanged;
55
56
57 ::comparable_array < ::data::text_will_change > m_textwillchangea;
58 ::comparable_array < ::data::text_changed > m_textchangeda;
59 //::comparable_array < insert_text > m_inserttexta;
60
61
62 void unhook_callbacks();
63 void hook_callbacks();
64
65
66 public:
67
68
69 //property * m_ppropertyText;
70
71
72 text_handler(::data::property_container * ppropertycontainer = nullptr, const ::atom & atom = {});
73 ~text_handler();
74
75
76 void set_text_property(const ::data::text_property & textproperty);
77
78
79 //::text_property & text() { return m_textproperty; }
80
81 //virtual void get_text(string & str);
82
83
84 //virtual character_count get_text_length();
85 //virtual void get_text(char_pointer psz, character_count len);
86 //virtual void get_text(string & str, ::collection::index iBeg, ::collection::index iEnd);
87
88
89 //virtual void set_text(const ::scoped_string & scopedstr, const ::action_context & action_context);
90 //virtual void set_text(const ::scoped_string & scopedstr, character_count len, const ::action_context & action_context);
91
92
93
94 //virtual void _001GetSel(character_count & iBeg, character_count & iEnd);
95 //virtual void set_text_selection(character_count iBeg, character_count iEnd, const ::action_context & action_context = ::e_source_user);
96 //virtual void _001SetSelEnd(character_count iSelEnd, const ::action_context & action_context = ::e_source_user);
97
98
99 //virtual void get_selection_text(string & str);
100 //virtual void set_selection_text(const ::scoped_string & scopedstr, const ::action_context & action_context);
101
102
103 //virtual void get_text_selection(character_count &iSelStart, character_count &iSelEnd);
104
105
106 //virtual void MacroBegin();
107 //virtual void MacroEnd();
108
109
110 void insert_text(const ::scoped_string & scopedstr, bool bForceNewStep, const ::action_context & context);
111
112
113 //string as_string() const override;
114 //virtual string& string_reference();
116
117
118 //virtual bool edit_undo();
119
120
121 //virtual void get_text_composition_area(::i32_rectangle& rectangle);
122
123 ::comparable_array < ::data::text_will_change > & text_will_change();
124 ::comparable_array < ::data::text_changed > & text_changed();
125
126 /*virtual bool on_property_will_change(property_container * pcontainer, const ::atom_array & atoma, const ::payload & payload, const ::action_context & actioncontext);
127 virtual void on_property_changed(property_container * pcontainer, const ::atom_array & atoma, const ::payload & payload, const ::action_context & actioncontext);
128 */
129
130
131
132 bool on_text_will_change(text_change & textchange);
133 void on_text_changed(text_change & textchange);
134
135
136 bool operator == (const ::data::text_property & textproperty) const;
137 bool operator == (const text_change & change) const;
138
139
140 };
141
142
143} // namespace user
144
145
Definition property_container.h:17
Definition text_property.h:45
Definition _template_forward_declaration.h:297
Definition _.h:34
Definition aaa_text_handler.h:25