mirror of
https://github.com/ocornut/imgui.git
synced 2026-04-02 21:47:38 -05:00
InputText: rename Edited->EditedThisFrame, add EditedBefore. (#701) + Comments + About box clipboard blurb include a comment.
This commit is contained in:
4
imgui.h
4
imgui.h
@@ -2030,11 +2030,11 @@ enum ImGuiTableFlags_
|
||||
// Features
|
||||
ImGuiTableFlags_None = 0,
|
||||
ImGuiTableFlags_Resizable = 1 << 0, // Enable resizing columns.
|
||||
ImGuiTableFlags_Reorderable = 1 << 1, // Enable reordering columns in header row (need calling TableSetupColumn() + TableHeadersRow() to display headers)
|
||||
ImGuiTableFlags_Reorderable = 1 << 1, // Enable reordering columns in header row. (Need calling TableSetupColumn() + TableHeadersRow() to display headers, or using ImGuiTableFlags_ContextMenuInBody to access context-menu without headers).
|
||||
ImGuiTableFlags_Hideable = 1 << 2, // Enable hiding/disabling columns in context menu.
|
||||
ImGuiTableFlags_Sortable = 1 << 3, // Enable sorting. Call TableGetSortSpecs() to obtain sort specs. Also see ImGuiTableFlags_SortMulti and ImGuiTableFlags_SortTristate.
|
||||
ImGuiTableFlags_NoSavedSettings = 1 << 4, // Disable persisting columns order, width, visibility and sort settings in the .ini file.
|
||||
ImGuiTableFlags_ContextMenuInBody = 1 << 5, // Right-click on columns body/contents will display table context menu. By default it is available in TableHeadersRow().
|
||||
ImGuiTableFlags_ContextMenuInBody = 1 << 5, // Right-click on columns body/contents will also display table context menu. By default it is available in TableHeadersRow().
|
||||
// Decorations
|
||||
ImGuiTableFlags_RowBg = 1 << 6, // Set each RowBg color with ImGuiCol_TableRowBg or ImGuiCol_TableRowBgAlt (equivalent of calling TableSetBgColor with ImGuiTableBgFlags_RowBg0 on each row manually)
|
||||
ImGuiTableFlags_BordersInnerH = 1 << 7, // Draw horizontal borders between rows.
|
||||
|
||||
@@ -8175,6 +8175,7 @@ void ImGui::ShowAboutWindow(bool* p_open)
|
||||
if (copy_to_clipboard)
|
||||
{
|
||||
ImGui::LogToClipboard();
|
||||
ImGui::LogText("// (Copy from the next line. Keep the ``` markers for formatting.)\n");
|
||||
ImGui::LogText("```cpp\n"); // Back quotes will make text appears without formatting when pasting on GitHub
|
||||
}
|
||||
|
||||
|
||||
@@ -1245,7 +1245,8 @@ struct IMGUI_API ImGuiInputTextState
|
||||
bool CursorFollow; // set when we want scrolling to follow the current cursor position (not always!)
|
||||
bool CursorCenterY; // set when we want scrolling to be centered over the cursor position (while resizing a word-wrapping field)
|
||||
bool SelectedAllMouseLock; // after a double-click to select all, we ignore further mouse drags to update selection
|
||||
bool Edited; // edited this frame
|
||||
bool EditedBefore; // edited since activated
|
||||
bool EditedThisFrame; // edited this frame
|
||||
bool WantReloadUserBuf; // force a reload of user buf so it may be modified externally. may be automatic in future version.
|
||||
ImS8 LastMoveDirectionLR; // ImGuiDir_Left or ImGuiDir_Right. track last movement direction so when cursor cross over a word-wrapping boundaries we can display it on either line depending on last move.s
|
||||
int ReloadSelectionStart;
|
||||
|
||||
@@ -4184,7 +4184,7 @@ static void STB_TEXTEDIT_DELETECHARS(ImGuiInputTextState* obj, int pos, int n)
|
||||
char* dst = obj->TextA.Data + pos;
|
||||
char* src = obj->TextA.Data + pos + n;
|
||||
memmove(dst, src, obj->TextLen - n - pos + 1);
|
||||
obj->Edited = true;
|
||||
obj->EditedBefore = obj->EditedThisFrame = true;
|
||||
obj->TextLen -= n;
|
||||
}
|
||||
|
||||
@@ -4214,7 +4214,7 @@ static int STB_TEXTEDIT_INSERTCHARS(ImGuiInputTextState* obj, int pos, const cha
|
||||
memmove(text + pos + new_text_len, text + pos, (size_t)(text_len - pos));
|
||||
memcpy(text + pos, new_text, (size_t)new_text_len);
|
||||
|
||||
obj->Edited = true;
|
||||
obj->EditedBefore = obj->EditedThisFrame = true;
|
||||
obj->TextLen += new_text_len;
|
||||
obj->TextA[obj->TextLen] = '\0';
|
||||
|
||||
@@ -4841,6 +4841,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
// Start edition
|
||||
state->ID = id;
|
||||
state->TextLen = buf_len;
|
||||
state->EditedBefore = false;
|
||||
if (!is_readonly)
|
||||
{
|
||||
state->TextA.resize(buf_size + 1); // we use +1 to make sure that .Data is always pointing to at least an empty string.
|
||||
@@ -4956,7 +4957,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
if (g.ActiveId == id)
|
||||
{
|
||||
IM_ASSERT(state != NULL);
|
||||
state->Edited = false;
|
||||
state->EditedThisFrame = false;
|
||||
state->BufCapacity = buf_size;
|
||||
state->Flags = flags;
|
||||
state->WrapWidth = wrap_width;
|
||||
@@ -5294,7 +5295,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
event_flag = ImGuiInputTextFlags_CallbackHistory;
|
||||
event_key = ImGuiKey_DownArrow;
|
||||
}
|
||||
else if ((flags & ImGuiInputTextFlags_CallbackEdit) && state->Edited)
|
||||
else if ((flags & ImGuiInputTextFlags_CallbackEdit) && state->EditedThisFrame)
|
||||
{
|
||||
event_flag = ImGuiInputTextFlags_CallbackEdit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user