docs
Loading...
Searching...
No Matches
CAPI_Editor.h
Go to the documentation of this file.
1///
2/// Copyright (C) 2026 Ultralight, Inc. All rights reserved.
3/// A license is required for commercial use. https://ultralig.ht
4///
5/// @file CAPI_Editor.h
6///
7/// Text-editing interface for a View.
8///
9/// `#include <Ultralight/CAPI/CAPI_Editor.h>`
10///
11/// The C editor functions run editing commands and manage composition state for the focused element
12/// in a View.
13///
14/// Standard keyboard shortcuts like Ctrl+C and Ctrl+V run automatically when you dispatch key
15/// events to a View. You use the editor functions to connect native controls like Edit menus and
16/// on-screen keyboards directly to the page, or to relay text from an OS input method.
17///
18/// This example updates native Edit menu items before display and runs the command the user picks:
19///
20/// ```c
21/// static void UpdateEditMenu(void) {
22/// ULEditor editor = ulViewGetEditor(view);
23/// SetMenuItemEnabled("Cut", ulEditorCanExecute(editor, kEditorCommand_Cut));
24/// SetMenuItemEnabled("Copy", ulEditorCanExecute(editor, kEditorCommand_Copy));
25/// SetMenuItemEnabled("Paste", ulEditorCanExecute(editor, kEditorCommand_Paste));
26/// }
27///
28/// static void OnEditMenuCommand(ULEditorCommand command) {
29/// ulEditorExecute(ulViewGetEditor(view), command);
30/// }
31/// ```
32///
33/// ## The Editor Handle
34///
35/// Call ulViewGetEditor() with a ULView handle to obtain its editor. The returned ULEditor is
36/// borrowed (it's never `NULL`), so you don't destroy it yourself. It belongs to the handle you
37/// passed and stays valid until you destroy that handle with ulDestroyView().
38///
39/// ## Input Methods on Hosted Views
40///
41/// When you host a View directly, register the editing callbacks in `<Ultralight/CAPI/CAPI_View.h>`
42/// to coordinate an OS input method with the page:
43///
44/// - **ulViewSetChangeEditableStateCallback() reports when the focused element accepts text.** Turn
45/// the input method on only while both `view_has_focus` and `is_mutable` are `true` in
46/// ULEditableState.
47/// - **ulViewSetUpdateCompositionCallback() signals when to reposition the candidate window.**
48/// Anchor the candidate window to the composition's first character with
49/// ulEditorGetCompositionCharacterBounds().
50/// - **ulViewSetDiscardCompositionCallback() signals when the page drops the active composition.**
51/// Cancel the OS input method without recommitting or inserting the text again.
52///
53/// For the complete input method lifecycle and candidate window placement rules, see
54/// `<Ultralight/Editor.h>`.
55///
56/// When styling composition clauses for ulEditorSetComposition(), zero-initialize each
57/// ULCompositionSegment struct. A zero-initialized ULColor represents an unset color.
58///
59/// This function updates the in-progress composition text and styles the active clause with a thick
60/// underline:
61///
62/// ```c
63/// // Offsets are in UTF-16 code units.
64/// static void OnCompositionUpdate(ULString text, unsigned int text_length,
65/// unsigned int caret) {
66/// ULCompositionSegment clause = {0}; // colors left unset
67/// clause.range.end = text_length;
68/// clause.thick = true;
69///
70/// ULCompositionRange selection = {caret, caret};
71/// ulEditorSetComposition(ulViewGetEditor(view), text, &clause, 1, selection);
72/// }
73/// ```
74///
75/// @note AppCore panel Views already set the editing callbacks to run the window's input method.
76/// Setting an editing callback on a panel's View replaces AppCore's callback and turns off
77/// input method support for that View.
78///
79/// @see `<Ultralight/Editor.h>`, ulViewGetEditor(), ulViewSetChangeEditableStateCallback(),
80/// ULEditableState, ULEditorCommand
81///
82
83#ifndef ULTRALIGHT_CAPI_EDITOR_H
84#define ULTRALIGHT_CAPI_EDITOR_H
85
89
90#ifdef __cplusplus
91extern "C" {
92#endif
93
94/******************************************************************************
95 * Editor
96 *****************************************************************************/
97
98///
99/// The editing commands you can run with ulEditorExecute().
100///
101/// Most commands act on editable text (a text field or an editable region). Copy, SelectAll, and
102/// the selection commands (the AndModifySelection forms, SelectWord, SelectLine, SelectParagraph,
103/// and Unselect) also work on a selection in regular page content.
104///
105/// Every caret motion has an AndModifySelection form that extends the selection instead of moving
106/// the caret (the Shift-key behavior).
107///
108typedef enum {
109 // Clipboard, selection, and history commands (the Edit-menu set).
110 kEditorCommand_Cut = 0, ///< Cut the selection to the clipboard.
111 kEditorCommand_Copy, ///< Copy the selection to the clipboard.
112 kEditorCommand_Paste, ///< Paste the clipboard's contents.
113 kEditorCommand_PasteAsPlainText, ///< Paste the clipboard's text without its formatting.
114 kEditorCommand_SelectAll, ///< Select all the text (or the whole page).
115 kEditorCommand_Undo, ///< Undo the last edit.
116 kEditorCommand_Redo, ///< Redo the last undone edit.
117
118 // Caret motions.
119 kEditorCommand_MoveLeft, ///< Move the caret one character left.
120 kEditorCommand_MoveRight, ///< Move the caret one character right.
121 kEditorCommand_MoveUp, ///< Move the caret one line up.
122 kEditorCommand_MoveDown, ///< Move the caret one line down.
123 kEditorCommand_MoveWordLeft, ///< Move the caret one word left.
124 kEditorCommand_MoveWordRight, ///< Move the caret one word right.
125 kEditorCommand_MoveToBeginningOfLine, ///< Move the caret to the start of the line.
126 kEditorCommand_MoveToEndOfLine, ///< Move the caret to the end of the line.
127 kEditorCommand_MoveToBeginningOfParagraph, ///< Move the caret to the start of the paragraph.
128 kEditorCommand_MoveToEndOfParagraph, ///< Move the caret to the end of the paragraph.
129 kEditorCommand_MoveToBeginningOfDocument, ///< Move the caret to the start of the text.
130 kEditorCommand_MoveToEndOfDocument, ///< Move the caret to the end of the text.
131 kEditorCommand_MovePageUp, ///< Move the caret one page up.
132 kEditorCommand_MovePageDown, ///< Move the caret one page down.
133
134 // Selection-extending forms of each caret motion.
135 kEditorCommand_MoveLeftAndModifySelection, ///< Select one character left.
136 kEditorCommand_MoveRightAndModifySelection, ///< Select one character right.
149
150 // Selection commands.
151 kEditorCommand_SelectWord, ///< Select the word at the caret.
152 kEditorCommand_SelectLine, ///< Select the line at the caret.
153 kEditorCommand_SelectParagraph, ///< Select the paragraph at the caret.
154 kEditorCommand_Unselect, ///< Clear the selection (no caret remains).
155
156 // Deletion commands.
157 kEditorCommand_DeleteBackward, ///< Delete the selection or the previous character.
158 kEditorCommand_DeleteForward, ///< Delete the selection or the next character.
159 kEditorCommand_DeleteWordBackward, ///< Delete the word before the caret.
160 kEditorCommand_DeleteWordForward, ///< Delete the word after the caret.
161 kEditorCommand_DeleteToBeginningOfLine, ///< Delete to the start of the line.
162 kEditorCommand_DeleteToEndOfLine, ///< Delete to the end of the line.
163
164 // Insertion commands.
165 kEditorCommand_InsertNewline, ///< Insert a new paragraph (the Enter key).
166 kEditorCommand_InsertLineBreak, ///< Insert a line break in the paragraph (Shift+Enter).
167 kEditorCommand_InsertTab, ///< Insert a tab.
168 kEditorCommand_InsertBacktab, ///< Insert a backtab (Shift+Tab).
170
171///
172/// Get the editor for a View.
173///
174/// @param view The View.
175///
176/// @return Returns the View's editor (this is never NULL).
177///
178/// @note Don't destroy the returned handle, it is owned by `view` and stays valid until you call
179/// ulDestroyView() on it.
180///
182
183///
184/// Run an editing command.
185///
186/// @param editor The editor.
187///
188/// @param command The command to run.
189///
190/// @return Returns whether the command ran (false whenever ulEditorCanExecute() would return
191/// false).
192///
194
195///
196/// Whether or not a command would do anything right now.
197///
198/// You can use this to grey out items in a native menu.
199///
200/// @param editor The editor.
201///
202/// @param command The command to check.
203///
204/// @return Returns true if ulEditorExecute() would run the command.
205///
207
208///
209/// Insert text at the caret, replacing the selection (the same as typing it).
210///
211/// @param editor The editor.
212///
213/// @param text The text to insert.
214///
215/// @return Returns whether the text was inserted (false when there's no editable text to insert
216/// into).
217///
219
220///
221/// Get the bounds of the caret.
222///
223/// The rect is in viewport CSS pixels (the same space as ulViewFireMouseEvent()). Multiply by
224/// ulViewGetDeviceScale() for device pixels.
225///
226/// @param editor The editor.
227///
228/// @return Returns the caret bounds (an empty rect when there's no caret in editable text).
229///
230/// @note This updates any pending layout first-- query it when you need it (eg, when opening a
231/// menu) rather than every frame.
232///
234
235///
236/// A range of a composition's text, in UTF-16 code units (see ulEditorSetComposition()).
237///
238typedef struct {
239 ///
240 /// The starting offset of the range, in UTF-16 code units.
241 ///
242 unsigned int start;
243
244 ///
245 /// The ending offset of the range (exclusive), in UTF-16 code units.
246 ///
247 unsigned int end;
249
250///
251/// Underline style for part of a composition's text (see ulEditorSetComposition()).
252///
253/// An input method usually reports one segment per clause, with the clause being converted
254/// marked `thick`.
255///
256/// @note Zero-initialize this struct. A zero-initialized ULColor is unset.
257///
258typedef struct {
259 ///
260 /// The range of composition text this segment styles.
261 ///
263
264 ///
265 /// The underline color (unset draws the underline in the text's own color).
266 ///
268
269 ///
270 /// A fill drawn behind the text (unset draws no fill).
271 ///
273
274 ///
275 /// Whether the underline is drawn thick (the convention for the active clause).
276 ///
277 bool thick;
279
280///
281/// Set or update the in-progress text of an input method's composition.
282///
283/// The first call starts a composition and replaces the selection. Later calls replace the
284/// previous in-progress text.
285///
286/// @param editor The editor.
287///
288/// @param text The full in-progress text. Pass an empty string to remove it (the same
289/// as ulEditorCancelComposition()).
290///
291/// @param segments Underline styles for parts of the text (eg, one per clause). Pass NULL to
292/// underline all of it.
293///
294/// @param num_segments The number of entries in `segments`.
295///
296/// @param selection The caret or selection within `text`, in UTF-16 code units.
297///
298/// @return Returns whether the composition was applied (false when there's no editable text).
299///
300/// @note During a composition, the page gets the standard composition events. Every keydown
301/// reports key code 229 (the same as in a browser).
302///
304 const ULCompositionSegment* segments, size_t num_segments,
305 ULCompositionRange selection);
306
307///
308/// Replace the active composition with the input method's final text.
309///
310/// With no active composition, this inserts `text` at the caret.
311///
312/// @param editor The editor.
313///
314/// @param text The final text.
315///
316/// @return Returns whether the text was inserted (false when there's no editable text).
317///
319
320///
321/// Keep the active composition's in-progress text as final text.
322///
323/// Call this when the input method closes without committing or cancelling (eg, focus moves away
324/// mid-composition).
325///
326/// @param editor The editor.
327///
328/// @return Returns whether a composition was finished (false when none was active).
329///
331
332///
333/// Cancel the active composition and remove its text.
334///
335/// @param editor The editor.
336///
337/// @return Returns whether a composition was cancelled (false when none was active).
338///
340
341///
342/// Whether or not a composition is active.
343///
344/// @param editor The editor.
345///
346/// @return Returns true if a composition is active.
347///
349
350///
351/// Get the bounds of the active composition's text, in viewport CSS pixels.
352///
353/// You can use this as the area a candidate window shouldn't cover.
354///
355/// @param editor The editor.
356///
357/// @return Returns the bounds (all-zero when no composition is active).
358///
360
361///
362/// Get the length of the active composition's text, in UTF-16 code units.
363///
364/// @param editor The editor.
365///
366/// @return Returns the length (0 when no composition is active).
367///
369
370///
371/// Get the bounds of one character of the active composition's text, in viewport CSS pixels.
372///
373/// You can use this to place a candidate window. Anchor it on the composition's first character
374/// (index 0) so it doesn't move as the candidates change.
375///
376/// @param editor The editor.
377///
378/// @param index The character's offset within the composition's text, in UTF-16 code units.
379///
380/// @return Returns the character's bounds (all-zero when `index` is out of range or no
381/// composition is active).
382///
384
385///
386/// Get the selection's offsets within the focused element's text.
387///
388/// The offset functions (this, ulEditorGetTextInRange(), ulEditorReplaceTextInRange(), and
389/// ulEditorGetCompositionOffsets()) use UTF-16 code units into the text of the focused text field
390/// or editable region. For `<input>` and `<textarea>`, they match the element's `selectionStart`
391/// and `selectionEnd`.
392///
393/// @param editor The editor.
394///
395/// @param start Set to the selection's start.
396///
397/// @param end Set to the selection's end (the same as `start` for a caret).
398///
399/// @return Returns whether the offsets were set (false when the focused element isn't editable
400/// text, or the selection is outside it).
401///
402ULExport bool ulEditorGetSelectionOffsets(ULEditor editor, unsigned int* start,
403 unsigned int* end);
404
405///
406/// Get part of the focused element's text (see ulEditorGetSelectionOffsets() for the offsets).
407///
408/// Offsets past the end of the text are clamped to it.
409///
410/// @param editor The editor.
411///
412/// @param start The start offset.
413///
414/// @param end The end offset (exclusive).
415///
416/// @return Returns a new string with the text in the range (empty when the focused element isn't
417/// editable text). You must call ulDestroyString() when finished.
418///
419/// @warning This reads password fields too, so treat the result as sensitive.
420///
421ULExport ULString ulEditorGetTextInRange(ULEditor editor, unsigned int start, unsigned int end);
422
423///
424/// Replace part of the focused element's text (see ulEditorGetSelectionOffsets() for the
425/// offsets).
426///
427/// This edits the same way typing does. The edit is one undo step, and the caret ends up after
428/// the new text. You can use this for an input method's replacement ranges (eg, the macOS accent
429/// picker replaces the character it targets).
430///
431/// Offsets past the end of the text are clamped to it.
432///
433/// @param editor The editor.
434///
435/// @param start The start offset.
436///
437/// @param end The end offset (exclusive).
438///
439/// @param text The new text (an empty string deletes the range).
440///
441/// @return Returns whether the text was replaced (false when the focused element isn't editable
442/// text, or `start` is greater than `end`).
443///
444/// @note An active composition is cancelled first, and the offsets apply to the text left after
445/// that.
446///
447ULExport bool ulEditorReplaceTextInRange(ULEditor editor, unsigned int start, unsigned int end,
448 ULString text);
449
450///
451/// Get the active composition's offsets within the focused element's text (see
452/// ulEditorGetSelectionOffsets() for the offsets).
453///
454/// You can use this to report the input method's marked range.
455///
456/// @param editor The editor.
457///
458/// @param start Set to the composition's start.
459///
460/// @param end Set to the composition's end (exclusive).
461///
462/// @return Returns whether the offsets were set (false when no composition is active in the
463/// focused element).
464///
465ULExport bool ulEditorGetCompositionOffsets(ULEditor editor, unsigned int* start,
466 unsigned int* end);
467
468///
469/// The kind of element that holds keyboard focus (see ULEditableState).
470///
471typedef enum {
472 kEditableType_None = 0, ///< No element holds keyboard focus.
473 kEditableType_Text, ///< A single-line text field.
474 kEditableType_Password, ///< A password field.
475 kEditableType_TextArea, ///< A multi-line text area.
476 kEditableType_ContentEditable, ///< An editable (contenteditable) region.
477 kEditableType_Other, ///< A focused element that is not a text-editing target.
479
480///
481/// The focused element's inputmode hint (what kind of virtual keyboard the page asks for).
482///
494
495///
496/// The focused element's enterkeyhint (what label or icon the Enter key should present).
497///
508
509///
510/// The conditions that decide whether an input method should be active.
511///
512/// Reported through the callback you set with ulViewSetChangeEditableStateCallback(). An input
513/// method or on-screen keyboard should be active when both `view_has_focus` and `is_mutable` are
514/// true.
515///
516/// @note This is reported when focus moves, not when the focused element moves or resizes. To
517/// follow the caret, use ulEditorGetCaretBounds().
518///
519typedef struct {
520 ///
521 /// The kind of element that holds keyboard focus.
522 ///
524
525 ///
526 /// Whether or not the focused element accepts typed text (false for a read-only or disabled text
527 /// control, and always false when `type` is kEditableType_None or kEditableType_Other).
528 ///
530
531 ///
532 /// Whether or not the View itself has input focus (see ulViewFocus() and ulViewUnfocus()).
533 ///
535
536 ///
537 /// The focused element's inputmode hint.
538 ///
540
541 ///
542 /// The focused element's enterkeyhint.
543 ///
545
546 ///
547 /// The focused element's bounds in viewport CSS pixels (the same space as
548 /// ulViewFireMouseEvent()). All-zero when no element has focus.
549 ///
552
553#ifdef __cplusplus
554} // extern "C"
555#endif
556
557#endif // ULTRALIGHT_CAPI_EDITOR_H
An RGBA color value in a certain color space (with CSS parsing helpers).
bool ulEditorCancelComposition(ULEditor editor)
Cancel the active composition and remove its text.
bool ulEditorSetComposition(ULEditor editor, ULString text, const ULCompositionSegment *segments, size_t num_segments, ULCompositionRange selection)
Set or update the in-progress text of an input method's composition.
ULString ulEditorGetTextInRange(ULEditor editor, unsigned int start, unsigned int end)
Get part of the focused element's text (see ulEditorGetSelectionOffsets() for the offsets).
bool ulEditorCommitComposition(ULEditor editor, ULString text)
Replace the active composition with the input method's final text.
bool ulEditorExecute(ULEditor editor, ULEditorCommand command)
Run an editing command.
bool ulEditorGetSelectionOffsets(ULEditor editor, unsigned int *start, unsigned int *end)
Get the selection's offsets within the focused element's text.
bool ulEditorGetCompositionOffsets(ULEditor editor, unsigned int *start, unsigned int *end)
Get the active composition's offsets within the focused element's text (see ulEditorGetSelectionOffse...
bool ulEditorReplaceTextInRange(ULEditor editor, unsigned int start, unsigned int end, ULString text)
Replace part of the focused element's text (see ulEditorGetSelectionOffsets() for the offsets).
bool ulEditorHasComposition(ULEditor editor)
Whether or not a composition is active.
unsigned int ulEditorGetCompositionCharacterCount(ULEditor editor)
Get the length of the active composition's text, in UTF-16 code units.
ULRect ulEditorGetCompositionBounds(ULEditor editor)
Get the bounds of the active composition's text, in viewport CSS pixels.
ULEditor ulViewGetEditor(ULView view)
Get the editor for a View.
ULEditableType
The kind of element that holds keyboard focus (see ULEditableState).
Definition CAPI_Editor.h:471
@ kEditableType_Text
A single-line text field.
Definition CAPI_Editor.h:473
@ kEditableType_Other
A focused element that is not a text-editing target.
Definition CAPI_Editor.h:477
@ kEditableType_Password
A password field.
Definition CAPI_Editor.h:474
@ kEditableType_TextArea
A multi-line text area.
Definition CAPI_Editor.h:475
@ kEditableType_None
No element holds keyboard focus.
Definition CAPI_Editor.h:472
@ kEditableType_ContentEditable
An editable (contenteditable) region.
Definition CAPI_Editor.h:476
ULInputMode
The focused element's inputmode hint (what kind of virtual keyboard the page asks for).
Definition CAPI_Editor.h:483
@ kInputMode_Text
Definition CAPI_Editor.h:486
@ kInputMode_Decimal
Definition CAPI_Editor.h:491
@ kInputMode_Email
Definition CAPI_Editor.h:489
@ kInputMode_Url
Definition CAPI_Editor.h:488
@ kInputMode_Unspecified
Definition CAPI_Editor.h:484
@ kInputMode_Numeric
Definition CAPI_Editor.h:490
@ kInputMode_Search
Definition CAPI_Editor.h:492
@ kInputMode_Telephone
Definition CAPI_Editor.h:487
@ kInputMode_None
Definition CAPI_Editor.h:485
ULRect ulEditorGetCompositionCharacterBounds(ULEditor editor, unsigned int index)
Get the bounds of one character of the active composition's text, in viewport CSS pixels.
ULEditorCommand
The editing commands you can run with ulEditorExecute().
Definition CAPI_Editor.h:108
@ kEditorCommand_MoveToBeginningOfParagraph
Move the caret to the start of the paragraph.
Definition CAPI_Editor.h:127
@ kEditorCommand_MoveToEndOfParagraph
Move the caret to the end of the paragraph.
Definition CAPI_Editor.h:128
@ kEditorCommand_DeleteBackward
Delete the selection or the previous character.
Definition CAPI_Editor.h:157
@ kEditorCommand_DeleteWordBackward
Delete the word before the caret.
Definition CAPI_Editor.h:159
@ kEditorCommand_MoveToBeginningOfDocument
Move the caret to the start of the text.
Definition CAPI_Editor.h:129
@ kEditorCommand_MoveToEndOfLine
Move the caret to the end of the line.
Definition CAPI_Editor.h:126
@ kEditorCommand_MoveRight
Move the caret one character right.
Definition CAPI_Editor.h:120
@ kEditorCommand_SelectParagraph
Select the paragraph at the caret.
Definition CAPI_Editor.h:153
@ kEditorCommand_DeleteForward
Delete the selection or the next character.
Definition CAPI_Editor.h:158
@ kEditorCommand_MoveRightAndModifySelection
Select one character right.
Definition CAPI_Editor.h:136
@ kEditorCommand_DeleteToEndOfLine
Delete to the end of the line.
Definition CAPI_Editor.h:162
@ kEditorCommand_MoveToBeginningOfParagraphAndModifySelection
Select to paragraph start.
Definition CAPI_Editor.h:143
@ kEditorCommand_MoveToBeginningOfLineAndModifySelection
Select to line start.
Definition CAPI_Editor.h:141
@ kEditorCommand_Cut
Cut the selection to the clipboard.
Definition CAPI_Editor.h:110
@ kEditorCommand_SelectWord
Select the word at the caret.
Definition CAPI_Editor.h:151
@ kEditorCommand_MoveDown
Move the caret one line down.
Definition CAPI_Editor.h:122
@ kEditorCommand_MoveToEndOfLineAndModifySelection
Select to line end.
Definition CAPI_Editor.h:142
@ kEditorCommand_MoveToEndOfDocumentAndModifySelection
Select to text end.
Definition CAPI_Editor.h:146
@ kEditorCommand_MoveLeftAndModifySelection
Select one character left.
Definition CAPI_Editor.h:135
@ kEditorCommand_DeleteToBeginningOfLine
Delete to the start of the line.
Definition CAPI_Editor.h:161
@ kEditorCommand_InsertTab
Insert a tab.
Definition CAPI_Editor.h:167
@ kEditorCommand_MovePageDown
Move the caret one page down.
Definition CAPI_Editor.h:132
@ kEditorCommand_MovePageUp
Move the caret one page up.
Definition CAPI_Editor.h:131
@ kEditorCommand_MoveToEndOfParagraphAndModifySelection
Select to paragraph end.
Definition CAPI_Editor.h:144
@ kEditorCommand_InsertLineBreak
Insert a line break in the paragraph (Shift+Enter).
Definition CAPI_Editor.h:166
@ kEditorCommand_Unselect
Clear the selection (no caret remains).
Definition CAPI_Editor.h:154
@ kEditorCommand_Copy
Copy the selection to the clipboard.
Definition CAPI_Editor.h:111
@ kEditorCommand_InsertNewline
Insert a new paragraph (the Enter key).
Definition CAPI_Editor.h:165
@ kEditorCommand_MoveUpAndModifySelection
Select one line up.
Definition CAPI_Editor.h:137
@ kEditorCommand_SelectAll
Select all the text (or the whole page).
Definition CAPI_Editor.h:114
@ kEditorCommand_MoveToBeginningOfLine
Move the caret to the start of the line.
Definition CAPI_Editor.h:125
@ kEditorCommand_MoveUp
Move the caret one line up.
Definition CAPI_Editor.h:121
@ kEditorCommand_MoveWordLeft
Move the caret one word left.
Definition CAPI_Editor.h:123
@ kEditorCommand_MoveWordRight
Move the caret one word right.
Definition CAPI_Editor.h:124
@ kEditorCommand_SelectLine
Select the line at the caret.
Definition CAPI_Editor.h:152
@ kEditorCommand_InsertBacktab
Insert a backtab (Shift+Tab).
Definition CAPI_Editor.h:168
@ kEditorCommand_MoveToBeginningOfDocumentAndModifySelection
Select to text start.
Definition CAPI_Editor.h:145
@ kEditorCommand_DeleteWordForward
Delete the word after the caret.
Definition CAPI_Editor.h:160
@ kEditorCommand_Paste
Paste the clipboard's contents.
Definition CAPI_Editor.h:112
@ kEditorCommand_MoveWordRightAndModifySelection
Select one word right.
Definition CAPI_Editor.h:140
@ kEditorCommand_MoveDownAndModifySelection
Select one line down.
Definition CAPI_Editor.h:138
@ kEditorCommand_MoveToEndOfDocument
Move the caret to the end of the text.
Definition CAPI_Editor.h:130
@ kEditorCommand_MovePageUpAndModifySelection
Select one page up.
Definition CAPI_Editor.h:147
@ kEditorCommand_MovePageDownAndModifySelection
Select one page down.
Definition CAPI_Editor.h:148
@ kEditorCommand_MoveWordLeftAndModifySelection
Select one word left.
Definition CAPI_Editor.h:139
@ kEditorCommand_Undo
Undo the last edit.
Definition CAPI_Editor.h:115
@ kEditorCommand_MoveLeft
Move the caret one character left.
Definition CAPI_Editor.h:119
@ kEditorCommand_PasteAsPlainText
Paste the clipboard's text without its formatting.
Definition CAPI_Editor.h:113
@ kEditorCommand_Redo
Redo the last undone edit.
Definition CAPI_Editor.h:116
bool ulEditorInsertText(ULEditor editor, ULString text)
Insert text at the caret, replacing the selection (the same as typing it).
bool ulEditorCanExecute(ULEditor editor, ULEditorCommand command)
Whether or not a command would do anything right now.
ULRect ulEditorGetCaretBounds(ULEditor editor)
Get the bounds of the caret.
bool ulEditorFinishComposition(ULEditor editor)
Keep the active composition's in-progress text as final text.
ULEnterKeyHint
The focused element's enterkeyhint (what label or icon the Enter key should present).
Definition CAPI_Editor.h:498
@ kEnterKeyHint_Enter
Definition CAPI_Editor.h:500
@ kEnterKeyHint_Done
Definition CAPI_Editor.h:501
@ kEnterKeyHint_Send
Definition CAPI_Editor.h:506
@ kEnterKeyHint_Go
Definition CAPI_Editor.h:502
@ kEnterKeyHint_Search
Definition CAPI_Editor.h:505
@ kEnterKeyHint_Unspecified
Definition CAPI_Editor.h:499
@ kEnterKeyHint_Previous
Definition CAPI_Editor.h:504
@ kEnterKeyHint_Next
Definition CAPI_Editor.h:503
Geometry utilities.
Various defines and utility functions for the C API.
struct C_View * ULView
Opaque handle to a View object.
Definition CAPI_Defines.h:87
struct C_String * ULString
Opaque handle to a String object.
Definition CAPI_Defines.h:96
#define ULExport
Definition CAPI_Defines.h:42
struct C_Editor * ULEditor
Opaque handle to a View's Editor object.
Definition CAPI_Defines.h:90
A color value.
Definition CAPI_ColorTypes.h:45
A range of a composition's text, in UTF-16 code units (see ulEditorSetComposition()).
Definition CAPI_Editor.h:238
unsigned int start
The starting offset of the range, in UTF-16 code units.
Definition CAPI_Editor.h:242
unsigned int end
The ending offset of the range (exclusive), in UTF-16 code units.
Definition CAPI_Editor.h:247
Underline style for part of a composition's text (see ulEditorSetComposition()).
Definition CAPI_Editor.h:258
ULCompositionRange range
The range of composition text this segment styles.
Definition CAPI_Editor.h:262
ULColor underline_color
The underline color (unset draws the underline in the text's own color).
Definition CAPI_Editor.h:267
ULColor background_color
A fill drawn behind the text (unset draws no fill).
Definition CAPI_Editor.h:272
bool thick
Whether the underline is drawn thick (the convention for the active clause).
Definition CAPI_Editor.h:277
The conditions that decide whether an input method should be active.
Definition CAPI_Editor.h:519
ULInputMode input_mode
The focused element's inputmode hint.
Definition CAPI_Editor.h:539
ULRect bounds
The focused element's bounds in viewport CSS pixels (the same space as ulViewFireMouseEvent()).
Definition CAPI_Editor.h:550
bool view_has_focus
Whether or not the View itself has input focus (see ulViewFocus() and ulViewUnfocus()).
Definition CAPI_Editor.h:534
bool is_mutable
Whether or not the focused element accepts typed text (false for a read-only or disabled text control...
Definition CAPI_Editor.h:529
ULEditableType type
The kind of element that holds keyboard focus.
Definition CAPI_Editor.h:523
ULEnterKeyHint enter_key_hint
The focused element's enterkeyhint.
Definition CAPI_Editor.h:544
Float rectangle defined by left, top, right, and bottom coordinates.
Definition CAPI_Defines.h:538