Debian Codegraph @

wayland/qtwayland-dev/5.15.1/QtWaylandClient/private/qwayland-text-input-unstable-v2.h

raw symbols SCIP
1 // Copyright (C) 2016 The Qt Company Ltd.
2 //
3 // SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5 #ifndef QT_WAYLAND_TEXT_INPUT_UNSTABLE_V2
6 #define QT_WAYLAND_TEXT_INPUT_UNSTABLE_V2
7
8 #include <QtWaylandClient/private/wayland-text-input-unstable-v2-client-protocol.h>
9 #include <QByteArray>
10 #include <QString>
11
12 QT_BEGIN_NAMESPACE
13 QT_WARNING_PUSH
14 QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers")
15
16 #if !defined(Q_WAYLAND_CLIENT_TEXT_INPUT_UNSTABLE_V2_EXPORT)
17 # if defined(QT_SHARED)
18 # define Q_WAYLAND_CLIENT_TEXT_INPUT_UNSTABLE_V2_EXPORT Q_DECL_EXPORT
19 # else
20 # define Q_WAYLAND_CLIENT_TEXT_INPUT_UNSTABLE_V2_EXPORT
21 # endif
22 #endif
23
24 namespace QtWayland {
25 class Q_WAYLAND_CLIENT_TEXT_INPUT_UNSTABLE_V2_EXPORT zwp_text_input_v2
26 {
27 public:
28 zwp_text_input_v2(struct ::wl_registry *registry, int id, int version);
29 zwp_text_input_v2(struct ::zwp_text_input_v2 *object);
30 zwp_text_input_v2();
31
32 virtual ~zwp_text_input_v2();
33
34 void init(struct ::wl_registry *registry, int id, int version);
35 void init(struct ::zwp_text_input_v2 *object);
36
37 struct ::zwp_text_input_v2 *object() { return m_zwp_text_input_v2; }
38 const struct ::zwp_text_input_v2 *object() const { return m_zwp_text_input_v2; }
39
40 bool isInitialized() const;
41
42 static const struct ::wl_interface *interface();
43
44 enum content_hint {
45 content_hint_none = 0x0, // no special behaviour
46 content_hint_auto_completion = 0x1, // suggest word completions
47 content_hint_auto_correction = 0x2, // suggest word corrections
48 content_hint_auto_capitalization = 0x4, // switch to uppercase letters at the start of a sentence
49 content_hint_lowercase = 0x8, // prefer lowercase letters
50 content_hint_uppercase = 0x10, // prefer uppercase letters
51 content_hint_titlecase = 0x20, // prefer casing for titles and headings (can be language dependent)
52 content_hint_hidden_text = 0x40, // characters should be hidden
53 content_hint_sensitive_data = 0x80, // typed text should not be stored
54 content_hint_latin = 0x100, // just latin characters should be entered
55 content_hint_multiline = 0x200 // the text input is multiline
56 };
57
58 enum content_purpose {
59 content_purpose_normal = 0, // default input, allowing all characters
60 content_purpose_alpha = 1, // allow only alphabetic characters
61 content_purpose_digits = 2, // allow only digits
62 content_purpose_number = 3, // input a number (including decimal separator and sign)
63 content_purpose_phone = 4, // input a phone number
64 content_purpose_url = 5, // input an URL
65 content_purpose_email = 6, // input an email address
66 content_purpose_name = 7, // input a name of a person
67 content_purpose_password = 8, // input a password (combine with password or sensitive_data hint)
68 content_purpose_date = 9, // input a date
69 content_purpose_time = 10, // input a time
70 content_purpose_datetime = 11, // input a date and time
71 content_purpose_terminal = 12 // input for a terminal
72 };
73
74 enum update_state {
75 update_state_change = 0, // updated state because it changed
76 update_state_full = 1, // full state after enter or input_method_changed event
77 update_state_reset = 2, // full state after reset
78 update_state_enter = 3 // full state after switching focus to a different widget on client side
79 };
80
81 enum input_panel_visibility {
82 input_panel_visibility_hidden = 0, // the input panel (virtual keyboard) is hidden
83 input_panel_visibility_visible = 1 // the input panel (virtual keyboard) is visible
84 };
85
86 enum preedit_style {
87 preedit_style_default = 0, // default style for composing text
88 preedit_style_none = 1, // composing text should be shown the same as non-composing text
89 preedit_style_active = 2, // composing text might be bold
90 preedit_style_inactive = 3, // composing text might be cursive
91 preedit_style_highlight = 4, // composing text might have a different background color
92 preedit_style_underline = 5, // composing text might be underlined
93 preedit_style_selection = 6, // composing text should be shown the same as selected text
94 preedit_style_incorrect = 7 // composing text might be underlined with a red wavy line
95 };
96
97 enum text_direction {
98 text_direction_auto = 0, // automatic text direction based on text and language
99 text_direction_ltr = 1, // left-to-right
100 text_direction_rtl = 2 // right-to-left
101 };
102
103 void destroy();
104 void enable(struct ::wl_surface *surface);
105 void disable(struct ::wl_surface *surface);
106 void show_input_panel();
107 void hide_input_panel();
108 void set_surrounding_text(const QString &text, int32_t cursor, int32_t anchor);
109 void set_content_type(uint32_t hint, uint32_t purpose);
110 void set_cursor_rectangle(int32_t x, int32_t y, int32_t width, int32_t height);
111 void set_preferred_language(const QString &language);
112 void update_state(uint32_t serial, uint32_t reason);
113
114 protected:
115 virtual void zwp_text_input_v2_enter(uint32_t serial, struct ::wl_surface *surface);
116 virtual void zwp_text_input_v2_leave(uint32_t serial, struct ::wl_surface *surface);
117 virtual void zwp_text_input_v2_input_panel_state(uint32_t state, int32_t x, int32_t y, int32_t width, int32_t height);
118 virtual void zwp_text_input_v2_preedit_string(const QString &text, const QString &commit);
119 virtual void zwp_text_input_v2_preedit_styling(uint32_t index, uint32_t length, uint32_t style);
120 virtual void zwp_text_input_v2_preedit_cursor(int32_t index);
121 virtual void zwp_text_input_v2_commit_string(const QString &text);
122 virtual void zwp_text_input_v2_cursor_position(int32_t index, int32_t anchor);
123 virtual void zwp_text_input_v2_delete_surrounding_text(uint32_t before_length, uint32_t after_length);
124 virtual void zwp_text_input_v2_modifiers_map(wl_array *map);
125 virtual void zwp_text_input_v2_keysym(uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers);
126 virtual void zwp_text_input_v2_language(const QString &language);
127 virtual void zwp_text_input_v2_text_direction(uint32_t direction);
128 virtual void zwp_text_input_v2_configure_surrounding_text(int32_t before_cursor, int32_t after_cursor);
129 virtual void zwp_text_input_v2_input_method_changed(uint32_t serial, uint32_t flags);
130
131 private:
132 void init_listener();
133 static const struct zwp_text_input_v2_listener m_zwp_text_input_v2_listener;
134 static void handle_enter(
135 void *data,
136 struct ::zwp_text_input_v2 *object,
137 uint32_t serial,
138 struct ::wl_surface *surface);
139 static void handle_leave(
140 void *data,
141 struct ::zwp_text_input_v2 *object,
142 uint32_t serial,
143 struct ::wl_surface *surface);
144 static void handle_input_panel_state(
145 void *data,
146 struct ::zwp_text_input_v2 *object,
147 uint32_t state,
148 int32_t x,
149 int32_t y,
150 int32_t width,
151 int32_t height);
152 static void handle_preedit_string(
153 void *data,
154 struct ::zwp_text_input_v2 *object,
155 const char *text,
156 const char *commit);
157 static void handle_preedit_styling(
158 void *data,
159 struct ::zwp_text_input_v2 *object,
160 uint32_t index,
161 uint32_t length,
162 uint32_t style);
163 static void handle_preedit_cursor(
164 void *data,
165 struct ::zwp_text_input_v2 *object,
166 int32_t index);
167 static void handle_commit_string(
168 void *data,
169 struct ::zwp_text_input_v2 *object,
170 const char *text);
171 static void handle_cursor_position(
172 void *data,
173 struct ::zwp_text_input_v2 *object,
174 int32_t index,
175 int32_t anchor);
176 static void handle_delete_surrounding_text(
177 void *data,
178 struct ::zwp_text_input_v2 *object,
179 uint32_t before_length,
180 uint32_t after_length);
181 static void handle_modifiers_map(
182 void *data,
183 struct ::zwp_text_input_v2 *object,
184 wl_array *map);
185 static void handle_keysym(
186 void *data,
187 struct ::zwp_text_input_v2 *object,
188 uint32_t time,
189 uint32_t sym,
190 uint32_t state,
191 uint32_t modifiers);
192 static void handle_language(
193 void *data,
194 struct ::zwp_text_input_v2 *object,
195 const char *language);
196 static void handle_text_direction(
197 void *data,
198 struct ::zwp_text_input_v2 *object,
199 uint32_t direction);
200 static void handle_configure_surrounding_text(
201 void *data,
202 struct ::zwp_text_input_v2 *object,
203 int32_t before_cursor,
204 int32_t after_cursor);
205 static void handle_input_method_changed(
206 void *data,
207 struct ::zwp_text_input_v2 *object,
208 uint32_t serial,
209 uint32_t flags);
210 struct ::zwp_text_input_v2 *m_zwp_text_input_v2;
211 };
212
213 class Q_WAYLAND_CLIENT_TEXT_INPUT_UNSTABLE_V2_EXPORT zwp_text_input_manager_v2
214 {
215 public:
216 zwp_text_input_manager_v2(struct ::wl_registry *registry, int id, int version);
217 zwp_text_input_manager_v2(struct ::zwp_text_input_manager_v2 *object);
218 zwp_text_input_manager_v2();
219
220 virtual ~zwp_text_input_manager_v2();
221
222 void init(struct ::wl_registry *registry, int id, int version);
223 void init(struct ::zwp_text_input_manager_v2 *object);
224
225 struct ::zwp_text_input_manager_v2 *object() { return m_zwp_text_input_manager_v2; }
226 const struct ::zwp_text_input_manager_v2 *object() const { return m_zwp_text_input_manager_v2; }
227
228 bool isInitialized() const;
229
230 static const struct ::wl_interface *interface();
231
232 void destroy();
233 struct ::zwp_text_input_v2 *get_text_input(struct ::wl_seat *seat);
234
235 private:
236 struct ::zwp_text_input_manager_v2 *m_zwp_text_input_manager_v2;
237 };
238 }
239
240 QT_WARNING_POP
241 QT_END_NAMESPACE
242
243 #endif