TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::ITextSystem Class Referenceabstract

Text and icon registration, measurement, rendering and editing. More...

#include <gui_core/text/gui_text_system.h>

Inheritance diagram for tachyon::ITextSystem:

Classes

struct  TextEditUpdate

Public Member Functions

virtual ~ITextSystem ()=default
virtual void SetFontDirectory (std::string_view directory)=0
 Where the built-in fonts are (default "fonts", relative to the working directory): Inter for text and JetBrains Mono for monospace.
virtual void SetFallbackFontDirectory (std::string_view directory)=0
 Where the optional fallback fonts are: Noto, for other scripts, emoji and symbols.
virtual bool Initialize (GraphicsContext *graphicsContext, StyleManager *styleManager, TextAtlasManager *textAtlasManager, GUIStateManager *guiStateManager, IClipboard *clipboard)=0
virtual void Shutdown ()=0
virtual void Update ()=0
virtual void BeginFrame (int2 screenMousePos, MouseButtons mouseButtons, uint32_t timeMs)=0
 Starts a frame, before the UI is built: clears the per-frame editor registrations that this frame's RegisterEditableText calls fill again.
virtual void BeginAtlasRecord (ID)
 Records the glyph and icon atlas entries a cached scope's primitives use, until EndAtlasRecord.
virtual void EndAtlasRecord ()
virtual bool ReplayAtlasTouches (ID)
virtual void SetLanguage (std::string_view languageTag)=0
 The default language as a BCP 47 tag ("ja", "zh-Hant", "ko"), for text whose style has no language of its own (TextStyle::language / -tachyon-language).
virtual FontID RegisterFontFamily (std::string_view familyName, std::span< const FontFaceSource > faces)=0
 Registers a font family from its faces (regular, bold, italic, ...); each face's weight and style come from the file.
FontID RegisterFontFamily (std::string_view familyName, std::span< const std::string_view > faceFiles)
virtual TextID RegisterText (ID elementId, IconID iconId, std::string_view text, StyleRef styleIndex, ElementState state)=0
 Registers static text, with an optional icon, for elementId.
TextID RegisterText (ID elementId, std::string_view text, StyleRef styleIndex, ElementState state)
virtual TextID RegisterEditableText (ID elementId, std::string &text, TextEditBehavior behavior, StyleRef styleIndex, ElementState state, bool &wasModified, const ITextValidator *validator=nullptr)=0
 Registers Text as editable by elementId; wasModified is set when an edit changed it.
virtual std::string * ValueEditText (ID elementId, bool &started)=0
 The text the focused field elementId edits, kept while it has the focus (its value isn't formatted again under the typing); null when it doesn't have it.
template<typename T, typename Converter = TextConverter<T>>
TextID RegisterEditableValue (ID elementId, T &value, TextEditBehavior behavior, StyleRef styleIndex, ElementState state, bool &wasModified, const Converter &converter=DefaultTextConverter< T >())
 Registers a field that edits value as text: converter formats it and parses the edits back (see TextConverter).
template<typename T>
TextID RegisterEditableNumber (ID elementId, T &value, TextEditBehavior behavior, StyleRef styleIndex, ElementState state, bool &wasModified, NumericFieldConfig< T > config={})
 Registers an editable number, clamped to config's [minVal, maxVal] after an edit.
virtual void SetTextColor (TextID textId, VisualColorStyleIndex color)=0
 Draw a registered text in color instead of its style's text color, until it is registered again (call after each registration, e.g.
virtual void SetCaretColor (VisualColorStyleIndex color)=0
 The text caret's color (the theme's –caret). Set again after the style manager is cleared.
virtual void SetUndoHistory (class UndoHistory *history)=0
 Where committed text edits go as undo steps (none: not recorded).
virtual std::string_view GetText (TextID textId) const =0
 The text registered as textId.
virtual TextID RegisterRichText (ID elementId, const std::span< ContentRun > &contentRuns, StyleRef styleIndex, ElementState state)=0
 Registers text made of runs: styled text, inline icons and links.
virtual TextID RegisterEditableRichText (ID elementId, const std::span< ContentRun > &contentRuns, TextEditBehavior behavior, StyleRef styleIndex, ElementState state, bool &wasModified)=0
 Registers rich text that renders like RegisterRichText but can also be selected and copied (the runs' text joined).
virtual TextID GetTextID (ID elementId) const =0
 The TextID elementId registered this frame, or TextID::Invalid.
virtual TextMeasurement GetTextMeasurement (TextID textId) const =0
 The unwrapped measurement of textId, in pixels; cached until its text or style changes.
virtual TextMeasurement MeasureText (TextID textId, const TextWrapContext &wrapContext) const =0
 The measurement of textId wrapped to wrapContext.maxWidth, in pixels.
virtual int32_t GetTextHeightWithoutIcon (TextID textId) const =0
 How high textId's text is unwrapped, in pixels, without the icon it was registered with (which its measurement has in it).
virtual void RenderText (TextID textId, IntRect rect, IntRect innerRect, IntRect clipRect, float pixelScale=1.f, const float3x2 &screenToLayout=float3x2::Identity())=0
 Draws textId into rect (renderer space, window-local), clipped to clipRect.
virtual std::optional< MouseCursor > LinkCursorAt (ID elementId, int32_t localX, int32_t localY) const =0
 The cursor of the link at (localX, localY), element-local (its LinkStyle::cursor); none when there's no link there.
virtual intptr_t HitTestContent (TextID textId, int32_t localX, int32_t localY) const =0
 The contentId of the run at (localX, localY), element-local; 0 if none.
virtual void SetHoveredContent (TextID textId, intptr_t contentId)=0
 Sets the hovered run of textId (by contentId), drawn in its hover style; 0 for none.
virtual IconMeasurement GetIconMeasurement (IconID iconId) const =0
 The natural size of iconId, in pixels (same as MeasureIcon).
virtual IconMeasurement MeasureIcon (IconID iconId) const =0
 The natural size of iconId, in pixels.
virtual bool IsValidIcon (IconID iconId) const =0
 True when iconId is a registered icon.
virtual IconID RegisterIconFromSVG (const char *name, const char *svg_data, size_t svg_size)=0
 Registers an icon from SVG data under a unique name.
virtual IconID RegisterIconFromSVGFile (const char *path)=0
 Registers an icon from an SVG file, named by its path.
virtual IconID RegisterIconFromPixels (const char *name, uint2 size, std::span< const uint8_t > rgba)=0
 Registers an icon from size.x x size.y RGBA pixels (straight alpha, rows from the top) under a unique name: a picture in its own colors, drawn untinted.
virtual void UnregisterIcon (IconID iconId)=0
 Lets go of an icon from RegisterIconFromPixels: its image slot is freed, the ID draws nothing from then on and isn't given out again, and its name can be registered anew.
virtual void RenderIcon (IconID iconId, IntRect rect, IntRect clipRect, VisualColorStyleIndex tint, std::span< const VisualShadow > shadows={})=0
 Draws iconId fitted into rect (aspect kept, centered), clipped to clipRect.
virtual void OnKeyboard (ID windowId, KeyCode key, int repeat, KeyModifier modifiers, KeyAction action)=0
 Keyboard input for the active text editor.
virtual void OnMouseMove (ID windowId, tachyon::int2 screenPos, MouseButtons button, KeyModifier modifiers)=0
 Mouse movement for text selection and drag-drop.
virtual void OnMouseButton (ID windowId, tachyon::int2 screenPos, MouseButtons button, KeyModifier modifiers, MouseAction action)=0
 Mouse buttons for text editors: caret placement, selection, drag-drop.
virtual void OnMouseScroll (ID windowId, tachyon::int2 screenPos, tachyon::float2 scrollOffset, KeyModifier modifiers)=0
 Mouse wheel input for text editors.
virtual void SwitchTextEditor (ID from, ID to)=0
 The focused text field changed (GUIStateManager::TextEditorFocus): commit from (ID::Invalid if none) and move the editor to to (ID::Invalid: no editor).
virtual bool DoesTextEditorAcceptTabs (ID elementId) const =0
 True when the editor elementId inserts tabs (TextEditBehavior::AcceptTabs).
virtual bool IsTextEditor (ID elementId) const =0
 True when elementId registered editable text this frame.
virtual void RequestSelectAll (ID elementId)=0
 Selects all text of the editor elementId the next time it renders.
virtual TextEditUpdate ConsumeTextEditUpdate (TextID textId, std::string &outText)=0
 Takes the pending edit of textId: the edited text goes to outText, the result says whether it changed or was committed.
virtual bool UpdateText (TextID textId, std::string_view text)=0
 Replaces the text of textId; true when it changed.
virtual std::string Copy ()=0
 The active editor's selected text.
virtual std::string Cut ()=0
 Removes the active editor's selected text and returns it.
virtual void Paste (std::string_view text)=0
 Inserts Text into the active editor at the caret, replacing the selection.
virtual bool IsHoveringSelectedText (ID textEditorId, ID windowId, tachyon::int2 screenSpace) const =0
 True when the screen point screenSpace is over selected text in textEditorId.
virtual bool TryGetTextDragCursor (ID windowId, tachyon::int2 screenSpace, MouseCursor &outCursor) const =0
 The mouse cursor to show while text is dragged; true when it overrides the hover cursor.
virtual bool TryGetTextDragHoverTarget (ID windowId, tachyon::int2 screenSpace, ID &outTargetId) const =0
 While text is dragged, sets outTargetId to the drop target under the cursor (ID::Invalid if none) and returns true.
virtual void ClearCache ()=0
 Drops every registered text and the live editor; earlier TextIDs become invalid.
virtual void EnsureCursorVisible (ID textEditorId)=0
 Asks for the caret of textEditorId to be scrolled into view; editor input calls it when the caret moves.
virtual std::optional< IntRect > GetCursorRect (ID textEditorId)=0
 Takes a pending EnsureCursorVisible request for textEditorId and returns the caret rect, relative to the editor's inner rect.
virtual std::optional< IntRect > GetCaretScreenRect () const =0
 The active editor's caret in absolute screen coordinates (through any zoom/pan), to place the IME candidate window.
Public Member Functions inherited from tachyon::IPlatformInputHandler
virtual ~IPlatformInputHandler ()=default
virtual void OnTextComposition (tachyon::ID id, std::string_view text, int32_t cursor)=0
 IME composition (pre-edit) text, UTF-8, shown but not yet committed; empty when composing ends.
virtual void OnFileDrop (tachyon::ID, tachyon::int2, FileDropAction, std::string_view)
 A drag from another application over window id: it came, moved to screenPos (screen pixels), dropped a file or text (data), or ended (dropped, or left the window).

Detailed Description

Text and icon registration, measurement, rendering and editing.

Constructor & Destructor Documentation

◆ ~ITextSystem()

virtual tachyon::ITextSystem::~ITextSystem ( )
virtualdefault

Member Function Documentation

◆ SetFontDirectory()

virtual void tachyon::ITextSystem::SetFontDirectory ( std::string_view directory)
pure virtual

Where the built-in fonts are (default "fonts", relative to the working directory): Inter for text and JetBrains Mono for monospace.

Empty loads none, for an app that registers its own. Initialize fails when they are set but missing. Call before Initialize.

Implemented in tachyon::SkribidiTextSystem.

◆ SetFallbackFontDirectory()

virtual void tachyon::ITextSystem::SetFallbackFontDirectory ( std::string_view directory)
pure virtual

Where the optional fallback fonts are: Noto, for other scripts, emoji and symbols.

Empty (the default) loads none. Only the files an app ships there are used; missing ones are skipped with a warning. Call before Initialize.

Implemented in tachyon::SkribidiTextSystem.

◆ Initialize()

virtual bool tachyon::ITextSystem::Initialize ( GraphicsContext * graphicsContext,
StyleManager * styleManager,
TextAtlasManager * textAtlasManager,
GUIStateManager * guiStateManager,
IClipboard * clipboard )
pure virtual

Implemented in tachyon::SkribidiTextSystem.

◆ Shutdown()

virtual void tachyon::ITextSystem::Shutdown ( )
pure virtual

Implemented in tachyon::SkribidiTextSystem.

◆ Update()

virtual void tachyon::ITextSystem::Update ( )
pure virtual

Implemented in tachyon::SkribidiTextSystem.

◆ BeginFrame()

virtual void tachyon::ITextSystem::BeginFrame ( int2 screenMousePos,
MouseButtons mouseButtons,
uint32_t timeMs )
pure virtual

Starts a frame, before the UI is built: clears the per-frame editor registrations that this frame's RegisterEditableText calls fill again.

Implemented in tachyon::SkribidiTextSystem.

◆ BeginAtlasRecord()

virtual void tachyon::ITextSystem::BeginAtlasRecord ( ID )
inlinevirtual

Records the glyph and icon atlas entries a cached scope's primitives use, until EndAtlasRecord.

ReplayAtlasTouches keeps them alive on each frame the cached pixels are reused, and returns false when one was evicted or moved: the scope must render again.

Reimplemented in tachyon::SkribidiTextSystem.

◆ EndAtlasRecord()

virtual void tachyon::ITextSystem::EndAtlasRecord ( )
inlinevirtual

Reimplemented in tachyon::SkribidiTextSystem.

◆ ReplayAtlasTouches()

virtual bool tachyon::ITextSystem::ReplayAtlasTouches ( ID )
inlinevirtual

Reimplemented in tachyon::SkribidiTextSystem.

◆ SetLanguage()

virtual void tachyon::ITextSystem::SetLanguage ( std::string_view languageTag)
pure virtual

The default language as a BCP 47 tag ("ja", "zh-Hant", "ko"), for text whose style has no language of its own (TextStyle::language / -tachyon-language).

It picks regional letterforms, e.g. Japanese kanji vs Chinese hanzi; empty means Simplified Chinese forms. Changing it lays all text out again.

Implemented in tachyon::SkribidiTextSystem.

◆ RegisterFontFamily() [1/2]

virtual FontID tachyon::ITextSystem::RegisterFontFamily ( std::string_view familyName,
std::span< const FontFaceSource > faces )
pure virtual

Registers a font family from its faces (regular, bold, italic, ...); each face's weight and style come from the file.

Returns FontIDFromName(familyName) for use in TextStyle::fontId, or FontID::Invalid if no face could be loaded. Re-registering a family name with the same faces is a no-op; other faces replace the old ones and all text is laid out again (a failed re-registration keeps the previous faces).

Implemented in tachyon::SkribidiTextSystem.

◆ RegisterFontFamily() [2/2]

FontID tachyon::ITextSystem::RegisterFontFamily ( std::string_view familyName,
std::span< const std::string_view > faceFiles )
inline

◆ RegisterText() [1/2]

virtual TextID tachyon::ITextSystem::RegisterText ( ID elementId,
IconID iconId,
std::string_view text,
StyleRef styleIndex,
ElementState state )
pure virtual

Registers static text, with an optional icon, for elementId.

Implemented in tachyon::SkribidiTextSystem.

◆ RegisterText() [2/2]

TextID tachyon::ITextSystem::RegisterText ( ID elementId,
std::string_view text,
StyleRef styleIndex,
ElementState state )
inline

◆ RegisterEditableText()

virtual TextID tachyon::ITextSystem::RegisterEditableText ( ID elementId,
std::string & text,
TextEditBehavior behavior,
StyleRef styleIndex,
ElementState state,
bool & wasModified,
const ITextValidator * validator = nullptr )
pure virtual

Registers Text as editable by elementId; wasModified is set when an edit changed it.

validator limits what can be typed, pasted or dropped in; it must outlive the field.

Implemented in tachyon::SkribidiTextSystem.

◆ ValueEditText()

virtual std::string * tachyon::ITextSystem::ValueEditText ( ID elementId,
bool & started )
pure virtual

The text the focused field elementId edits, kept while it has the focus (its value isn't formatted again under the typing); null when it doesn't have it.

started is set when the focus just arrived: fill it from the value then.

Implemented in tachyon::SkribidiTextSystem.

◆ RegisterEditableValue()

template<typename T, typename Converter = TextConverter<T>>
TextID tachyon::ITextSystem::RegisterEditableValue ( ID elementId,
T & value,
TextEditBehavior behavior,
StyleRef styleIndex,
ElementState state,
bool & wasModified,
const Converter & converter = DefaultTextConverter<T>() )
inline

Registers a field that edits value as text: converter formats it and parses the edits back (see TextConverter).

wasModified is set when an edit parsed.

◆ RegisterEditableNumber()

template<typename T>
TextID tachyon::ITextSystem::RegisterEditableNumber ( ID elementId,
T & value,
TextEditBehavior behavior,
StyleRef styleIndex,
ElementState state,
bool & wasModified,
NumericFieldConfig< T > config = {} )
inline

Registers an editable number, clamped to config's [minVal, maxVal] after an edit.

◆ SetTextColor()

virtual void tachyon::ITextSystem::SetTextColor ( TextID textId,
VisualColorStyleIndex color )
pure virtual

Draw a registered text in color instead of its style's text color, until it is registered again (call after each registration, e.g.

for a NaN value).

Implemented in tachyon::SkribidiTextSystem.

◆ SetCaretColor()

virtual void tachyon::ITextSystem::SetCaretColor ( VisualColorStyleIndex color)
pure virtual

The text caret's color (the theme's –caret). Set again after the style manager is cleared.

Implemented in tachyon::SkribidiTextSystem.

◆ SetUndoHistory()

virtual void tachyon::ITextSystem::SetUndoHistory ( class UndoHistory * history)
pure virtual

Where committed text edits go as undo steps (none: not recorded).

Implemented in tachyon::SkribidiTextSystem.

◆ GetText()

virtual std::string_view tachyon::ITextSystem::GetText ( TextID textId) const
pure virtual

The text registered as textId.

Implemented in tachyon::SkribidiTextSystem.

◆ RegisterRichText()

virtual TextID tachyon::ITextSystem::RegisterRichText ( ID elementId,
const std::span< ContentRun > & contentRuns,
StyleRef styleIndex,
ElementState state )
pure virtual

Registers text made of runs: styled text, inline icons and links.

Implemented in tachyon::SkribidiTextSystem.

◆ RegisterEditableRichText()

virtual TextID tachyon::ITextSystem::RegisterEditableRichText ( ID elementId,
const std::span< ContentRun > & contentRuns,
TextEditBehavior behavior,
StyleRef styleIndex,
ElementState state,
bool & wasModified )
pure virtual

Registers rich text that renders like RegisterRichText but can also be selected and copied (the runs' text joined).

Pass TextEditBehavior::ReadOnly to block edits.

Implemented in tachyon::SkribidiTextSystem.

◆ GetTextID()

virtual TextID tachyon::ITextSystem::GetTextID ( ID elementId) const
pure virtual

The TextID elementId registered this frame, or TextID::Invalid.

Lets an event handler find its text for hit-testing and hover.

Implemented in tachyon::SkribidiTextSystem.

◆ GetTextMeasurement()

virtual TextMeasurement tachyon::ITextSystem::GetTextMeasurement ( TextID textId) const
pure virtual

The unwrapped measurement of textId, in pixels; cached until its text or style changes.

Implemented in tachyon::SkribidiTextSystem.

◆ MeasureText()

virtual TextMeasurement tachyon::ITextSystem::MeasureText ( TextID textId,
const TextWrapContext & wrapContext ) const
pure virtual

The measurement of textId wrapped to wrapContext.maxWidth, in pixels.

Implemented in tachyon::SkribidiTextSystem.

◆ GetTextHeightWithoutIcon()

virtual int32_t tachyon::ITextSystem::GetTextHeightWithoutIcon ( TextID textId) const
pure virtual

How high textId's text is unwrapped, in pixels, without the icon it was registered with (which its measurement has in it).

Implemented in tachyon::SkribidiTextSystem.

◆ RenderText()

virtual void tachyon::ITextSystem::RenderText ( TextID textId,
IntRect rect,
IntRect innerRect,
IntRect clipRect,
float pixelScale = 1.f,
const float3x2 & screenToLayout = float3x2::Identity() )
pure virtual

Draws textId into rect (renderer space, window-local), clipped to clipRect.

rect can be larger than innerRect when the element scrolls its text. innerRect is the visible content area in absolute layout coordinates (the element's ElementRect::innerRect); mouse positions are hit-tested against it after mapping them with screenToLayout, the inverse of any ancestor zoom/pan.

Implemented in tachyon::SkribidiTextSystem.

◆ LinkCursorAt()

virtual std::optional< MouseCursor > tachyon::ITextSystem::LinkCursorAt ( ID elementId,
int32_t localX,
int32_t localY ) const
pure virtual

The cursor of the link at (localX, localY), element-local (its LinkStyle::cursor); none when there's no link there.

Implemented in tachyon::SkribidiTextSystem.

◆ HitTestContent()

virtual intptr_t tachyon::ITextSystem::HitTestContent ( TextID textId,
int32_t localX,
int32_t localY ) const
pure virtual

The contentId of the run at (localX, localY), element-local; 0 if none.

Implemented in tachyon::SkribidiTextSystem.

◆ SetHoveredContent()

virtual void tachyon::ITextSystem::SetHoveredContent ( TextID textId,
intptr_t contentId )
pure virtual

Sets the hovered run of textId (by contentId), drawn in its hover style; 0 for none.

Implemented in tachyon::SkribidiTextSystem.

◆ GetIconMeasurement()

virtual IconMeasurement tachyon::ITextSystem::GetIconMeasurement ( IconID iconId) const
pure virtual

The natural size of iconId, in pixels (same as MeasureIcon).

Implemented in tachyon::SkribidiTextSystem.

◆ MeasureIcon()

virtual IconMeasurement tachyon::ITextSystem::MeasureIcon ( IconID iconId) const
pure virtual

The natural size of iconId, in pixels.

Implemented in tachyon::SkribidiTextSystem.

◆ IsValidIcon()

virtual bool tachyon::ITextSystem::IsValidIcon ( IconID iconId) const
pure virtual

True when iconId is a registered icon.

Implemented in tachyon::SkribidiTextSystem.

◆ RegisterIconFromSVG()

virtual IconID tachyon::ITextSystem::RegisterIconFromSVG ( const char * name,
const char * svg_data,
size_t svg_size )
pure virtual

Registers an icon from SVG data under a unique name.

Registering a name again returns the existing icon.

Implemented in tachyon::SkribidiTextSystem.

◆ RegisterIconFromSVGFile()

virtual IconID tachyon::ITextSystem::RegisterIconFromSVGFile ( const char * path)
pure virtual

Registers an icon from an SVG file, named by its path.

IconID::Invalid if the file is missing, unreadable or doesn't parse.

Implemented in tachyon::SkribidiTextSystem.

◆ RegisterIconFromPixels()

virtual IconID tachyon::ITextSystem::RegisterIconFromPixels ( const char * name,
uint2 size,
std::span< const uint8_t > rgba )
pure virtual

Registers an icon from size.x x size.y RGBA pixels (straight alpha, rows from the top) under a unique name: a picture in its own colors, drawn untinted.

Registering a name again returns the existing icon. Each takes one of the image slots shared with fonts, gradients and images. IconID::Invalid if rgba is too short.

Implemented in tachyon::SkribidiTextSystem.

◆ UnregisterIcon()

virtual void tachyon::ITextSystem::UnregisterIcon ( IconID iconId)
pure virtual

Lets go of an icon from RegisterIconFromPixels: its image slot is freed, the ID draws nothing from then on and isn't given out again, and its name can be registered anew.

Does nothing for other icons.

Implemented in tachyon::SkribidiTextSystem.

◆ RenderIcon()

virtual void tachyon::ITextSystem::RenderIcon ( IconID iconId,
IntRect rect,
IntRect clipRect,
VisualColorStyleIndex tint,
std::span< const VisualShadow > shadows = {} )
pure virtual

Draws iconId fitted into rect (aspect kept, centered), clipped to clipRect.

Single-color icons are drawn in tint, like text; colored icons keep their colors. shadows (a text style's textShadows, the first on top) are drawn under it.

Implemented in tachyon::SkribidiTextSystem.

◆ OnKeyboard()

virtual void tachyon::ITextSystem::OnKeyboard ( ID windowId,
KeyCode key,
int repeat,
KeyModifier modifiers,
KeyAction action )
pure virtual

Keyboard input for the active text editor.

Implements tachyon::IPlatformInputHandler.

Implemented in tachyon::SkribidiTextSystem.

◆ OnMouseMove()

virtual void tachyon::ITextSystem::OnMouseMove ( ID windowId,
tachyon::int2 screenPos,
MouseButtons button,
KeyModifier modifiers )
pure virtual

Mouse movement for text selection and drag-drop.

Implements tachyon::IPlatformInputHandler.

Implemented in tachyon::SkribidiTextSystem.

◆ OnMouseButton()

virtual void tachyon::ITextSystem::OnMouseButton ( ID windowId,
tachyon::int2 screenPos,
MouseButtons button,
KeyModifier modifiers,
MouseAction action )
pure virtual

Mouse buttons for text editors: caret placement, selection, drag-drop.

Implements tachyon::IPlatformInputHandler.

Implemented in tachyon::SkribidiTextSystem.

◆ OnMouseScroll()

virtual void tachyon::ITextSystem::OnMouseScroll ( ID windowId,
tachyon::int2 screenPos,
tachyon::float2 scrollOffset,
KeyModifier modifiers )
pure virtual

Mouse wheel input for text editors.

Implements tachyon::IPlatformInputHandler.

Implemented in tachyon::SkribidiTextSystem.

◆ SwitchTextEditor()

virtual void tachyon::ITextSystem::SwitchTextEditor ( ID from,
ID to )
pure virtual

The focused text field changed (GUIStateManager::TextEditorFocus): commit from (ID::Invalid if none) and move the editor to to (ID::Invalid: no editor).

Implemented in tachyon::SkribidiTextSystem.

◆ DoesTextEditorAcceptTabs()

virtual bool tachyon::ITextSystem::DoesTextEditorAcceptTabs ( ID elementId) const
pure virtual

True when the editor elementId inserts tabs (TextEditBehavior::AcceptTabs).

Implemented in tachyon::SkribidiTextSystem.

◆ IsTextEditor()

virtual bool tachyon::ITextSystem::IsTextEditor ( ID elementId) const
pure virtual

True when elementId registered editable text this frame.

Implemented in tachyon::SkribidiTextSystem.

◆ RequestSelectAll()

virtual void tachyon::ITextSystem::RequestSelectAll ( ID elementId)
pure virtual

Selects all text of the editor elementId the next time it renders.

Implemented in tachyon::SkribidiTextSystem.

◆ ConsumeTextEditUpdate()

virtual TextEditUpdate tachyon::ITextSystem::ConsumeTextEditUpdate ( TextID textId,
std::string & outText )
pure virtual

Takes the pending edit of textId: the edited text goes to outText, the result says whether it changed or was committed.

Implemented in tachyon::SkribidiTextSystem.

◆ UpdateText()

virtual bool tachyon::ITextSystem::UpdateText ( TextID textId,
std::string_view text )
pure virtual

Replaces the text of textId; true when it changed.

Implemented in tachyon::SkribidiTextSystem.

◆ Copy()

virtual std::string tachyon::ITextSystem::Copy ( )
pure virtual

The active editor's selected text.

Implemented in tachyon::SkribidiTextSystem.

◆ Cut()

virtual std::string tachyon::ITextSystem::Cut ( )
pure virtual

Removes the active editor's selected text and returns it.

Implemented in tachyon::SkribidiTextSystem.

◆ Paste()

virtual void tachyon::ITextSystem::Paste ( std::string_view text)
pure virtual

Inserts Text into the active editor at the caret, replacing the selection.

Implemented in tachyon::SkribidiTextSystem.

◆ IsHoveringSelectedText()

virtual bool tachyon::ITextSystem::IsHoveringSelectedText ( ID textEditorId,
ID windowId,
tachyon::int2 screenSpace ) const
pure virtual

True when the screen point screenSpace is over selected text in textEditorId.

Implemented in tachyon::SkribidiTextSystem.

◆ TryGetTextDragCursor()

virtual bool tachyon::ITextSystem::TryGetTextDragCursor ( ID windowId,
tachyon::int2 screenSpace,
MouseCursor & outCursor ) const
pure virtual

The mouse cursor to show while text is dragged; true when it overrides the hover cursor.

Implemented in tachyon::SkribidiTextSystem.

◆ TryGetTextDragHoverTarget()

virtual bool tachyon::ITextSystem::TryGetTextDragHoverTarget ( ID windowId,
tachyon::int2 screenSpace,
ID & outTargetId ) const
pure virtual

While text is dragged, sets outTargetId to the drop target under the cursor (ID::Invalid if none) and returns true.

False when no text drag is in progress.

Implemented in tachyon::SkribidiTextSystem.

◆ ClearCache()

virtual void tachyon::ITextSystem::ClearCache ( )
pure virtual

Drops every registered text and the live editor; earlier TextIDs become invalid.

The focused field keeps its focus. Call when the styles are reloaded.

Implemented in tachyon::SkribidiTextSystem.

◆ EnsureCursorVisible()

virtual void tachyon::ITextSystem::EnsureCursorVisible ( ID textEditorId)
pure virtual

Asks for the caret of textEditorId to be scrolled into view; editor input calls it when the caret moves.

Doesn't scroll: whoever scrolls takes the request with GetCursorRect.

Implemented in tachyon::SkribidiTextSystem.

◆ GetCursorRect()

virtual std::optional< IntRect > tachyon::ITextSystem::GetCursorRect ( ID textEditorId)
pure virtual

Takes a pending EnsureCursorVisible request for textEditorId and returns the caret rect, relative to the editor's inner rect.

Empty when none is pending for it.

Implemented in tachyon::SkribidiTextSystem.

◆ GetCaretScreenRect()

virtual std::optional< IntRect > tachyon::ITextSystem::GetCaretScreenRect ( ) const
pure virtual

The active editor's caret in absolute screen coordinates (through any zoom/pan), to place the IME candidate window.

Empty when no editor is active.

Implemented in tachyon::SkribidiTextSystem.


The documentation for this class was generated from the following file: