mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-12 02:00:58 +01:00
InputText: moved imstb_textedit.h include to imgui_widgets.cpp
This commit is contained in:
parent
ca5701d458
commit
15cb7d61f9
@ -198,26 +198,6 @@ typedef void (*ImGuiErrorLogCallback)(void* user_data, const char* fmt, ...);
|
||||
extern IMGUI_API ImGuiContext* GImGui; // Current implicit context pointer
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// [SECTION] STB libraries includes
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
namespace ImStb
|
||||
{
|
||||
|
||||
#undef IMSTB_TEXTEDIT_STRING
|
||||
#undef IMSTB_TEXTEDIT_CHARTYPE
|
||||
#define IMSTB_TEXTEDIT_STRING ImGuiInputTextState
|
||||
#define IMSTB_TEXTEDIT_CHARTYPE ImWchar
|
||||
#define IMSTB_TEXTEDIT_GETWIDTH_NEWLINE (-1.0f)
|
||||
#define IMSTB_TEXTEDIT_UNDOSTATECOUNT 99
|
||||
#define IMSTB_TEXTEDIT_UNDOCHARCOUNT 999
|
||||
#include "imstb_textedit.h"
|
||||
|
||||
} // namespace ImStb
|
||||
|
||||
typedef ImStb::STB_TexteditState ImStbTexteditState;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] Macros
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -1113,6 +1093,17 @@ struct IMGUI_API ImGuiInputTextDeactivatedState
|
||||
void ClearFreeMemory() { ID = 0; TextA.clear(); }
|
||||
};
|
||||
|
||||
// Forward declare imstb_textedit.h structure + make its main configuration define accessible
|
||||
#undef IMSTB_TEXTEDIT_STRING
|
||||
#undef IMSTB_TEXTEDIT_CHARTYPE
|
||||
#define IMSTB_TEXTEDIT_STRING ImGuiInputTextState
|
||||
#define IMSTB_TEXTEDIT_CHARTYPE ImWchar
|
||||
#define IMSTB_TEXTEDIT_GETWIDTH_NEWLINE (-1.0f)
|
||||
#define IMSTB_TEXTEDIT_UNDOSTATECOUNT 99
|
||||
#define IMSTB_TEXTEDIT_UNDOCHARCOUNT 999
|
||||
namespace ImStb { struct STB_TexteditState; }
|
||||
typedef ImStb::STB_TexteditState ImStbTexteditState;
|
||||
|
||||
// Internal state of the currently focused/edited text input box
|
||||
// For a given item ID, access with ImGui::GetInputTextState()
|
||||
struct IMGUI_API ImGuiInputTextState
|
||||
|
@ -3786,6 +3786,7 @@ bool ImGui::InputDouble(const char* label, double* v, double step, double step_f
|
||||
//-------------------------------------------------------------------------
|
||||
// [SECTION] Widgets: InputText, InputTextMultiline, InputTextWithHint
|
||||
//-------------------------------------------------------------------------
|
||||
// - imstb_textedit.h include
|
||||
// - InputText()
|
||||
// - InputTextWithHint()
|
||||
// - InputTextMultiline()
|
||||
@ -3796,6 +3797,11 @@ bool ImGui::InputDouble(const char* label, double* v, double step, double step_f
|
||||
// - DebugNodeInputTextState() [Internal]
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
namespace ImStb
|
||||
{
|
||||
#include "imstb_textedit.h"
|
||||
}
|
||||
|
||||
bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
|
||||
{
|
||||
IM_ASSERT(!(flags & ImGuiInputTextFlags_Multiline)); // call InputTextMultiline()
|
||||
|
@ -3,6 +3,7 @@
|
||||
// Those changes would need to be pushed into nothings/stb:
|
||||
// - Fix in stb_textedit_discard_redo (see https://github.com/nothings/stb/issues/321)
|
||||
// - Fix in stb_textedit_find_charpos to handle last line (see https://github.com/ocornut/imgui/issues/6000 + #6783)
|
||||
// - Added name to struct or it may be forward declared in our code.
|
||||
// Grep for [DEAR IMGUI] to find the changes.
|
||||
// - Also renamed macros used or defined outside of IMSTB_TEXTEDIT_IMPLEMENTATION block from STB_TEXTEDIT_* to IMSTB_TEXTEDIT_*
|
||||
|
||||
@ -318,7 +319,7 @@ typedef struct
|
||||
int undo_char_point, redo_char_point;
|
||||
} StbUndoState;
|
||||
|
||||
typedef struct
|
||||
typedef struct STB_TexteditState
|
||||
{
|
||||
/////////////////////
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user