mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 15:50:25 +01: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
|
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 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
|
bool SelectedAllMouseLock; // after a double-click to select all, we ignore further mouse drags to update selection
|
||||||
|
ImGuiInputTextFlags UserFlags; // Temporarily set while we call user's callback
|
||||||
// Temporarily set when active
|
ImGuiInputTextCallback UserCallback; // "
|
||||||
ImGuiInputTextFlags UserFlags;
|
void* UserCallbackData; // "
|
||||||
ImGuiInputTextCallback UserCallback;
|
|
||||||
void* UserCallbackData;
|
|
||||||
|
|
||||||
ImGuiInputTextState() { memset(this, 0, sizeof(*this)); }
|
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(); }
|
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 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); }
|
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; }
|
bool HasSelection() const { return Stb.select_start != Stb.select_end; }
|
||||||
void ClearSelection() { Stb.select_start = Stb.select_end = Stb.cursor; }
|
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; }
|
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
|
// Windows data saved in imgui.ini file
|
||||||
|
Loading…
Reference in New Issue
Block a user