Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
ImGuiInputTextCallbackData Struct Reference

#include <src/imgui/imgui.h>

Public Member Functions

IMGUI_API ImGuiInputTextCallbackData ()
 
IMGUI_API void DeleteChars (int pos, int bytes_count)
 
IMGUI_API void InsertChars (int pos, const char *text, const char *text_end=NULL)
 
void SelectAll ()
 
void ClearSelection ()
 
bool HasSelection () const
 

Public Attributes

ImGuiInputTextFlags EventFlag
 
ImGuiInputTextFlags Flags
 
voidUserData
 
ImWchar EventChar
 
ImGuiKey EventKey
 
char * Buf
 
int BufTextLen
 
int BufSize
 
bool BufDirty
 
int CursorPos
 
int SelectionStart
 
int SelectionEnd
 

Detailed Description

Constructor & Destructor Documentation

◆ ImGuiInputTextCallbackData()

ImGuiInputTextCallbackData::ImGuiInputTextCallbackData ( )
3714{
3715 memset(this, 0, sizeof(*this));
3716}

Member Function Documentation

◆ ClearSelection()

void ImGuiInputTextCallbackData::ClearSelection ( )
inline
int SelectionEnd
Definition imgui.h:1933
int SelectionStart
Definition imgui.h:1932
int BufTextLen
Definition imgui.h:1928

◆ DeleteChars()

void ImGuiInputTextCallbackData::DeleteChars ( int  pos,
int  bytes_count 
)
3722{
3723 IM_ASSERT(pos + bytes_count <= BufTextLen);
3724 char* dst = Buf + pos;
3725 const char* src = Buf + pos + bytes_count;
3726 while (char c = *src++)
3727 *dst++ = c;
3728 *dst = '\0';
3729
3730 if (CursorPos >= pos + bytes_count)
3731 CursorPos -= bytes_count;
3732 else if (CursorPos >= pos)
3733 CursorPos = pos;
3735 BufDirty = true;
3736 BufTextLen -= bytes_count;
3737}
#define IM_ASSERT(_EXPR)
Definition imgui.h:81
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:14
int CursorPos
Definition imgui.h:1931
bool BufDirty
Definition imgui.h:1930
char * Buf
Definition imgui.h:1927

References Buf, BufDirty, BufTextLen, CursorPos, IM_ASSERT, SelectionEnd, and SelectionStart.

◆ HasSelection()

bool ImGuiInputTextCallbackData::HasSelection ( ) const
inline
1942{ return SelectionStart != SelectionEnd; }

◆ InsertChars()

void ImGuiInputTextCallbackData::InsertChars ( int  pos,
const char *  text,
const char *  text_end = NULL 
)
3740{
3741 const bool is_resizable = (Flags & ImGuiInputTextFlags_CallbackResize) != 0;
3742 const int new_text_len = new_text_end ? (int)(new_text_end - new_text) : (int)strlen(new_text);
3743 if (new_text_len + BufTextLen >= BufSize)
3744 {
3745 if (!is_resizable)
3746 return;
3747
3748 // Contrary to STB_TEXTEDIT_INSERTCHARS() this is working in the UTF8 buffer, hence the mildly similar code (until we remove the U16 buffer altogether!)
3749 ImGuiContext& g = *GImGui;
3750 ImGuiInputTextState* edit_state = &g.InputTextState;
3751 IM_ASSERT(edit_state->ID != 0 && g.ActiveId == edit_state->ID);
3752 IM_ASSERT(Buf == edit_state->TextA.Data);
3753 int new_buf_size = BufTextLen + ImClamp(new_text_len * 4, 32, ImMax(256, new_text_len)) + 1;
3754 edit_state->TextA.reserve(new_buf_size + 1);
3755 Buf = edit_state->TextA.Data;
3756 BufSize = edit_state->BufCapacityA = new_buf_size;
3757 }
3758
3759 if (BufTextLen != pos)
3760 memmove(Buf + pos + new_text_len, Buf + pos, (size_t)(BufTextLen - pos));
3761 memcpy(Buf + pos, new_text, (size_t)new_text_len * sizeof(char));
3762 Buf[BufTextLen + new_text_len] = '\0';
3763
3764 if (CursorPos >= pos)
3765 CursorPos += new_text_len;
3767 BufDirty = true;
3768 BufTextLen += new_text_len;
3769}
ImGuiContext * GImGui
Definition imgui.cpp:960
@ ImGuiInputTextFlags_CallbackResize
Definition imgui.h:974
static T ImClamp(T v, T mn, T mx)
Definition imgui_internal.h:411
static T ImMax(T lhs, T rhs)
Definition imgui_internal.h:410
Definition imgui_internal.h:1351
ImGuiID ActiveId
Definition imgui_internal.h:1398
ImGuiInputTextState InputTextState
Definition imgui_internal.h:1534
int BufSize
Definition imgui.h:1929
ImGuiInputTextFlags Flags
Definition imgui.h:1919
Definition imgui_internal.h:1018
int BufCapacityA
Definition imgui_internal.h:1025
ImGuiID ID
Definition imgui_internal.h:1019
ImVector< char > TextA
Definition imgui_internal.h:1022
void reserve(int new_capacity)
Definition imgui.h:1693
T * Data
Definition imgui.h:1657

References ImGuiContext::ActiveId, Buf, ImGuiInputTextState::BufCapacityA, BufDirty, BufSize, BufTextLen, CursorPos, ImVector< T >::Data, Flags, GImGui, ImGuiInputTextState::ID, IM_ASSERT, ImClamp(), ImGuiInputTextFlags_CallbackResize, ImMax(), ImGuiContext::InputTextState, ImVector< T >::reserve(), SelectionEnd, SelectionStart, and ImGuiInputTextState::TextA.

+ Here is the call graph for this function:

◆ SelectAll()

void ImGuiInputTextCallbackData::SelectAll ( )
inline

Member Data Documentation

◆ Buf

char* ImGuiInputTextCallbackData::Buf

◆ BufDirty

bool ImGuiInputTextCallbackData::BufDirty

◆ BufSize

int ImGuiInputTextCallbackData::BufSize

Referenced by ImGui::InputTextEx(), and InsertChars().

◆ BufTextLen

int ImGuiInputTextCallbackData::BufTextLen

◆ CursorPos

int ImGuiInputTextCallbackData::CursorPos

◆ EventChar

ImWchar ImGuiInputTextCallbackData::EventChar

◆ EventFlag

ImGuiInputTextFlags ImGuiInputTextCallbackData::EventFlag

◆ EventKey

ImGuiKey ImGuiInputTextCallbackData::EventKey

Referenced by ImGui::InputTextEx().

◆ Flags

ImGuiInputTextFlags ImGuiInputTextCallbackData::Flags

◆ SelectionEnd

int ImGuiInputTextCallbackData::SelectionEnd

◆ SelectionStart

int ImGuiInputTextCallbackData::SelectionStart

◆ UserData

void* ImGuiInputTextCallbackData::UserData

The documentation for this struct was generated from the following files: