DVX_GUI/texthelp/textHelp.h

44 lines
2.2 KiB
C

// textHelp.h -- Public API for the shared text editing infrastructure library
//
// Declares clipboard operations, multi-click detection, word boundary
// logic, cross-widget selection clearing, and the single-line text
// editing engine shared across widget DXEs (TextInput, Spinner,
// ComboBox, AnsiTerm, etc.).
#ifndef TEXT_HELP_H
#define TEXT_HELP_H
#include "../core/dvxWidgetPlugin.h"
#define TEXT_INPUT_PAD 3
// ============================================================
// Cursor blink
// ============================================================
void wgtUpdateCursorBlink(void);
// ============================================================
// Selection management
// ============================================================
void clearOtherSelections(WidgetT *except);
// ============================================================
// Word / character helpers
// ============================================================
bool isWordChar(char c);
int32_t wordEnd(const char *buf, int32_t len, int32_t pos);
int32_t wordStart(const char *buf, int32_t pos);
// ============================================================
// Single-line text editing engine
// ============================================================
void widgetTextEditDragUpdateLine(int32_t vx, int32_t leftEdge, int32_t maxChars, const BitmapFontT *font, int32_t len, int32_t *pCursorPos, int32_t *pScrollOff, int32_t *pSelEnd);
void widgetTextEditMouseClick(WidgetT *w, int32_t vx, int32_t vy, int32_t textLeftX, const BitmapFontT *font, const char *buf, int32_t len, int32_t scrollOff, int32_t *pCursorPos, int32_t *pSelStart, int32_t *pSelEnd, bool wordSelect, bool dragSelect);
void widgetTextEditOnKey(WidgetT *w, int32_t key, int32_t mod, char *buf, int32_t bufSize, int32_t *pLen, int32_t *pCursor, int32_t *pScrollOff, int32_t *pSelStart, int32_t *pSelEnd, char *undoBuf, int32_t *pUndoLen, int32_t *pUndoCursor);
void widgetTextEditPaintLine(DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, const ColorSchemeT *colors, int32_t textX, int32_t textY, const char *buf, int32_t visLen, int32_t scrollOff, int32_t cursorPos, int32_t selStart, int32_t selEnd, uint32_t fg, uint32_t bg, bool showCursor, int32_t cursorMinX, int32_t cursorMaxX);
#endif // TEXT_HELP_H