mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-23 21:09:01 +08:00
Internal: Added ImGuiInputTextState::ClearText() helper.
This commit is contained in:
parent
85ad8e0e2e
commit
494d804735
@ -630,22 +630,23 @@ struct IMGUI_API ImGuiInputTextState
|
||||
float CursorAnim; // timer for cursor blink, reset on every user action so the cursor reappears immediately
|
||||
bool CursorFollow; // set when we want scrolling to follow the current cursor position (not always!)
|
||||
bool SelectedAllMouseLock; // after a double-click to select all, we ignore further mouse drags to update selection
|
||||
|
||||
// Temporarily set when active
|
||||
ImGuiInputTextFlags UserFlags;
|
||||
ImGuiInputTextCallback UserCallback;
|
||||
void* UserCallbackData;
|
||||
ImGuiInputTextFlags UserFlags; // Temporarily set while we call user's callback
|
||||
ImGuiInputTextCallback UserCallback; // "
|
||||
void* UserCallbackData; // "
|
||||
|
||||
ImGuiInputTextState() { memset(this, 0, sizeof(*this)); }
|
||||
void ClearText() { CurLenW = CurLenA = 0; TextW[0] = 0; TextA[0] = 0; CursorClamp(); }
|
||||
void ClearFreeMemory() { TextW.clear(); TextA.clear(); InitialTextA.clear(); }
|
||||
int GetUndoAvailCount() const { return Stb.undostate.undo_point; }
|
||||
int GetRedoAvailCount() const { return STB_TEXTEDIT_UNDOSTATECOUNT - Stb.undostate.redo_point; }
|
||||
void OnKeyPressed(int key); // Cannot be inline because we call in code in stb_textedit.h implementation
|
||||
|
||||
// Cursor & Selection
|
||||
void CursorAnimReset() { CursorAnim = -0.30f; } // After a user-input the cursor stays on for a while without blinking
|
||||
void CursorClamp() { Stb.cursor = ImMin(Stb.cursor, CurLenW); Stb.select_start = ImMin(Stb.select_start, CurLenW); Stb.select_end = ImMin(Stb.select_end, CurLenW); }
|
||||
bool HasSelection() const { return Stb.select_start != Stb.select_end; }
|
||||
void ClearSelection() { Stb.select_start = Stb.select_end = Stb.cursor; }
|
||||
void SelectAll() { Stb.select_start = 0; Stb.cursor = Stb.select_end = CurLenW; Stb.has_preferred_x = 0; }
|
||||
int GetUndoAvailCount() const { return Stb.undostate.undo_point; }
|
||||
int GetRedoAvailCount() const { return STB_TEXTEDIT_UNDOSTATECOUNT - Stb.undostate.redo_point; }
|
||||
void OnKeyPressed(int key); // Cannot be inline because we call in code in stb_textedit.h implementation
|
||||
};
|
||||
|
||||
// Windows data saved in imgui.ini file
|
||||
|
Loading…
Reference in New Issue
Block a user