Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
ImGui Namespace Reference

Functions

static void NavUpdate ()
 
static void NavUpdateWindowing ()
 
static void NavUpdateWindowingOverlay ()
 
static void NavUpdateMoveResult ()
 
static void NavUpdateInitResult ()
 
static float NavUpdatePageUpPageDown ()
 
static void NavUpdateAnyRequestFlag ()
 
static void NavEndFrame ()
 
static bool NavScoreItem (ImGuiNavItemData *result, ImRect cand)
 
static void NavApplyItemToResult (ImGuiNavItemData *result, ImGuiWindow *window, ImGuiID id, const ImRect &nav_bb_rel)
 
static void NavProcessItem (ImGuiWindow *window, const ImRect &nav_bb, ImGuiID id)
 
static ImVec2 NavCalcPreferredRefPos ()
 
static void NavSaveLastChildNavWindowIntoParent (ImGuiWindow *nav_window)
 
static ImGuiWindowNavRestoreLastChildNavWindow (ImGuiWindow *window)
 
static void NavRestoreLayer (ImGuiNavLayer layer)
 
static int FindWindowFocusIndex (ImGuiWindow *window)
 
static void ErrorCheckNewFrameSanityChecks ()
 
static void ErrorCheckEndFrameSanityChecks ()
 
static void UpdateSettings ()
 
static void UpdateMouseInputs ()
 
static void UpdateMouseWheel ()
 
static void UpdateTabFocus ()
 
static void UpdateDebugToolItemPicker ()
 
static bool UpdateWindowManualResize (ImGuiWindow *window, const ImVec2 &size_auto_fit, int *border_held, int resize_grip_count, ImU32 resize_grip_col[4], const ImRect &visibility_rect)
 
static void RenderWindowOuterBorders (ImGuiWindow *window)
 
static void RenderWindowDecorations (ImGuiWindow *window, const ImRect &title_bar_rect, bool title_bar_is_highlight, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size)
 
static void RenderWindowTitleBarContents (ImGuiWindow *window, const ImRect &title_bar_rect, const char *name, bool *p_open)
 
static void UpdateViewportsNewFrame ()
 
void ShowFontAtlas (ImFontAtlas *atlas)
 
IMGUI_API ImGuiContextCreateContext (ImFontAtlas *shared_font_atlas=NULL)
 
IMGUI_API void DestroyContext (ImGuiContext *ctx=NULL)
 
IMGUI_API ImGuiContextGetCurrentContext ()
 
IMGUI_API void SetCurrentContext (ImGuiContext *ctx)
 
IMGUI_API ImGuiIOGetIO ()
 
IMGUI_API ImGuiStyleGetStyle ()
 
IMGUI_API void NewFrame ()
 
IMGUI_API void EndFrame ()
 
IMGUI_API void Render ()
 
IMGUI_API ImDrawDataGetDrawData ()
 
IMGUI_API void ShowDemoWindow (bool *p_open=NULL)
 
IMGUI_API void ShowMetricsWindow (bool *p_open=NULL)
 
IMGUI_API void ShowAboutWindow (bool *p_open=NULL)
 
IMGUI_API void ShowStyleEditor (ImGuiStyle *ref=NULL)
 
IMGUI_API bool ShowStyleSelector (const char *label)
 
IMGUI_API void ShowFontSelector (const char *label)
 
IMGUI_API void ShowUserGuide ()
 
IMGUI_API const char * GetVersion ()
 
IMGUI_API void StyleColorsDark (ImGuiStyle *dst=NULL)
 
IMGUI_API void StyleColorsLight (ImGuiStyle *dst=NULL)
 
IMGUI_API void StyleColorsClassic (ImGuiStyle *dst=NULL)
 
IMGUI_API bool Begin (const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
 
IMGUI_API void End ()
 
IMGUI_API bool BeginChild (const char *str_id, const ImVec2 &size=ImVec2(0, 0), bool border=false, ImGuiWindowFlags flags=0)
 
IMGUI_API bool BeginChild (ImGuiID id, const ImVec2 &size=ImVec2(0, 0), bool border=false, ImGuiWindowFlags flags=0)
 
IMGUI_API void EndChild ()
 
IMGUI_API bool IsWindowAppearing ()
 
IMGUI_API bool IsWindowCollapsed ()
 
IMGUI_API bool IsWindowFocused (ImGuiFocusedFlags flags=0)
 
IMGUI_API bool IsWindowHovered (ImGuiHoveredFlags flags=0)
 
IMGUI_API ImDrawListGetWindowDrawList ()
 
IMGUI_API ImVec2 GetWindowPos ()
 
IMGUI_API ImVec2 GetWindowSize ()
 
IMGUI_API float GetWindowWidth ()
 
IMGUI_API float GetWindowHeight ()
 
IMGUI_API void SetNextWindowPos (const ImVec2 &pos, ImGuiCond cond=0, const ImVec2 &pivot=ImVec2(0, 0))
 
IMGUI_API void SetNextWindowSize (const ImVec2 &size, ImGuiCond cond=0)
 
IMGUI_API void SetNextWindowSizeConstraints (const ImVec2 &size_min, const ImVec2 &size_max, ImGuiSizeCallback custom_callback=NULL, void *custom_callback_data=NULL)
 
IMGUI_API void SetNextWindowContentSize (const ImVec2 &size)
 
IMGUI_API void SetNextWindowCollapsed (bool collapsed, ImGuiCond cond=0)
 
IMGUI_API void SetNextWindowFocus ()
 
IMGUI_API void SetNextWindowBgAlpha (float alpha)
 
IMGUI_API void SetWindowPos (const ImVec2 &pos, ImGuiCond cond=0)
 
IMGUI_API void SetWindowSize (const ImVec2 &size, ImGuiCond cond=0)
 
IMGUI_API void SetWindowCollapsed (bool collapsed, ImGuiCond cond=0)
 
IMGUI_API void SetWindowFocus ()
 
IMGUI_API void SetWindowFontScale (float scale)
 
IMGUI_API void SetWindowPos (const char *name, const ImVec2 &pos, ImGuiCond cond=0)
 
IMGUI_API void SetWindowSize (const char *name, const ImVec2 &size, ImGuiCond cond=0)
 
IMGUI_API void SetWindowCollapsed (const char *name, bool collapsed, ImGuiCond cond=0)
 
IMGUI_API void SetWindowFocus (const char *name)
 
IMGUI_API ImVec2 GetContentRegionAvail ()
 
IMGUI_API ImVec2 GetContentRegionMax ()
 
IMGUI_API ImVec2 GetWindowContentRegionMin ()
 
IMGUI_API ImVec2 GetWindowContentRegionMax ()
 
IMGUI_API float GetWindowContentRegionWidth ()
 
IMGUI_API float GetScrollX ()
 
IMGUI_API float GetScrollY ()
 
IMGUI_API void SetScrollX (float scroll_x)
 
IMGUI_API void SetScrollY (float scroll_y)
 
IMGUI_API float GetScrollMaxX ()
 
IMGUI_API float GetScrollMaxY ()
 
IMGUI_API void SetScrollHereX (float center_x_ratio=0.5f)
 
IMGUI_API void SetScrollHereY (float center_y_ratio=0.5f)
 
IMGUI_API void SetScrollFromPosX (float local_x, float center_x_ratio=0.5f)
 
IMGUI_API void SetScrollFromPosY (float local_y, float center_y_ratio=0.5f)
 
IMGUI_API void PushFont (ImFont *font)
 
IMGUI_API void PopFont ()
 
IMGUI_API void PushStyleColor (ImGuiCol idx, ImU32 col)
 
IMGUI_API void PushStyleColor (ImGuiCol idx, const ImVec4 &col)
 
IMGUI_API void PopStyleColor (int count=1)
 
IMGUI_API void PushStyleVar (ImGuiStyleVar idx, float val)
 
IMGUI_API void PushStyleVar (ImGuiStyleVar idx, const ImVec2 &val)
 
IMGUI_API void PopStyleVar (int count=1)
 
IMGUI_API void PushAllowKeyboardFocus (bool allow_keyboard_focus)
 
IMGUI_API void PopAllowKeyboardFocus ()
 
IMGUI_API void PushButtonRepeat (bool repeat)
 
IMGUI_API void PopButtonRepeat ()
 
IMGUI_API void PushItemWidth (float item_width)
 
IMGUI_API void PopItemWidth ()
 
IMGUI_API void SetNextItemWidth (float item_width)
 
IMGUI_API float CalcItemWidth ()
 
IMGUI_API void PushTextWrapPos (float wrap_local_pos_x=0.0f)
 
IMGUI_API void PopTextWrapPos ()
 
IMGUI_API ImFontGetFont ()
 
IMGUI_API float GetFontSize ()
 
IMGUI_API ImVec2 GetFontTexUvWhitePixel ()
 
IMGUI_API ImU32 GetColorU32 (ImGuiCol idx, float alpha_mul=1.0f)
 
IMGUI_API ImU32 GetColorU32 (const ImVec4 &col)
 
IMGUI_API ImU32 GetColorU32 (ImU32 col)
 
IMGUI_API const ImVec4GetStyleColorVec4 (ImGuiCol idx)
 
IMGUI_API void Separator ()
 
IMGUI_API void SameLine (float offset_from_start_x=0.0f, float spacing=-1.0f)
 
IMGUI_API void NewLine ()
 
IMGUI_API void Spacing ()
 
IMGUI_API void Dummy (const ImVec2 &size)
 
IMGUI_API void Indent (float indent_w=0.0f)
 
IMGUI_API void Unindent (float indent_w=0.0f)
 
IMGUI_API void BeginGroup ()
 
IMGUI_API void EndGroup ()
 
IMGUI_API ImVec2 GetCursorPos ()
 
IMGUI_API float GetCursorPosX ()
 
IMGUI_API float GetCursorPosY ()
 
IMGUI_API void SetCursorPos (const ImVec2 &local_pos)
 
IMGUI_API void SetCursorPosX (float local_x)
 
IMGUI_API void SetCursorPosY (float local_y)
 
IMGUI_API ImVec2 GetCursorStartPos ()
 
IMGUI_API ImVec2 GetCursorScreenPos ()
 
IMGUI_API void SetCursorScreenPos (const ImVec2 &pos)
 
IMGUI_API void AlignTextToFramePadding ()
 
IMGUI_API float GetTextLineHeight ()
 
IMGUI_API float GetTextLineHeightWithSpacing ()
 
IMGUI_API float GetFrameHeight ()
 
IMGUI_API float GetFrameHeightWithSpacing ()
 
IMGUI_API void PushID (const char *str_id)
 
IMGUI_API void PushID (const char *str_id_begin, const char *str_id_end)
 
IMGUI_API void PushID (const void *ptr_id)
 
IMGUI_API void PushID (int int_id)
 
IMGUI_API void PopID ()
 
IMGUI_API ImGuiID GetID (const char *str_id)
 
IMGUI_API ImGuiID GetID (const char *str_id_begin, const char *str_id_end)
 
IMGUI_API ImGuiID GetID (const void *ptr_id)
 
IMGUI_API void TextUnformatted (const char *text, const char *text_end=NULL)
 
IMGUI_API void Text (const char *fmt,...) IM_FMTARGS(1)
 
IMGUI_API void TextV (const char *fmt, va_list args) IM_FMTLIST(1)
 
IMGUI_API void TextColored (const ImVec4 &col, const char *fmt,...) IM_FMTARGS(2)
 
IMGUI_API void TextColoredV (const ImVec4 &col, const char *fmt, va_list args) IM_FMTLIST(2)
 
IMGUI_API void TextDisabled (const char *fmt,...) IM_FMTARGS(1)
 
IMGUI_API void TextDisabledV (const char *fmt, va_list args) IM_FMTLIST(1)
 
IMGUI_API void TextWrapped (const char *fmt,...) IM_FMTARGS(1)
 
IMGUI_API void TextWrappedV (const char *fmt, va_list args) IM_FMTLIST(1)
 
IMGUI_API void LabelText (const char *label, const char *fmt,...) IM_FMTARGS(2)
 
IMGUI_API void LabelTextV (const char *label, const char *fmt, va_list args) IM_FMTLIST(2)
 
IMGUI_API void BulletText (const char *fmt,...) IM_FMTARGS(1)
 
IMGUI_API void BulletTextV (const char *fmt, va_list args) IM_FMTLIST(1)
 
IMGUI_API bool Button (const char *label, const ImVec2 &size=ImVec2(0, 0))
 
IMGUI_API bool SmallButton (const char *label)
 
IMGUI_API bool InvisibleButton (const char *str_id, const ImVec2 &size, ImGuiButtonFlags flags=0)
 
IMGUI_API bool ArrowButton (const char *str_id, ImGuiDir dir)
 
IMGUI_API void Image (ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1), const ImVec4 &border_col=ImVec4(0, 0, 0, 0))
 
IMGUI_API bool ImageButton (ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), int frame_padding=-1, const ImVec4 &bg_col=ImVec4(0, 0, 0, 0), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1))
 
IMGUI_API bool Checkbox (const char *label, bool *v)
 
IMGUI_API bool CheckboxFlags (const char *label, int *flags, int flags_value)
 
IMGUI_API bool CheckboxFlags (const char *label, unsigned int *flags, unsigned int flags_value)
 
IMGUI_API bool RadioButton (const char *label, bool active)
 
IMGUI_API bool RadioButton (const char *label, int *v, int v_button)
 
IMGUI_API void ProgressBar (float fraction, const ImVec2 &size_arg=ImVec2(-FLT_MIN, 0), const char *overlay=NULL)
 
IMGUI_API void Bullet ()
 
IMGUI_API bool BeginCombo (const char *label, const char *preview_value, ImGuiComboFlags flags=0)
 
IMGUI_API void EndCombo ()
 
IMGUI_API bool Combo (const char *label, int *current_item, const char *const items[], int items_count, int popup_max_height_in_items=-1)
 
IMGUI_API bool Combo (const char *label, int *current_item, const char *items_separated_by_zeros, int popup_max_height_in_items=-1)
 
IMGUI_API bool Combo (const char *label, int *current_item, bool(*items_getter)(void *data, int idx, const char **out_text), void *data, int items_count, int popup_max_height_in_items=-1)
 
IMGUI_API bool DragFloat (const char *label, float *v, float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *format="%.3f", ImGuiSliderFlags flags=0)
 
IMGUI_API bool DragFloat2 (const char *label, float v[2], float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *format="%.3f", ImGuiSliderFlags flags=0)
 
IMGUI_API bool DragFloat3 (const char *label, float v[3], float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *format="%.3f", ImGuiSliderFlags flags=0)
 
IMGUI_API bool DragFloat4 (const char *label, float v[4], float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *format="%.3f", ImGuiSliderFlags flags=0)
 
IMGUI_API bool DragFloatRange2 (const char *label, float *v_current_min, float *v_current_max, float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *format="%.3f", const char *format_max=NULL, ImGuiSliderFlags flags=0)
 
IMGUI_API bool DragInt (const char *label, int *v, float v_speed=1.0f, int v_min=0, int v_max=0, const char *format="%d", ImGuiSliderFlags flags=0)
 
IMGUI_API bool DragInt2 (const char *label, int v[2], float v_speed=1.0f, int v_min=0, int v_max=0, const char *format="%d", ImGuiSliderFlags flags=0)
 
IMGUI_API bool DragInt3 (const char *label, int v[3], float v_speed=1.0f, int v_min=0, int v_max=0, const char *format="%d", ImGuiSliderFlags flags=0)
 
IMGUI_API bool DragInt4 (const char *label, int v[4], float v_speed=1.0f, int v_min=0, int v_max=0, const char *format="%d", ImGuiSliderFlags flags=0)
 
IMGUI_API bool DragIntRange2 (const char *label, int *v_current_min, int *v_current_max, float v_speed=1.0f, int v_min=0, int v_max=0, const char *format="%d", const char *format_max=NULL, ImGuiSliderFlags flags=0)
 
IMGUI_API bool DragScalar (const char *label, ImGuiDataType data_type, void *p_data, float v_speed=1.0f, const void *p_min=NULL, const void *p_max=NULL, const char *format=NULL, ImGuiSliderFlags flags=0)
 
IMGUI_API bool DragScalarN (const char *label, ImGuiDataType data_type, void *p_data, int components, float v_speed=1.0f, const void *p_min=NULL, const void *p_max=NULL, const char *format=NULL, ImGuiSliderFlags flags=0)
 
IMGUI_API bool SliderFloat (const char *label, float *v, float v_min, float v_max, const char *format="%.3f", ImGuiSliderFlags flags=0)
 
IMGUI_API bool SliderFloat2 (const char *label, float v[2], float v_min, float v_max, const char *format="%.3f", ImGuiSliderFlags flags=0)
 
IMGUI_API bool SliderFloat3 (const char *label, float v[3], float v_min, float v_max, const char *format="%.3f", ImGuiSliderFlags flags=0)
 
IMGUI_API bool SliderFloat4 (const char *label, float v[4], float v_min, float v_max, const char *format="%.3f", ImGuiSliderFlags flags=0)
 
IMGUI_API bool SliderAngle (const char *label, float *v_rad, float v_degrees_min=-360.0f, float v_degrees_max=+360.0f, const char *format="%.0f deg", ImGuiSliderFlags flags=0)
 
IMGUI_API bool SliderInt (const char *label, int *v, int v_min, int v_max, const char *format="%d", ImGuiSliderFlags flags=0)
 
IMGUI_API bool SliderInt2 (const char *label, int v[2], int v_min, int v_max, const char *format="%d", ImGuiSliderFlags flags=0)
 
IMGUI_API bool SliderInt3 (const char *label, int v[3], int v_min, int v_max, const char *format="%d", ImGuiSliderFlags flags=0)
 
IMGUI_API bool SliderInt4 (const char *label, int v[4], int v_min, int v_max, const char *format="%d", ImGuiSliderFlags flags=0)
 
IMGUI_API bool SliderScalar (const char *label, ImGuiDataType data_type, void *p_data, const void *p_min, const void *p_max, const char *format=NULL, ImGuiSliderFlags flags=0)
 
IMGUI_API bool SliderScalarN (const char *label, ImGuiDataType data_type, void *p_data, int components, const void *p_min, const void *p_max, const char *format=NULL, ImGuiSliderFlags flags=0)
 
IMGUI_API bool VSliderFloat (const char *label, const ImVec2 &size, float *v, float v_min, float v_max, const char *format="%.3f", ImGuiSliderFlags flags=0)
 
IMGUI_API bool VSliderInt (const char *label, const ImVec2 &size, int *v, int v_min, int v_max, const char *format="%d", ImGuiSliderFlags flags=0)
 
IMGUI_API bool VSliderScalar (const char *label, const ImVec2 &size, ImGuiDataType data_type, void *p_data, const void *p_min, const void *p_max, const char *format=NULL, ImGuiSliderFlags flags=0)
 
IMGUI_API bool InputText (const char *label, char *buf, size_t buf_size, ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=NULL, void *user_data=NULL)
 
IMGUI_API bool InputTextMultiline (const char *label, char *buf, size_t buf_size, const ImVec2 &size=ImVec2(0, 0), ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=NULL, void *user_data=NULL)
 
IMGUI_API bool InputTextWithHint (const char *label, const char *hint, char *buf, size_t buf_size, ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=NULL, void *user_data=NULL)
 
IMGUI_API bool InputFloat (const char *label, float *v, float step=0.0f, float step_fast=0.0f, const char *format="%.3f", ImGuiInputTextFlags flags=0)
 
IMGUI_API bool InputFloat2 (const char *label, float v[2], const char *format="%.3f", ImGuiInputTextFlags flags=0)
 
IMGUI_API bool InputFloat3 (const char *label, float v[3], const char *format="%.3f", ImGuiInputTextFlags flags=0)
 
IMGUI_API bool InputFloat4 (const char *label, float v[4], const char *format="%.3f", ImGuiInputTextFlags flags=0)
 
IMGUI_API bool InputInt (const char *label, int *v, int step=1, int step_fast=100, ImGuiInputTextFlags flags=0)
 
IMGUI_API bool InputInt2 (const char *label, int v[2], ImGuiInputTextFlags flags=0)
 
IMGUI_API bool InputInt3 (const char *label, int v[3], ImGuiInputTextFlags flags=0)
 
IMGUI_API bool InputInt4 (const char *label, int v[4], ImGuiInputTextFlags flags=0)
 
IMGUI_API bool InputDouble (const char *label, double *v, double step=0.0, double step_fast=0.0, const char *format="%.6f", ImGuiInputTextFlags flags=0)
 
IMGUI_API bool InputScalar (const char *label, ImGuiDataType data_type, void *p_data, const void *p_step=NULL, const void *p_step_fast=NULL, const char *format=NULL, ImGuiInputTextFlags flags=0)
 
IMGUI_API bool InputScalarN (const char *label, ImGuiDataType data_type, void *p_data, int components, const void *p_step=NULL, const void *p_step_fast=NULL, const char *format=NULL, ImGuiInputTextFlags flags=0)
 
IMGUI_API bool ColorEdit3 (const char *label, float col[3], ImGuiColorEditFlags flags=0)
 
IMGUI_API bool ColorEdit4 (const char *label, float col[4], ImGuiColorEditFlags flags=0, const char *current_label=NULL, const char *original_label=NULL)
 
IMGUI_API bool ColorPicker3 (const char *label, float col[3], ImGuiColorEditFlags flags=0)
 
IMGUI_API bool ColorPicker4 (const char *label, float col[4], ImGuiColorEditFlags flags=0, const float *ref_col=NULL, const char *current_label=NULL, const char *original_label=NULL)
 
IMGUI_API bool ColorButton (const char *desc_id, const ImVec4 &col, ImGuiColorEditFlags flags=0, ImVec2 size=ImVec2(0, 0))
 
IMGUI_API void SetColorEditOptions (ImGuiColorEditFlags flags)
 
IMGUI_API bool TreeNode (const char *label)
 
IMGUI_API bool TreeNode (const char *str_id, const char *fmt,...) IM_FMTARGS(2)
 
IMGUI_API bool TreeNode (const void *ptr_id, const char *fmt,...) IM_FMTARGS(2)
 
IMGUI_API bool TreeNodeV (const char *str_id, const char *fmt, va_list args) IM_FMTLIST(2)
 
IMGUI_API bool TreeNodeV (const void *ptr_id, const char *fmt, va_list args) IM_FMTLIST(2)
 
IMGUI_API bool TreeNodeEx (const char *label, ImGuiTreeNodeFlags flags=0)
 
IMGUI_API bool TreeNodeEx (const char *str_id, ImGuiTreeNodeFlags flags, const char *fmt,...) IM_FMTARGS(3)
 
IMGUI_API bool TreeNodeEx (const void *ptr_id, ImGuiTreeNodeFlags flags, const char *fmt,...) IM_FMTARGS(3)
 
IMGUI_API bool TreeNodeExV (const char *str_id, ImGuiTreeNodeFlags flags, const char *fmt, va_list args) IM_FMTLIST(3)
 
IMGUI_API bool TreeNodeExV (const void *ptr_id, ImGuiTreeNodeFlags flags, const char *fmt, va_list args) IM_FMTLIST(3)
 
IMGUI_API void TreePush (const char *str_id)
 
IMGUI_API void TreePush (const void *ptr_id=NULL)
 
IMGUI_API void TreePop ()
 
IMGUI_API float GetTreeNodeToLabelSpacing ()
 
IMGUI_API bool CollapsingHeader (const char *label, ImGuiTreeNodeFlags flags=0)
 
IMGUI_API bool CollapsingHeader (const char *label, bool *p_visible, ImGuiTreeNodeFlags flags=0)
 
IMGUI_API void SetNextItemOpen (bool is_open, ImGuiCond cond=0)
 
IMGUI_API bool Selectable (const char *label, bool selected=false, ImGuiSelectableFlags flags=0, const ImVec2 &size=ImVec2(0, 0))
 
IMGUI_API bool Selectable (const char *label, bool *p_selected, ImGuiSelectableFlags flags=0, const ImVec2 &size=ImVec2(0, 0))
 
IMGUI_API bool BeginListBox (const char *label, const ImVec2 &size=ImVec2(0, 0))
 
IMGUI_API void EndListBox ()
 
IMGUI_API bool ListBox (const char *label, int *current_item, const char *const items[], int items_count, int height_in_items=-1)
 
IMGUI_API bool ListBox (const char *label, int *current_item, bool(*items_getter)(void *data, int idx, const char **out_text), void *data, int items_count, int height_in_items=-1)
 
IMGUI_API void PlotLines (const char *label, const float *values, int values_count, int values_offset=0, const char *overlay_text=NULL, float scale_min=FLT_MAX, float scale_max=FLT_MAX, ImVec2 graph_size=ImVec2(0, 0), int stride=sizeof(float))
 
IMGUI_API void PlotLines (const char *label, float(*values_getter)(void *data, int idx), void *data, int values_count, int values_offset=0, const char *overlay_text=NULL, float scale_min=FLT_MAX, float scale_max=FLT_MAX, ImVec2 graph_size=ImVec2(0, 0))
 
IMGUI_API void PlotHistogram (const char *label, const float *values, int values_count, int values_offset=0, const char *overlay_text=NULL, float scale_min=FLT_MAX, float scale_max=FLT_MAX, ImVec2 graph_size=ImVec2(0, 0), int stride=sizeof(float))
 
IMGUI_API void PlotHistogram (const char *label, float(*values_getter)(void *data, int idx), void *data, int values_count, int values_offset=0, const char *overlay_text=NULL, float scale_min=FLT_MAX, float scale_max=FLT_MAX, ImVec2 graph_size=ImVec2(0, 0))
 
IMGUI_API void Value (const char *prefix, bool b)
 
IMGUI_API void Value (const char *prefix, int v)
 
IMGUI_API void Value (const char *prefix, unsigned int v)
 
IMGUI_API void Value (const char *prefix, float v, const char *float_format=NULL)
 
IMGUI_API bool BeginMenuBar ()
 
IMGUI_API void EndMenuBar ()
 
IMGUI_API bool BeginMainMenuBar ()
 
IMGUI_API void EndMainMenuBar ()
 
IMGUI_API bool BeginMenu (const char *label, bool enabled=true)
 
IMGUI_API void EndMenu ()
 
IMGUI_API bool MenuItem (const char *label, const char *shortcut=NULL, bool selected=false, bool enabled=true)
 
IMGUI_API bool MenuItem (const char *label, const char *shortcut, bool *p_selected, bool enabled=true)
 
IMGUI_API void BeginTooltip ()
 
IMGUI_API void EndTooltip ()
 
IMGUI_API void SetTooltip (const char *fmt,...) IM_FMTARGS(1)
 
IMGUI_API void SetTooltipV (const char *fmt, va_list args) IM_FMTLIST(1)
 
IMGUI_API bool BeginPopup (const char *str_id, ImGuiWindowFlags flags=0)
 
IMGUI_API bool BeginPopupModal (const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
 
IMGUI_API void EndPopup ()
 
IMGUI_API void OpenPopup (const char *str_id, ImGuiPopupFlags popup_flags=0)
 
IMGUI_API void OpenPopup (ImGuiID id, ImGuiPopupFlags popup_flags=0)
 
IMGUI_API void OpenPopupOnItemClick (const char *str_id=NULL, ImGuiPopupFlags popup_flags=1)
 
IMGUI_API void CloseCurrentPopup ()
 
IMGUI_API bool BeginPopupContextItem (const char *str_id=NULL, ImGuiPopupFlags popup_flags=1)
 
IMGUI_API bool BeginPopupContextWindow (const char *str_id=NULL, ImGuiPopupFlags popup_flags=1)
 
IMGUI_API bool BeginPopupContextVoid (const char *str_id=NULL, ImGuiPopupFlags popup_flags=1)
 
IMGUI_API bool IsPopupOpen (const char *str_id, ImGuiPopupFlags flags=0)
 
IMGUI_API bool BeginTable (const char *str_id, int column, ImGuiTableFlags flags=0, const ImVec2 &outer_size=ImVec2(0.0f, 0.0f), float inner_width=0.0f)
 
IMGUI_API void EndTable ()
 
IMGUI_API void TableNextRow (ImGuiTableRowFlags row_flags=0, float min_row_height=0.0f)
 
IMGUI_API bool TableNextColumn ()
 
IMGUI_API bool TableSetColumnIndex (int column_n)
 
IMGUI_API void TableSetupColumn (const char *label, ImGuiTableColumnFlags flags=0, float init_width_or_weight=0.0f, ImGuiID user_id=0)
 
IMGUI_API void TableSetupScrollFreeze (int cols, int rows)
 
IMGUI_API void TableHeadersRow ()
 
IMGUI_API void TableHeader (const char *label)
 
IMGUI_API ImGuiTableSortSpecsTableGetSortSpecs ()
 
IMGUI_API int TableGetColumnCount ()
 
IMGUI_API int TableGetColumnIndex ()
 
IMGUI_API int TableGetRowIndex ()
 
IMGUI_API const char * TableGetColumnName (int column_n=-1)
 
IMGUI_API ImGuiTableColumnFlags TableGetColumnFlags (int column_n=-1)
 
IMGUI_API void TableSetColumnEnabled (int column_n, bool v)
 
IMGUI_API void TableSetBgColor (ImGuiTableBgTarget target, ImU32 color, int column_n=-1)
 
IMGUI_API void Columns (int count=1, const char *id=NULL, bool border=true)
 
IMGUI_API void NextColumn ()
 
IMGUI_API int GetColumnIndex ()
 
IMGUI_API float GetColumnWidth (int column_index=-1)
 
IMGUI_API void SetColumnWidth (int column_index, float width)
 
IMGUI_API float GetColumnOffset (int column_index=-1)
 
IMGUI_API void SetColumnOffset (int column_index, float offset_x)
 
IMGUI_API int GetColumnsCount ()
 
IMGUI_API bool BeginTabBar (const char *str_id, ImGuiTabBarFlags flags=0)
 
IMGUI_API void EndTabBar ()
 
IMGUI_API bool BeginTabItem (const char *label, bool *p_open=NULL, ImGuiTabItemFlags flags=0)
 
IMGUI_API void EndTabItem ()
 
IMGUI_API bool TabItemButton (const char *label, ImGuiTabItemFlags flags=0)
 
IMGUI_API void SetTabItemClosed (const char *tab_or_docked_window_label)
 
IMGUI_API void LogToTTY (int auto_open_depth=-1)
 
IMGUI_API void LogToFile (int auto_open_depth=-1, const char *filename=NULL)
 
IMGUI_API void LogToClipboard (int auto_open_depth=-1)
 
IMGUI_API void LogFinish ()
 
IMGUI_API void LogButtons ()
 
IMGUI_API void LogText (const char *fmt,...) IM_FMTARGS(1)
 
IMGUI_API void LogTextV (const char *fmt, va_list args) IM_FMTLIST(1)
 
IMGUI_API bool BeginDragDropSource (ImGuiDragDropFlags flags=0)
 
IMGUI_API bool SetDragDropPayload (const char *type, const void *data, size_t sz, ImGuiCond cond=0)
 
IMGUI_API void EndDragDropSource ()
 
IMGUI_API bool BeginDragDropTarget ()
 
IMGUI_API const ImGuiPayloadAcceptDragDropPayload (const char *type, ImGuiDragDropFlags flags=0)
 
IMGUI_API void EndDragDropTarget ()
 
IMGUI_API const ImGuiPayloadGetDragDropPayload ()
 
IMGUI_API void PushClipRect (const ImVec2 &clip_rect_min, const ImVec2 &clip_rect_max, bool intersect_with_current_clip_rect)
 
IMGUI_API void PopClipRect ()
 
IMGUI_API void SetItemDefaultFocus ()
 
IMGUI_API void SetKeyboardFocusHere (int offset=0)
 
IMGUI_API bool IsItemHovered (ImGuiHoveredFlags flags=0)
 
IMGUI_API bool IsItemActive ()
 
IMGUI_API bool IsItemFocused ()
 
IMGUI_API bool IsItemClicked (ImGuiMouseButton mouse_button=0)
 
IMGUI_API bool IsItemVisible ()
 
IMGUI_API bool IsItemEdited ()
 
IMGUI_API bool IsItemActivated ()
 
IMGUI_API bool IsItemDeactivated ()
 
IMGUI_API bool IsItemDeactivatedAfterEdit ()
 
IMGUI_API bool IsItemToggledOpen ()
 
IMGUI_API bool IsAnyItemHovered ()
 
IMGUI_API bool IsAnyItemActive ()
 
IMGUI_API bool IsAnyItemFocused ()
 
IMGUI_API ImVec2 GetItemRectMin ()
 
IMGUI_API ImVec2 GetItemRectMax ()
 
IMGUI_API ImVec2 GetItemRectSize ()
 
IMGUI_API void SetItemAllowOverlap ()
 
IMGUI_API ImGuiViewportGetMainViewport ()
 
IMGUI_API bool IsRectVisible (const ImVec2 &size)
 
IMGUI_API bool IsRectVisible (const ImVec2 &rect_min, const ImVec2 &rect_max)
 
IMGUI_API double GetTime ()
 
IMGUI_API int GetFrameCount ()
 
IMGUI_API ImDrawListGetBackgroundDrawList ()
 
IMGUI_API ImDrawListGetForegroundDrawList ()
 
IMGUI_API ImDrawListSharedDataGetDrawListSharedData ()
 
IMGUI_API const char * GetStyleColorName (ImGuiCol idx)
 
IMGUI_API void SetStateStorage (ImGuiStorage *storage)
 
IMGUI_API ImGuiStorageGetStateStorage ()
 
IMGUI_API void CalcListClipping (int items_count, float items_height, int *out_items_display_start, int *out_items_display_end)
 
IMGUI_API bool BeginChildFrame (ImGuiID id, const ImVec2 &size, ImGuiWindowFlags flags=0)
 
IMGUI_API void EndChildFrame ()
 
IMGUI_API ImVec2 CalcTextSize (const char *text, const char *text_end=NULL, bool hide_text_after_double_hash=false, float wrap_width=-1.0f)
 
IMGUI_API ImVec4 ColorConvertU32ToFloat4 (ImU32 in)
 
IMGUI_API ImU32 ColorConvertFloat4ToU32 (const ImVec4 &in)
 
IMGUI_API void ColorConvertRGBtoHSV (float r, float g, float b, float &out_h, float &out_s, float &out_v)
 
IMGUI_API void ColorConvertHSVtoRGB (float h, float s, float v, float &out_r, float &out_g, float &out_b)
 
IMGUI_API int GetKeyIndex (ImGuiKey imgui_key)
 
IMGUI_API bool IsKeyDown (int user_key_index)
 
IMGUI_API bool IsKeyPressed (int user_key_index, bool repeat=true)
 
IMGUI_API bool IsKeyReleased (int user_key_index)
 
IMGUI_API int GetKeyPressedAmount (int key_index, float repeat_delay, float rate)
 
IMGUI_API void CaptureKeyboardFromApp (bool want_capture_keyboard_value=true)
 
IMGUI_API bool IsMouseDown (ImGuiMouseButton button)
 
IMGUI_API bool IsMouseClicked (ImGuiMouseButton button, bool repeat=false)
 
IMGUI_API bool IsMouseReleased (ImGuiMouseButton button)
 
IMGUI_API bool IsMouseDoubleClicked (ImGuiMouseButton button)
 
IMGUI_API bool IsMouseHoveringRect (const ImVec2 &r_min, const ImVec2 &r_max, bool clip=true)
 
IMGUI_API bool IsMousePosValid (const ImVec2 *mouse_pos=NULL)
 
IMGUI_API bool IsAnyMouseDown ()
 
IMGUI_API ImVec2 GetMousePos ()
 
IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup ()
 
IMGUI_API bool IsMouseDragging (ImGuiMouseButton button, float lock_threshold=-1.0f)
 
IMGUI_API ImVec2 GetMouseDragDelta (ImGuiMouseButton button=0, float lock_threshold=-1.0f)
 
IMGUI_API void ResetMouseDragDelta (ImGuiMouseButton button=0)
 
IMGUI_API ImGuiMouseCursor GetMouseCursor ()
 
IMGUI_API void SetMouseCursor (ImGuiMouseCursor cursor_type)
 
IMGUI_API void CaptureMouseFromApp (bool want_capture_mouse_value=true)
 
IMGUI_API const char * GetClipboardText ()
 
IMGUI_API void SetClipboardText (const char *text)
 
IMGUI_API void LoadIniSettingsFromDisk (const char *ini_filename)
 
IMGUI_API void LoadIniSettingsFromMemory (const char *ini_data, size_t ini_size=0)
 
IMGUI_API void SaveIniSettingsToDisk (const char *ini_filename)
 
IMGUI_API const char * SaveIniSettingsToMemory (size_t *out_ini_size=NULL)
 
IMGUI_API bool DebugCheckVersionAndDataLayout (const char *version_str, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_drawvert, size_t sz_drawidx)
 
IMGUI_API void SetAllocatorFunctions (ImGuiMemAllocFunc alloc_func, ImGuiMemFreeFunc free_func, void *user_data=NULL)
 
IMGUI_API void GetAllocatorFunctions (ImGuiMemAllocFunc *p_alloc_func, ImGuiMemFreeFunc *p_free_func, void **p_user_data)
 
IMGUI_API voidMemAlloc (size_t size)
 
IMGUI_API void MemFree (void *ptr)
 
IMGUI_API bool ListBoxHeader (const char *label, int items_count, int height_in_items=-1)
 
static bool ListBoxHeader (const char *label, const ImVec2 &size=ImVec2(0, 0))
 
static void ListBoxFooter ()
 
static void OpenPopupContextItem (const char *str_id=NULL, ImGuiMouseButton mb=1)
 
IMGUI_API bool DragScalar (const char *label, ImGuiDataType data_type, void *p_data, float v_speed, const void *p_min, const void *p_max, const char *format, float power)
 
IMGUI_API bool DragScalarN (const char *label, ImGuiDataType data_type, void *p_data, int components, float v_speed, const void *p_min, const void *p_max, const char *format, float power)
 
static bool DragFloat (const char *label, float *v, float v_speed, float v_min, float v_max, const char *format, float power)
 
static bool DragFloat2 (const char *label, float v[2], float v_speed, float v_min, float v_max, const char *format, float power)
 
static bool DragFloat3 (const char *label, float v[3], float v_speed, float v_min, float v_max, const char *format, float power)
 
static bool DragFloat4 (const char *label, float v[4], float v_speed, float v_min, float v_max, const char *format, float power)
 
IMGUI_API bool SliderScalar (const char *label, ImGuiDataType data_type, void *p_data, const void *p_min, const void *p_max, const char *format, float power)
 
IMGUI_API bool SliderScalarN (const char *label, ImGuiDataType data_type, void *p_data, int components, const void *p_min, const void *p_max, const char *format, float power)
 
static bool SliderFloat (const char *label, float *v, float v_min, float v_max, const char *format, float power)
 
static bool SliderFloat2 (const char *label, float v[2], float v_min, float v_max, const char *format, float power)
 
static bool SliderFloat3 (const char *label, float v[3], float v_min, float v_max, const char *format, float power)
 
static bool SliderFloat4 (const char *label, float v[4], float v_min, float v_max, const char *format, float power)
 
static bool BeginPopupContextWindow (const char *str_id, ImGuiMouseButton mb, bool over_items)
 
static void TreeAdvanceToLabelPos ()
 
static void SetNextTreeNodeOpen (bool open, ImGuiCond cond=0)
 
static float GetContentRegionAvailWidth ()
 
static ImDrawListGetOverlayDrawList ()
 
ImGuiWindowGetCurrentWindowRead ()
 
ImGuiWindowGetCurrentWindow ()
 
IMGUI_API ImGuiWindowFindWindowByID (ImGuiID id)
 
IMGUI_API ImGuiWindowFindWindowByName (const char *name)
 
IMGUI_API void UpdateWindowParentAndRootLinks (ImGuiWindow *window, ImGuiWindowFlags flags, ImGuiWindow *parent_window)
 
IMGUI_API ImVec2 CalcWindowNextAutoFitSize (ImGuiWindow *window)
 
IMGUI_API bool IsWindowChildOf (ImGuiWindow *window, ImGuiWindow *potential_parent)
 
IMGUI_API bool IsWindowAbove (ImGuiWindow *potential_above, ImGuiWindow *potential_below)
 
IMGUI_API bool IsWindowNavFocusable (ImGuiWindow *window)
 
IMGUI_API ImRect GetWindowAllowedExtentRect (ImGuiWindow *window)
 
IMGUI_API void SetWindowPos (ImGuiWindow *window, const ImVec2 &pos, ImGuiCond cond=0)
 
IMGUI_API void SetWindowSize (ImGuiWindow *window, const ImVec2 &size, ImGuiCond cond=0)
 
IMGUI_API void SetWindowCollapsed (ImGuiWindow *window, bool collapsed, ImGuiCond cond=0)
 
IMGUI_API void SetWindowHitTestHole (ImGuiWindow *window, const ImVec2 &pos, const ImVec2 &size)
 
IMGUI_API void FocusWindow (ImGuiWindow *window)
 
IMGUI_API void FocusTopMostWindowUnderOne (ImGuiWindow *under_this_window, ImGuiWindow *ignore_window)
 
IMGUI_API void BringWindowToFocusFront (ImGuiWindow *window)
 
IMGUI_API void BringWindowToDisplayFront (ImGuiWindow *window)
 
IMGUI_API void BringWindowToDisplayBack (ImGuiWindow *window)
 
IMGUI_API void SetCurrentFont (ImFont *font)
 
ImFontGetDefaultFont ()
 
ImDrawListGetForegroundDrawList (ImGuiWindow *window)
 
IMGUI_API ImDrawListGetBackgroundDrawList (ImGuiViewport *viewport)
 
IMGUI_API ImDrawListGetForegroundDrawList (ImGuiViewport *viewport)
 
IMGUI_API void Initialize (ImGuiContext *context)
 
IMGUI_API void Shutdown (ImGuiContext *context)
 
IMGUI_API void UpdateHoveredWindowAndCaptureFlags ()
 
IMGUI_API void StartMouseMovingWindow (ImGuiWindow *window)
 
IMGUI_API void UpdateMouseMovingWindowNewFrame ()
 
IMGUI_API void UpdateMouseMovingWindowEndFrame ()
 
IMGUI_API ImGuiID AddContextHook (ImGuiContext *context, const ImGuiContextHook *hook)
 
IMGUI_API void RemoveContextHook (ImGuiContext *context, ImGuiID hook_to_remove)
 
IMGUI_API void CallContextHooks (ImGuiContext *context, ImGuiContextHookType type)
 
IMGUI_API void MarkIniSettingsDirty ()
 
IMGUI_API void MarkIniSettingsDirty (ImGuiWindow *window)
 
IMGUI_API void ClearIniSettings ()
 
IMGUI_API ImGuiWindowSettingsCreateNewWindowSettings (const char *name)
 
IMGUI_API ImGuiWindowSettingsFindWindowSettings (ImGuiID id)
 
IMGUI_API ImGuiWindowSettingsFindOrCreateWindowSettings (const char *name)
 
IMGUI_API ImGuiSettingsHandlerFindSettingsHandler (const char *type_name)
 
IMGUI_API void SetNextWindowScroll (const ImVec2 &scroll)
 
IMGUI_API void SetScrollX (ImGuiWindow *window, float scroll_x)
 
IMGUI_API void SetScrollY (ImGuiWindow *window, float scroll_y)
 
IMGUI_API void SetScrollFromPosX (ImGuiWindow *window, float local_x, float center_x_ratio)
 
IMGUI_API void SetScrollFromPosY (ImGuiWindow *window, float local_y, float center_y_ratio)
 
IMGUI_API ImVec2 ScrollToBringRectIntoView (ImGuiWindow *window, const ImRect &item_rect)
 
ImGuiID GetItemID ()
 
ImGuiItemStatusFlags GetItemStatusFlags ()
 
ImGuiID GetActiveID ()
 
ImGuiID GetFocusID ()
 
ImGuiItemFlags GetItemFlags ()
 
IMGUI_API void SetActiveID (ImGuiID id, ImGuiWindow *window)
 
IMGUI_API void SetFocusID (ImGuiID id, ImGuiWindow *window)
 
IMGUI_API void ClearActiveID ()
 
IMGUI_API ImGuiID GetHoveredID ()
 
IMGUI_API void SetHoveredID (ImGuiID id)
 
IMGUI_API void KeepAliveID (ImGuiID id)
 
IMGUI_API void MarkItemEdited (ImGuiID id)
 
IMGUI_API void PushOverrideID (ImGuiID id)
 
IMGUI_API ImGuiID GetIDWithSeed (const char *str_id_begin, const char *str_id_end, ImGuiID seed)
 
IMGUI_API void ItemSize (const ImVec2 &size, float text_baseline_y=-1.0f)
 
IMGUI_API void ItemSize (const ImRect &bb, float text_baseline_y=-1.0f)
 
IMGUI_API bool ItemAdd (const ImRect &bb, ImGuiID id, const ImRect *nav_bb=NULL, ImGuiItemAddFlags flags=0)
 
IMGUI_API bool ItemHoverable (const ImRect &bb, ImGuiID id)
 
IMGUI_API void ItemFocusable (ImGuiWindow *window, ImGuiID id)
 
IMGUI_API bool IsClippedEx (const ImRect &bb, ImGuiID id, bool clip_even_when_logged)
 
IMGUI_API void SetLastItemData (ImGuiWindow *window, ImGuiID item_id, ImGuiItemStatusFlags status_flags, const ImRect &item_rect)
 
IMGUI_API ImVec2 CalcItemSize (ImVec2 size, float default_w, float default_h)
 
IMGUI_API float CalcWrapWidthForPos (const ImVec2 &pos, float wrap_pos_x)
 
IMGUI_API void PushMultiItemsWidths (int components, float width_full)
 
IMGUI_API void PushItemFlag (ImGuiItemFlags option, bool enabled)
 
IMGUI_API void PopItemFlag ()
 
IMGUI_API bool IsItemToggledSelection ()
 
IMGUI_API ImVec2 GetContentRegionMaxAbs ()
 
IMGUI_API void ShrinkWidths (ImGuiShrinkWidthItem *items, int count, float width_excess)
 
bool FocusableItemRegister (ImGuiWindow *window, ImGuiID id)
 
void FocusableItemUnregister (ImGuiWindow *window)
 
IMGUI_API void LogBegin (ImGuiLogType type, int auto_open_depth)
 
IMGUI_API void LogToBuffer (int auto_open_depth=-1)
 
IMGUI_API void LogRenderedText (const ImVec2 *ref_pos, const char *text, const char *text_end=NULL)
 
IMGUI_API void LogSetNextTextDecoration (const char *prefix, const char *suffix)
 
IMGUI_API bool BeginChildEx (const char *name, ImGuiID id, const ImVec2 &size_arg, bool border, ImGuiWindowFlags flags)
 
IMGUI_API void OpenPopupEx (ImGuiID id, ImGuiPopupFlags popup_flags=ImGuiPopupFlags_None)
 
IMGUI_API void ClosePopupToLevel (int remaining, bool restore_focus_to_window_under_popup)
 
IMGUI_API void ClosePopupsOverWindow (ImGuiWindow *ref_window, bool restore_focus_to_window_under_popup)
 
IMGUI_API bool IsPopupOpen (ImGuiID id, ImGuiPopupFlags popup_flags)
 
IMGUI_API bool BeginPopupEx (ImGuiID id, ImGuiWindowFlags extra_flags)
 
IMGUI_API void BeginTooltipEx (ImGuiWindowFlags extra_flags, ImGuiTooltipFlags tooltip_flags)
 
IMGUI_API ImGuiWindowGetTopMostPopupModal ()
 
IMGUI_API ImVec2 FindBestWindowPosForPopup (ImGuiWindow *window)
 
IMGUI_API ImVec2 FindBestWindowPosForPopupEx (const ImVec2 &ref_pos, const ImVec2 &size, ImGuiDir *last_dir, const ImRect &r_outer, const ImRect &r_avoid, ImGuiPopupPositionPolicy policy)
 
IMGUI_API bool BeginViewportSideBar (const char *name, ImGuiViewport *viewport, ImGuiDir dir, float size, ImGuiWindowFlags window_flags)
 
IMGUI_API void NavInitWindow (ImGuiWindow *window, bool force_reinit)
 
IMGUI_API bool NavMoveRequestButNoResultYet ()
 
IMGUI_API void NavMoveRequestCancel ()
 
IMGUI_API void NavMoveRequestForward (ImGuiDir move_dir, ImGuiDir clip_dir, const ImRect &bb_rel, ImGuiNavMoveFlags move_flags)
 
IMGUI_API void NavMoveRequestTryWrapping (ImGuiWindow *window, ImGuiNavMoveFlags move_flags)
 
IMGUI_API float GetNavInputAmount (ImGuiNavInput n, ImGuiInputReadMode mode)
 
IMGUI_API ImVec2 GetNavInputAmount2d (ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor=0.0f, float fast_factor=0.0f)
 
IMGUI_API int CalcTypematicRepeatAmount (float t0, float t1, float repeat_delay, float repeat_rate)
 
IMGUI_API void ActivateItem (ImGuiID id)
 
IMGUI_API void SetNavID (ImGuiID id, ImGuiNavLayer nav_layer, ImGuiID focus_scope_id, const ImRect &rect_rel)
 
IMGUI_API void PushFocusScope (ImGuiID id)
 
IMGUI_API void PopFocusScope ()
 
ImGuiID GetFocusedFocusScope ()
 
ImGuiID GetFocusScope ()
 
IMGUI_API void SetItemUsingMouseWheel ()
 
bool IsActiveIdUsingNavDir (ImGuiDir dir)
 
bool IsActiveIdUsingNavInput (ImGuiNavInput input)
 
bool IsActiveIdUsingKey (ImGuiKey key)
 
IMGUI_API bool IsMouseDragPastThreshold (ImGuiMouseButton button, float lock_threshold=-1.0f)
 
bool IsKeyPressedMap (ImGuiKey key, bool repeat=true)
 
bool IsNavInputDown (ImGuiNavInput n)
 
bool IsNavInputTest (ImGuiNavInput n, ImGuiInputReadMode rm)
 
IMGUI_API ImGuiKeyModFlags GetMergedKeyModFlags ()
 
IMGUI_API bool BeginDragDropTargetCustom (const ImRect &bb, ImGuiID id)
 
IMGUI_API void ClearDragDrop ()
 
IMGUI_API bool IsDragDropPayloadBeingAccepted ()
 
IMGUI_API void SetWindowClipRectBeforeSetChannel (ImGuiWindow *window, const ImRect &clip_rect)
 
IMGUI_API void BeginColumns (const char *str_id, int count, ImGuiOldColumnFlags flags=0)
 
IMGUI_API void EndColumns ()
 
IMGUI_API void PushColumnClipRect (int column_index)
 
IMGUI_API void PushColumnsBackground ()
 
IMGUI_API void PopColumnsBackground ()
 
IMGUI_API ImGuiID GetColumnsID (const char *str_id, int count)
 
IMGUI_API ImGuiOldColumnsFindOrCreateColumns (ImGuiWindow *window, ImGuiID id)
 
IMGUI_API float GetColumnOffsetFromNorm (const ImGuiOldColumns *columns, float offset_norm)
 
IMGUI_API float GetColumnNormFromOffset (const ImGuiOldColumns *columns, float offset)
 
IMGUI_API void TableOpenContextMenu (int column_n=-1)
 
IMGUI_API void TableSetColumnWidth (int column_n, float width)
 
IMGUI_API void TableSetColumnSortDirection (int column_n, ImGuiSortDirection sort_direction, bool append_to_sort_specs)
 
IMGUI_API int TableGetHoveredColumn ()
 
IMGUI_API float TableGetHeaderRowHeight ()
 
IMGUI_API void TablePushBackgroundChannel ()
 
IMGUI_API void TablePopBackgroundChannel ()
 
ImGuiTableGetCurrentTable ()
 
IMGUI_API ImGuiTableTableFindByID (ImGuiID id)
 
IMGUI_API bool BeginTableEx (const char *name, ImGuiID id, int columns_count, ImGuiTableFlags flags=0, const ImVec2 &outer_size=ImVec2(0, 0), float inner_width=0.0f)
 
IMGUI_API void TableBeginInitMemory (ImGuiTable *table, int columns_count)
 
IMGUI_API void TableBeginApplyRequests (ImGuiTable *table)
 
IMGUI_API void TableSetupDrawChannels (ImGuiTable *table)
 
IMGUI_API void TableUpdateLayout (ImGuiTable *table)
 
IMGUI_API void TableUpdateBorders (ImGuiTable *table)
 
IMGUI_API void TableUpdateColumnsWeightFromWidth (ImGuiTable *table)
 
IMGUI_API void TableDrawBorders (ImGuiTable *table)
 
IMGUI_API void TableDrawContextMenu (ImGuiTable *table)
 
IMGUI_API void TableMergeDrawChannels (ImGuiTable *table)
 
IMGUI_API void TableSortSpecsSanitize (ImGuiTable *table)
 
IMGUI_API void TableSortSpecsBuild (ImGuiTable *table)
 
IMGUI_API ImGuiSortDirection TableGetColumnNextSortDirection (ImGuiTableColumn *column)
 
IMGUI_API void TableFixColumnSortDirection (ImGuiTable *table, ImGuiTableColumn *column)
 
IMGUI_API float TableGetColumnWidthAuto (ImGuiTable *table, ImGuiTableColumn *column)
 
IMGUI_API void TableBeginRow (ImGuiTable *table)
 
IMGUI_API void TableEndRow (ImGuiTable *table)
 
IMGUI_API void TableBeginCell (ImGuiTable *table, int column_n)
 
IMGUI_API void TableEndCell (ImGuiTable *table)
 
IMGUI_API ImRect TableGetCellBgRect (const ImGuiTable *table, int column_n)
 
IMGUI_API const char * TableGetColumnName (const ImGuiTable *table, int column_n)
 
IMGUI_API ImGuiID TableGetColumnResizeID (const ImGuiTable *table, int column_n, int instance_no=0)
 
IMGUI_API float TableGetMaxColumnWidth (const ImGuiTable *table, int column_n)
 
IMGUI_API void TableSetColumnWidthAutoSingle (ImGuiTable *table, int column_n)
 
IMGUI_API void TableSetColumnWidthAutoAll (ImGuiTable *table)
 
IMGUI_API void TableRemove (ImGuiTable *table)
 
IMGUI_API void TableGcCompactTransientBuffers (ImGuiTable *table)
 
IMGUI_API void TableGcCompactTransientBuffers (ImGuiTableTempData *table)
 
IMGUI_API void TableGcCompactSettings ()
 
IMGUI_API void TableLoadSettings (ImGuiTable *table)
 
IMGUI_API void TableSaveSettings (ImGuiTable *table)
 
IMGUI_API void TableResetSettings (ImGuiTable *table)
 
IMGUI_API ImGuiTableSettingsTableGetBoundSettings (ImGuiTable *table)
 
IMGUI_API void TableSettingsInstallHandler (ImGuiContext *context)
 
IMGUI_API ImGuiTableSettingsTableSettingsCreate (ImGuiID id, int columns_count)
 
IMGUI_API ImGuiTableSettingsTableSettingsFindByID (ImGuiID id)
 
IMGUI_API bool BeginTabBarEx (ImGuiTabBar *tab_bar, const ImRect &bb, ImGuiTabBarFlags flags)
 
IMGUI_API ImGuiTabItemTabBarFindTabByID (ImGuiTabBar *tab_bar, ImGuiID tab_id)
 
IMGUI_API void TabBarRemoveTab (ImGuiTabBar *tab_bar, ImGuiID tab_id)
 
IMGUI_API void TabBarCloseTab (ImGuiTabBar *tab_bar, ImGuiTabItem *tab)
 
IMGUI_API void TabBarQueueReorder (ImGuiTabBar *tab_bar, const ImGuiTabItem *tab, int offset)
 
IMGUI_API void TabBarQueueReorderFromMousePos (ImGuiTabBar *tab_bar, const ImGuiTabItem *tab, ImVec2 mouse_pos)
 
IMGUI_API bool TabBarProcessReorder (ImGuiTabBar *tab_bar)
 
IMGUI_API bool TabItemEx (ImGuiTabBar *tab_bar, const char *label, bool *p_open, ImGuiTabItemFlags flags)
 
IMGUI_API ImVec2 TabItemCalcSize (const char *label, bool has_close_button)
 
IMGUI_API void TabItemBackground (ImDrawList *draw_list, const ImRect &bb, ImGuiTabItemFlags flags, ImU32 col)
 
IMGUI_API void TabItemLabelAndCloseButton (ImDrawList *draw_list, const ImRect &bb, ImGuiTabItemFlags flags, ImVec2 frame_padding, const char *label, ImGuiID tab_id, ImGuiID close_button_id, bool is_contents_visible, bool *out_just_closed, bool *out_text_clipped)
 
IMGUI_API void RenderText (ImVec2 pos, const char *text, const char *text_end=NULL, bool hide_text_after_hash=true)
 
IMGUI_API void RenderTextWrapped (ImVec2 pos, const char *text, const char *text_end, float wrap_width)
 
IMGUI_API void RenderTextClipped (const ImVec2 &pos_min, const ImVec2 &pos_max, const char *text, const char *text_end, const ImVec2 *text_size_if_known, const ImVec2 &align=ImVec2(0, 0), const ImRect *clip_rect=NULL)
 
IMGUI_API void RenderTextClippedEx (ImDrawList *draw_list, const ImVec2 &pos_min, const ImVec2 &pos_max, const char *text, const char *text_end, const ImVec2 *text_size_if_known, const ImVec2 &align=ImVec2(0, 0), const ImRect *clip_rect=NULL)
 
IMGUI_API void RenderTextEllipsis (ImDrawList *draw_list, const ImVec2 &pos_min, const ImVec2 &pos_max, float clip_max_x, float ellipsis_max_x, const char *text, const char *text_end, const ImVec2 *text_size_if_known)
 
IMGUI_API void RenderFrame (ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border=true, float rounding=0.0f)
 
IMGUI_API void RenderFrameBorder (ImVec2 p_min, ImVec2 p_max, float rounding=0.0f)
 
IMGUI_API void RenderColorRectWithAlphaCheckerboard (ImDrawList *draw_list, ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding=0.0f, ImDrawFlags flags=0)
 
IMGUI_API void RenderNavHighlight (const ImRect &bb, ImGuiID id, ImGuiNavHighlightFlags flags=ImGuiNavHighlightFlags_TypeDefault)
 
IMGUI_API const char * FindRenderedTextEnd (const char *text, const char *text_end=NULL)
 
IMGUI_API void RenderArrow (ImDrawList *draw_list, ImVec2 pos, ImU32 col, ImGuiDir dir, float scale=1.0f)
 
IMGUI_API void RenderBullet (ImDrawList *draw_list, ImVec2 pos, ImU32 col)
 
IMGUI_API void RenderCheckMark (ImDrawList *draw_list, ImVec2 pos, ImU32 col, float sz)
 
IMGUI_API void RenderMouseCursor (ImDrawList *draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow)
 
IMGUI_API void RenderArrowPointingAt (ImDrawList *draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col)
 
IMGUI_API void RenderRectFilledRangeH (ImDrawList *draw_list, const ImRect &rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding)
 
IMGUI_API void RenderRectFilledWithHole (ImDrawList *draw_list, ImRect outer, ImRect inner, ImU32 col, float rounding)
 
void RenderArrow (ImVec2 pos, ImGuiDir dir, float scale=1.0f)
 
void RenderBullet (ImVec2 pos)
 
IMGUI_API void TextEx (const char *text, const char *text_end=NULL, ImGuiTextFlags flags=0)
 
IMGUI_API bool ButtonEx (const char *label, const ImVec2 &size_arg=ImVec2(0, 0), ImGuiButtonFlags flags=0)
 
IMGUI_API bool CloseButton (ImGuiID id, const ImVec2 &pos)
 
IMGUI_API bool CollapseButton (ImGuiID id, const ImVec2 &pos)
 
IMGUI_API bool ArrowButtonEx (const char *str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags=0)
 
IMGUI_API void Scrollbar (ImGuiAxis axis)
 
IMGUI_API bool ScrollbarEx (const ImRect &bb, ImGuiID id, ImGuiAxis axis, float *p_scroll_v, float avail_v, float contents_v, ImDrawFlags flags)
 
IMGUI_API bool ImageButtonEx (ImGuiID id, ImTextureID texture_id, const ImVec2 &size, const ImVec2 &uv0, const ImVec2 &uv1, const ImVec2 &padding, const ImVec4 &bg_col, const ImVec4 &tint_col)
 
IMGUI_API ImRect GetWindowScrollbarRect (ImGuiWindow *window, ImGuiAxis axis)
 
IMGUI_API ImGuiID GetWindowScrollbarID (ImGuiWindow *window, ImGuiAxis axis)
 
IMGUI_API ImGuiID GetWindowResizeCornerID (ImGuiWindow *window, int n)
 
IMGUI_API ImGuiID GetWindowResizeBorderID (ImGuiWindow *window, ImGuiDir dir)
 
IMGUI_API void SeparatorEx (ImGuiSeparatorFlags flags)
 
IMGUI_API bool CheckboxFlags (const char *label, ImS64 *flags, ImS64 flags_value)
 
IMGUI_API bool CheckboxFlags (const char *label, ImU64 *flags, ImU64 flags_value)
 
IMGUI_API bool ButtonBehavior (const ImRect &bb, ImGuiID id, bool *out_hovered, bool *out_held, ImGuiButtonFlags flags=0)
 
IMGUI_API bool DragBehavior (ImGuiID id, ImGuiDataType data_type, void *p_v, float v_speed, const void *p_min, const void *p_max, const char *format, ImGuiSliderFlags flags)
 
IMGUI_API bool SliderBehavior (const ImRect &bb, ImGuiID id, ImGuiDataType data_type, void *p_v, const void *p_min, const void *p_max, const char *format, ImGuiSliderFlags flags, ImRect *out_grab_bb)
 
IMGUI_API bool SplitterBehavior (const ImRect &bb, ImGuiID id, ImGuiAxis axis, float *size1, float *size2, float min_size1, float min_size2, float hover_extend=0.0f, float hover_visibility_delay=0.0f)
 
IMGUI_API bool TreeNodeBehavior (ImGuiID id, ImGuiTreeNodeFlags flags, const char *label, const char *label_end=NULL)
 
IMGUI_API bool TreeNodeBehaviorIsOpen (ImGuiID id, ImGuiTreeNodeFlags flags=0)
 
IMGUI_API void TreePushOverrideID (ImGuiID id)
 
template<typename T , typename SIGNED_T , typename FLOAT_T >
IMGUI_API float ScaleRatioFromValueT (ImGuiDataType data_type, T v, T v_min, T v_max, bool is_logarithmic, float logarithmic_zero_epsilon, float zero_deadzone_size)
 
template<typename T , typename SIGNED_T , typename FLOAT_T >
IMGUI_APIScaleValueFromRatioT (ImGuiDataType data_type, float t, T v_min, T v_max, bool is_logarithmic, float logarithmic_zero_epsilon, float zero_deadzone_size)
 
template<typename T , typename SIGNED_T , typename FLOAT_T >
IMGUI_API bool DragBehaviorT (ImGuiDataType data_type, T *v, float v_speed, T v_min, T v_max, const char *format, ImGuiSliderFlags flags)
 
template<typename T , typename SIGNED_T , typename FLOAT_T >
IMGUI_API bool SliderBehaviorT (const ImRect &bb, ImGuiID id, ImGuiDataType data_type, T *v, T v_min, T v_max, const char *format, ImGuiSliderFlags flags, ImRect *out_grab_bb)
 
template<typename T , typename SIGNED_T >
IMGUI_APIRoundScalarWithFormatT (const char *format, ImGuiDataType data_type, T v)
 
template<typename T >
IMGUI_API bool CheckboxFlagsT (const char *label, T *flags, T flags_value)
 
IMGUI_API const ImGuiDataTypeInfoDataTypeGetInfo (ImGuiDataType data_type)
 
IMGUI_API int DataTypeFormatString (char *buf, int buf_size, ImGuiDataType data_type, const void *p_data, const char *format)
 
IMGUI_API void DataTypeApplyOp (ImGuiDataType data_type, int op, void *output, const void *arg_1, const void *arg_2)
 
IMGUI_API bool DataTypeApplyOpFromText (const char *buf, const char *initial_value_buf, ImGuiDataType data_type, void *p_data, const char *format)
 
IMGUI_API int DataTypeCompare (ImGuiDataType data_type, const void *arg_1, const void *arg_2)
 
IMGUI_API bool DataTypeClamp (ImGuiDataType data_type, void *p_data, const void *p_min, const void *p_max)
 
IMGUI_API bool InputTextEx (const char *label, const char *hint, char *buf, int buf_size, const ImVec2 &size_arg, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback=NULL, void *user_data=NULL)
 
IMGUI_API bool TempInputText (const ImRect &bb, ImGuiID id, const char *label, char *buf, int buf_size, ImGuiInputTextFlags flags)
 
IMGUI_API bool TempInputScalar (const ImRect &bb, ImGuiID id, const char *label, ImGuiDataType data_type, void *p_data, const char *format, const void *p_clamp_min=NULL, const void *p_clamp_max=NULL)
 
bool TempInputIsActive (ImGuiID id)
 
ImGuiInputTextStateGetInputTextState (ImGuiID id)
 
IMGUI_API void ColorTooltip (const char *text, const float *col, ImGuiColorEditFlags flags)
 
IMGUI_API void ColorEditOptionsPopup (const float *col, ImGuiColorEditFlags flags)
 
IMGUI_API void ColorPickerOptionsPopup (const float *ref_col, ImGuiColorEditFlags flags)
 
IMGUI_API int PlotEx (ImGuiPlotType plot_type, const char *label, float(*values_getter)(void *data, int idx), void *data, int values_count, int values_offset, const char *overlay_text, float scale_min, float scale_max, ImVec2 frame_size)
 
IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha (ImDrawList *draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1)
 
IMGUI_API void ShadeVertsLinearUV (ImDrawList *draw_list, int vert_start_idx, int vert_end_idx, const ImVec2 &a, const ImVec2 &b, const ImVec2 &uv_a, const ImVec2 &uv_b, bool clamp)
 
IMGUI_API void GcCompactTransientMiscBuffers ()
 
IMGUI_API void GcCompactTransientWindowBuffers (ImGuiWindow *window)
 
IMGUI_API void GcAwakeTransientWindowBuffers (ImGuiWindow *window)
 
IMGUI_API void ErrorCheckEndFrameRecover (ImGuiErrorLogCallback log_callback, void *user_data=NULL)
 
void DebugDrawItemRect (ImU32 col=IM_COL32(255, 0, 0, 255))
 
void DebugStartItemPicker ()
 
IMGUI_API void DebugNodeColumns (ImGuiOldColumns *columns)
 
IMGUI_API void DebugNodeDrawList (ImGuiWindow *window, const ImDrawList *draw_list, const char *label)
 
IMGUI_API void DebugNodeDrawCmdShowMeshAndBoundingBox (ImDrawList *out_draw_list, const ImDrawList *draw_list, const ImDrawCmd *draw_cmd, bool show_mesh, bool show_aabb)
 
IMGUI_API void DebugNodeStorage (ImGuiStorage *storage, const char *label)
 
IMGUI_API void DebugNodeTabBar (ImGuiTabBar *tab_bar, const char *label)
 
IMGUI_API void DebugNodeTable (ImGuiTable *table)
 
IMGUI_API void DebugNodeTableSettings (ImGuiTableSettings *settings)
 
IMGUI_API void DebugNodeWindow (ImGuiWindow *window, const char *label)
 
IMGUI_API void DebugNodeWindowSettings (ImGuiWindowSettings *settings)
 
IMGUI_API void DebugNodeWindowsList (ImVector< ImGuiWindow * > *windows, const char *label)
 
IMGUI_API void DebugNodeViewport (ImGuiViewportP *viewport)
 
IMGUI_API void DebugRenderViewportThumbnail (ImDrawList *draw_list, ImGuiViewportP *viewport, const ImRect &bb)
 
IMGUI_API bool InputText (const char *label, std::string *str, ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=NULL, void *user_data=NULL)
 
IMGUI_API bool InputTextMultiline (const char *label, std::string *str, const ImVec2 &size=ImVec2(0, 0), ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=NULL, void *user_data=NULL)
 
IMGUI_API bool InputTextWithHint (const char *label, const char *hint, std::string *str, ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=NULL, void *user_data=NULL)
 
static void TabBarLayout (ImGuiTabBar *tab_bar)
 
static ImU32 TabBarCalcTabID (ImGuiTabBar *tab_bar, const char *label)
 
static float TabBarCalcMaxTabWidth ()
 
static float TabBarScrollClamp (ImGuiTabBar *tab_bar, float scrolling)
 
static void TabBarScrollToTab (ImGuiTabBar *tab_bar, ImGuiID tab_id, ImGuiTabBarSection *sections)
 
static ImGuiTabItemTabBarScrollingButtons (ImGuiTabBar *tab_bar)
 
static ImGuiTabItemTabBarTabListPopupButton (ImGuiTabBar *tab_bar)
 
bool Combo (const char *label, int *idx, std::vector< std::string > &values)
 
bool Combo (const char *label, int *idx, std::function< const char *(int)> getter, int items_count)
 
bool ListBox (const char *label, int *idx, std::vector< std::string > &values)
 
bool InputText (const char *label, std::string &str, ImGuiInputTextFlags flags=0, ImGuiTextEditCallback callback=NULL, void *user_data=NULL)
 

Variables

const char ColorMarkerHovered = 0x1
 
const char ColorMarkerStart = 0x2
 
const char ColorMarkerEnd = 0x3
 
const wchar_t PrintIconMarker = 0x4
 
const wchar_t PrinterIconMarker = 0x5
 
const wchar_t PrinterSlaIconMarker = 0x6
 
const wchar_t FilamentIconMarker = 0x7
 
const wchar_t MaterialIconMarker = 0x8
 
const wchar_t CloseNotifButton = 0xB
 
const wchar_t CloseNotifHoverButton = 0xC
 
const wchar_t MinimalizeButton = 0xE
 
const wchar_t MinimalizeHoverButton = 0xF
 
const wchar_t WarningMarker = 0x10
 
const wchar_t ErrorMarker = 0x11
 
const wchar_t EjectButton = 0x12
 
const wchar_t EjectHoverButton = 0x13
 
const wchar_t CancelButton = 0x14
 
const wchar_t CancelHoverButton = 0x15
 
const wchar_t RevertButton = 0x16
 
const wchar_t RightArrowButton = 0x18
 
const wchar_t RightArrowHoverButton = 0x19
 
const wchar_t PreferencesButton = 0x1A
 
const wchar_t PreferencesHoverButton = 0x1B
 
const wchar_t PlugMarker = 0x1C
 
const wchar_t DowelMarker = 0x1D
 
const wchar_t DocumentationButton = 0x2600
 
const wchar_t DocumentationHoverButton = 0x2601
 
const wchar_t ClippyMarker = 0x2602
 
const wchar_t InfoMarker = 0x2603
 
const wchar_t SliderFloatEditBtnIcon = 0x2604
 
const wchar_t SliderFloatEditBtnPressedIcon = 0x2605
 
const wchar_t ClipboardBtnIcon = 0x2606
 
const wchar_t PlayButton = 0x2618
 
const wchar_t PlayHoverButton = 0x2619
 
const wchar_t PauseButton = 0x261A
 
const wchar_t PauseHoverButton = 0x261B
 
const wchar_t OpenButton = 0x261C
 
const wchar_t OpenHoverButton = 0x261D
 
const wchar_t SlaViewOriginal = 0x261E
 
const wchar_t SlaViewProcessed = 0x261F
 
const wchar_t LegendTravel = 0x2701
 
const wchar_t LegendWipe = 0x2702
 
const wchar_t LegendRetract = 0x2703
 
const wchar_t LegendDeretract = 0x2704
 
const wchar_t LegendSeams = 0x2705
 
const wchar_t LegendToolChanges = 0x2706
 
const wchar_t LegendColorChanges = 0x2707
 
const wchar_t LegendPausePrints = 0x2708
 
const wchar_t LegendCustomGCodes = 0x2709
 
const wchar_t LegendCOG = 0x2710
 
const wchar_t LegendShells = 0x2711
 
const wchar_t LegendToolMarker = 0x2712
 
const wchar_t WarningMarkerSmall = 0x2713
 
const wchar_t ExpandBtn = 0x2714
 
const wchar_t InfoMarkerSmall = 0x2716
 
const wchar_t CollapseBtn = 0x2715
 
static auto vector_getter
 

Function Documentation

◆ AcceptDragDropPayload()

const ImGuiPayload * ImGui::AcceptDragDropPayload ( const char *  type,
ImGuiDragDropFlags  flags = 0 
)
10009{
10010 ImGuiContext& g = *GImGui;
10011 ImGuiWindow* window = g.CurrentWindow;
10012 ImGuiPayload& payload = g.DragDropPayload;
10013 IM_ASSERT(g.DragDropActive); // Not called between BeginDragDropTarget() and EndDragDropTarget() ?
10014 IM_ASSERT(payload.DataFrameCount != -1); // Forgot to call EndDragDropTarget() ?
10015 if (type != NULL && !payload.IsDataType(type))
10016 return NULL;
10017
10018 // Accept smallest drag target bounding box, this allows us to nest drag targets conveniently without ordering constraints.
10019 // NB: We currently accept NULL id as target. However, overlapping targets requires a unique ID to function!
10020 const bool was_accepted_previously = (g.DragDropAcceptIdPrev == g.DragDropTargetId);
10022 float r_surface = r.GetWidth() * r.GetHeight();
10023 if (r_surface <= g.DragDropAcceptIdCurrRectSurface)
10024 {
10025 g.DragDropAcceptFlags = flags;
10027 g.DragDropAcceptIdCurrRectSurface = r_surface;
10028 }
10029
10030 // Render default drop visuals
10031 payload.Preview = was_accepted_previously;
10032 flags |= (g.DragDropSourceFlags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect); // Source can also inhibit the preview (useful for external sources that lives for 1 frame)
10033 if (!(flags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect) && payload.Preview)
10034 {
10035 // FIXME-DRAGDROP: Settle on a proper default visuals for drop target.
10036 r.Expand(3.5f);
10037 bool push_clip_rect = !window->ClipRect.Contains(r);
10038 if (push_clip_rect) window->DrawList->PushClipRect(r.Min - ImVec2(1, 1), r.Max + ImVec2(1, 1));
10039 window->DrawList->AddRect(r.Min, r.Max, GetColorU32(ImGuiCol_DragDropTarget), 0.0f, 0, 2.0f);
10040 if (push_clip_rect) window->DrawList->PopClipRect();
10041 }
10042
10044 payload.Delivery = was_accepted_previously && !IsMouseDown(g.DragDropMouseButton); // For extern drag sources affecting os window focus, it's easier to just test !IsMouseDown() instead of IsMouseReleased()
10045 if (!payload.Delivery && !(flags & ImGuiDragDropFlags_AcceptBeforeDelivery))
10046 return NULL;
10047
10048 return &payload;
10049}
ImGuiContext * GImGui
Definition imgui.cpp:960
@ ImGuiDragDropFlags_AcceptBeforeDelivery
Definition imgui.h:1266
@ ImGuiDragDropFlags_AcceptNoDrawDefaultRect
Definition imgui.h:1267
@ ImGuiCol_DragDropTarget
Definition imgui.h:1461
#define IM_ASSERT(_EXPR)
Definition imgui.h:81
IMGUI_API bool IsMouseDown(ImGuiMouseButton button)
Definition imgui.cpp:4693
IMGUI_API void PopClipRect()
Definition imgui_draw.cpp:592
IMGUI_API void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect=false)
Definition imgui_draw.cpp:568
IMGUI_API void AddRect(const ImVec2 &p_min, const ImVec2 &p_max, ImU32 col, float rounding=0.0f, ImDrawFlags flags=0, float thickness=1.0f)
Definition imgui_draw.cpp:1377
Definition imgui_internal.h:1351
int DragDropMouseButton
Definition imgui_internal.h:1505
bool DragDropActive
Definition imgui_internal.h:1500
ImGuiPayload DragDropPayload
Definition imgui_internal.h:1506
float DragDropAcceptIdCurrRectSurface
Definition imgui_internal.h:1510
ImGuiDragDropFlags DragDropSourceFlags
Definition imgui_internal.h:1503
ImGuiDragDropFlags DragDropAcceptFlags
Definition imgui_internal.h:1509
int DragDropAcceptFrameCount
Definition imgui_internal.h:1513
ImRect DragDropTargetRect
Definition imgui_internal.h:1507
ImGuiWindow * CurrentWindow
Definition imgui_internal.h:1380
ImGuiID DragDropAcceptIdPrev
Definition imgui_internal.h:1512
int FrameCount
Definition imgui_internal.h:1361
ImGuiID DragDropAcceptIdCurr
Definition imgui_internal.h:1511
ImGuiID DragDropTargetId
Definition imgui_internal.h:1508
Definition imgui.h:1957
bool Preview
Definition imgui.h:1967
bool Delivery
Definition imgui.h:1968
bool IsDataType(const char *type) const
Definition imgui.h:1972
int DataFrameCount
Definition imgui.h:1965
Definition imgui_internal.h:1807
ImDrawList * DrawList
Definition imgui_internal.h:1883
ImRect ClipRect
Definition imgui_internal.h:1870
Definition imgui_internal.h:471
float GetHeight() const
Definition imgui_internal.h:483
ImVec2 Max
Definition imgui_internal.h:473
bool Contains(const ImVec2 &p) const
Definition imgui_internal.h:489
void Expand(const float amount)
Definition imgui_internal.h:494
ImVec2 Min
Definition imgui_internal.h:472
float GetWidth() const
Definition imgui_internal.h:482
Definition imgui.h:245

References ImDrawList::AddRect(), ImGuiWindow::ClipRect, ImRect::Contains(), ImGuiContext::CurrentWindow, ImGuiPayload::DataFrameCount, ImGuiPayload::Delivery, ImGuiContext::DragDropAcceptFlags, ImGuiContext::DragDropAcceptFrameCount, ImGuiContext::DragDropAcceptIdCurr, ImGuiContext::DragDropAcceptIdCurrRectSurface, ImGuiContext::DragDropAcceptIdPrev, ImGuiContext::DragDropActive, ImGuiContext::DragDropMouseButton, ImGuiContext::DragDropPayload, ImGuiContext::DragDropSourceFlags, ImGuiContext::DragDropTargetId, ImGuiContext::DragDropTargetRect, ImGuiWindow::DrawList, ImRect::Expand(), ImGuiContext::FrameCount, GetColorU32(), ImRect::GetHeight(), ImRect::GetWidth(), GImGui, IM_ASSERT, ImGuiCol_DragDropTarget, ImGuiDragDropFlags_AcceptBeforeDelivery, ImGuiDragDropFlags_AcceptNoDrawDefaultRect, ImGuiPayload::IsDataType(), IsMouseDown(), ImRect::Max, ImRect::Min, ImDrawList::PopClipRect(), ImGuiPayload::Preview, and ImDrawList::PushClipRect().

Referenced by ColorEdit4(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ActivateItem()

void ImGui::ActivateItem ( ImGuiID  id)
6957{
6958 ImGuiContext& g = *GImGui;
6959 g.NavNextActivateId = id;
6960}
ImGuiID NavNextActivateId
Definition imgui_internal.h:1451

References GImGui, and ImGuiContext::NavNextActivateId.

◆ AddContextHook()

ImGuiID ImGui::AddContextHook ( ImGuiContext context,
const ImGuiContextHook hook 
)
3411{
3412 ImGuiContext& g = *ctx;
3413 IM_ASSERT(hook->Callback != NULL && hook->HookId == 0 && hook->Type != ImGuiContextHookType_PendingRemoval_);
3414 g.Hooks.push_back(*hook);
3415 g.Hooks.back().HookId = ++g.HookIdNext;
3416 return g.HookIdNext;
3417}
@ ImGuiContextHookType_PendingRemoval_
Definition imgui_internal.h:1333
ImGuiContextHookType Type
Definition imgui_internal.h:1338
ImGuiContextHookCallback Callback
Definition imgui_internal.h:1340
ImGuiID HookId
Definition imgui_internal.h:1337
ImGuiID HookIdNext
Definition imgui_internal.h:1566
ImVector< ImGuiContextHook > Hooks
Definition imgui_internal.h:1565
T & back()
Definition imgui.h:1685
void push_back(const T &v)
Definition imgui.h:1696

References ImVector< T >::back(), ImGuiContextHook::Callback, ImGuiContextHook::HookId, ImGuiContext::HookIdNext, ImGuiContext::Hooks, IM_ASSERT, ImGuiContextHookType_PendingRemoval_, ImVector< T >::push_back(), and ImGuiContextHook::Type.

+ Here is the call graph for this function:

◆ AlignTextToFramePadding()

void ImGui::AlignTextToFramePadding ( )
1348{
1349 ImGuiWindow* window = GetCurrentWindow();
1350 if (window->SkipItems)
1351 return;
1352
1353 ImGuiContext& g = *GImGui;
1354 window->DC.CurrLineSize.y = ImMax(window->DC.CurrLineSize.y, g.FontSize + g.Style.FramePadding.y * 2);
1356}
ImVec2 CurrLineSize
Definition imgui_internal.h:1759
float CurrLineTextBaseOffset
Definition imgui_internal.h:1761
static T ImMax(T lhs, T rhs)
Definition imgui_internal.h:410
ImGuiWindow * GetCurrentWindow()
Definition imgui_internal.h:2280
ImGuiStyle Style
Definition imgui_internal.h:1355
float FontSize
Definition imgui_internal.h:1357
ImVec2 FramePadding
Definition imgui.h:1733
ImGuiWindowTempData DC
Definition imgui_internal.h:1861
bool SkipItems
Definition imgui_internal.h:1835
float y
Definition imgui.h:246

References ImGuiWindowTempData::CurrLineSize, ImGuiWindowTempData::CurrLineTextBaseOffset, ImGuiWindow::DC, ImGuiContext::FontSize, ImGuiStyle::FramePadding, GetCurrentWindow(), GImGui, ImMax(), ImGuiWindow::SkipItems, ImGuiContext::Style, and ImVec2::y.

Referenced by BeginMenuBar(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GLGizmoHollow::on_render_input_window(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), Slic3r::GUI::GLGizmoSeam::on_render_input_window(), Slic3r::GUI::GLGizmoSlaSupports::on_render_input_window(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GLGizmoCut3D::render_build_size(), Slic3r::GUI::GLGizmoCut3D::render_combo(), Slic3r::GUI::GLGizmoCut3D::render_connectors_input_window(), Slic3r::GUI::GLGizmoCut3D::render_cut_plane_input_window(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::GLGizmoCut3D::render_double_input(), Slic3r::GUI::GLCanvas3D::LayersEditing::render_overlay(), Slic3r::GUI::ImGuiWrapper::search_list(), ShowDemoWindowLayout(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), and ShowPlaceholderObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ArrowButton()

bool ImGui::ArrowButton ( const char *  str_id,
ImGuiDir  dir 
)
786{
787 float sz = GetFrameHeight();
788 return ArrowButtonEx(str_id, dir, ImVec2(sz, sz), ImGuiButtonFlags_None);
789}
@ ImGuiButtonFlags_None
Definition imgui.h:1509
IMGUI_API bool ArrowButtonEx(const char *str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags=0)
Definition imgui_widgets.cpp:755
IMGUI_API float GetFrameHeight()
Definition imgui.cpp:7651

References ArrowButtonEx(), GetFrameHeight(), and ImGuiButtonFlags_None.

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ArrowButtonEx()

bool ImGui::ArrowButtonEx ( const char *  str_id,
ImGuiDir  dir,
ImVec2  size_arg,
ImGuiButtonFlags  flags = 0 
)
756{
757 ImGuiWindow* window = GetCurrentWindow();
758 if (window->SkipItems)
759 return false;
760
761 ImGuiContext& g = *GImGui;
762 const ImGuiID id = window->GetID(str_id);
763 const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
764 const float default_size = GetFrameHeight();
765 ItemSize(size, (size.y >= default_size) ? g.Style.FramePadding.y : -1.0f);
766 if (!ItemAdd(bb, id))
767 return false;
768
771
772 bool hovered, held;
773 bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
774
775 // Render
776 const ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
777 const ImU32 text_col = GetColorU32(ImGuiCol_Text);
778 RenderNavHighlight(bb, id);
779 RenderFrame(bb.Min, bb.Max, bg_col, true, g.Style.FrameRounding);
780 RenderArrow(window->DrawList, bb.Min + ImVec2(ImMax(0.0f, (size.x - g.FontSize) * 0.5f), ImMax(0.0f, (size.y - g.FontSize) * 0.5f)), text_col, dir);
781
782 return pressed;
783}
unsigned int ImU32
Definition imgui.h:229
unsigned int ImGuiID
Definition imgui.h:207
@ ImGuiCol_Button
Definition imgui.h:1434
@ ImGuiCol_ButtonHovered
Definition imgui.h:1435
@ ImGuiCol_ButtonActive
Definition imgui.h:1436
@ ImGuiCol_Text
Definition imgui.h:1413
@ ImGuiButtonFlags_Repeat
Definition imgui_internal.h:784
@ ImGuiItemFlags_ButtonRepeat
Definition imgui_internal.h:724
ImVec2 CursorPos
Definition imgui_internal.h:1754
IMGUI_API bool ItemAdd(const ImRect &bb, ImGuiID id, const ImRect *nav_bb=NULL, ImGuiItemAddFlags flags=0)
Definition imgui.cpp:7390
IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul=1.0f)
Definition imgui.cpp:2429
IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border=true, float rounding=0.0f)
Definition imgui.cpp:2834
IMGUI_API bool ButtonBehavior(const ImRect &bb, ImGuiID id, bool *out_hovered, bool *out_held, ImGuiButtonFlags flags=0)
Definition imgui_widgets.cpp:488
IMGUI_API void RenderArrow(ImDrawList *draw_list, ImVec2 pos, ImU32 col, ImGuiDir dir, float scale=1.0f)
Definition imgui_draw.cpp:3738
IMGUI_API void ItemSize(const ImVec2 &size, float text_baseline_y=-1.0f)
Definition imgui.cpp:7349
IMGUI_API void RenderNavHighlight(const ImRect &bb, ImGuiID id, ImGuiNavHighlightFlags flags=ImGuiNavHighlightFlags_TypeDefault)
Definition imgui.cpp:2859
ImGuiItemFlags CurrentItemFlags
Definition imgui_internal.h:1389
float FrameRounding
Definition imgui.h:1734
ImGuiID GetID(const char *str, const char *str_end=NULL)
Definition imgui.cpp:2927

References ButtonBehavior(), ImGuiContext::CurrentItemFlags, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, ImGuiContext::FontSize, ImGuiStyle::FramePadding, ImGuiStyle::FrameRounding, GetColorU32(), GetCurrentWindow(), GetFrameHeight(), ImGuiWindow::GetID(), GImGui, ImGuiButtonFlags_Repeat, ImGuiCol_Button, ImGuiCol_ButtonActive, ImGuiCol_ButtonHovered, ImGuiCol_Text, ImGuiItemFlags_ButtonRepeat, ImMax(), ItemAdd(), ItemSize(), ImRect::Max, ImRect::Min, RenderArrow(), RenderFrame(), RenderNavHighlight(), ImGuiWindow::SkipItems, ImGuiContext::Style, and ImVec2::y.

Referenced by ArrowButton(), and TabBarScrollingButtons().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Begin()

bool ImGui::Begin ( const char *  name,
bool *  p_open = NULL,
ImGuiWindowFlags  flags = 0 
)
5723{
5724 ImGuiContext& g = *GImGui;
5725 const ImGuiStyle& style = g.Style;
5726 IM_ASSERT(name != NULL && name[0] != '\0'); // Window name required
5727 IM_ASSERT(g.WithinFrameScope); // Forgot to call ImGui::NewFrame()
5728 IM_ASSERT(g.FrameCountEnded != g.FrameCount); // Called ImGui::Render() or ImGui::EndFrame() and haven't called ImGui::NewFrame() again yet
5729
5730 // Find or create
5731 ImGuiWindow* window = FindWindowByName(name);
5732 const bool window_just_created = (window == NULL);
5733 if (window_just_created)
5734 window = CreateNewWindow(name, flags);
5735
5736 // Automatically disable manual moving/resizing when NoInputs is set
5739
5742
5743 const int current_frame = g.FrameCount;
5744 const bool first_begin_of_the_frame = (window->LastFrameActive != current_frame);
5746
5747 // Update the Appearing flag
5748 bool window_just_activated_by_user = (window->LastFrameActive < current_frame - 1); // Not using !WasActive because the implicit "Debug" window would always toggle off->on
5749 if (flags & ImGuiWindowFlags_Popup)
5750 {
5752 window_just_activated_by_user |= (window->PopupId != popup_ref.PopupId); // We recycle popups so treat window as activated if popup id changed
5753 window_just_activated_by_user |= (window != popup_ref.Window);
5754 }
5755 window->Appearing = window_just_activated_by_user;
5756 if (window->Appearing)
5758
5759 // Update Flags, LastFrameActive, BeginOrderXXX fields
5760 if (first_begin_of_the_frame)
5761 {
5762 window->Flags = (ImGuiWindowFlags)flags;
5763 window->LastFrameActive = current_frame;
5764 window->LastTimeActive = (float)g.Time;
5765 window->BeginOrderWithinParent = 0;
5766 window->BeginOrderWithinContext = (short)(g.WindowsActiveCount++);
5767 }
5768 else
5769 {
5770 flags = window->Flags;
5771 }
5772
5773 // Parent window is latched only on the first call to Begin() of the frame, so further append-calls can be done from a different window stack
5774 ImGuiWindow* parent_window_in_stack = g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back();
5775 ImGuiWindow* parent_window = first_begin_of_the_frame ? ((flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)) ? parent_window_in_stack : NULL) : window->ParentWindow;
5776 IM_ASSERT(parent_window != NULL || !(flags & ImGuiWindowFlags_ChildWindow));
5777
5778 // We allow window memory to be compacted so recreate the base stack when needed.
5779 if (window->IDStack.Size == 0)
5780 window->IDStack.push_back(window->ID);
5781
5782 // Add to stack
5783 // We intentionally set g.CurrentWindow to NULL to prevent usage until when the viewport is set, then will call SetCurrentWindow()
5784 g.CurrentWindowStack.push_back(window);
5785 g.CurrentWindow = window;
5787 g.CurrentWindow = NULL;
5788
5789 if (flags & ImGuiWindowFlags_Popup)
5790 {
5792 popup_ref.Window = window;
5793 g.BeginPopupStack.push_back(popup_ref);
5794 window->PopupId = popup_ref.PopupId;
5795 }
5796
5797 // Update ->RootWindow and others pointers (before any possible call to FocusWindow)
5798 if (first_begin_of_the_frame)
5799 UpdateWindowParentAndRootLinks(window, flags, parent_window);
5800
5801 // Process SetNextWindow***() calls
5802 // (FIXME: Consider splitting the HasXXX flags into X/Y components
5803 bool window_pos_set_by_api = false;
5804 bool window_size_x_set_by_api = false, window_size_y_set_by_api = false;
5806 {
5807 window_pos_set_by_api = (window->SetWindowPosAllowFlags & g.NextWindowData.PosCond) != 0;
5808 if (window_pos_set_by_api && ImLengthSqr(g.NextWindowData.PosPivotVal) > 0.00001f)
5809 {
5810 // May be processed on the next frame if this is our first frame and we are measuring size
5811 // FIXME: Look into removing the branch so everything can go through this same code path for consistency.
5815 }
5816 else
5817 {
5819 }
5820 }
5822 {
5823 window_size_x_set_by_api = (window->SetWindowSizeAllowFlags & g.NextWindowData.SizeCond) != 0 && (g.NextWindowData.SizeVal.x > 0.0f);
5824 window_size_y_set_by_api = (window->SetWindowSizeAllowFlags & g.NextWindowData.SizeCond) != 0 && (g.NextWindowData.SizeVal.y > 0.0f);
5826 }
5828 {
5829 if (g.NextWindowData.ScrollVal.x >= 0.0f)
5830 {
5832 window->ScrollTargetCenterRatio.x = 0.0f;
5833 }
5834 if (g.NextWindowData.ScrollVal.y >= 0.0f)
5835 {
5837 window->ScrollTargetCenterRatio.y = 0.0f;
5838 }
5839 }
5842 else if (first_begin_of_the_frame)
5843 window->ContentSizeExplicit = ImVec2(0.0f, 0.0f);
5847 FocusWindow(window);
5848 if (window->Appearing)
5850
5851 // When reusing window again multiple times a frame, just append content (don't need to setup again)
5852 if (first_begin_of_the_frame)
5853 {
5854 // Initialize
5855 const bool window_is_child_tooltip = (flags & ImGuiWindowFlags_ChildWindow) && (flags & ImGuiWindowFlags_Tooltip); // FIXME-WIP: Undocumented behavior of Child+Tooltip for pinned tooltip (#1345)
5856 window->Active = true;
5857 window->HasCloseButton = (p_open != NULL);
5858 window->ClipRect = ImVec4(-FLT_MAX, -FLT_MAX, +FLT_MAX, +FLT_MAX);
5859 window->IDStack.resize(1);
5860 window->DrawList->_ResetForNewFrame();
5861 window->DC.CurrentTableIdx = -1;
5862
5863 // Restore buffer capacity when woken from a compacted state, to avoid
5864 if (window->MemoryCompacted)
5866
5867 // Update stored window name when it changes (which can _only_ happen with the "###" operator, so the ID would stay unchanged).
5868 // The title bar always display the 'name' parameter, so we only update the string storage if it needs to be visible to the end-user elsewhere.
5869 bool window_title_visible_elsewhere = false;
5870 if (g.NavWindowingListWindow != NULL && (window->Flags & ImGuiWindowFlags_NoNavFocus) == 0) // Window titles visible when using CTRL+TAB
5871 window_title_visible_elsewhere = true;
5872 if (window_title_visible_elsewhere && !window_just_created && strcmp(name, window->Name) != 0)
5873 {
5874 size_t buf_len = (size_t)window->NameBufLen;
5875 window->Name = ImStrdupcpy(window->Name, &buf_len, name);
5876 window->NameBufLen = (int)buf_len;
5877 }
5878
5879 // UPDATE CONTENTS SIZE, UPDATE HIDDEN STATUS
5880
5881 // Update contents size from last frame for auto-fitting (or use explicit size)
5882 const bool window_just_appearing_after_hidden_for_resize = (window->HiddenFramesCannotSkipItems > 0);
5883 CalcWindowContentSizes(window, &window->ContentSize, &window->ContentSizeIdeal);
5884 if (window->HiddenFramesCanSkipItems > 0)
5885 window->HiddenFramesCanSkipItems--;
5886 if (window->HiddenFramesCannotSkipItems > 0)
5888 if (window->HiddenFramesForRenderOnly > 0)
5889 window->HiddenFramesForRenderOnly--;
5890
5891 // Hide new windows for one frame until they calculate their size
5892 if (window_just_created && (!window_size_x_set_by_api || !window_size_y_set_by_api))
5893 window->HiddenFramesCannotSkipItems = 1;
5894
5895 // Hide popup/tooltip window when re-opening while we measure size (because we recycle the windows)
5896 // We reset Size/ContentSize for reappearing popups/tooltips early in this function, so further code won't be tempted to use the old size.
5897 if (window_just_activated_by_user && (flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) != 0)
5898 {
5899 window->HiddenFramesCannotSkipItems = 1;
5901 {
5902 if (!window_size_x_set_by_api)
5903 window->Size.x = window->SizeFull.x = 0.f;
5904 if (!window_size_y_set_by_api)
5905 window->Size.y = window->SizeFull.y = 0.f;
5906 window->ContentSize = window->ContentSizeIdeal = ImVec2(0.f, 0.f);
5907 }
5908 }
5909
5910 // SELECT VIEWPORT
5911 // FIXME-VIEWPORT: In the docking/viewport branch, this is the point where we select the current viewport (which may affect the style)
5912 SetCurrentWindow(window);
5913
5914 // LOCK BORDER SIZE AND PADDING FOR THE FRAME (so that altering them doesn't cause inconsistencies)
5915
5916 if (flags & ImGuiWindowFlags_ChildWindow)
5917 window->WindowBorderSize = style.ChildBorderSize;
5918 else
5919 window->WindowBorderSize = ((flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupBorderSize : style.WindowBorderSize;
5920 window->WindowPadding = style.WindowPadding;
5922 window->WindowPadding = ImVec2(0.0f, (flags & ImGuiWindowFlags_MenuBar) ? style.WindowPadding.y : 0.0f);
5923
5924 // Lock menu offset so size calculation can use it as menu-bar windows need a minimum size.
5925 window->DC.MenuBarOffset.x = ImMax(ImMax(window->WindowPadding.x, style.ItemSpacing.x), g.NextWindowData.MenuBarOffsetMinVal.x);
5927
5928 // Collapse window by double-clicking on title bar
5929 // At this point we don't have a clipping rectangle setup yet, so we can use the title bar area for hit detection and drawing
5930 if (!(flags & ImGuiWindowFlags_NoTitleBar) && !(flags & ImGuiWindowFlags_NoCollapse))
5931 {
5932 // We don't use a regular button+id to test for double-click on title bar (mostly due to legacy reason, could be fixed), so verify that we don't have items over the title bar.
5933 ImRect title_bar_rect = window->TitleBarRect();
5934 if (g.HoveredWindow == window && g.HoveredId == 0 && g.HoveredIdPreviousFrame == 0 && IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max) && g.IO.MouseDoubleClicked[0])
5935 window->WantCollapseToggle = true;
5936 if (window->WantCollapseToggle)
5937 {
5938 window->Collapsed = !window->Collapsed;
5939 MarkIniSettingsDirty(window);
5940 }
5941 }
5942 else
5943 {
5944 window->Collapsed = false;
5945 }
5946 window->WantCollapseToggle = false;
5947
5948 // SIZE
5949
5950 // Calculate auto-fit size, handle automatic resize
5951 const ImVec2 size_auto_fit = CalcWindowAutoFitSize(window, window->ContentSizeIdeal);
5952 bool use_current_size_for_scrollbar_x = window_just_created;
5953 bool use_current_size_for_scrollbar_y = window_just_created;
5954 if ((flags & ImGuiWindowFlags_AlwaysAutoResize) && !window->Collapsed)
5955 {
5956 // Using SetNextWindowSize() overrides ImGuiWindowFlags_AlwaysAutoResize, so it can be used on tooltips/popups, etc.
5957 if (!window_size_x_set_by_api)
5958 {
5959 window->SizeFull.x = size_auto_fit.x;
5960 use_current_size_for_scrollbar_x = true;
5961 }
5962 if (!window_size_y_set_by_api)
5963 {
5964 window->SizeFull.y = size_auto_fit.y;
5965 use_current_size_for_scrollbar_y = true;
5966 }
5967 }
5968 else if (window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0)
5969 {
5970 // Auto-fit may only grow window during the first few frames
5971 // We still process initial auto-fit on collapsed windows to get a window width, but otherwise don't honor ImGuiWindowFlags_AlwaysAutoResize when collapsed.
5972 if (!window_size_x_set_by_api && window->AutoFitFramesX > 0)
5973 {
5974 window->SizeFull.x = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.x, size_auto_fit.x) : size_auto_fit.x;
5975 use_current_size_for_scrollbar_x = true;
5976 }
5977 if (!window_size_y_set_by_api && window->AutoFitFramesY > 0)
5978 {
5979 window->SizeFull.y = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.y, size_auto_fit.y) : size_auto_fit.y;
5980 use_current_size_for_scrollbar_y = true;
5981 }
5982 if (!window->Collapsed)
5983 MarkIniSettingsDirty(window);
5984 }
5985
5986 // Apply minimum/maximum window size constraints and final size
5987 window->SizeFull = CalcWindowSizeAfterConstraint(window, window->SizeFull);
5988 window->Size = window->Collapsed && !(flags & ImGuiWindowFlags_ChildWindow) ? window->TitleBarRect().GetSize() : window->SizeFull;
5989
5990 // Decoration size
5991 const float decoration_up_height = window->TitleBarHeight() + window->MenuBarHeight();
5992
5993 // POSITION
5994
5995 // Popup latch its initial position, will position itself when it appears next frame
5996 if (window_just_activated_by_user)
5997 {
5999 if ((flags & ImGuiWindowFlags_Popup) != 0 && !(flags & ImGuiWindowFlags_Modal) && !window_pos_set_by_api) // FIXME: BeginPopup() could use SetNextWindowPos()
6000 window->Pos = g.BeginPopupStack.back().OpenPopupPos;
6001 }
6002
6003 // Position child window
6004 if (flags & ImGuiWindowFlags_ChildWindow)
6005 {
6006 IM_ASSERT(parent_window && parent_window->Active);
6007 window->BeginOrderWithinParent = (short)parent_window->DC.ChildWindows.Size;
6008 parent_window->DC.ChildWindows.push_back(window);
6009 if (!(flags & ImGuiWindowFlags_Popup) && !window_pos_set_by_api && !window_is_child_tooltip)
6010 window->Pos = parent_window->DC.CursorPos;
6011 }
6012
6013 const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFramesCannotSkipItems == 0);
6014 if (window_pos_with_pivot)
6015 SetWindowPos(window, window->SetWindowPosVal - window->Size * window->SetWindowPosPivot, 0); // Position given a pivot (e.g. for centering)
6016 else if ((flags & ImGuiWindowFlags_ChildMenu) != 0)
6017 window->Pos = FindBestWindowPosForPopup(window);
6018 else if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_just_appearing_after_hidden_for_resize)
6019 window->Pos = FindBestWindowPosForPopup(window);
6020 else if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api && !window_is_child_tooltip)
6021 window->Pos = FindBestWindowPosForPopup(window);
6022
6023 // Calculate the range of allowed position for that window (to be movable and visible past safe area padding)
6024 // When clamping to stay visible, we will enforce that window->Pos stays inside of visibility_rect.
6025 ImGuiViewportP* viewport = (ImGuiViewportP*)(void*)GetMainViewport();
6026 ImRect viewport_rect(viewport->GetMainRect());
6027 ImRect viewport_work_rect(viewport->GetWorkRect());
6028 ImVec2 visibility_padding = ImMax(style.DisplayWindowPadding, style.DisplaySafeAreaPadding);
6029 ImRect visibility_rect(viewport_work_rect.Min + visibility_padding, viewport_work_rect.Max - visibility_padding);
6030
6031 // Clamp position/size so window stays visible within its viewport or monitor
6032 // Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing.
6033 if (!window_pos_set_by_api && !(flags & ImGuiWindowFlags_ChildWindow) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)
6034 if (viewport_rect.GetWidth() > 0.0f && viewport_rect.GetHeight() > 0.0f)
6035 ClampWindowRect(window, visibility_rect);
6036 window->Pos = ImFloor(window->Pos);
6037
6038 // Lock window rounding for the frame (so that altering them doesn't cause inconsistencies)
6039 // Large values tend to lead to variety of artifacts and are not recommended.
6040 window->WindowRounding = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildRounding : ((flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupRounding : style.WindowRounding;
6041
6042 // For windows with title bar or menu bar, we clamp to FrameHeight(FontSize + FramePadding.y * 2.0f) to completely hide artifacts.
6043 //if ((window->Flags & ImGuiWindowFlags_MenuBar) || !(window->Flags & ImGuiWindowFlags_NoTitleBar))
6044 // window->WindowRounding = ImMin(window->WindowRounding, g.FontSize + style.FramePadding.y * 2.0f);
6045
6046 // Apply window focus (new and reactivated windows are moved to front)
6047 bool want_focus = false;
6048 if (window_just_activated_by_user && !(flags & ImGuiWindowFlags_NoFocusOnAppearing))
6049 {
6050 if (flags & ImGuiWindowFlags_Popup)
6051 want_focus = true;
6052 else if ((flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip)) == 0)
6053 want_focus = true;
6054 }
6055
6056 // Handle manual resize: Resize Grips, Borders, Gamepad
6057 int border_held = -1;
6058 ImU32 resize_grip_col[4] = {};
6059 const int resize_grip_count = g.IO.ConfigWindowsResizeFromEdges ? 2 : 1; // Allow resize from lower-left if we have the mouse cursor feedback for it.
6060 const float resize_grip_draw_size = IM_FLOOR(ImMax(g.FontSize * 1.10f, window->WindowRounding + 1.0f + g.FontSize * 0.2f));
6061 if (!window->Collapsed)
6062 if (UpdateWindowManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0], visibility_rect))
6063 use_current_size_for_scrollbar_x = use_current_size_for_scrollbar_y = true;
6064 window->ResizeBorderHeld = (signed char)border_held;
6065
6066 // SCROLLBAR VISIBILITY
6067
6068 // Update scrollbar visibility (based on the Size that was effective during last frame or the auto-resized Size).
6069 if (!window->Collapsed)
6070 {
6071 // When reading the current size we need to read it after size constraints have been applied.
6072 // When we use InnerRect here we are intentionally reading last frame size, same for ScrollbarSizes values before we set them again.
6073 ImVec2 avail_size_from_current_frame = ImVec2(window->SizeFull.x, window->SizeFull.y - decoration_up_height);
6074 ImVec2 avail_size_from_last_frame = window->InnerRect.GetSize() + window->ScrollbarSizes;
6075 ImVec2 needed_size_from_last_frame = window_just_created ? ImVec2(0, 0) : window->ContentSize + window->WindowPadding * 2.0f;
6076 float size_x_for_scrollbars = use_current_size_for_scrollbar_x ? avail_size_from_current_frame.x : avail_size_from_last_frame.x;
6077 float size_y_for_scrollbars = use_current_size_for_scrollbar_y ? avail_size_from_current_frame.y : avail_size_from_last_frame.y;
6078 //bool scrollbar_y_from_last_frame = window->ScrollbarY; // FIXME: May want to use that in the ScrollbarX expression? How many pros vs cons?
6079 window->ScrollbarY = (flags & ImGuiWindowFlags_AlwaysVerticalScrollbar) || ((needed_size_from_last_frame.y > size_y_for_scrollbars) && !(flags & ImGuiWindowFlags_NoScrollbar));
6080 window->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((needed_size_from_last_frame.x > size_x_for_scrollbars - (window->ScrollbarY ? style.ScrollbarSize : 0.0f)) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar));
6081 if (window->ScrollbarX && !window->ScrollbarY)
6082 window->ScrollbarY = (needed_size_from_last_frame.y > size_y_for_scrollbars) && !(flags & ImGuiWindowFlags_NoScrollbar);
6083 window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f);
6084 }
6085
6086 // UPDATE RECTANGLES (1- THOSE NOT AFFECTED BY SCROLLING)
6087 // Update various regions. Variables they depends on should be set above in this function.
6088 // We set this up after processing the resize grip so that our rectangles doesn't lag by a frame.
6089
6090 // Outer rectangle
6091 // Not affected by window border size. Used by:
6092 // - FindHoveredWindow() (w/ extra padding when border resize is enabled)
6093 // - Begin() initial clipping rect for drawing window background and borders.
6094 // - Begin() clipping whole child
6095 const ImRect host_rect = ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_is_child_tooltip) ? parent_window->ClipRect : viewport_rect;
6096 const ImRect outer_rect = window->Rect();
6097 const ImRect title_bar_rect = window->TitleBarRect();
6098 window->OuterRectClipped = outer_rect;
6099 window->OuterRectClipped.ClipWith(host_rect);
6100
6101 // Inner rectangle
6102 // Not affected by window border size. Used by:
6103 // - InnerClipRect
6104 // - ScrollToBringRectIntoView()
6105 // - NavUpdatePageUpPageDown()
6106 // - Scrollbar()
6107 window->InnerRect.Min.x = window->Pos.x;
6108 window->InnerRect.Min.y = window->Pos.y + decoration_up_height;
6109 window->InnerRect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x;
6110 window->InnerRect.Max.y = window->Pos.y + window->Size.y - window->ScrollbarSizes.y;
6111
6112 // Inner clipping rectangle.
6113 // Will extend a little bit outside the normal work region.
6114 // This is to allow e.g. Selectable or CollapsingHeader or some separators to cover that space.
6115 // Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.
6116 // Note that if our window is collapsed we will end up with an inverted (~null) clipping rectangle which is the correct behavior.
6117 // Affected by window/frame border size. Used by:
6118 // - Begin() initial clip rect
6119 float top_border_size = (((flags & ImGuiWindowFlags_MenuBar) || !(flags & ImGuiWindowFlags_NoTitleBar)) ? style.FrameBorderSize : window->WindowBorderSize);
6120 window->InnerClipRect.Min.x = ImFloor(0.5f + window->InnerRect.Min.x + ImMax(ImFloor(window->WindowPadding.x * 0.5f), window->WindowBorderSize));
6121 window->InnerClipRect.Min.y = ImFloor(0.5f + window->InnerRect.Min.y + top_border_size);
6122 window->InnerClipRect.Max.x = ImFloor(0.5f + window->InnerRect.Max.x - ImMax(ImFloor(window->WindowPadding.x * 0.5f), window->WindowBorderSize));
6123 window->InnerClipRect.Max.y = ImFloor(0.5f + window->InnerRect.Max.y - window->WindowBorderSize);
6124 window->InnerClipRect.ClipWithFull(host_rect);
6125
6126 // Default item width. Make it proportional to window size if window manually resizes
6127 if (window->Size.x > 0.0f && !(flags & ImGuiWindowFlags_Tooltip) && !(flags & ImGuiWindowFlags_AlwaysAutoResize))
6128 window->ItemWidthDefault = ImFloor(window->Size.x * 0.65f);
6129 else
6130 window->ItemWidthDefault = ImFloor(g.FontSize * 16.0f);
6131
6132 // SCROLLING
6133
6134 // Lock down maximum scrolling
6135 // The value of ScrollMax are ahead from ScrollbarX/ScrollbarY which is intentionally using InnerRect from previous rect in order to accommodate
6136 // for right/bottom aligned items without creating a scrollbar.
6137 window->ScrollMax.x = ImMax(0.0f, window->ContentSize.x + window->WindowPadding.x * 2.0f - window->InnerRect.GetWidth());
6138 window->ScrollMax.y = ImMax(0.0f, window->ContentSize.y + window->WindowPadding.y * 2.0f - window->InnerRect.GetHeight());
6139
6140 // Apply scrolling
6142 window->ScrollTarget = ImVec2(FLT_MAX, FLT_MAX);
6143
6144 // DRAWING
6145
6146 // Setup draw list and outer clipping rectangle
6147 IM_ASSERT(window->DrawList->CmdBuffer.Size == 1 && window->DrawList->CmdBuffer[0].ElemCount == 0);
6149 PushClipRect(host_rect.Min, host_rect.Max, false);
6150
6151 // Draw modal window background (darkens what is behind them, all viewports)
6152 const bool dim_bg_for_modal = (flags & ImGuiWindowFlags_Modal) && window == GetTopMostPopupModal() && window->HiddenFramesCannotSkipItems <= 0;
6153 const bool dim_bg_for_window_list = g.NavWindowingTargetAnim && (window == g.NavWindowingTargetAnim->RootWindow);
6154 if (dim_bg_for_modal || dim_bg_for_window_list)
6155 {
6156 const ImU32 dim_bg_col = GetColorU32(dim_bg_for_modal ? ImGuiCol_ModalWindowDimBg : ImGuiCol_NavWindowingDimBg, g.DimBgRatio);
6157 window->DrawList->AddRectFilled(viewport_rect.Min, viewport_rect.Max, dim_bg_col);
6158 }
6159
6160 // Draw navigation selection/windowing rectangle background
6161 if (dim_bg_for_window_list && window == g.NavWindowingTargetAnim)
6162 {
6163 ImRect bb = window->Rect();
6164 bb.Expand(g.FontSize);
6165 if (!bb.Contains(viewport_rect)) // Avoid drawing if the window covers all the viewport anyway
6167 }
6168
6169 // Since 1.71, child window can render their decoration (bg color, border, scrollbars, etc.) within their parent to save a draw call.
6170 // When using overlapping child windows, this will break the assumption that child z-order is mapped to submission order.
6171 // We disable this when the parent window has zero vertices, which is a common pattern leading to laying out multiple overlapping child.
6172 // We also disabled this when we have dimming overlay behind this specific one child.
6173 // FIXME: More code may rely on explicit sorting of overlapping child window and would need to disable this somehow. Please get in contact if you are affected.
6174 {
6175 bool render_decorations_in_parent = false;
6176 if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_is_child_tooltip)
6177 if (window->DrawList->CmdBuffer.back().ElemCount == 0 && parent_window->DrawList->VtxBuffer.Size > 0)
6178 render_decorations_in_parent = true;
6179 if (render_decorations_in_parent)
6180 window->DrawList = parent_window->DrawList;
6181
6182 // Handle title bar, scrollbar, resize grips and resize borders
6183 const ImGuiWindow* window_to_highlight = g.NavWindowingTarget ? g.NavWindowingTarget : g.NavWindow;
6184 const bool title_bar_is_highlight = want_focus || (window_to_highlight && window->RootWindowForTitleBarHighlight == window_to_highlight->RootWindowForTitleBarHighlight);
6185 RenderWindowDecorations(window, title_bar_rect, title_bar_is_highlight, resize_grip_count, resize_grip_col, resize_grip_draw_size);
6186
6187 if (render_decorations_in_parent)
6188 window->DrawList = &window->DrawListInst;
6189 }
6190
6191 // Draw navigation selection/windowing rectangle border
6192 if (g.NavWindowingTargetAnim == window)
6193 {
6194 float rounding = ImMax(window->WindowRounding, g.Style.WindowRounding);
6195 ImRect bb = window->Rect();
6196 bb.Expand(g.FontSize);
6197 if (bb.Contains(viewport_rect)) // If a window fits the entire viewport, adjust its highlight inward
6198 {
6199 bb.Expand(-g.FontSize - 1.0f);
6200 rounding = window->WindowRounding;
6201 }
6203 }
6204
6205 // UPDATE RECTANGLES (2- THOSE AFFECTED BY SCROLLING)
6206
6207 // Work rectangle.
6208 // Affected by window padding and border size. Used by:
6209 // - Columns() for right-most edge
6210 // - TreeNode(), CollapsingHeader() for right-most edge
6211 // - BeginTabBar() for right-most edge
6212 const bool allow_scrollbar_x = !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar);
6213 const bool allow_scrollbar_y = !(flags & ImGuiWindowFlags_NoScrollbar);
6214 const float work_rect_size_x = (window->ContentSizeExplicit.x != 0.0f ? window->ContentSizeExplicit.x : ImMax(allow_scrollbar_x ? window->ContentSize.x : 0.0f, window->Size.x - window->WindowPadding.x * 2.0f - window->ScrollbarSizes.x));
6215 const float work_rect_size_y = (window->ContentSizeExplicit.y != 0.0f ? window->ContentSizeExplicit.y : ImMax(allow_scrollbar_y ? window->ContentSize.y : 0.0f, window->Size.y - window->WindowPadding.y * 2.0f - decoration_up_height - window->ScrollbarSizes.y));
6216 window->WorkRect.Min.x = ImFloor(window->InnerRect.Min.x - window->Scroll.x + ImMax(window->WindowPadding.x, window->WindowBorderSize));
6217 window->WorkRect.Min.y = ImFloor(window->InnerRect.Min.y - window->Scroll.y + ImMax(window->WindowPadding.y, window->WindowBorderSize));
6218 window->WorkRect.Max.x = window->WorkRect.Min.x + work_rect_size_x;
6219 window->WorkRect.Max.y = window->WorkRect.Min.y + work_rect_size_y;
6220 window->ParentWorkRect = window->WorkRect;
6221
6222 // [LEGACY] Content Region
6223 // FIXME-OBSOLETE: window->ContentRegionRect.Max is currently very misleading / partly faulty, but some BeginChild() patterns relies on it.
6224 // Used by:
6225 // - Mouse wheel scrolling + many other things
6226 window->ContentRegionRect.Min.x = window->Pos.x - window->Scroll.x + window->WindowPadding.x;
6227 window->ContentRegionRect.Min.y = window->Pos.y - window->Scroll.y + window->WindowPadding.y + decoration_up_height;
6228 window->ContentRegionRect.Max.x = window->ContentRegionRect.Min.x + (window->ContentSizeExplicit.x != 0.0f ? window->ContentSizeExplicit.x : (window->Size.x - window->WindowPadding.x * 2.0f - window->ScrollbarSizes.x));
6229 window->ContentRegionRect.Max.y = window->ContentRegionRect.Min.y + (window->ContentSizeExplicit.y != 0.0f ? window->ContentSizeExplicit.y : (window->Size.y - window->WindowPadding.y * 2.0f - decoration_up_height - window->ScrollbarSizes.y));
6230
6231 // Setup drawing context
6232 // (NB: That term "drawing context / DC" lost its meaning a long time ago. Initially was meant to hold transient data only. Nowadays difference between window-> and window->DC-> is dubious.)
6233 window->DC.Indent.x = 0.0f + window->WindowPadding.x - window->Scroll.x;
6234 window->DC.GroupOffset.x = 0.0f;
6235 window->DC.ColumnsOffset.x = 0.0f;
6236 window->DC.CursorStartPos = window->Pos + ImVec2(window->DC.Indent.x + window->DC.ColumnsOffset.x, decoration_up_height + window->WindowPadding.y - window->Scroll.y);
6237 window->DC.CursorPos = window->DC.CursorStartPos;
6238 window->DC.CursorPosPrevLine = window->DC.CursorPos;
6239 window->DC.CursorMaxPos = window->DC.CursorStartPos;
6240 window->DC.IdealMaxPos = window->DC.CursorStartPos;
6241 window->DC.CurrLineSize = window->DC.PrevLineSize = ImVec2(0.0f, 0.0f);
6242 window->DC.CurrLineTextBaseOffset = window->DC.PrevLineTextBaseOffset = 0.0f;
6243
6246 window->DC.NavLayersActiveMaskNext = 0x00;
6247 window->DC.NavHideHighlightOneFrame = false;
6248 window->DC.NavHasScroll = (window->ScrollMax.y > 0.0f);
6249
6250 window->DC.MenuBarAppending = false;
6251 window->DC.MenuColumns.Update(3, style.ItemSpacing.x, window_just_activated_by_user);
6252 window->DC.TreeDepth = 0;
6253 window->DC.TreeJumpToParentOnPopMask = 0x00;
6254 window->DC.ChildWindows.resize(0);
6255 window->DC.StateStorage = &window->StateStorage;
6256 window->DC.CurrentColumns = NULL;
6258 window->DC.ParentLayoutType = parent_window ? parent_window->DC.LayoutType : ImGuiLayoutType_Vertical;
6259 window->DC.FocusCounterRegular = window->DC.FocusCounterTabStop = -1;
6260
6261 window->DC.ItemWidth = window->ItemWidthDefault;
6262 window->DC.TextWrapPos = -1.0f; // disabled
6263 window->DC.ItemWidthStack.resize(0);
6264 window->DC.TextWrapPosStack.resize(0);
6265
6266 if (window->AutoFitFramesX > 0)
6267 window->AutoFitFramesX--;
6268 if (window->AutoFitFramesY > 0)
6269 window->AutoFitFramesY--;
6270
6271 // Apply focus (we need to call FocusWindow() AFTER setting DC.CursorStartPos so our initial navigation reference rectangle can start around there)
6272 if (want_focus)
6273 {
6274 FocusWindow(window);
6275 NavInitWindow(window, false); // <-- this is in the way for us to be able to defer and sort reappearing FocusWindow() calls
6276 }
6277
6278 // Title bar
6279 if (!(flags & ImGuiWindowFlags_NoTitleBar))
6280 RenderWindowTitleBarContents(window, ImRect(title_bar_rect.Min.x + window->WindowBorderSize, title_bar_rect.Min.y, title_bar_rect.Max.x - window->WindowBorderSize, title_bar_rect.Max.y), name, p_open);
6281
6282 // Clear hit test shape every frame
6283 window->HitTestHoleSize.x = window->HitTestHoleSize.y = 0;
6284
6285 // Pressing CTRL+C while holding on a window copy its content to the clipboard
6286 // This works but 1. doesn't handle multiple Begin/End pairs, 2. recursing into another Begin/End pair - so we need to work that out and add better logging scope.
6287 // Maybe we can support CTRL+C on every element?
6288 /*
6289 //if (g.NavWindow == window && g.ActiveId == 0)
6290 if (g.ActiveId == window->MoveId)
6291 if (g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_C))
6292 LogToClipboard();
6293 */
6294
6295 // We fill last item data based on Title Bar/Tab, in order for IsItemHovered() and IsItemActive() to be usable after Begin().
6296 // This is useful to allow creating context menus on title bar only, etc.
6297 SetLastItemData(window, window->MoveId, IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false) ? ImGuiItemStatusFlags_HoveredRect : 0, title_bar_rect);
6298
6299#ifdef IMGUI_ENABLE_TEST_ENGINE
6300 if (!(window->Flags & ImGuiWindowFlags_NoTitleBar))
6302#endif
6303 }
6304 else
6305 {
6306 // Append
6307 SetCurrentWindow(window);
6308 }
6309
6310 // Pull/inherit current state
6311 g.CurrentItemFlags = g.ItemFlagsStack.back(); // Inherit from shared stack
6312 window->DC.NavFocusScopeIdCurrent = (flags & ImGuiWindowFlags_ChildWindow) ? parent_window->DC.NavFocusScopeIdCurrent : 0; // Inherit from parent only // -V595
6313
6314 PushClipRect(window->InnerClipRect.Min, window->InnerClipRect.Max, true);
6315
6316 // Clear 'accessed' flag last thing (After PushClipRect which will set the flag. We want the flag to stay false when the default "Debug" window is unused)
6317 window->WriteAccessed = false;
6318 window->BeginCount++;
6320
6321 // Update visibility
6322 if (first_begin_of_the_frame)
6323 {
6324 if (flags & ImGuiWindowFlags_ChildWindow)
6325 {
6326 // Child window can be out of sight and have "negative" clip windows.
6327 // Mark them as collapsed so commands are skipped earlier (we can't manually collapse them because they have no title bar).
6328 IM_ASSERT((flags & ImGuiWindowFlags_NoTitleBar) != 0);
6329 if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0) // FIXME: Doesn't make sense for ChildWindow??
6330 if (!g.LogEnabled)
6331 if (window->OuterRectClipped.Min.x >= window->OuterRectClipped.Max.x || window->OuterRectClipped.Min.y >= window->OuterRectClipped.Max.y)
6332 window->HiddenFramesCanSkipItems = 1;
6333
6334 // Hide along with parent or if parent is collapsed
6335 if (parent_window && (parent_window->Collapsed || parent_window->HiddenFramesCanSkipItems > 0))
6336 window->HiddenFramesCanSkipItems = 1;
6337 if (parent_window && (parent_window->Collapsed || parent_window->HiddenFramesCannotSkipItems > 0))
6338 window->HiddenFramesCannotSkipItems = 1;
6339 }
6340
6341 // Don't render if style alpha is 0.0 at the time of Begin(). This is arbitrary and inconsistent but has been there for a long while (may remove at some point)
6342 if (style.Alpha <= 0.0f)
6343 window->HiddenFramesCanSkipItems = 1;
6344
6345 // Update the Hidden flag
6346 window->Hidden = (window->HiddenFramesCanSkipItems > 0) || (window->HiddenFramesCannotSkipItems > 0) || (window->HiddenFramesForRenderOnly > 0);
6347
6348 // Disable inputs for requested number of frames
6349 if (window->DisableInputsFrames > 0)
6350 {
6351 window->DisableInputsFrames--;
6353 }
6354
6355 // Update the SkipItems flag, used to early out of all items functions (no layout required)
6356 bool skip_items = false;
6357 if (window->Collapsed || !window->Active || window->Hidden)
6358 if (window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0 && window->HiddenFramesCannotSkipItems <= 0)
6359 skip_items = true;
6360 window->SkipItems = skip_items;
6361 }
6362
6363 return !window->SkipItems;
6364}
#define style
Definition WipeTowerDialog.cpp:68
char * ImStrdupcpy(char *dst, size_t *p_dst_size, const char *src)
Definition imgui.cpp:1330
static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow *window)
Definition imgui.cpp:7819
static ImVec2 CalcWindowSizeAfterConstraint(ImGuiWindow *window, const ImVec2 &size_desired)
Definition imgui.cpp:5176
static ImGuiWindow * CreateNewWindow(const char *name, ImGuiWindowFlags flags)
Definition imgui.cpp:5124
static void ClampWindowRect(ImGuiWindow *window, const ImRect &visibility_rect)
Definition imgui.cpp:5498
static void SetCurrentWindow(ImGuiWindow *window)
Definition imgui.cpp:3006
static void CalcWindowContentSizes(ImGuiWindow *window, ImVec2 *content_size_current, ImVec2 *content_size_ideal)
Definition imgui.cpp:5211
static void SetWindowConditionAllowFlags(ImGuiWindow *window, ImGuiCond flags, bool enabled)
Definition imgui.cpp:5097
static ImVec2 CalcWindowAutoFitSize(ImGuiWindow *window, const ImVec2 &size_contents)
Definition imgui.cpp:5231
int ImGuiWindowFlags
Definition imgui.h:201
@ ImGuiCol_ModalWindowDimBg
Definition imgui.h:1465
@ ImGuiCol_NavWindowingHighlight
Definition imgui.h:1463
@ ImGuiCol_NavWindowingDimBg
Definition imgui.h:1464
@ ImGuiWindowFlags_NoInputs
Definition imgui.h:938
@ ImGuiWindowFlags_AlwaysUseWindowPadding
Definition imgui.h:932
@ ImGuiWindowFlags_AlwaysAutoResize
Definition imgui.h:922
@ ImGuiWindowFlags_MenuBar
Definition imgui.h:926
@ ImGuiWindowFlags_HorizontalScrollbar
Definition imgui.h:927
@ ImGuiWindowFlags_Tooltip
Definition imgui.h:943
@ ImGuiWindowFlags_NoTitleBar
Definition imgui.h:916
@ ImGuiWindowFlags_NoNavFocus
Definition imgui.h:934
@ ImGuiWindowFlags_AlwaysVerticalScrollbar
Definition imgui.h:930
@ ImGuiWindowFlags_NoFocusOnAppearing
Definition imgui.h:928
@ ImGuiWindowFlags_NoCollapse
Definition imgui.h:921
@ ImGuiWindowFlags_Modal
Definition imgui.h:945
@ ImGuiWindowFlags_Popup
Definition imgui.h:944
@ ImGuiWindowFlags_ChildMenu
Definition imgui.h:946
@ ImGuiWindowFlags_AlwaysHorizontalScrollbar
Definition imgui.h:931
@ ImGuiWindowFlags_NavFlattened
Definition imgui.h:941
@ ImGuiWindowFlags_NoMove
Definition imgui.h:918
@ ImGuiWindowFlags_ChildWindow
Definition imgui.h:942
@ ImGuiWindowFlags_NoResize
Definition imgui.h:917
@ ImGuiWindowFlags_NoScrollbar
Definition imgui.h:919
@ ImGuiCond_FirstUseEver
Definition imgui.h:1617
@ ImGuiCond_Once
Definition imgui.h:1616
@ ImGuiCond_Appearing
Definition imgui.h:1618
@ ImGuiDir_None
Definition imgui.h:1295
bool NavHideHighlightOneFrame
Definition imgui_internal.h:1778
ImVec2 IdealMaxPos
Definition imgui_internal.h:1758
ImU32 TreeJumpToParentOnPopMask
Definition imgui_internal.h:1786
ImVec1 Indent
Definition imgui_internal.h:1763
ImVec1 GroupOffset
Definition imgui_internal.h:1765
ImVec2 CursorMaxPos
Definition imgui_internal.h:1757
static float ImLengthSqr(const ImVec2 &lhs)
Definition imgui_internal.h:424
short NavLayersActiveMask
Definition imgui_internal.h:1775
ImVec2 CursorStartPos
Definition imgui_internal.h:1756
float TextWrapPos
Definition imgui_internal.h:1799
static float ImFloor(float f)
Definition imgui_internal.h:427
ImGuiLayoutType LayoutType
Definition imgui_internal.h:1791
float PrevLineTextBaseOffset
Definition imgui_internal.h:1762
short NavLayersActiveMaskNext
Definition imgui_internal.h:1776
bool NavHasScroll
Definition imgui_internal.h:1779
int CurrentTableIdx
Definition imgui_internal.h:1790
@ ImGuiItemStatusFlags_HoveredRect
Definition imgui_internal.h:745
ImGuiMenuColumns MenuColumns
Definition imgui_internal.h:1784
int FocusCounterRegular
Definition imgui_internal.h:1793
#define IMGUI_TEST_ENGINE_ITEM_ADD(_BB, _ID)
Definition imgui_internal.h:2669
ImGuiNavLayer NavLayerCurrent
Definition imgui_internal.h:1774
ImGuiID LastItemId
Definition imgui_internal.h:1768
bool MenuBarAppending
Definition imgui_internal.h:1782
ImVector< float > TextWrapPosStack
Definition imgui_internal.h:1801
ImVec2 PrevLineSize
Definition imgui_internal.h:1760
int TreeDepth
Definition imgui_internal.h:1785
ImGuiStackSizes StackSizesOnBegin
Definition imgui_internal.h:1802
@ ImGuiNextWindowDataFlags_HasSize
Definition imgui_internal.h:1083
@ ImGuiNextWindowDataFlags_HasFocus
Definition imgui_internal.h:1087
@ ImGuiNextWindowDataFlags_HasContentSize
Definition imgui_internal.h:1084
@ ImGuiNextWindowDataFlags_HasScroll
Definition imgui_internal.h:1089
@ ImGuiNextWindowDataFlags_HasCollapsed
Definition imgui_internal.h:1085
@ ImGuiNextWindowDataFlags_HasPos
Definition imgui_internal.h:1082
float ItemWidth
Definition imgui_internal.h:1798
@ ImGuiLayoutType_Vertical
Definition imgui_internal.h:849
ImRect LastItemRect
Definition imgui_internal.h:1770
ImVector< float > ItemWidthStack
Definition imgui_internal.h:1800
ImVector< ImGuiWindow * > ChildWindows
Definition imgui_internal.h:1787
ImGuiOldColumns * CurrentColumns
Definition imgui_internal.h:1789
#define IM_FLOOR(_VAL)
Definition imgui_internal.h:232
ImVec2 MenuBarOffset
Definition imgui_internal.h:1783
ImVec2 CursorPosPrevLine
Definition imgui_internal.h:1755
ImGuiID NavFocusScopeIdCurrent
Definition imgui_internal.h:1777
ImGuiStorage * StateStorage
Definition imgui_internal.h:1788
int FocusCounterTabStop
Definition imgui_internal.h:1794
ImGuiLayoutType ParentLayoutType
Definition imgui_internal.h:1792
ImVec1 ColumnsOffset
Definition imgui_internal.h:1764
@ ImGuiNavLayer_Main
Definition imgui_internal.h:935
const Scalar & y
Definition MathFunctions.h:552
IMGUI_API void PushClipRect(const ImVec2 &clip_rect_min, const ImVec2 &clip_rect_max, bool intersect_with_current_clip_rect)
Definition imgui.cpp:4365
IMGUI_API ImVec2 FindBestWindowPosForPopup(ImGuiWindow *window)
Definition imgui.cpp:8535
static void RenderWindowTitleBarContents(ImGuiWindow *window, const ImRect &title_bar_rect, const char *name, bool *p_open)
Definition imgui.cpp:5617
IMGUI_API void SetWindowSize(const ImVec2 &size, ImGuiCond cond=0)
Definition imgui.cpp:6790
IMGUI_API ImGuiWindow * GetTopMostPopupModal()
Definition imgui.cpp:8111
IMGUI_API ImGuiViewport * GetMainViewport()
Definition imgui.cpp:10630
IMGUI_API void SetLastItemData(ImGuiWindow *window, ImGuiID item_id, ImGuiItemStatusFlags status_flags, const ImRect &item_rect)
Definition imgui.cpp:3247
IMGUI_API void UpdateWindowParentAndRootLinks(ImGuiWindow *window, ImGuiWindowFlags flags, ImGuiWindow *parent_window)
Definition imgui.cpp:5700
IMGUI_API void SetWindowPos(const ImVec2 &pos, ImGuiCond cond=0)
Definition imgui.cpp:6740
static void RenderWindowDecorations(ImGuiWindow *window, const ImRect &title_bar_rect, bool title_bar_is_highlight, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size)
Definition imgui.cpp:5533
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond=0)
Definition imgui.cpp:6819
IMGUI_API ImGuiWindow * FindWindowByName(const char *name)
Definition imgui.cpp:5110
IMGUI_API void GcAwakeTransientWindowBuffers(ImGuiWindow *window)
Definition imgui.cpp:3039
IMGUI_API void FocusWindow(ImGuiWindow *window)
Definition imgui.cpp:6451
IMGUI_API bool IsMouseHoveringRect(const ImVec2 &r_min, const ImVec2 &r_max, bool clip=true)
Definition imgui.cpp:4609
IMGUI_API void NavInitWindow(ImGuiWindow *window, bool force_reinit)
Definition imgui.cpp:8932
IMGUI_API void MarkIniSettingsDirty()
Definition imgui.cpp:10358
static bool UpdateWindowManualResize(ImGuiWindow *window, const ImVec2 &size_auto_fit, int *border_held, int resize_grip_count, ImU32 resize_grip_col[4], const ImRect &visibility_rect)
Definition imgui.cpp:5368
TCoord< P > x(const P &p)
Definition geometry_traits.hpp:297
unsigned int ElemCount
Definition imgui.h:2241
IMGUI_API void _ResetForNewFrame()
Definition imgui_draw.cpp:404
ImVector< ImDrawCmd > CmdBuffer
Definition imgui.h:2350
IMGUI_API void AddRectFilled(const ImVec2 &p_min, const ImVec2 &p_max, ImU32 col, float rounding=0.0f, ImDrawFlags flags=0)
Definition imgui_draw.cpp:1388
IMGUI_API void PushTextureID(ImTextureID texture_id)
Definition imgui_draw.cpp:599
ImTextureID TexID
Definition imgui.h:2654
ImFontAtlas * ContainerAtlas
Definition imgui.h:2702
ImGuiID HoveredIdPreviousFrame
Definition imgui_internal.h:1391
ImVector< ImGuiPopupData > OpenPopupStack
Definition imgui_internal.h:1433
ImGuiNextWindowData NextWindowData
Definition imgui_internal.h:1423
ImVector< ImGuiWindow * > CurrentWindowStack
Definition imgui_internal.h:1376
bool LogEnabled
Definition imgui_internal.h:1569
double Time
Definition imgui_internal.h:1360
ImGuiID HoveredId
Definition imgui_internal.h:1390
ImVector< ImGuiPopupData > BeginPopupStack
Definition imgui_internal.h:1434
float NavWindowingHighlightAlpha
Definition imgui_internal.h:1483
ImGuiWindow * HoveredWindow
Definition imgui_internal.h:1381
bool WithinFrameScope
Definition imgui_internal.h:1364
ImVector< ImGuiItemFlags > ItemFlagsStack
Definition imgui_internal.h:1431
ImGuiWindow * NavWindowingTarget
Definition imgui_internal.h:1479
int WindowsActiveCount
Definition imgui_internal.h:1378
int FrameCountEnded
Definition imgui_internal.h:1362
ImGuiWindow * NavWindowingListWindow
Definition imgui_internal.h:1481
ImGuiWindow * NavWindowingTargetAnim
Definition imgui_internal.h:1480
bool WithinFrameScopeWithImplicitWindow
Definition imgui_internal.h:1365
ImGuiIO IO
Definition imgui_internal.h:1354
ImGuiWindow * NavWindow
Definition imgui_internal.h:1440
ImFont * Font
Definition imgui_internal.h:1356
bool MouseDoubleClicked[5]
Definition imgui.h:1884
bool ConfigWindowsResizeFromEdges
Definition imgui.h:1806
void Update(int count, float spacing, bool clear)
Definition imgui_widgets.cpp:6513
ImVec2 ContentSizeVal
Definition imgui_internal.h:1102
bool CollapsedVal
Definition imgui_internal.h:1104
ImGuiCond SizeCond
Definition imgui_internal.h:1097
ImVec2 PosPivotVal
Definition imgui_internal.h:1100
ImGuiCond CollapsedCond
Definition imgui_internal.h:1098
void ClearFlags()
Definition imgui_internal.h:1112
ImGuiNextWindowDataFlags Flags
Definition imgui_internal.h:1095
ImVec2 PosVal
Definition imgui_internal.h:1099
ImVec2 MenuBarOffsetMinVal
Definition imgui_internal.h:1109
ImGuiCond PosCond
Definition imgui_internal.h:1096
ImVec2 ScrollVal
Definition imgui_internal.h:1103
ImVec2 SizeVal
Definition imgui_internal.h:1101
Definition imgui_internal.h:1053
ImGuiID PopupId
Definition imgui_internal.h:1054
ImVec2 OpenPopupPos
Definition imgui_internal.h:1059
ImGuiWindow * Window
Definition imgui_internal.h:1055
void SetToCurrentState()
Definition imgui.cpp:7278
Definition imgui.h:1721
float WindowRounding
Definition imgui.h:1724
Definition imgui_internal.h:1228
ImRect GetMainRect() const
Definition imgui_internal.h:1248
ImRect GetWorkRect() const
Definition imgui_internal.h:1249
ImVec2 ScrollbarSizes
Definition imgui_internal.h:1828
short BeginCount
Definition imgui_internal.h:1841
bool Collapsed
Definition imgui_internal.h:1833
ImRect TitleBarRect() const
Definition imgui_internal.h:1914
ImGuiCond SetWindowSizeAllowFlags
Definition imgui_internal.h:1855
ImRect InnerRect
Definition imgui_internal.h:1866
ImS8 AutoFitFramesY
Definition imgui_internal.h:1846
ImVec2 Pos
Definition imgui_internal.h:1811
ImRect Rect() const
Definition imgui_internal.h:1911
bool Appearing
Definition imgui_internal.h:1836
ImVector< ImGuiID > IDStack
Definition imgui_internal.h:1860
int NameBufLen
Definition imgui_internal.h:1820
ImGuiStorage StateStorage
Definition imgui_internal.h:1878
ImS8 DisableInputsFrames
Definition imgui_internal.h:1853
signed char ResizeBorderHeld
Definition imgui_internal.h:1840
ImGuiID PopupId
Definition imgui_internal.h:1845
bool AutoFitOnlyGrows
Definition imgui_internal.h:1848
bool WriteAccessed
Definition imgui_internal.h:1832
ImRect WorkRect
Definition imgui_internal.h:1868
bool WantCollapseToggle
Definition imgui_internal.h:1834
ImVec2 ScrollTargetCenterRatio
Definition imgui_internal.h:1826
bool Active
Definition imgui_internal.h:1830
bool Hidden
Definition imgui_internal.h:1837
ImVec2 SetWindowPosPivot
Definition imgui_internal.h:1858
ImVec2 WindowPadding
Definition imgui_internal.h:1817
ImGuiID ID
Definition imgui_internal.h:1809
ImRect InnerClipRect
Definition imgui_internal.h:1867
bool ScrollbarX
Definition imgui_internal.h:1829
float ItemWidthDefault
Definition imgui_internal.h:1877
ImS8 HiddenFramesForRenderOnly
Definition imgui_internal.h:1852
ImGuiID MoveId
Definition imgui_internal.h:1821
ImVec2 ContentSize
Definition imgui_internal.h:1814
ImVec2 SetWindowPosVal
Definition imgui_internal.h:1857
ImS8 AutoFitFramesX
Definition imgui_internal.h:1846
int LastFrameActive
Definition imgui_internal.h:1875
ImS8 HiddenFramesCannotSkipItems
Definition imgui_internal.h:1851
ImVec2 ScrollTarget
Definition imgui_internal.h:1825
ImGuiWindowFlags Flags
Definition imgui_internal.h:1810
float WindowRounding
Definition imgui_internal.h:1818
ImVec2 Size
Definition imgui_internal.h:1812
ImGuiCond SetWindowPosAllowFlags
Definition imgui_internal.h:1854
short BeginOrderWithinParent
Definition imgui_internal.h:1842
ImGuiDir AutoPosLastDirection
Definition imgui_internal.h:1849
ImVec2 ContentSizeExplicit
Definition imgui_internal.h:1816
ImDrawList DrawListInst
Definition imgui_internal.h:1884
ImVec2ih HitTestHoleSize
Definition imgui_internal.h:1872
ImVec2 ContentSizeIdeal
Definition imgui_internal.h:1815
char * Name
Definition imgui_internal.h:1808
ImVec2 Scroll
Definition imgui_internal.h:1823
ImVec2 SizeFull
Definition imgui_internal.h:1813
ImRect OuterRectClipped
Definition imgui_internal.h:1865
float MenuBarHeight() const
Definition imgui_internal.h:1915
float TitleBarHeight() const
Definition imgui_internal.h:1913
float WindowBorderSize
Definition imgui_internal.h:1819
ImRect ParentWorkRect
Definition imgui_internal.h:1869
ImGuiWindow * RootWindowForTitleBarHighlight
Definition imgui_internal.h:1887
ImRect ContentRegionRect
Definition imgui_internal.h:1871
bool ScrollbarY
Definition imgui_internal.h:1829
float LastTimeActive
Definition imgui_internal.h:1876
bool HasCloseButton
Definition imgui_internal.h:1839
ImGuiWindow * RootWindow
Definition imgui_internal.h:1886
ImVec2 ScrollMax
Definition imgui_internal.h:1824
bool IsFallbackWindow
Definition imgui_internal.h:1838
ImS8 HiddenFramesCanSkipItems
Definition imgui_internal.h:1850
bool MemoryCompacted
Definition imgui_internal.h:1896
short BeginOrderWithinContext
Definition imgui_internal.h:1843
void ClipWithFull(const ImRect &r)
Definition imgui_internal.h:500
void ClipWith(const ImRect &r)
Definition imgui_internal.h:499
ImVec2 GetSize() const
Definition imgui_internal.h:481
float x
Definition imgui_internal.h:454
float x
Definition imgui.h:246
short x
Definition imgui_internal.h:462
short y
Definition imgui_internal.h:462
Definition imgui.h:258
bool empty() const
Definition imgui.h:1670
int Size
Definition imgui.h:1655
void resize(int new_size)
Definition imgui.h:1690

References ImDrawList::_ResetForNewFrame(), ImGuiWindow::Active, ImDrawList::AddRect(), ImDrawList::AddRectFilled(), ImGuiWindow::Appearing, ImGuiWindow::AutoFitFramesX, ImGuiWindow::AutoFitFramesY, ImGuiWindow::AutoFitOnlyGrows, ImGuiWindow::AutoPosLastDirection, ImVector< T >::back(), ImGuiWindow::BeginCount, ImGuiWindow::BeginOrderWithinContext, ImGuiWindow::BeginOrderWithinParent, ImGuiContext::BeginPopupStack, CalcNextScrollFromScrollTargetAndClamp(), CalcWindowAutoFitSize(), CalcWindowContentSizes(), CalcWindowSizeAfterConstraint(), ImGuiWindowTempData::ChildWindows, ClampWindowRect(), ImGuiNextWindowData::ClearFlags(), ImGuiWindow::ClipRect, ImRect::ClipWith(), ImRect::ClipWithFull(), ImDrawList::CmdBuffer, ImGuiWindow::Collapsed, ImGuiNextWindowData::CollapsedCond, ImGuiNextWindowData::CollapsedVal, ImGuiWindowTempData::ColumnsOffset, ImGuiIO::ConfigWindowsResizeFromEdges, ImFont::ContainerAtlas, ImRect::Contains(), ImGuiWindow::ContentRegionRect, ImGuiWindow::ContentSize, ImGuiWindow::ContentSizeExplicit, ImGuiWindow::ContentSizeIdeal, ImGuiNextWindowData::ContentSizeVal, CreateNewWindow(), ImGuiWindowTempData::CurrentColumns, ImGuiContext::CurrentItemFlags, ImGuiWindowTempData::CurrentTableIdx, ImGuiContext::CurrentWindow, ImGuiContext::CurrentWindowStack, ImGuiWindowTempData::CurrLineSize, ImGuiWindowTempData::CurrLineTextBaseOffset, ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindowTempData::CursorPosPrevLine, ImGuiWindowTempData::CursorStartPos, ImGuiWindow::DC, ImGuiContext::DimBgRatio, ImGuiWindow::DisableInputsFrames, ImGuiWindow::DrawList, ImGuiWindow::DrawListInst, ImDrawCmd::ElemCount, ImVector< T >::empty(), ImRect::Expand(), FindBestWindowPosForPopup(), FindWindowByName(), ImGuiNextWindowData::Flags, ImGuiWindow::Flags, ImGuiWindowTempData::FocusCounterRegular, ImGuiWindowTempData::FocusCounterTabStop, FocusWindow(), ImGuiContext::Font, ImGuiContext::FontSize, ImGuiContext::FrameCount, ImGuiContext::FrameCountEnded, GcAwakeTransientWindowBuffers(), GetColorU32(), ImRect::GetHeight(), ImGuiViewportP::GetMainRect(), GetMainViewport(), ImRect::GetSize(), GetTopMostPopupModal(), ImRect::GetWidth(), ImGuiViewportP::GetWorkRect(), GImGui, ImGuiWindowTempData::GroupOffset, ImGuiWindow::HasCloseButton, ImGuiWindow::Hidden, ImGuiWindow::HiddenFramesCannotSkipItems, ImGuiWindow::HiddenFramesCanSkipItems, ImGuiWindow::HiddenFramesForRenderOnly, ImGuiWindow::HitTestHoleSize, ImGuiContext::HoveredId, ImGuiContext::HoveredIdPreviousFrame, ImGuiContext::HoveredWindow, ImGuiWindow::ID, ImGuiWindowTempData::IdealMaxPos, ImGuiWindow::IDStack, IM_ASSERT, IM_FLOOR, ImFloor(), IMGUI_TEST_ENGINE_ITEM_ADD, ImGuiCol_ModalWindowDimBg, ImGuiCol_NavWindowingDimBg, ImGuiCol_NavWindowingHighlight, ImGuiCond_Appearing, ImGuiCond_FirstUseEver, ImGuiCond_Once, ImGuiDir_None, ImGuiItemStatusFlags_HoveredRect, ImGuiLayoutType_Vertical, ImGuiNavLayer_Main, ImGuiNextWindowDataFlags_HasCollapsed, ImGuiNextWindowDataFlags_HasContentSize, ImGuiNextWindowDataFlags_HasFocus, ImGuiNextWindowDataFlags_HasPos, ImGuiNextWindowDataFlags_HasScroll, ImGuiNextWindowDataFlags_HasSize, ImGuiWindowFlags_AlwaysAutoResize, ImGuiWindowFlags_AlwaysHorizontalScrollbar, ImGuiWindowFlags_AlwaysUseWindowPadding, ImGuiWindowFlags_AlwaysVerticalScrollbar, ImGuiWindowFlags_ChildMenu, ImGuiWindowFlags_ChildWindow, ImGuiWindowFlags_HorizontalScrollbar, ImGuiWindowFlags_MenuBar, ImGuiWindowFlags_Modal, ImGuiWindowFlags_NavFlattened, ImGuiWindowFlags_NoCollapse, ImGuiWindowFlags_NoFocusOnAppearing, ImGuiWindowFlags_NoInputs, ImGuiWindowFlags_NoMove, ImGuiWindowFlags_NoNavFocus, ImGuiWindowFlags_NoResize, ImGuiWindowFlags_NoScrollbar, ImGuiWindowFlags_NoTitleBar, ImGuiWindowFlags_Popup, ImGuiWindowFlags_Tooltip, ImLengthSqr(), ImMax(), ImStrdupcpy(), ImGuiWindowTempData::Indent, ImGuiWindow::InnerClipRect, ImGuiWindow::InnerRect, ImGuiContext::IO, ImGuiWindow::IsFallbackWindow, IsMouseHoveringRect(), ImGuiContext::ItemFlagsStack, ImGuiWindowTempData::ItemWidth, ImGuiWindow::ItemWidthDefault, ImGuiWindowTempData::ItemWidthStack, ImGuiWindow::LastFrameActive, ImGuiWindowTempData::LastItemId, ImGuiWindowTempData::LastItemRect, ImGuiWindow::LastTimeActive, ImGuiWindowTempData::LayoutType, ImGuiContext::LogEnabled, MarkIniSettingsDirty(), ImRect::Max, ImGuiWindow::MemoryCompacted, ImGuiWindowTempData::MenuBarAppending, ImGuiWindow::MenuBarHeight(), ImGuiWindowTempData::MenuBarOffset, ImGuiNextWindowData::MenuBarOffsetMinVal, ImGuiWindowTempData::MenuColumns, ImRect::Min, ImGuiIO::MouseDoubleClicked, ImGuiWindow::MoveId, ImGuiWindow::Name, ImGuiWindow::NameBufLen, ImGuiWindowTempData::NavFocusScopeIdCurrent, ImGuiWindowTempData::NavHasScroll, ImGuiWindowTempData::NavHideHighlightOneFrame, NavInitWindow(), ImGuiWindowTempData::NavLayerCurrent, ImGuiWindowTempData::NavLayersActiveMask, ImGuiWindowTempData::NavLayersActiveMaskNext, ImGuiContext::NavWindow, ImGuiContext::NavWindowingHighlightAlpha, ImGuiContext::NavWindowingListWindow, ImGuiContext::NavWindowingTarget, ImGuiContext::NavWindowingTargetAnim, ImGuiContext::NextWindowData, ImGuiPopupData::OpenPopupPos, ImGuiContext::OpenPopupStack, ImGuiWindow::OuterRectClipped, ImGuiWindowTempData::ParentLayoutType, ImGuiWindow::ParentWindow, ImGuiWindow::ParentWorkRect, ImGuiPopupData::PopupId, ImGuiWindow::PopupId, ImGuiWindow::Pos, ImGuiNextWindowData::PosCond, ImGuiNextWindowData::PosPivotVal, ImGuiNextWindowData::PosVal, ImGuiWindowTempData::PrevLineSize, ImGuiWindowTempData::PrevLineTextBaseOffset, ImVector< T >::push_back(), PushClipRect(), ImDrawList::PushTextureID(), ImGuiWindow::Rect(), RenderWindowDecorations(), RenderWindowTitleBarContents(), ImVector< T >::resize(), ImGuiWindow::ResizeBorderHeld, ImGuiWindow::RootWindow, ImGuiWindow::RootWindowForTitleBarHighlight, ImGuiWindow::Scroll, ImGuiWindow::ScrollbarSizes, ImGuiWindow::ScrollbarX, ImGuiWindow::ScrollbarY, ImGuiWindow::ScrollMax, ImGuiWindow::ScrollTarget, ImGuiWindow::ScrollTargetCenterRatio, ImGuiNextWindowData::ScrollVal, SetCurrentWindow(), SetLastItemData(), ImGuiStackSizes::SetToCurrentState(), SetWindowCollapsed(), SetWindowConditionAllowFlags(), SetWindowPos(), ImGuiWindow::SetWindowPosAllowFlags, ImGuiWindow::SetWindowPosPivot, ImGuiWindow::SetWindowPosVal, SetWindowSize(), ImGuiWindow::SetWindowSizeAllowFlags, ImVector< T >::Size, ImGuiWindow::Size, ImGuiNextWindowData::SizeCond, ImGuiWindow::SizeFull, ImGuiNextWindowData::SizeVal, ImGuiWindow::SkipItems, ImGuiWindowTempData::StackSizesOnBegin, ImGuiWindowTempData::StateStorage, ImGuiWindow::StateStorage, ImGuiContext::Style, style, ImFontAtlas::TexID, ImGuiWindowTempData::TextWrapPos, ImGuiWindowTempData::TextWrapPosStack, ImGuiContext::Time, ImGuiWindow::TitleBarHeight(), ImGuiWindow::TitleBarRect(), ImGuiWindowTempData::TreeDepth, ImGuiWindowTempData::TreeJumpToParentOnPopMask, ImGuiMenuColumns::Update(), UpdateWindowManualResize(), UpdateWindowParentAndRootLinks(), ImDrawList::VtxBuffer, ImGuiWindow::WantCollapseToggle, ImGuiPopupData::Window, ImGuiWindow::WindowBorderSize, ImGuiWindow::WindowPadding, ImGuiStyle::WindowRounding, ImGuiWindow::WindowRounding, ImGuiContext::WindowsActiveCount, ImGuiContext::WithinFrameScope, ImGuiContext::WithinFrameScopeWithImplicitWindow, ImGuiWindow::WorkRect, ImGuiWindow::WriteAccessed, ImVec2::x, ImVec1::x, ImVec2ih::x, ImVec2::y, and ImVec2ih::y.

Referenced by Slic3r::GUI::ImGuiWrapper::begin(), Slic3r::GUI::ImGuiWrapper::begin(), BeginChildEx(), BeginCombo(), BeginPopupEx(), BeginPopupModal(), BeginTooltipEx(), BeginViewportSideBar(), ExampleAppConsole::Draw(), ExampleAppLog::Draw(), igl::opengl::glfw::imgui::ImGuiMenu::draw_labels_window(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_window(), NavUpdateWindowingOverlay(), NewFrame(), Slic3r::GUI::GLGizmoEmboss::on_render_input_window(), ShowAboutWindow(), ShowDemoWindow(), ShowDemoWindowLayout(), ShowDemoWindowWidgets(), ShowExampleAppAutoResize(), ShowExampleAppConstrainedResize(), ShowExampleAppCustomRendering(), ShowExampleAppDocuments(), ShowExampleAppFullscreen(), ShowExampleAppLayout(), ShowExampleAppLog(), ShowExampleAppLongText(), ShowExampleAppPropertyEditor(), ShowExampleAppSimpleOverlay(), ShowExampleAppWindowTitles(), and ShowMetricsWindow().

+ Here is the caller graph for this function:

◆ BeginChild() [1/2]

bool ImGui::BeginChild ( const char *  str_id,
const ImVec2 size = ImVec2(0, 0),
bool  border = false,
ImGuiWindowFlags  flags = 0 
)
5020{
5021 ImGuiWindow* window = GetCurrentWindow();
5022 return BeginChildEx(str_id, window->GetID(str_id), size_arg, border, extra_flags);
5023}
IMGUI_API bool BeginChildEx(const char *name, ImGuiID id, const ImVec2 &size_arg, bool border, ImGuiWindowFlags flags)
Definition imgui.cpp:4969

References BeginChildEx(), GetCurrentWindow(), and ImGuiWindow::GetID().

Referenced by BeginChildFrame(), ExampleAppConsole::Draw(), ExampleAppLog::Draw(), Slic3r::GUI::GCodeViewer::render_legend(), ShowDemoWindowColumns(), ShowDemoWindowLayout(), ShowDemoWindowWidgets(), ShowExampleAppLayout(), ShowExampleAppLongText(), ShowExampleMenuFile(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginChild() [2/2]

bool ImGui::BeginChild ( ImGuiID  id,
const ImVec2 size = ImVec2(0, 0),
bool  border = false,
ImGuiWindowFlags  flags = 0 
)
5026{
5027 IM_ASSERT(id != 0);
5028 return BeginChildEx(NULL, id, size_arg, border, extra_flags);
5029}

References BeginChildEx(), and IM_ASSERT.

+ Here is the call graph for this function:

◆ BeginChildEx()

bool ImGui::BeginChildEx ( const char *  name,
ImGuiID  id,
const ImVec2 size_arg,
bool  border,
ImGuiWindowFlags  flags 
)
4970{
4971 ImGuiContext& g = *GImGui;
4972 ImGuiWindow* parent_window = g.CurrentWindow;
4973
4975 flags |= (parent_window->Flags & ImGuiWindowFlags_NoMove); // Inherit the NoMove flag
4976
4977 // Size
4978 const ImVec2 content_avail = GetContentRegionAvail();
4979 ImVec2 size = ImFloor(size_arg);
4980 const int auto_fit_axises = ((size.x == 0.0f) ? (1 << ImGuiAxis_X) : 0x00) | ((size.y == 0.0f) ? (1 << ImGuiAxis_Y) : 0x00);
4981 if (size.x <= 0.0f)
4982 size.x = ImMax(content_avail.x + size.x, 4.0f); // Arbitrary minimum child size (0.0f causing too much issues)
4983 if (size.y <= 0.0f)
4984 size.y = ImMax(content_avail.y + size.y, 4.0f);
4985 SetNextWindowSize(size);
4986
4987 // Build up name. If you need to append to a same child from multiple location in the ID stack, use BeginChild(ImGuiID id) with a stable value.
4988 if (name)
4989 ImFormatString(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), "%s/%s_%08X", parent_window->Name, name, id);
4990 else
4991 ImFormatString(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), "%s/%08X", parent_window->Name, id);
4992
4993 const float backup_border_size = g.Style.ChildBorderSize;
4994 if (!border)
4995 g.Style.ChildBorderSize = 0.0f;
4996 bool ret = Begin(g.TempBuffer, NULL, flags);
4997 g.Style.ChildBorderSize = backup_border_size;
4998
4999 ImGuiWindow* child_window = g.CurrentWindow;
5000 child_window->ChildId = id;
5001 child_window->AutoFitChildAxises = (ImS8)auto_fit_axises;
5002
5003 // Set the cursor to handle case where the user called SetNextWindowPos()+BeginChild() manually.
5004 // While this is not really documented/defined, it seems that the expected thing to do.
5005 if (child_window->BeginCount == 1)
5006 parent_window->DC.CursorPos = child_window->Pos;
5007
5008 // Process navigation-in immediately so NavInit can run on first frame
5009 if (g.NavActivateId == id && !(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayersActiveMask != 0 || child_window->DC.NavHasScroll))
5010 {
5011 FocusWindow(child_window);
5012 NavInitWindow(child_window, false);
5013 SetActiveID(id + 1, child_window); // Steal ActiveId with another arbitrary id so that key-press won't activate child item
5015 }
5016 return ret;
5017}
int ImFormatString(char *buf, size_t buf_size, const char *fmt,...)
Definition imgui.cpp:1435
signed char ImS8
Definition imgui.h:224
@ ImGuiWindowFlags_NoSavedSettings
Definition imgui.h:924
#define IM_ARRAYSIZE(_ARR)
Definition imgui.h:83
@ ImGuiAxis_X
Definition imgui_internal.h:865
@ ImGuiAxis_Y
Definition imgui_internal.h:866
@ ImGuiInputSource_Nav
Definition imgui_internal.h:881
IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow *window)
Definition imgui.cpp:3049
IMGUI_API ImVec2 GetContentRegionAvail()
Definition imgui.cpp:7687
IMGUI_API bool Begin(const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
Definition imgui.cpp:5722
IMGUI_API void SetNextWindowSize(const ImVec2 &size, ImGuiCond cond=0)
Definition imgui.cpp:6870
ImGuiInputSource ActiveIdSource
Definition imgui_internal.h:1413
ImGuiID NavActivateId
Definition imgui_internal.h:1443
char TempBuffer[1024 *3+1]
Definition imgui_internal.h:1594
float ChildBorderSize
Definition imgui.h:1730
ImGuiID ChildId
Definition imgui_internal.h:1822
ImS8 AutoFitChildAxises
Definition imgui_internal.h:1847

References ImGuiContext::ActiveIdSource, ImGuiWindow::AutoFitChildAxises, Begin(), ImGuiWindow::BeginCount, ImGuiStyle::ChildBorderSize, ImGuiWindow::ChildId, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::Flags, FocusWindow(), GetContentRegionAvail(), GImGui, IM_ARRAYSIZE, ImFloor(), ImFormatString(), ImGuiAxis_X, ImGuiAxis_Y, ImGuiInputSource_Nav, ImGuiWindowFlags_ChildWindow, ImGuiWindowFlags_NavFlattened, ImGuiWindowFlags_NoMove, ImGuiWindowFlags_NoResize, ImGuiWindowFlags_NoSavedSettings, ImGuiWindowFlags_NoTitleBar, ImMax(), ImGuiWindow::Name, ImGuiContext::NavActivateId, ImGuiWindowTempData::NavHasScroll, NavInitWindow(), ImGuiWindowTempData::NavLayersActiveMask, ImGuiWindow::Pos, SetActiveID(), SetNextWindowSize(), ImGuiContext::Style, ImGuiContext::TempBuffer, ImVec2::x, and ImVec2::y.

Referenced by BeginChild(), BeginChild(), BeginTableEx(), and InputTextEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginChildFrame()

bool ImGui::BeginChildFrame ( ImGuiID  id,
const ImVec2 size,
ImGuiWindowFlags  flags = 0 
)
5079{
5080 ImGuiContext& g = *GImGui;
5081 const ImGuiStyle& style = g.Style;
5086 bool ret = BeginChild(id, size, true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags);
5087 PopStyleVar(3);
5088 PopStyleColor();
5089 return ret;
5090}
@ ImGuiStyleVar_ChildRounding
Definition imgui.h:1485
@ ImGuiStyleVar_WindowPadding
Definition imgui.h:1480
@ ImGuiStyleVar_ChildBorderSize
Definition imgui.h:1486
@ ImGuiCol_FrameBg
Definition imgui.h:1420
@ ImGuiCol_ChildBg
Definition imgui.h:1416
IMGUI_API void PopStyleVar(int count=1)
Definition imgui.cpp:2565
IMGUI_API bool BeginChild(const char *str_id, const ImVec2 &size=ImVec2(0, 0), bool border=false, ImGuiWindowFlags flags=0)
Definition imgui.cpp:5019
IMGUI_API void PushStyleColor(ImGuiCol idx, ImU32 col)
Definition imgui.cpp:2462
IMGUI_API void PopStyleColor(int count=1)
Definition imgui.cpp:2482
IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val)
Definition imgui.cpp:2537

References BeginChild(), GImGui, ImGuiCol_ChildBg, ImGuiCol_FrameBg, ImGuiStyleVar_ChildBorderSize, ImGuiStyleVar_ChildRounding, ImGuiStyleVar_WindowPadding, ImGuiWindowFlags_AlwaysUseWindowPadding, ImGuiWindowFlags_NoMove, PopStyleColor(), PopStyleVar(), PushStyleColor(), PushStyleVar(), ImGuiContext::Style, and style.

Referenced by BeginListBox(), Slic3r::GUI::ImGuiWrapper::search_list(), ShowAboutWindow(), and ShowExampleAppDocuments().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginColumns()

void ImGui::BeginColumns ( const char *  str_id,
int  count,
ImGuiOldColumnFlags  flags = 0 
)
3801{
3802 ImGuiContext& g = *GImGui;
3803 ImGuiWindow* window = GetCurrentWindow();
3804
3805 IM_ASSERT(columns_count >= 1);
3806 IM_ASSERT(window->DC.CurrentColumns == NULL); // Nested columns are currently not supported
3807
3808 // Acquire storage for the columns set
3809 ImGuiID id = GetColumnsID(str_id, columns_count);
3810 ImGuiOldColumns* columns = FindOrCreateColumns(window, id);
3811 IM_ASSERT(columns->ID == id);
3812 columns->Current = 0;
3813 columns->Count = columns_count;
3814 columns->Flags = flags;
3815 window->DC.CurrentColumns = columns;
3816
3817 columns->HostCursorPosY = window->DC.CursorPos.y;
3818 columns->HostCursorMaxPosX = window->DC.CursorMaxPos.x;
3819 columns->HostInitialClipRect = window->ClipRect;
3820 columns->HostBackupParentWorkRect = window->ParentWorkRect;
3821 window->ParentWorkRect = window->WorkRect;
3822
3823 // Set state for first column
3824 // We aim so that the right-most column will have the same clipping width as other after being clipped by parent ClipRect
3825 const float column_padding = g.Style.ItemSpacing.x;
3826 const float half_clip_extend_x = ImFloor(ImMax(window->WindowPadding.x * 0.5f, window->WindowBorderSize));
3827 const float max_1 = window->WorkRect.Max.x + column_padding - ImMax(column_padding - window->WindowPadding.x, 0.0f);
3828 const float max_2 = window->WorkRect.Max.x + half_clip_extend_x;
3829 columns->OffMinX = window->DC.Indent.x - column_padding + ImMax(column_padding - window->WindowPadding.x, 0.0f);
3830 columns->OffMaxX = ImMax(ImMin(max_1, max_2) - window->Pos.x, columns->OffMinX + 1.0f);
3831 columns->LineMinY = columns->LineMaxY = window->DC.CursorPos.y;
3832
3833 // Clear data if columns count changed
3834 if (columns->Columns.Size != 0 && columns->Columns.Size != columns_count + 1)
3835 columns->Columns.resize(0);
3836
3837 // Initialize default widths
3838 columns->IsFirstFrame = (columns->Columns.Size == 0);
3839 if (columns->Columns.Size == 0)
3840 {
3841 columns->Columns.reserve(columns_count + 1);
3842 for (int n = 0; n < columns_count + 1; n++)
3843 {
3844 ImGuiOldColumnData column;
3845 column.OffsetNorm = n / (float)columns_count;
3846 columns->Columns.push_back(column);
3847 }
3848 }
3849
3850 for (int n = 0; n < columns_count; n++)
3851 {
3852 // Compute clipping rectangle
3853 ImGuiOldColumnData* column = &columns->Columns[n];
3854 float clip_x1 = IM_ROUND(window->Pos.x + GetColumnOffset(n));
3855 float clip_x2 = IM_ROUND(window->Pos.x + GetColumnOffset(n + 1) - 1.0f);
3856 column->ClipRect = ImRect(clip_x1, -FLT_MAX, clip_x2, +FLT_MAX);
3857 column->ClipRect.ClipWithFull(window->ClipRect);
3858 }
3859
3860 if (columns->Count > 1)
3861 {
3862 columns->Splitter.Split(window->DrawList, 1 + columns->Count);
3863 columns->Splitter.SetCurrentChannel(window->DrawList, 1);
3865 }
3866
3867 // We don't generally store Indent.x inside ColumnsOffset because it may be manipulated by the user.
3868 float offset_0 = GetColumnOffset(columns->Current);
3869 float offset_1 = GetColumnOffset(columns->Current + 1);
3870 float width = offset_1 - offset_0;
3871 PushItemWidth(width * 0.65f);
3872 window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f);
3873 window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
3874 window->WorkRect.Max.x = window->Pos.x + offset_1 - column_padding;
3875}
static T ImMin(T lhs, T rhs)
Definition imgui_internal.h:409
#define IM_ROUND(_VAL)
Definition imgui_internal.h:233
IMGUI_API ImGuiID GetColumnsID(const char *str_id, int count)
Definition imgui_tables.cpp:3787
IMGUI_API void PushItemWidth(float item_width)
Definition imgui.cpp:7563
IMGUI_API void PushColumnClipRect(int column_index)
Definition imgui_tables.cpp:3737
IMGUI_API float GetColumnOffset(int column_index=-1)
Definition imgui_tables.cpp:3662
IMGUI_API ImGuiOldColumns * FindOrCreateColumns(ImGuiWindow *window, ImGuiID id)
Definition imgui_tables.cpp:3774
coord_t width(const BoundingBox &box)
Definition Arrange.cpp:539
IMGUI_API void Split(ImDrawList *draw_list, int count)
Definition imgui_draw.cpp:1677
IMGUI_API void SetCurrentChannel(ImDrawList *draw_list, int channel_idx)
Definition imgui_draw.cpp:1778
Definition imgui_internal.h:1175
ImRect ClipRect
Definition imgui_internal.h:1179
float OffsetNorm
Definition imgui_internal.h:1176
Definition imgui_internal.h:1185
ImDrawListSplitter Splitter
Definition imgui_internal.h:1200
float OffMaxX
Definition imgui_internal.h:1192
float LineMinY
Definition imgui_internal.h:1193
float LineMaxY
Definition imgui_internal.h:1193
float OffMinX
Definition imgui_internal.h:1192
float HostCursorMaxPosX
Definition imgui_internal.h:1195
bool IsFirstFrame
Definition imgui_internal.h:1188
ImRect HostInitialClipRect
Definition imgui_internal.h:1196
ImGuiOldColumnFlags Flags
Definition imgui_internal.h:1187
ImVector< ImGuiOldColumnData > Columns
Definition imgui_internal.h:1199
int Count
Definition imgui_internal.h:1191
int Current
Definition imgui_internal.h:1190
float HostCursorPosY
Definition imgui_internal.h:1194
ImGuiID ID
Definition imgui_internal.h:1186
ImRect HostBackupParentWorkRect
Definition imgui_internal.h:1198
ImVec2 ItemSpacing
Definition imgui.h:1736
void reserve(int new_capacity)
Definition imgui.h:1693

References ImGuiOldColumnData::ClipRect, ImGuiWindow::ClipRect, ImRect::ClipWithFull(), ImGuiOldColumns::Columns, ImGuiWindowTempData::ColumnsOffset, ImGuiOldColumns::Count, ImGuiOldColumns::Current, ImGuiWindowTempData::CurrentColumns, ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, FindOrCreateColumns(), ImGuiOldColumns::Flags, GetColumnOffset(), GetColumnsID(), GetCurrentWindow(), GImGui, ImGuiOldColumns::HostBackupParentWorkRect, ImGuiOldColumns::HostCursorMaxPosX, ImGuiOldColumns::HostCursorPosY, ImGuiOldColumns::HostInitialClipRect, ImGuiOldColumns::ID, IM_ASSERT, IM_FLOOR, IM_ROUND, ImFloor(), ImMax(), ImMin(), ImGuiWindowTempData::Indent, ImGuiOldColumns::IsFirstFrame, ImGuiStyle::ItemSpacing, ImGuiOldColumns::LineMaxY, ImGuiOldColumns::LineMinY, ImRect::Max, ImGuiOldColumns::OffMaxX, ImGuiOldColumns::OffMinX, ImGuiOldColumnData::OffsetNorm, ImGuiWindow::ParentWorkRect, ImGuiWindow::Pos, ImVector< T >::push_back(), PushColumnClipRect(), PushItemWidth(), ImVector< T >::reserve(), ImVector< T >::resize(), ImDrawListSplitter::SetCurrentChannel(), ImVector< T >::Size, ImDrawListSplitter::Split(), ImGuiOldColumns::Splitter, ImGuiContext::Style, ImGuiWindow::WindowBorderSize, ImGuiWindow::WindowPadding, ImGuiWindow::WorkRect, ImVec2::x, ImVec1::x, and ImVec2::y.

Referenced by Columns().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginCombo()

bool ImGui::BeginCombo ( const char *  label,
const char *  preview_value,
ImGuiComboFlags  flags = 0 
)
1556{
1557 // Always consume the SetNextWindowSizeConstraint() call in our early return paths
1558 ImGuiContext& g = *GImGui;
1559 bool has_window_size_constraint = (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint) != 0;
1560 g.NextWindowData.Flags &= ~ImGuiNextWindowDataFlags_HasSizeConstraint;
1561
1562 ImGuiWindow* window = GetCurrentWindow();
1563 if (window->SkipItems)
1564 return false;
1565
1567
1568 const ImGuiStyle& style = g.Style;
1569 const ImGuiID id = window->GetID(label);
1570
1571 const float arrow_size = (flags & ImGuiComboFlags_NoArrowButton) ? 0.0f : GetFrameHeight();
1572 const ImVec2 label_size = CalcTextSize(label, NULL, true);
1573 const float expected_w = CalcItemWidth();
1574 const float w = (flags & ImGuiComboFlags_NoPreview) ? arrow_size : expected_w;
1575 const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f));
1576 const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
1577 ItemSize(total_bb, style.FramePadding.y);
1578 if (!ItemAdd(total_bb, id, &frame_bb))
1579 return false;
1580
1581 bool hovered, held;
1582 bool pressed = ButtonBehavior(frame_bb, id, &hovered, &held);
1583
1584 const ImGuiID popup_id = ImHashStr("##ComboPopup", 0, id);
1585 bool popup_open = IsPopupOpen(popup_id, ImGuiPopupFlags_None);
1586
1587 const ImU32 frame_col = GetColorU32(hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);
1588 const float value_x2 = ImMax(frame_bb.Min.x, frame_bb.Max.x - arrow_size);
1589 RenderNavHighlight(frame_bb, id);
1590 if (!(flags & ImGuiComboFlags_NoPreview))
1591 window->DrawList->AddRectFilled(frame_bb.Min, ImVec2(value_x2, frame_bb.Max.y), frame_col, style.FrameRounding, (flags & ImGuiComboFlags_NoArrowButton) ? ImDrawFlags_RoundCornersAll : ImDrawFlags_RoundCornersLeft);
1592 if (!(flags & ImGuiComboFlags_NoArrowButton))
1593 {
1594 ImU32 bg_col = GetColorU32((popup_open || hovered) ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
1595 ImU32 text_col = GetColorU32(ImGuiCol_Text);
1596 window->DrawList->AddRectFilled(ImVec2(value_x2, frame_bb.Min.y), frame_bb.Max, bg_col, style.FrameRounding, (w <= arrow_size) ? ImDrawFlags_RoundCornersAll : ImDrawFlags_RoundCornersRight);
1597 if (value_x2 + arrow_size - style.FramePadding.x <= frame_bb.Max.x)
1598 RenderArrow(window->DrawList, ImVec2(value_x2 + style.FramePadding.y, frame_bb.Min.y + style.FramePadding.y), text_col, ImGuiDir_Down, 1.0f);
1599 }
1600 RenderFrameBorder(frame_bb.Min, frame_bb.Max, style.FrameRounding);
1601 if (preview_value != NULL && !(flags & ImGuiComboFlags_NoPreview))
1602 {
1603 ImVec2 preview_pos = frame_bb.Min + style.FramePadding;
1604 if (g.LogEnabled)
1605 LogSetNextTextDecoration("{", "}");
1606 RenderTextClipped(preview_pos, ImVec2(value_x2, frame_bb.Max.y), preview_value, NULL, NULL, ImVec2(0.0f, 0.0f));
1607 }
1608 if (label_size.x > 0)
1609 RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
1610
1611 if ((pressed || g.NavActivateId == id) && !popup_open)
1612 {
1613 if (window->DC.NavLayerCurrent == 0)
1614 window->NavLastIds[0] = id;
1616 popup_open = true;
1617 }
1618
1619 if (!popup_open)
1620 return false;
1621
1622 if (has_window_size_constraint)
1623 {
1626 }
1627 else
1628 {
1629 if ((flags & ImGuiComboFlags_HeightMask_) == 0)
1632 int popup_max_height_in_items = -1;
1633 if (flags & ImGuiComboFlags_HeightRegular) popup_max_height_in_items = 8;
1634 else if (flags & ImGuiComboFlags_HeightSmall) popup_max_height_in_items = 4;
1635 else if (flags & ImGuiComboFlags_HeightLarge) popup_max_height_in_items = 20;
1636 SetNextWindowSizeConstraints(ImVec2(w, 0.0f), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items)));
1637 }
1638
1639 char name[16];
1640 ImFormatString(name, IM_ARRAYSIZE(name), "##Combo_%02d", g.BeginPopupStack.Size); // Recycle windows based on depth
1641
1642 // Position the window given a custom constraint (peak into expected window size so we can position it)
1643 // This might be easier to express with an hypothetical SetNextWindowPosConstraints() function.
1644 if (ImGuiWindow* popup_window = FindWindowByName(name))
1645 if (popup_window->WasActive)
1646 {
1647 // Always override 'AutoPosLastDirection' to not leave a chance for a past value to affect us.
1648 ImVec2 size_expected = CalcWindowNextAutoFitSize(popup_window);
1650 popup_window->AutoPosLastDirection = ImGuiDir_Left; // "Below, Toward Left"
1651 else
1652 popup_window->AutoPosLastDirection = ImGuiDir_Down; // "Below, Toward Right (default)"
1653 ImRect r_outer = GetWindowAllowedExtentRect(popup_window);
1654 ImVec2 pos = FindBestWindowPosForPopupEx(frame_bb.GetBL(), size_expected, &popup_window->AutoPosLastDirection, r_outer, frame_bb, ImGuiPopupPositionPolicy_ComboBox);
1655 SetNextWindowPos(pos);
1656 }
1657
1658 // We don't use BeginPopupEx() solely because we have a custom name string, which we could make an argument to BeginPopupEx()
1660
1661 // Horizontally align ourselves with the framed text
1662 PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(style.FramePadding.x, style.WindowPadding.y));
1663 bool ret = Begin(name, NULL, window_flags);
1664 PopStyleVar();
1665 if (!ret)
1666 {
1667 EndPopup();
1668 IM_ASSERT(0); // This should never happen as we tested for IsPopupOpen() above
1669 return false;
1670 }
1671 return true;
1672}
ImGuiID ImHashStr(const char *data_p, size_t data_size, ImU32 seed)
Definition imgui.cpp:1511
@ ImGuiPopupFlags_None
Definition imgui.h:1015
@ ImGuiCol_FrameBgHovered
Definition imgui.h:1421
@ ImGuiComboFlags_NoPreview
Definition imgui.h:1049
@ ImGuiComboFlags_PopupAlignLeft
Definition imgui.h:1043
@ ImGuiComboFlags_HeightSmall
Definition imgui.h:1044
@ ImGuiComboFlags_HeightRegular
Definition imgui.h:1045
@ ImGuiComboFlags_NoArrowButton
Definition imgui.h:1048
@ ImGuiComboFlags_HeightLarge
Definition imgui.h:1046
@ ImGuiComboFlags_HeightMask_
Definition imgui.h:1050
@ ImGuiDir_Down
Definition imgui.h:1299
@ ImGuiDir_Left
Definition imgui.h:1296
@ ImDrawFlags_RoundCornersRight
Definition imgui.h:2321
@ ImDrawFlags_RoundCornersLeft
Definition imgui.h:2320
@ ImDrawFlags_RoundCornersAll
Definition imgui.h:2322
static bool ImIsPowerOfTwo(int v)
Definition imgui_internal.h:298
@ ImGuiPopupPositionPolicy_ComboBox
Definition imgui_internal.h:943
@ ImGuiNextWindowDataFlags_HasSizeConstraint
Definition imgui_internal.h:1086
static float CalcMaxPopupHeightFromItemCount(int items_count)
Definition imgui_widgets.cpp:1547
IMGUI_API bool IsPopupOpen(const char *str_id, ImGuiPopupFlags flags=0)
Definition imgui.cpp:8102
IMGUI_API void SetNextWindowSizeConstraints(const ImVec2 &size_min, const ImVec2 &size_max, ImGuiSizeCallback custom_callback=NULL, void *custom_callback_data=NULL)
Definition imgui.cpp:6879
IMGUI_API ImRect GetWindowAllowedExtentRect(ImGuiWindow *window)
Definition imgui.cpp:8525
IMGUI_API ImVec2 CalcTextSize(const char *text, const char *text_end=NULL, bool hide_text_after_double_hash=false, float wrap_width=-1.0f)
Definition imgui.cpp:4524
IMGUI_API void RenderText(ImVec2 pos, const char *text, const char *text_end=NULL, bool hide_text_after_hash=true)
Definition imgui.cpp:2665
IMGUI_API ImVec2 CalcWindowNextAutoFitSize(ImGuiWindow *window)
Definition imgui.cpp:5269
IMGUI_API void EndPopup()
Definition imgui.cpp:8357
IMGUI_API float CalcItemWidth()
Definition imgui.cpp:7596
IMGUI_API ImVec2 FindBestWindowPosForPopupEx(const ImVec2 &ref_pos, const ImVec2 &size, ImGuiDir *last_dir, const ImRect &r_outer, const ImRect &r_avoid, ImGuiPopupPositionPolicy policy)
Definition imgui.cpp:8450
IMGUI_API void OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags=ImGuiPopupFlags_None)
Definition imgui.cpp:8136
IMGUI_API void SetNextWindowPos(const ImVec2 &pos, ImGuiCond cond=0, const ImVec2 &pivot=ImVec2(0, 0))
Definition imgui.cpp:6860
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:14
ImRect SizeConstraintRect
Definition imgui_internal.h:1105
ImGuiID NavLastIds[ImGuiNavLayer_COUNT]
Definition imgui_internal.h:1891

References ImDrawList::AddRectFilled(), Begin(), ImGuiContext::BeginPopupStack, ButtonBehavior(), CalcItemWidth(), CalcMaxPopupHeightFromItemCount(), CalcTextSize(), CalcWindowNextAutoFitSize(), ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, EndPopup(), FindBestWindowPosForPopupEx(), FindWindowByName(), ImGuiNextWindowData::Flags, ImRect::GetBL(), GetColorU32(), GetCurrentWindow(), GetFrameHeight(), ImGuiWindow::GetID(), GetWindowAllowedExtentRect(), GImGui, IM_ARRAYSIZE, IM_ASSERT, ImDrawFlags_RoundCornersAll, ImDrawFlags_RoundCornersLeft, ImDrawFlags_RoundCornersRight, ImFormatString(), ImGuiCol_Button, ImGuiCol_ButtonHovered, ImGuiCol_FrameBg, ImGuiCol_FrameBgHovered, ImGuiCol_Text, ImGuiComboFlags_HeightLarge, ImGuiComboFlags_HeightMask_, ImGuiComboFlags_HeightRegular, ImGuiComboFlags_HeightSmall, ImGuiComboFlags_NoArrowButton, ImGuiComboFlags_NoPreview, ImGuiComboFlags_PopupAlignLeft, ImGuiDir_Down, ImGuiDir_Left, ImGuiNextWindowDataFlags_HasSizeConstraint, ImGuiPopupFlags_None, ImGuiPopupPositionPolicy_ComboBox, ImGuiStyleVar_WindowPadding, ImGuiWindowFlags_AlwaysAutoResize, ImGuiWindowFlags_NoMove, ImGuiWindowFlags_NoResize, ImGuiWindowFlags_NoSavedSettings, ImGuiWindowFlags_NoTitleBar, ImGuiWindowFlags_Popup, ImHashStr(), ImIsPowerOfTwo(), ImMax(), IsPopupOpen(), ItemAdd(), ItemSize(), ImGuiContext::LogEnabled, LogSetNextTextDecoration(), ImRect::Max, ImRect::Min, ImGuiContext::NavActivateId, ImGuiWindow::NavLastIds, ImGuiWindowTempData::NavLayerCurrent, ImGuiContext::NextWindowData, OpenPopupEx(), PopStyleVar(), PushStyleVar(), RenderArrow(), RenderFrameBorder(), RenderNavHighlight(), RenderText(), RenderTextClipped(), SetNextWindowPos(), SetNextWindowSizeConstraints(), ImVector< T >::Size, ImGuiNextWindowData::SizeConstraintRect, ImGuiWindow::SkipItems, ImGuiContext::Style, style, ImVec2::x, and ImVec2::y.

Referenced by Slic3r::GUI::GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(), Slic3r::GUI::ImGuiWrapper::combo(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), EditTableSizingFlags(), Slic3r::GUI::render_extruders_combo(), ShowDemoWindowWidgets(), ShowFontSelector(), and TabBarTabListPopupButton().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginDragDropSource()

bool ImGui::BeginDragDropSource ( ImGuiDragDropFlags  flags = 0)
9776{
9777 ImGuiContext& g = *GImGui;
9778 ImGuiWindow* window = g.CurrentWindow;
9779
9780 // FIXME-DRAGDROP: While in the common-most "drag from non-zero active id" case we can tell the mouse button,
9781 // in both SourceExtern and id==0 cases we may requires something else (explicit flags or some heuristic).
9783
9784 bool source_drag_active = false;
9785 ImGuiID source_id = 0;
9786 ImGuiID source_parent_id = 0;
9787 if (!(flags & ImGuiDragDropFlags_SourceExtern))
9788 {
9789 source_id = window->DC.LastItemId;
9790 if (source_id != 0)
9791 {
9792 // Common path: items with ID
9793 if (g.ActiveId != source_id)
9794 return false;
9795 if (g.ActiveIdMouseButton != -1)
9796 mouse_button = g.ActiveIdMouseButton;
9797 if (g.IO.MouseDown[mouse_button] == false)
9798 return false;
9799 g.ActiveIdAllowOverlap = false;
9800 }
9801 else
9802 {
9803 // Uncommon path: items without ID
9804 if (g.IO.MouseDown[mouse_button] == false)
9805 return false;
9806
9807 // If you want to use BeginDragDropSource() on an item with no unique identifier for interaction, such as Text() or Image(), you need to:
9808 // A) Read the explanation below, B) Use the ImGuiDragDropFlags_SourceAllowNullID flag, C) Swallow your programmer pride.
9810 {
9811 IM_ASSERT(0);
9812 return false;
9813 }
9814
9815 // Early out
9816 if ((window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_HoveredRect) == 0 && (g.ActiveId == 0 || g.ActiveIdWindow != window))
9817 return false;
9818
9819 // Magic fallback (=somehow reprehensible) to handle items with no assigned ID, e.g. Text(), Image()
9820 // We build a throwaway ID based on current ID stack + relative AABB of items in window.
9821 // THE IDENTIFIER WON'T SURVIVE ANY REPOSITIONING OF THE WIDGET, so if your widget moves your dragging operation will be canceled.
9822 // We don't need to maintain/call ClearActiveID() as releasing the button will early out this function and trigger !ActiveIdIsAlive.
9823 source_id = window->DC.LastItemId = window->GetIDFromRectangle(window->DC.LastItemRect);
9824 bool is_hovered = ItemHoverable(window->DC.LastItemRect, source_id);
9825 if (is_hovered && g.IO.MouseClicked[mouse_button])
9826 {
9827 SetActiveID(source_id, window);
9828 FocusWindow(window);
9829 }
9830 if (g.ActiveId == source_id) // Allow the underlying widget to display/return hovered during the mouse release frame, else we would get a flicker.
9831 g.ActiveIdAllowOverlap = is_hovered;
9832 }
9833 if (g.ActiveId != source_id)
9834 return false;
9835 source_parent_id = window->IDStack.back();
9836 source_drag_active = IsMouseDragging(mouse_button);
9837
9838 // Disable navigation and key inputs while dragging
9842 }
9843 else
9844 {
9845 window = NULL;
9846 source_id = ImHashStr("#SourceExtern");
9847 source_drag_active = true;
9848 }
9849
9850 if (source_drag_active)
9851 {
9852 if (!g.DragDropActive)
9853 {
9854 IM_ASSERT(source_id != 0);
9855 ClearDragDrop();
9856 ImGuiPayload& payload = g.DragDropPayload;
9857 payload.SourceId = source_id;
9858 payload.SourceParentId = source_parent_id;
9859 g.DragDropActive = true;
9860 g.DragDropSourceFlags = flags;
9861 g.DragDropMouseButton = mouse_button;
9862 if (payload.SourceId == g.ActiveId)
9864 }
9866 g.DragDropWithinSource = true;
9867
9869 {
9870 // Target can request the Source to not display its tooltip (we use a dedicated flag to make this request explicit)
9871 // We unfortunately can't just modify the source flags and skip the call to BeginTooltip, as caller may be emitting contents.
9872 BeginTooltip();
9874 {
9875 ImGuiWindow* tooltip_window = g.CurrentWindow;
9876 tooltip_window->SkipItems = true;
9877 tooltip_window->HiddenFramesCanSkipItems = 1;
9878 }
9879 }
9880
9882 window->DC.LastItemStatusFlags &= ~ImGuiItemStatusFlags_HoveredRect;
9883
9884 return true;
9885 }
9886 return false;
9887}
@ ImGuiDragDropFlags_SourceNoPreviewTooltip
Definition imgui.h:1259
@ ImGuiDragDropFlags_SourceAllowNullID
Definition imgui.h:1262
@ ImGuiDragDropFlags_SourceExtern
Definition imgui.h:1263
@ ImGuiDragDropFlags_SourceNoDisableHover
Definition imgui.h:1260
@ ImGuiDragDropFlags_AcceptNoPreviewTooltip
Definition imgui.h:1268
unsigned long long ImU64
Definition imgui.h:239
@ ImGuiMouseButton_Left
Definition imgui.h:1586
int ImGuiMouseButton
Definition imgui.h:173
ImGuiItemStatusFlags LastItemStatusFlags
Definition imgui_internal.h:1769
IMGUI_API bool IsMouseDragging(ImGuiMouseButton button, float lock_threshold=-1.0f)
Definition imgui.cpp:4743
IMGUI_API void BeginTooltip()
Definition imgui.cpp:8008
IMGUI_API bool ItemHoverable(const ImRect &bb, ImGuiID id)
Definition imgui.cpp:3193
IMGUI_API void ClearDragDrop()
Definition imgui.cpp:9754
int DragDropSourceFrameCount
Definition imgui_internal.h:1504
int ActiveIdMouseButton
Definition imgui_internal.h:1414
ImGuiID ActiveId
Definition imgui_internal.h:1398
bool DragDropWithinSource
Definition imgui_internal.h:1501
ImU32 ActiveIdUsingNavDirMask
Definition imgui_internal.h:1408
ImU64 ActiveIdUsingKeyInputMask
Definition imgui_internal.h:1410
ImGuiWindow * ActiveIdWindow
Definition imgui_internal.h:1412
bool ActiveIdAllowOverlap
Definition imgui_internal.h:1402
ImU32 ActiveIdUsingNavInputMask
Definition imgui_internal.h:1409
bool ActiveIdNoClearOnFocusLoss
Definition imgui_internal.h:1403
bool MouseClicked[5]
Definition imgui.h:1883
bool MouseDown[5]
Definition imgui.h:1838
ImGuiID SourceParentId
Definition imgui.h:1964
ImGuiID SourceId
Definition imgui.h:1963
ImGuiID GetIDFromRectangle(const ImRect &r_abs)
Definition imgui.cpp:2997

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdAllowOverlap, ImGuiContext::ActiveIdMouseButton, ImGuiContext::ActiveIdNoClearOnFocusLoss, ImGuiContext::ActiveIdUsingKeyInputMask, ImGuiContext::ActiveIdUsingNavDirMask, ImGuiContext::ActiveIdUsingNavInputMask, ImGuiContext::ActiveIdWindow, ImVector< T >::back(), BeginTooltip(), ClearDragDrop(), ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiContext::DragDropAcceptFlags, ImGuiContext::DragDropAcceptIdPrev, ImGuiContext::DragDropActive, ImGuiContext::DragDropMouseButton, ImGuiContext::DragDropPayload, ImGuiContext::DragDropSourceFlags, ImGuiContext::DragDropSourceFrameCount, ImGuiContext::DragDropWithinSource, FocusWindow(), ImGuiContext::FrameCount, ImGuiWindow::GetIDFromRectangle(), GImGui, ImGuiWindow::HiddenFramesCanSkipItems, ImGuiWindow::IDStack, IM_ASSERT, ImGuiDragDropFlags_AcceptNoPreviewTooltip, ImGuiDragDropFlags_SourceAllowNullID, ImGuiDragDropFlags_SourceExtern, ImGuiDragDropFlags_SourceNoDisableHover, ImGuiDragDropFlags_SourceNoPreviewTooltip, ImGuiItemStatusFlags_HoveredRect, ImGuiMouseButton_Left, ImHashStr(), ImGuiContext::IO, IsMouseDragging(), ItemHoverable(), ImGuiWindowTempData::LastItemId, ImGuiWindowTempData::LastItemRect, ImGuiWindowTempData::LastItemStatusFlags, ImGuiIO::MouseClicked, ImGuiIO::MouseDown, SetActiveID(), ImGuiWindow::SkipItems, ImGuiPayload::SourceId, and ImGuiPayload::SourceParentId.

Referenced by ColorButton(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginDragDropTarget()

bool ImGui::BeginDragDropTarget ( )
9976{
9977 ImGuiContext& g = *GImGui;
9978 if (!g.DragDropActive)
9979 return false;
9980
9981 ImGuiWindow* window = g.CurrentWindow;
9983 return false;
9984 ImGuiWindow* hovered_window = g.HoveredWindowUnderMovingWindow;
9985 if (hovered_window == NULL || window->RootWindow != hovered_window->RootWindow)
9986 return false;
9987
9988 const ImRect& display_rect = (window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_HasDisplayRect) ? window->DC.LastItemDisplayRect : window->DC.LastItemRect;
9989 ImGuiID id = window->DC.LastItemId;
9990 if (id == 0)
9991 id = window->GetIDFromRectangle(display_rect);
9992 if (g.DragDropPayload.SourceId == id)
9993 return false;
9994
9995 IM_ASSERT(g.DragDropWithinTarget == false);
9996 g.DragDropTargetRect = display_rect;
9997 g.DragDropTargetId = id;
9998 g.DragDropWithinTarget = true;
9999 return true;
10000}
ImRect LastItemDisplayRect
Definition imgui_internal.h:1771
@ ImGuiItemStatusFlags_HasDisplayRect
Definition imgui_internal.h:746
bool DragDropWithinTarget
Definition imgui_internal.h:1502
ImGuiWindow * HoveredWindowUnderMovingWindow
Definition imgui_internal.h:1382

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiContext::DragDropActive, ImGuiContext::DragDropPayload, ImGuiContext::DragDropTargetId, ImGuiContext::DragDropTargetRect, ImGuiContext::DragDropWithinTarget, ImGuiWindow::GetIDFromRectangle(), GImGui, ImGuiContext::HoveredWindowUnderMovingWindow, IM_ASSERT, ImGuiItemStatusFlags_HasDisplayRect, ImGuiItemStatusFlags_HoveredRect, ImGuiWindowTempData::LastItemDisplayRect, ImGuiWindowTempData::LastItemId, ImGuiWindowTempData::LastItemRect, ImGuiWindowTempData::LastItemStatusFlags, ImGuiWindow::RootWindow, and ImGuiPayload::SourceId.

Referenced by ColorEdit4(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginDragDropTargetCustom()

bool ImGui::BeginDragDropTargetCustom ( const ImRect bb,
ImGuiID  id 
)
9949{
9950 ImGuiContext& g = *GImGui;
9951 if (!g.DragDropActive)
9952 return false;
9953
9954 ImGuiWindow* window = g.CurrentWindow;
9955 ImGuiWindow* hovered_window = g.HoveredWindowUnderMovingWindow;
9956 if (hovered_window == NULL || window->RootWindow != hovered_window->RootWindow)
9957 return false;
9958 IM_ASSERT(id != 0);
9959 if (!IsMouseHoveringRect(bb.Min, bb.Max) || (id == g.DragDropPayload.SourceId))
9960 return false;
9961 if (window->SkipItems)
9962 return false;
9963
9964 IM_ASSERT(g.DragDropWithinTarget == false);
9965 g.DragDropTargetRect = bb;
9966 g.DragDropTargetId = id;
9967 g.DragDropWithinTarget = true;
9968 return true;
9969}

References ImGuiContext::CurrentWindow, ImGuiContext::DragDropActive, ImGuiContext::DragDropPayload, ImGuiContext::DragDropTargetId, ImGuiContext::DragDropTargetRect, ImGuiContext::DragDropWithinTarget, GImGui, ImGuiContext::HoveredWindowUnderMovingWindow, IM_ASSERT, IsMouseHoveringRect(), ImRect::Max, ImRect::Min, ImGuiWindow::RootWindow, ImGuiWindow::SkipItems, and ImGuiPayload::SourceId.

+ Here is the call graph for this function:

◆ BeginGroup()

void ImGui::BeginGroup ( )
7715{
7716 ImGuiContext& g = *GImGui;
7717 ImGuiWindow* window = g.CurrentWindow;
7718
7720 ImGuiGroupData& group_data = g.GroupStack.back();
7721 group_data.WindowID = window->ID;
7722 group_data.BackupCursorPos = window->DC.CursorPos;
7723 group_data.BackupCursorMaxPos = window->DC.CursorMaxPos;
7724 group_data.BackupIndent = window->DC.Indent;
7725 group_data.BackupGroupOffset = window->DC.GroupOffset;
7726 group_data.BackupCurrLineSize = window->DC.CurrLineSize;
7729 group_data.BackupHoveredIdIsAlive = g.HoveredId != 0;
7731 group_data.EmitItem = true;
7732
7733 window->DC.GroupOffset.x = window->DC.CursorPos.x - window->Pos.x - window->DC.ColumnsOffset.x;
7734 window->DC.Indent = window->DC.GroupOffset;
7735 window->DC.CursorMaxPos = window->DC.CursorPos;
7736 window->DC.CurrLineSize = ImVec2(0.0f, 0.0f);
7737 if (g.LogEnabled)
7738 g.LogLinePosY = -FLT_MAX; // To enforce a carriage return
7739}
ImVec1 BackupIndent
Definition imgui_internal.h:992
float BackupCurrLineTextBaseOffset
Definition imgui_internal.h:995
bool BackupHoveredIdIsAlive
Definition imgui_internal.h:998
ImVec2 BackupCursorPos
Definition imgui_internal.h:990
ImGuiID BackupActiveIdIsAlive
Definition imgui_internal.h:996
ImVec2 BackupCursorMaxPos
Definition imgui_internal.h:991
bool EmitItem
Definition imgui_internal.h:999
ImGuiID WindowID
Definition imgui_internal.h:989
ImVec2 BackupCurrLineSize
Definition imgui_internal.h:994
ImVec1 BackupGroupOffset
Definition imgui_internal.h:993
bool BackupActiveIdPreviousFrameIsAlive
Definition imgui_internal.h:997
Definition imgui_internal.h:988
ImVector< ImGuiGroupData > GroupStack
Definition imgui_internal.h:1432
float LogLinePosY
Definition imgui_internal.h:1575
ImGuiID ActiveIdIsAlive
Definition imgui_internal.h:1399
bool ActiveIdPreviousFrameIsAlive
Definition imgui_internal.h:1416

References ImGuiContext::ActiveIdIsAlive, ImGuiContext::ActiveIdPreviousFrameIsAlive, ImVector< T >::back(), ImGuiGroupData::BackupActiveIdIsAlive, ImGuiGroupData::BackupActiveIdPreviousFrameIsAlive, ImGuiGroupData::BackupCurrLineSize, ImGuiGroupData::BackupCurrLineTextBaseOffset, ImGuiGroupData::BackupCursorMaxPos, ImGuiGroupData::BackupCursorPos, ImGuiGroupData::BackupGroupOffset, ImGuiGroupData::BackupHoveredIdIsAlive, ImGuiGroupData::BackupIndent, ImGuiWindowTempData::ColumnsOffset, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CurrLineSize, ImGuiWindowTempData::CurrLineTextBaseOffset, ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiGroupData::EmitItem, GImGui, ImGuiWindowTempData::GroupOffset, ImGuiContext::GroupStack, ImGuiContext::HoveredId, ImGuiWindow::ID, ImGuiWindowTempData::Indent, ImGuiContext::LogEnabled, ImGuiContext::LogLinePosY, ImGuiWindow::Pos, ImVector< T >::resize(), ImVector< T >::Size, ImGuiGroupData::WindowID, ImVec2::x, and ImVec1::x.

Referenced by BeginListBox(), BeginMenuBar(), ColorEdit4(), ColorPicker4(), DragFloatRange2(), DragIntRange2(), DragScalarN(), InputScalar(), InputScalarN(), InputTextEx(), Slic3r::GUI::render_extruders_combo(), Slic3r::GUI::ImGuiWrapper::search_list(), ShowDemoWindowLayout(), ShowDemoWindowWidgets(), ShowExampleAppLayout(), ShowStyleEditor(), and SliderScalarN().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginListBox()

bool ImGui::BeginListBox ( const char *  label,
const ImVec2 size = ImVec2(0, 0) 
)
6181{
6182 ImGuiContext& g = *GImGui;
6183 ImGuiWindow* window = GetCurrentWindow();
6184 if (window->SkipItems)
6185 return false;
6186
6187 const ImGuiStyle& style = g.Style;
6188 const ImGuiID id = GetID(label);
6189 const ImVec2 label_size = CalcTextSize(label, NULL, true);
6190
6191 // Size default to hold ~7.25 items.
6192 // Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar.
6193 ImVec2 size = ImFloor(CalcItemSize(size_arg, CalcItemWidth(), GetTextLineHeightWithSpacing() * 7.25f + style.FramePadding.y * 2.0f));
6194 ImVec2 frame_size = ImVec2(size.x, ImMax(size.y, label_size.y));
6195 ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size);
6196 ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
6198
6199 if (!IsRectVisible(bb.Min, bb.Max))
6200 {
6201 ItemSize(bb.GetSize(), style.FramePadding.y);
6202 ItemAdd(bb, 0, &frame_bb);
6203 return false;
6204 }
6205
6206 // FIXME-OPT: We could omit the BeginGroup() if label_size.x but would need to omit the EndGroup() as well.
6207 BeginGroup();
6208 if (label_size.x > 0.0f)
6209 {
6210 ImVec2 label_pos = ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y);
6211 RenderText(label_pos, label);
6212 window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, label_pos + label_size);
6213 }
6214
6215 BeginChildFrame(id, frame_bb.GetSize());
6216 return true;
6217}
IMGUI_API bool BeginChildFrame(ImGuiID id, const ImVec2 &size, ImGuiWindowFlags flags=0)
Definition imgui.cpp:5078
IMGUI_API ImGuiID GetID(const char *str_id)
Definition imgui.cpp:7079
IMGUI_API bool IsRectVisible(const ImVec2 &size)
Definition imgui.cpp:7097
IMGUI_API float GetTextLineHeightWithSpacing()
Definition imgui.cpp:7645
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_w, float default_h)
Definition imgui.cpp:7618
ImGuiNextItemData NextItemData
Definition imgui_internal.h:1424
void ClearFlags()
Definition imgui_internal.h:1131

References BeginChildFrame(), BeginGroup(), CalcItemSize(), CalcItemWidth(), CalcTextSize(), ImGuiNextItemData::ClearFlags(), ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetCurrentWindow(), GetID(), ImRect::GetSize(), GetTextLineHeightWithSpacing(), GImGui, ImFloor(), ImMax(), IsRectVisible(), ItemAdd(), ItemSize(), ImRect::Max, ImRect::Min, ImGuiContext::NextItemData, RenderText(), ImGuiWindow::SkipItems, ImGuiContext::Style, style, ImVec2::x, and ImVec2::y.

Referenced by ListBoxHeader(), ListBoxHeader(), ShowDemoWindowLayout(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginMainMenuBar()

bool ImGui::BeginMainMenuBar ( )
6659{
6660 ImGuiContext& g = *GImGui;
6661 ImGuiViewportP* viewport = (ImGuiViewportP*)(void*)GetMainViewport();
6662
6663 // For the main menu bar, which cannot be moved, we honor g.Style.DisplaySafeAreaPadding to ensure text can be visible on a TV set.
6664 // FIXME: This could be generalized as an opt-in way to clamp window->DC.CursorStartPos to avoid SafeArea?
6665 // FIXME: Consider removing support for safe area down the line... it's messy. Nowadays consoles have support for TV calibration in OS settings.
6668 float height = GetFrameHeight();
6669 bool is_open = BeginViewportSideBar("##MainMenuBar", viewport, ImGuiDir_Up, height, window_flags);
6671
6672 if (is_open)
6673 BeginMenuBar();
6674 else
6675 End();
6676 return is_open;
6677}
@ ImGuiDir_Up
Definition imgui.h:1298
IMGUI_API bool BeginViewportSideBar(const char *name, ImGuiViewport *viewport, ImGuiDir dir, float size, ImGuiWindowFlags window_flags)
Definition imgui_widgets.cpp:6623
IMGUI_API bool BeginMenuBar()
Definition imgui_widgets.cpp:6551
IMGUI_API void End()
Definition imgui.cpp:6366
ImVec2 DisplaySafeAreaPadding
Definition imgui.h:1754

References BeginMenuBar(), BeginViewportSideBar(), ImGuiStyle::DisplaySafeAreaPadding, End(), ImGuiStyle::FramePadding, GetFrameHeight(), GetMainViewport(), GImGui, ImGuiDir_Up, ImGuiWindowFlags_MenuBar, ImGuiWindowFlags_NoSavedSettings, ImGuiWindowFlags_NoScrollbar, ImMax(), ImGuiNextWindowData::MenuBarOffsetMinVal, ImGuiContext::NextWindowData, ImGuiContext::Style, ImVec2::x, and ImVec2::y.

Referenced by ShowExampleAppMainMenuBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginMenu()

bool ImGui::BeginMenu ( const char *  label,
bool  enabled = true 
)
6693{
6694 ImGuiWindow* window = GetCurrentWindow();
6695 if (window->SkipItems)
6696 return false;
6697
6698 ImGuiContext& g = *GImGui;
6699 const ImGuiStyle& style = g.Style;
6700 const ImGuiID id = window->GetID(label);
6701 bool menu_is_open = IsPopupOpen(id, ImGuiPopupFlags_None);
6702
6703 // Sub-menus are ChildWindow so that mouse can be hovering across them (otherwise top-most popup menu would steal focus and not allow hovering on parent menu)
6707
6708 // If a menu with same the ID was already submitted, we will append to it, matching the behavior of Begin().
6709 // We are relying on a O(N) search - so O(N log N) over the frame - which seems like the most efficient for the expected small amount of BeginMenu() calls per frame.
6710 // If somehow this is ever becoming a problem we can switch to use e.g. ImGuiStorage mapping key to last frame used.
6712 {
6713 if (menu_is_open)
6714 menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
6715 else
6716 g.NextWindowData.ClearFlags(); // we behave like Begin() and need to consume those values
6717 return menu_is_open;
6718 }
6719
6720 // Tag menu as used. Next time BeginMenu() with same ID is called it will append to existing menu
6722
6723 ImVec2 label_size = CalcTextSize(label, NULL, true);
6724 bool pressed;
6725 bool menuset_is_open = !(window->Flags & ImGuiWindowFlags_Popup) && (g.OpenPopupStack.Size > g.BeginPopupStack.Size && g.OpenPopupStack[g.BeginPopupStack.Size].OpenParentId == window->IDStack.back());
6726 ImGuiWindow* backed_nav_window = g.NavWindow;
6727 if (menuset_is_open)
6728 g.NavWindow = window; // Odd hack to allow hovering across menus of a same menu-set (otherwise we wouldn't be able to hover parent)
6729
6730 // The reference position stored in popup_pos will be used by Begin() to find a suitable position for the child menu,
6731 // However the final position is going to be different! It is chosen by FindBestWindowPosForPopup().
6732 // e.g. Menus tend to overlap each other horizontally to amplify relative Z-ordering.
6733 ImVec2 popup_pos, pos = window->DC.CursorPos;
6735 {
6736 // Menu inside an horizontal menu bar
6737 // Selectable extend their highlight by half ItemSpacing in each direction.
6738 // For ChildMenu, the popup position will be overwritten by the call to FindBestWindowPosForPopup() in Begin()
6739 popup_pos = ImVec2(pos.x - 1.0f - IM_FLOOR(style.ItemSpacing.x * 0.5f), pos.y - style.FramePadding.y + window->MenuBarHeight());
6740 window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * 0.5f);
6741 PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y));
6742 float w = label_size.x;
6744 PopStyleVar();
6745 window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar().
6746 }
6747 else
6748 {
6749 // Menu inside a menu
6750 // (In a typical menu window where all items are BeginMenu() or MenuItem() calls, extra_w will always be 0.0f.
6751 // Only when they are other items sticking out we're going to add spacing, yet only register minimum width into the layout system.
6752 popup_pos = ImVec2(pos.x, pos.y - style.WindowPadding.y);
6753 float min_w = window->DC.MenuColumns.DeclColumns(label_size.x, 0.0f, IM_FLOOR(g.FontSize * 1.20f)); // Feedback to next frame
6754 float extra_w = ImMax(0.0f, GetContentRegionAvail().x - min_w);
6756 ImU32 text_col = GetColorU32(enabled ? ImGuiCol_Text : ImGuiCol_TextDisabled);
6757 RenderArrow(window->DrawList, pos + ImVec2(window->DC.MenuColumns.Pos[2] + extra_w + g.FontSize * 0.30f, 0.0f), text_col, ImGuiDir_Right);
6758 }
6759
6760 const bool hovered = enabled && ItemHoverable(window->DC.LastItemRect, id);
6761 if (menuset_is_open)
6762 g.NavWindow = backed_nav_window;
6763
6764 bool want_open = false;
6765 bool want_close = false;
6766 if (window->DC.LayoutType == ImGuiLayoutType_Vertical) // (window->Flags & (ImGuiWindowFlags_Popup|ImGuiWindowFlags_ChildMenu))
6767 {
6768 // Close menu when not hovering it anymore unless we are moving roughly in the direction of the menu
6769 // Implement http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown to avoid using timers, so menus feels more reactive.
6770 bool moving_toward_other_child_menu = false;
6771
6772 ImGuiWindow* child_menu_window = (g.BeginPopupStack.Size < g.OpenPopupStack.Size && g.OpenPopupStack[g.BeginPopupStack.Size].SourceWindow == window) ? g.OpenPopupStack[g.BeginPopupStack.Size].Window : NULL;
6773 if (g.HoveredWindow == window && child_menu_window != NULL && !(window->Flags & ImGuiWindowFlags_MenuBar))
6774 {
6775 // FIXME-DPI: Values should be derived from a master "scale" factor.
6776 ImRect next_window_rect = child_menu_window->Rect();
6777 ImVec2 ta = g.IO.MousePos - g.IO.MouseDelta;
6778 ImVec2 tb = (window->Pos.x < child_menu_window->Pos.x) ? next_window_rect.GetTL() : next_window_rect.GetTR();
6779 ImVec2 tc = (window->Pos.x < child_menu_window->Pos.x) ? next_window_rect.GetBL() : next_window_rect.GetBR();
6780 float extra = ImClamp(ImFabs(ta.x - tb.x) * 0.30f, 5.0f, 30.0f); // add a bit of extra slack.
6781 ta.x += (window->Pos.x < child_menu_window->Pos.x) ? -0.5f : +0.5f; // to avoid numerical issues
6782 tb.y = ta.y + ImMax((tb.y - extra) - ta.y, -100.0f); // triangle is maximum 200 high to limit the slope and the bias toward large sub-menus // FIXME: Multiply by fb_scale?
6783 tc.y = ta.y + ImMin((tc.y + extra) - ta.y, +100.0f);
6784 moving_toward_other_child_menu = ImTriangleContainsPoint(ta, tb, tc, g.IO.MousePos);
6785 //GetForegroundDrawList()->AddTriangleFilled(ta, tb, tc, moving_within_opened_triangle ? IM_COL32(0,128,0,128) : IM_COL32(128,0,0,128)); // [DEBUG]
6786 }
6787 if (menu_is_open && !hovered && g.HoveredWindow == window && g.HoveredIdPreviousFrame != 0 && g.HoveredIdPreviousFrame != id && !moving_toward_other_child_menu)
6788 want_close = true;
6789
6790 if (!menu_is_open && hovered && pressed) // Click to open
6791 want_open = true;
6792 else if (!menu_is_open && hovered && !moving_toward_other_child_menu) // Hover to open
6793 want_open = true;
6794
6795 if (g.NavActivateId == id)
6796 {
6797 want_close = menu_is_open;
6798 want_open = !menu_is_open;
6799 }
6800 if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Right) // Nav-Right to open
6801 {
6802 want_open = true;
6804 }
6805 }
6806 else
6807 {
6808 // Menu bar
6809 if (menu_is_open && pressed && menuset_is_open) // Click an open menu again to close it
6810 {
6811 want_close = true;
6812 want_open = menu_is_open = false;
6813 }
6814 else if (pressed || (hovered && menuset_is_open && !menu_is_open)) // First click to open, then hover to open others
6815 {
6816 want_open = true;
6817 }
6818 else if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Down) // Nav-Down to open
6819 {
6820 want_open = true;
6822 }
6823 }
6824
6825 if (!enabled) // explicitly close if an open menu becomes disabled, facilitate users code a lot in pattern such as 'if (BeginMenu("options", has_object)) { ..use object.. }'
6826 want_close = true;
6827 if (want_close && IsPopupOpen(id, ImGuiPopupFlags_None))
6829
6830 IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.LastItemStatusFlags | ImGuiItemStatusFlags_Openable | (menu_is_open ? ImGuiItemStatusFlags_Opened : 0));
6831
6832 if (!menu_is_open && want_open && g.OpenPopupStack.Size > g.BeginPopupStack.Size)
6833 {
6834 // Don't recycle same menu level in the same frame, first close the other menu and yield for a frame.
6835 OpenPopup(label);
6836 return false;
6837 }
6838
6839 menu_is_open |= want_open;
6840 if (want_open)
6841 OpenPopup(label);
6842
6843 if (menu_is_open)
6844 {
6845 SetNextWindowPos(popup_pos, ImGuiCond_Always); // Note: this is super misleading! The value will serve as reference for FindBestWindowPosForPopup(), not actual pos.
6846 menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
6847 }
6848 else
6849 {
6850 g.NextWindowData.ClearFlags(); // We behave like Begin() and need to consume those values
6851 }
6852
6853 return menu_is_open;
6854}
bool ImTriangleContainsPoint(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &p)
Definition imgui.cpp:1260
@ ImGuiStyleVar_ItemSpacing
Definition imgui.h:1492
@ ImGuiCol_TextDisabled
Definition imgui.h:1414
@ ImGuiSelectableFlags_DontClosePopups
Definition imgui.h:1032
@ ImGuiSelectableFlags_Disabled
Definition imgui.h:1035
@ ImGuiCond_Always
Definition imgui.h:1615
@ ImGuiDir_Right
Definition imgui.h:1297
static T ImClamp(T v, T mn, T mx)
Definition imgui_internal.h:411
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID, _LABEL, _FLAGS)
Definition imgui_internal.h:2670
#define ImFabs(X)
Definition imgui_internal.h:381
@ ImGuiLayoutType_Horizontal
Definition imgui_internal.h:848
@ ImGuiSelectableFlags_SpanAvailWidth
Definition imgui_internal.h:812
@ ImGuiSelectableFlags_NoHoldingActiveID
Definition imgui_internal.h:809
@ ImGuiSelectableFlags_SelectOnClick
Definition imgui_internal.h:810
IMGUI_API void ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup)
Definition imgui.cpp:8229
IMGUI_API void NavMoveRequestCancel()
Definition imgui.cpp:8855
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags)
Definition imgui.cpp:8288
IMGUI_API void OpenPopup(const char *str_id, ImGuiPopupFlags popup_flags=0)
Definition imgui.cpp:8121
IMGUI_API bool Selectable(const char *label, bool selected=false, ImGuiSelectableFlags flags=0, const ImVec2 &size=ImVec2(0, 0))
Definition imgui_widgets.cpp:6016
ImGuiID NavId
Definition imgui_internal.h:1441
ImGuiDir NavMoveDir
Definition imgui_internal.h:1470
ImVector< ImGuiID > MenusIdSubmittedThisFrame
Definition imgui_internal.h:1551
bool NavMoveRequest
Definition imgui_internal.h:1466
ImVec2 MouseDelta
Definition imgui.h:1873
ImVec2 MousePos
Definition imgui.h:1837
float DeclColumns(float w0, float w1, float w2)
Definition imgui_widgets.cpp:6531
float Pos[3]
Definition imgui_internal.h:1007
ImVec2 GetTL() const
Definition imgui_internal.h:485
ImVec2 GetBL() const
Definition imgui_internal.h:487
ImVec2 GetTR() const
Definition imgui_internal.h:486
ImVec2 GetBR() const
Definition imgui_internal.h:488
bool contains(const T &v) const
Definition imgui.h:1703

References ImVector< T >::back(), BeginPopupEx(), ImGuiContext::BeginPopupStack, CalcTextSize(), ImGuiNextWindowData::ClearFlags(), ClosePopupToLevel(), ImVector< T >::contains(), ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiMenuColumns::DeclColumns(), ImGuiWindow::DrawList, ImGuiWindow::Flags, ImGuiContext::FontSize, ImRect::GetBL(), ImRect::GetBR(), GetColorU32(), GetContentRegionAvail(), GetCurrentWindow(), ImGuiWindow::GetID(), ImRect::GetTL(), ImRect::GetTR(), GImGui, ImGuiContext::HoveredIdPreviousFrame, ImGuiContext::HoveredWindow, ImGuiWindow::IDStack, IM_FLOOR, ImClamp(), ImFabs, IMGUI_TEST_ENGINE_ITEM_INFO, ImGuiCol_Text, ImGuiCol_TextDisabled, ImGuiCond_Always, ImGuiDir_Down, ImGuiDir_Right, ImGuiLayoutType_Horizontal, ImGuiLayoutType_Vertical, ImGuiPopupFlags_None, ImGuiSelectableFlags_Disabled, ImGuiSelectableFlags_DontClosePopups, ImGuiSelectableFlags_NoHoldingActiveID, ImGuiSelectableFlags_SelectOnClick, ImGuiSelectableFlags_SpanAvailWidth, ImGuiStyleVar_ItemSpacing, ImGuiWindowFlags_AlwaysAutoResize, ImGuiWindowFlags_ChildMenu, ImGuiWindowFlags_ChildWindow, ImGuiWindowFlags_MenuBar, ImGuiWindowFlags_NoMove, ImGuiWindowFlags_NoNavFocus, ImGuiWindowFlags_NoSavedSettings, ImGuiWindowFlags_NoTitleBar, ImGuiWindowFlags_Popup, ImMax(), ImMin(), ImTriangleContainsPoint(), ImGuiContext::IO, IsPopupOpen(), ItemHoverable(), ImGuiWindowTempData::LastItemRect, ImGuiWindowTempData::LastItemStatusFlags, ImGuiWindowTempData::LayoutType, ImGuiWindow::MenuBarHeight(), ImGuiWindowTempData::MenuColumns, ImGuiContext::MenusIdSubmittedThisFrame, ImGuiIO::MouseDelta, ImGuiIO::MousePos, ImGuiContext::NavActivateId, ImGuiContext::NavId, ImGuiContext::NavMoveDir, ImGuiContext::NavMoveRequest, NavMoveRequestCancel(), ImGuiContext::NavWindow, ImGuiContext::NextWindowData, OpenPopup(), ImGuiContext::OpenPopupStack, PopStyleVar(), ImGuiMenuColumns::Pos, ImGuiWindow::Pos, ImVector< T >::push_back(), PushStyleVar(), ImGuiWindow::Rect(), RenderArrow(), Selectable(), SetNextWindowPos(), ImVector< T >::Size, ImGuiWindow::SkipItems, ImGuiContext::Style, style, ImVec2::x, and ImVec2::y.

Referenced by ShowDemoWindow(), ShowDemoWindowLayout(), ShowDemoWindowPopups(), ShowExampleAppDocuments(), ShowExampleAppLayout(), ShowExampleAppMainMenuBar(), and ShowExampleMenuFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginMenuBar()

bool ImGui::BeginMenuBar ( )
6552{
6553 ImGuiWindow* window = GetCurrentWindow();
6554 if (window->SkipItems)
6555 return false;
6556 if (!(window->Flags & ImGuiWindowFlags_MenuBar))
6557 return false;
6558
6559 IM_ASSERT(!window->DC.MenuBarAppending);
6560 BeginGroup(); // Backup position on layer 0 // FIXME: Misleading to use a group for that backup/restore
6561 PushID("##menubar");
6562
6563 // We don't clip with current window clipping rectangle as it is already set to the area below. However we clip with window full rect.
6564 // We remove 1 worth of rounding to Max.x to that text in long menus and small windows don't tend to display over the lower-right rounded area, which looks particularly glitchy.
6565 ImRect bar_rect = window->MenuBarRect();
6566 ImRect clip_rect(IM_ROUND(bar_rect.Min.x + window->WindowBorderSize), IM_ROUND(bar_rect.Min.y + window->WindowBorderSize), IM_ROUND(ImMax(bar_rect.Min.x, bar_rect.Max.x - ImMax(window->WindowRounding, window->WindowBorderSize))), IM_ROUND(bar_rect.Max.y));
6567 clip_rect.ClipWith(window->OuterRectClipped);
6568 PushClipRect(clip_rect.Min, clip_rect.Max, false);
6569
6570 // We overwrite CursorMaxPos because BeginGroup sets it to CursorPos (essentially the .EmitItem hack in EndMenuBar() would need something analogous here, maybe a BeginGroupEx() with flags).
6571 window->DC.CursorPos = window->DC.CursorMaxPos = ImVec2(bar_rect.Min.x + window->DC.MenuBarOffset.x, bar_rect.Min.y + window->DC.MenuBarOffset.y);
6574 window->DC.MenuBarAppending = true;
6576 return true;
6577}
@ ImGuiNavLayer_Menu
Definition imgui_internal.h:936
IMGUI_API void PushID(const char *str_id)
Definition imgui.cpp:7018
IMGUI_API void BeginGroup()
Definition imgui.cpp:7714
IMGUI_API void AlignTextToFramePadding()
Definition imgui_widgets.cpp:1347
ImRect MenuBarRect() const
Definition imgui_internal.h:1916

References AlignTextToFramePadding(), BeginGroup(), ImRect::ClipWith(), ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::Flags, GetCurrentWindow(), IM_ASSERT, IM_ROUND, ImGuiLayoutType_Horizontal, ImGuiNavLayer_Menu, ImGuiWindowFlags_MenuBar, ImMax(), ImGuiWindowTempData::LayoutType, ImRect::Max, ImGuiWindowTempData::MenuBarAppending, ImGuiWindowTempData::MenuBarOffset, ImGuiWindow::MenuBarRect(), ImRect::Min, ImGuiWindowTempData::NavLayerCurrent, ImGuiWindow::OuterRectClipped, PushClipRect(), PushID(), ImGuiWindow::SkipItems, ImGuiWindow::WindowBorderSize, ImGuiWindow::WindowRounding, ImVec2::x, and ImVec2::y.

Referenced by BeginMainMenuBar(), ShowDemoWindow(), ShowDemoWindowLayout(), ShowDemoWindowPopups(), ShowExampleAppDocuments(), and ShowExampleAppLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginPopup()

bool ImGui::BeginPopup ( const char *  str_id,
ImGuiWindowFlags  flags = 0 
)
8312{
8313 ImGuiContext& g = *GImGui;
8314 if (g.OpenPopupStack.Size <= g.BeginPopupStack.Size) // Early out for performance
8315 {
8316 g.NextWindowData.ClearFlags(); // We behave like Begin() and need to consume those values
8317 return false;
8318 }
8320 return BeginPopupEx(g.CurrentWindow->GetID(str_id), flags);
8321}

References BeginPopupEx(), ImGuiContext::BeginPopupStack, ImGuiNextWindowData::ClearFlags(), ImGuiContext::CurrentWindow, ImGuiWindow::GetID(), GImGui, ImGuiWindowFlags_AlwaysAutoResize, ImGuiWindowFlags_NoSavedSettings, ImGuiWindowFlags_NoTitleBar, ImGuiContext::NextWindowData, ImGuiContext::OpenPopupStack, and ImVector< T >::Size.

Referenced by ColorEdit4(), ColorEditOptionsPopup(), ColorPickerOptionsPopup(), ExampleAppConsole::Draw(), ExampleAppLog::Draw(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), and ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginPopupContextItem()

bool ImGui::BeginPopupContextItem ( const char *  str_id = NULL,
ImGuiPopupFlags  popup_flags = 1 
)
8407{
8408 ImGuiWindow* window = GImGui->CurrentWindow;
8409 if (window->SkipItems)
8410 return false;
8411 ImGuiID id = str_id ? window->GetID(str_id) : window->DC.LastItemId; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict!
8412 IM_ASSERT(id != 0); // You cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
8413 int mouse_button = (popup_flags & ImGuiPopupFlags_MouseButtonMask_);
8415 OpenPopupEx(id, popup_flags);
8417}
@ ImGuiHoveredFlags_AllowWhenBlockedByPopup
Definition imgui.h:1245
@ ImGuiPopupFlags_MouseButtonMask_
Definition imgui.h:1019
IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags=0)
Definition imgui.cpp:3149
IMGUI_API bool IsMouseReleased(ImGuiMouseButton button)
Definition imgui.cpp:4718

References BeginPopupEx(), ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiWindow::GetID(), GImGui, IM_ASSERT, ImGuiHoveredFlags_AllowWhenBlockedByPopup, ImGuiPopupFlags_MouseButtonMask_, ImGuiWindowFlags_AlwaysAutoResize, ImGuiWindowFlags_NoSavedSettings, ImGuiWindowFlags_NoTitleBar, IsItemHovered(), IsMouseReleased(), ImGuiWindowTempData::LastItemId, OpenPopupEx(), and ImGuiWindow::SkipItems.

Referenced by MyDocument::DisplayContextMenu(), ExampleAppConsole::Draw(), ShowDemoWindowPopups(), ShowDemoWindowTables(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginPopupContextVoid()

bool ImGui::BeginPopupContextVoid ( const char *  str_id = NULL,
ImGuiPopupFlags  popup_flags = 1 
)
8433{
8434 ImGuiWindow* window = GImGui->CurrentWindow;
8435 if (!str_id)
8436 str_id = "void_context";
8437 ImGuiID id = window->GetID(str_id);
8438 int mouse_button = (popup_flags & ImGuiPopupFlags_MouseButtonMask_);
8440 if (GetTopMostPopupModal() == NULL)
8441 OpenPopupEx(id, popup_flags);
8443}
@ ImGuiHoveredFlags_AnyWindow
Definition imgui.h:1244
IMGUI_API bool IsWindowHovered(ImGuiHoveredFlags flags=0)
Definition imgui.cpp:6633

References BeginPopupEx(), ImGuiContext::CurrentWindow, ImGuiWindow::GetID(), GetTopMostPopupModal(), GImGui, ImGuiHoveredFlags_AnyWindow, ImGuiPopupFlags_MouseButtonMask_, ImGuiWindowFlags_AlwaysAutoResize, ImGuiWindowFlags_NoSavedSettings, ImGuiWindowFlags_NoTitleBar, IsMouseReleased(), IsWindowHovered(), and OpenPopupEx().

+ Here is the call graph for this function:

◆ BeginPopupContextWindow() [1/2]

static bool ImGui::BeginPopupContextWindow ( const char *  str_id,
ImGuiMouseButton  mb,
bool  over_items 
)
inlinestatic
2806{ return BeginPopupContextWindow(str_id, mb | (over_items ? 0 : ImGuiPopupFlags_NoOpenOverItems)); }
@ ImGuiPopupFlags_NoOpenOverItems
Definition imgui.h:1022
IMGUI_API bool BeginPopupContextWindow(const char *str_id=NULL, ImGuiPopupFlags popup_flags=1)
Definition imgui.cpp:8419

References BeginPopupContextWindow(), and ImGuiPopupFlags_NoOpenOverItems.

+ Here is the call graph for this function:

◆ BeginPopupContextWindow() [2/2]

bool ImGui::BeginPopupContextWindow ( const char *  str_id = NULL,
ImGuiPopupFlags  popup_flags = 1 
)
8420{
8421 ImGuiWindow* window = GImGui->CurrentWindow;
8422 if (!str_id)
8423 str_id = "window_context";
8424 ImGuiID id = window->GetID(str_id);
8425 int mouse_button = (popup_flags & ImGuiPopupFlags_MouseButtonMask_);
8427 if (!(popup_flags & ImGuiPopupFlags_NoOpenOverItems) || !IsAnyItemHovered())
8428 OpenPopupEx(id, popup_flags);
8430}
IMGUI_API bool IsAnyItemHovered()
Definition imgui.cpp:4899

References BeginPopupEx(), ImGuiContext::CurrentWindow, ImGuiWindow::GetID(), GImGui, ImGuiHoveredFlags_AllowWhenBlockedByPopup, ImGuiPopupFlags_MouseButtonMask_, ImGuiPopupFlags_NoOpenOverItems, ImGuiWindowFlags_AlwaysAutoResize, ImGuiWindowFlags_NoSavedSettings, ImGuiWindowFlags_NoTitleBar, IsAnyItemHovered(), IsMouseReleased(), IsWindowHovered(), and OpenPopupEx().

Referenced by BeginPopupContextWindow(), ExampleAppConsole::Draw(), and ShowExampleAppSimpleOverlay().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginPopupEx()

bool ImGui::BeginPopupEx ( ImGuiID  id,
ImGuiWindowFlags  extra_flags 
)
8289{
8290 ImGuiContext& g = *GImGui;
8292 {
8293 g.NextWindowData.ClearFlags(); // We behave like Begin() and need to consume those values
8294 return false;
8295 }
8296
8297 char name[20];
8298 if (flags & ImGuiWindowFlags_ChildMenu)
8299 ImFormatString(name, IM_ARRAYSIZE(name), "##Menu_%02d", g.BeginPopupStack.Size); // Recycle windows based on depth
8300 else
8301 ImFormatString(name, IM_ARRAYSIZE(name), "##Popup_%08x", id); // Not recycling, so we can close/open during the same frame
8302
8303 flags |= ImGuiWindowFlags_Popup;
8304 bool is_open = Begin(name, NULL, flags);
8305 if (!is_open) // NB: Begin can return false when the popup is completely clipped (e.g. zero size display)
8306 EndPopup();
8307
8308 return is_open;
8309}

References Begin(), ImGuiContext::BeginPopupStack, ImGuiNextWindowData::ClearFlags(), EndPopup(), GImGui, IM_ARRAYSIZE, ImFormatString(), ImGuiPopupFlags_None, ImGuiWindowFlags_ChildMenu, ImGuiWindowFlags_Popup, IsPopupOpen(), ImGuiContext::NextWindowData, and ImVector< T >::Size.

Referenced by BeginMenu(), BeginPopup(), BeginPopupContextItem(), BeginPopupContextVoid(), BeginPopupContextWindow(), and TableUpdateLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginPopupModal()

bool ImGui::BeginPopupModal ( const char *  name,
bool *  p_open = NULL,
ImGuiWindowFlags  flags = 0 
)
8326{
8327 ImGuiContext& g = *GImGui;
8328 ImGuiWindow* window = g.CurrentWindow;
8329 const ImGuiID id = window->GetID(name);
8331 {
8332 g.NextWindowData.ClearFlags(); // We behave like Begin() and need to consume those values
8333 return false;
8334 }
8335
8336 // Center modal windows by default for increased visibility
8337 // (this won't really last as settings will kick in, and is mostly for backward compatibility. user may do the same themselves)
8338 // FIXME: Should test for (PosCond & window->SetWindowPosAllowFlags) with the upcoming window.
8340 {
8341 const ImGuiViewport* viewport = GetMainViewport();
8342 SetNextWindowPos(viewport->GetCenter(), ImGuiCond_FirstUseEver, ImVec2(0.5f, 0.5f));
8343 }
8344
8346 const bool is_open = Begin(name, p_open, flags);
8347 if (!is_open || (p_open && !*p_open)) // NB: is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
8348 {
8349 EndPopup();
8350 if (is_open)
8352 return false;
8353 }
8354 return is_open;
8355}
Definition imgui.h:2761
ImVec2 GetCenter() const
Definition imgui.h:2771

References Begin(), ImGuiContext::BeginPopupStack, ImGuiNextWindowData::ClearFlags(), ClosePopupToLevel(), ImGuiContext::CurrentWindow, EndPopup(), ImGuiNextWindowData::Flags, ImGuiViewport::GetCenter(), ImGuiWindow::GetID(), GetMainViewport(), GImGui, ImGuiCond_FirstUseEver, ImGuiNextWindowDataFlags_HasPos, ImGuiPopupFlags_None, ImGuiWindowFlags_Modal, ImGuiWindowFlags_NoCollapse, ImGuiWindowFlags_Popup, IsPopupOpen(), ImGuiContext::NextWindowData, SetNextWindowPos(), and ImVector< T >::Size.

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_style_add_button(), Slic3r::GUI::GLGizmoEmboss::draw_style_rename_button(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), ShowDemoWindowPopups(), and ShowExampleAppDocuments().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginTabBar()

bool ImGui::BeginTabBar ( const char *  str_id,
ImGuiTabBarFlags  flags = 0 
)
7016{
7017 ImGuiContext& g = *GImGui;
7018 ImGuiWindow* window = g.CurrentWindow;
7019 if (window->SkipItems)
7020 return false;
7021
7022 ImGuiID id = window->GetID(str_id);
7023 ImGuiTabBar* tab_bar = g.TabBars.GetOrAddByKey(id);
7024 ImRect tab_bar_bb = ImRect(window->DC.CursorPos.x, window->DC.CursorPos.y, window->WorkRect.Max.x, window->DC.CursorPos.y + g.FontSize + g.Style.FramePadding.y * 2);
7025 tab_bar->ID = id;
7026 return BeginTabBarEx(tab_bar, tab_bar_bb, flags | ImGuiTabBarFlags_IsFocused);
7027}
@ ImGuiTabBarFlags_IsFocused
Definition imgui_internal.h:1940
IMGUI_API bool BeginTabBarEx(ImGuiTabBar *tab_bar, const ImRect &bb, ImGuiTabBarFlags flags)
Definition imgui_widgets.cpp:7029
ImPool< ImGuiTabBar > TabBars
Definition imgui_internal.h:1528
Definition imgui_internal.h:1972
ImGuiID ID
Definition imgui_internal.h:1975
T * GetOrAddByKey(ImGuiID key)
Definition imgui_internal.h:618

References BeginTabBarEx(), ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiContext::FontSize, ImGuiStyle::FramePadding, ImGuiWindow::GetID(), ImPool< T >::GetOrAddByKey(), GImGui, ImGuiTabBar::ID, ImGuiTabBarFlags_IsFocused, ImRect::Max, ImGuiWindow::SkipItems, ImGuiContext::Style, ImGuiContext::TabBars, ImGuiWindow::WorkRect, ImVec2::x, and ImVec2::y.

Referenced by ShowDemoWindowLayout(), ShowDemoWindowWidgets(), ShowExampleAppCustomRendering(), ShowExampleAppDocuments(), ShowExampleAppLayout(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginTabBarEx()

bool ImGui::BeginTabBarEx ( ImGuiTabBar tab_bar,
const ImRect bb,
ImGuiTabBarFlags  flags 
)
7030{
7031 ImGuiContext& g = *GImGui;
7032 ImGuiWindow* window = g.CurrentWindow;
7033 if (window->SkipItems)
7034 return false;
7035
7036 if ((flags & ImGuiTabBarFlags_DockNode) == 0)
7037 PushOverrideID(tab_bar->ID);
7038
7039 // Add to stack
7041 g.CurrentTabBar = tab_bar;
7042
7043 // Append with multiple BeginTabBar()/EndTabBar() pairs.
7044 tab_bar->BackupCursorPos = window->DC.CursorPos;
7045 if (tab_bar->CurrFrameVisible == g.FrameCount)
7046 {
7047 window->DC.CursorPos = ImVec2(tab_bar->BarRect.Min.x, tab_bar->BarRect.Max.y + tab_bar->ItemSpacingY);
7048 tab_bar->BeginCount++;
7049 return true;
7050 }
7051
7052 // Ensure correct ordering when toggling ImGuiTabBarFlags_Reorderable flag, or when a new tab was added while being not reorderable
7053 if ((flags & ImGuiTabBarFlags_Reorderable) != (tab_bar->Flags & ImGuiTabBarFlags_Reorderable) || (tab_bar->TabsAddedNew && !(flags & ImGuiTabBarFlags_Reorderable)))
7054 if (tab_bar->Tabs.Size > 1)
7055 ImQsort(tab_bar->Tabs.Data, tab_bar->Tabs.Size, sizeof(ImGuiTabItem), TabItemComparerByBeginOrder);
7056 tab_bar->TabsAddedNew = false;
7057
7058 // Flags
7059 if ((flags & ImGuiTabBarFlags_FittingPolicyMask_) == 0)
7061
7062 tab_bar->Flags = flags;
7063 tab_bar->BarRect = tab_bar_bb;
7064 tab_bar->WantLayout = true; // Layout will be done on the first call to ItemTab()
7065 tab_bar->PrevFrameVisible = tab_bar->CurrFrameVisible;
7066 tab_bar->CurrFrameVisible = g.FrameCount;
7068 tab_bar->CurrTabsContentsHeight = 0.0f;
7069 tab_bar->ItemSpacingY = g.Style.ItemSpacing.y;
7070 tab_bar->FramePadding = g.Style.FramePadding;
7071 tab_bar->TabsActiveCount = 0;
7072 tab_bar->BeginCount = 1;
7073
7074 // Set cursor pos in a way which only be used in the off-chance the user erroneously submits item before BeginTabItem(): items will overlap
7075 window->DC.CursorPos = ImVec2(tab_bar->BarRect.Min.x, tab_bar->BarRect.Max.y + tab_bar->ItemSpacingY);
7076
7077 // Draw separator
7079 const float y = tab_bar->BarRect.Max.y - 1.0f;
7080 {
7081 const float separator_min_x = tab_bar->BarRect.Min.x - IM_FLOOR(window->WindowPadding.x * 0.5f);
7082 const float separator_max_x = tab_bar->BarRect.Max.x + IM_FLOOR(window->WindowPadding.x * 0.5f);
7083 window->DrawList->AddLine(ImVec2(separator_min_x, y), ImVec2(separator_max_x, y), col, 1.0f);
7084 }
7085 return true;
7086}
EIGEN_DEVICE_FUNC ColXpr col(Index i)
This is the const version of col().
Definition BlockMethods.h:838
@ ImGuiTabBarFlags_FittingPolicyDefault_
Definition imgui.h:1066
@ ImGuiTabBarFlags_FittingPolicyMask_
Definition imgui.h:1065
@ ImGuiTabBarFlags_Reorderable
Definition imgui.h:1057
@ ImGuiCol_TabUnfocusedActive
Definition imgui.h:1450
@ ImGuiCol_TabActive
Definition imgui.h:1448
@ ImGuiTabBarFlags_DockNode
Definition imgui_internal.h:1939
#define ImQsort
Definition imgui_internal.h:292
static int IMGUI_CDECL TabItemComparerByBeginOrder(const void *lhs, const void *rhs)
Definition imgui_widgets.cpp:6994
static ImGuiPtrOrIndex GetTabBarRefFromTabBar(ImGuiTabBar *tab_bar)
Definition imgui_widgets.cpp:7007
IMGUI_API void PushOverrideID(ImGuiID id)
Definition imgui.cpp:7051
IMGUI_API void AddLine(const ImVec2 &p1, const ImVec2 &p2, ImU32 col, float thickness=1.0f)
Definition imgui_draw.cpp:1366
ImVector< ImGuiPtrOrIndex > CurrentTabBarStack
Definition imgui_internal.h:1529
ImGuiTabBar * CurrentTabBar
Definition imgui_internal.h:1527
float PrevTabsContentsHeight
Definition imgui_internal.h:1983
ImVec2 BackupCursorPos
Definition imgui_internal.h:2002
ImVector< ImGuiTabItem > Tabs
Definition imgui_internal.h:1973
ImS16 TabsActiveCount
Definition imgui_internal.h:1998
bool TabsAddedNew
Definition imgui_internal.h:1997
ImRect BarRect
Definition imgui_internal.h:1981
int CurrFrameVisible
Definition imgui_internal.h:1979
ImVec2 FramePadding
Definition imgui_internal.h:2001
ImGuiTabBarFlags Flags
Definition imgui_internal.h:1974
float CurrTabsContentsHeight
Definition imgui_internal.h:1982
int PrevFrameVisible
Definition imgui_internal.h:1980
bool WantLayout
Definition imgui_internal.h:1995
ImS8 BeginCount
Definition imgui_internal.h:1994
float ItemSpacingY
Definition imgui_internal.h:2000
Definition imgui_internal.h:1954
T * Data
Definition imgui.h:1657

References ImDrawList::AddLine(), ImGuiTabBar::BackupCursorPos, ImGuiTabBar::BarRect, ImGuiTabBar::BeginCount, col(), ImGuiContext::CurrentTabBar, ImGuiContext::CurrentTabBarStack, ImGuiContext::CurrentWindow, ImGuiTabBar::CurrFrameVisible, ImGuiTabBar::CurrTabsContentsHeight, ImGuiWindowTempData::CursorPos, ImVector< T >::Data, ImGuiWindow::DC, ImGuiWindow::DrawList, ImGuiTabBar::Flags, ImGuiContext::FrameCount, ImGuiStyle::FramePadding, ImGuiTabBar::FramePadding, GetColorU32(), GetTabBarRefFromTabBar(), GImGui, ImGuiTabBar::ID, IM_FLOOR, ImGuiCol_TabActive, ImGuiCol_TabUnfocusedActive, ImGuiTabBarFlags_DockNode, ImGuiTabBarFlags_FittingPolicyDefault_, ImGuiTabBarFlags_FittingPolicyMask_, ImGuiTabBarFlags_IsFocused, ImGuiTabBarFlags_Reorderable, ImQsort, ImGuiStyle::ItemSpacing, ImGuiTabBar::ItemSpacingY, ImRect::Max, ImRect::Min, ImGuiTabBar::PrevFrameVisible, ImGuiTabBar::PrevTabsContentsHeight, ImVector< T >::push_back(), PushOverrideID(), ImVector< T >::Size, ImGuiWindow::SkipItems, ImGuiContext::Style, TabItemComparerByBeginOrder(), ImGuiTabBar::Tabs, ImGuiTabBar::TabsActiveCount, ImGuiTabBar::TabsAddedNew, ImGuiTabBar::WantLayout, ImGuiWindow::WindowPadding, ImVec2::x, and ImVec2::y.

Referenced by BeginTabBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginTabItem()

bool ImGui::BeginTabItem ( const char *  label,
bool *  p_open = NULL,
ImGuiTabItemFlags  flags = 0 
)
7651{
7652 ImGuiContext& g = *GImGui;
7653 ImGuiWindow* window = g.CurrentWindow;
7654 if (window->SkipItems)
7655 return false;
7656
7657 ImGuiTabBar* tab_bar = g.CurrentTabBar;
7658 if (tab_bar == NULL)
7659 {
7660 IM_ASSERT_USER_ERROR(tab_bar, "Needs to be called between BeginTabBar() and EndTabBar()!");
7661 return false;
7662 }
7663 IM_ASSERT(!(flags & ImGuiTabItemFlags_Button)); // BeginTabItem() Can't be used with button flags, use TabItemButton() instead!
7664
7665 bool ret = TabItemEx(tab_bar, label, p_open, flags);
7666 if (ret && !(flags & ImGuiTabItemFlags_NoPushId))
7667 {
7668 ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx];
7669 PushOverrideID(tab->ID); // We already hashed 'label' so push into the ID stack directly instead of doing another hash through PushID(label)
7670 }
7671 return ret;
7672}
@ ImGuiTabItemFlags_NoPushId
Definition imgui.h:1076
#define IM_ASSERT_USER_ERROR(_EXP, _MSG)
Definition imgui_internal.h:218
@ ImGuiTabItemFlags_Button
Definition imgui_internal.h:1949
ImS16 LastTabItemIdx
Definition imgui_internal.h:1999
ImGuiID ID
Definition imgui_internal.h:1955

References ImGuiContext::CurrentTabBar, ImGuiContext::CurrentWindow, GImGui, ImGuiTabItem::ID, IM_ASSERT, IM_ASSERT_USER_ERROR, ImGuiTabItemFlags_Button, ImGuiTabItemFlags_NoPushId, ImGuiTabBar::LastTabItemIdx, PushOverrideID(), ImGuiWindow::SkipItems, TabItemEx(), and ImGuiTabBar::Tabs.

Referenced by ShowDemoWindowLayout(), ShowDemoWindowWidgets(), ShowExampleAppCustomRendering(), ShowExampleAppDocuments(), ShowExampleAppLayout(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginTable()

bool ImGui::BeginTable ( const char *  str_id,
int  column,
ImGuiTableFlags  flags = 0,
const ImVec2 outer_size = ImVec2(0.0f, 0.0f),
float  inner_width = 0.0f 
)
310{
311 ImGuiID id = GetID(str_id);
312 return BeginTableEx(str_id, id, columns_count, flags, outer_size, inner_width);
313}
IMGUI_API bool BeginTableEx(const char *name, ImGuiID id, int columns_count, ImGuiTableFlags flags=0, const ImVec2 &outer_size=ImVec2(0, 0), float inner_width=0.0f)
Definition imgui_tables.cpp:315

References BeginTableEx(), and GetID().

Referenced by Slic3r::GUI::GLCanvas3D::_picking_pass(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::GCodeViewer::render_legend(), ShowDemoWindow(), ShowDemoWindowLayout(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), and ShowExampleAppPropertyEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginTableEx()

bool ImGui::BeginTableEx ( const char *  name,
ImGuiID  id,
int  columns_count,
ImGuiTableFlags  flags = 0,
const ImVec2 outer_size = ImVec2(0, 0),
float  inner_width = 0.0f 
)
316{
317 ImGuiContext& g = *GImGui;
318 ImGuiWindow* outer_window = GetCurrentWindow();
319 if (outer_window->SkipItems) // Consistent with other tables + beneficial side effect that assert on miscalling EndTable() will be more visible.
320 return false;
321
322 // Sanity checks
323 IM_ASSERT(columns_count > 0 && columns_count <= IMGUI_TABLE_MAX_COLUMNS && "Only 1..64 columns allowed!");
324 if (flags & ImGuiTableFlags_ScrollX)
325 IM_ASSERT(inner_width >= 0.0f);
326
327 // If an outer size is specified ahead we will be able to early out when not visible. Exact clipping rules may evolve.
328 const bool use_child_window = (flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) != 0;
329 const ImVec2 avail_size = GetContentRegionAvail();
330 ImVec2 actual_outer_size = CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f);
331 ImRect outer_rect(outer_window->DC.CursorPos, outer_window->DC.CursorPos + actual_outer_size);
332 if (use_child_window && IsClippedEx(outer_rect, 0, false))
333 {
334 ItemSize(outer_rect);
335 return false;
336 }
337
338 // Acquire storage for the table
339 ImGuiTable* table = g.Tables.GetOrAddByKey(id);
340 const int instance_no = (table->LastFrameActive != g.FrameCount) ? 0 : table->InstanceCurrent + 1;
341 const ImGuiID instance_id = id + instance_no;
342 const ImGuiTableFlags table_last_flags = table->Flags;
343 if (instance_no > 0)
344 IM_ASSERT(table->ColumnsCount == columns_count && "BeginTable(): Cannot change columns count mid-frame while preserving same ID");
345
346 // Acquire temporary buffers
347 const int table_idx = g.Tables.GetIndex(table);
352 temp_data->TableIndex = table_idx;
353 table->DrawSplitter = &table->TempData->DrawSplitter;
354 table->DrawSplitter->Clear();
355
356 // Fix flags
358 flags = TableFixFlags(flags, outer_window);
359
360 // Initialize
361 table->ID = id;
362 table->Flags = flags;
363 table->InstanceCurrent = (ImS16)instance_no;
364 table->LastFrameActive = g.FrameCount;
365 table->OuterWindow = table->InnerWindow = outer_window;
366 table->ColumnsCount = columns_count;
367 table->IsLayoutLocked = false;
368 table->InnerWidth = inner_width;
369 temp_data->UserOuterSize = outer_size;
370
371 // When not using a child window, WorkRect.Max will grow as we append contents.
372 if (use_child_window)
373 {
374 // Ensure no vertical scrollbar appears if we only want horizontal one, to make flag consistent
375 // (we have no other way to disable vertical scrollbar of a window while keeping the horizontal one showing)
376 ImVec2 override_content_size(FLT_MAX, FLT_MAX);
377 if ((flags & ImGuiTableFlags_ScrollX) && !(flags & ImGuiTableFlags_ScrollY))
378 override_content_size.y = FLT_MIN;
379
380 // Ensure specified width (when not specified, Stretched columns will act as if the width == OuterWidth and
381 // never lead to any scrolling). We don't handle inner_width < 0.0f, we could potentially use it to right-align
382 // based on the right side of the child window work rect, which would require knowing ahead if we are going to
383 // have decoration taking horizontal spaces (typically a vertical scrollbar).
384 if ((flags & ImGuiTableFlags_ScrollX) && inner_width > 0.0f)
385 override_content_size.x = inner_width;
386
387 if (override_content_size.x != FLT_MAX || override_content_size.y != FLT_MAX)
388 SetNextWindowContentSize(ImVec2(override_content_size.x != FLT_MAX ? override_content_size.x : 0.0f, override_content_size.y != FLT_MAX ? override_content_size.y : 0.0f));
389
390 // Reset scroll if we are reactivating it
391 if ((table_last_flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) == 0)
392 SetNextWindowScroll(ImVec2(0.0f, 0.0f));
393
394 // Create scrolling region (without border and zero window padding)
396 BeginChildEx(name, instance_id, outer_rect.GetSize(), false, child_flags);
397 table->InnerWindow = g.CurrentWindow;
398 table->WorkRect = table->InnerWindow->WorkRect;
399 table->OuterRect = table->InnerWindow->Rect();
400 table->InnerRect = table->InnerWindow->InnerRect;
401 IM_ASSERT(table->InnerWindow->WindowPadding.x == 0.0f && table->InnerWindow->WindowPadding.y == 0.0f && table->InnerWindow->WindowBorderSize == 0.0f);
402 }
403 else
404 {
405 // For non-scrolling tables, WorkRect == OuterRect == InnerRect.
406 // But at this point we do NOT have a correct value for .Max.y (unless a height has been explicitly passed in). It will only be updated in EndTable().
407 table->WorkRect = table->OuterRect = table->InnerRect = outer_rect;
408 }
409
410 // Push a standardized ID for both child-using and not-child-using tables
411 PushOverrideID(instance_id);
412
413 // Backup a copy of host window members we will modify
414 ImGuiWindow* inner_window = table->InnerWindow;
415 table->HostIndentX = inner_window->DC.Indent.x;
416 table->HostClipRect = inner_window->ClipRect;
417 table->HostSkipItems = inner_window->SkipItems;
418 temp_data->HostBackupWorkRect = inner_window->WorkRect;
419 temp_data->HostBackupParentWorkRect = inner_window->ParentWorkRect;
420 temp_data->HostBackupColumnsOffset = outer_window->DC.ColumnsOffset;
421 temp_data->HostBackupPrevLineSize = inner_window->DC.PrevLineSize;
422 temp_data->HostBackupCurrLineSize = inner_window->DC.CurrLineSize;
423 temp_data->HostBackupCursorMaxPos = inner_window->DC.CursorMaxPos;
424 temp_data->HostBackupItemWidth = outer_window->DC.ItemWidth;
425 temp_data->HostBackupItemWidthStackSize = outer_window->DC.ItemWidthStack.Size;
426 inner_window->DC.PrevLineSize = inner_window->DC.CurrLineSize = ImVec2(0.0f, 0.0f);
427
428 // Padding and Spacing
429 // - None ........Content..... Pad .....Content........
430 // - PadOuter | Pad ..Content..... Pad .....Content.. Pad |
431 // - PadInner ........Content.. Pad | Pad ..Content........
432 // - PadOuter+PadInner | Pad ..Content.. Pad | Pad ..Content.. Pad |
433 const bool pad_outer_x = (flags & ImGuiTableFlags_NoPadOuterX) ? false : (flags & ImGuiTableFlags_PadOuterX) ? true : (flags & ImGuiTableFlags_BordersOuterV) != 0;
434 const bool pad_inner_x = (flags & ImGuiTableFlags_NoPadInnerX) ? false : true;
435 const float inner_spacing_for_border = (flags & ImGuiTableFlags_BordersInnerV) ? TABLE_BORDER_SIZE : 0.0f;
436 const float inner_spacing_explicit = (pad_inner_x && (flags & ImGuiTableFlags_BordersInnerV) == 0) ? g.Style.CellPadding.x : 0.0f;
437 const float inner_padding_explicit = (pad_inner_x && (flags & ImGuiTableFlags_BordersInnerV) != 0) ? g.Style.CellPadding.x : 0.0f;
438 table->CellSpacingX1 = inner_spacing_explicit + inner_spacing_for_border;
439 table->CellSpacingX2 = inner_spacing_explicit;
440 table->CellPaddingX = inner_padding_explicit;
441 table->CellPaddingY = g.Style.CellPadding.y;
442
443 const float outer_padding_for_border = (flags & ImGuiTableFlags_BordersOuterV) ? TABLE_BORDER_SIZE : 0.0f;
444 const float outer_padding_explicit = pad_outer_x ? g.Style.CellPadding.x : 0.0f;
445 table->OuterPaddingX = (outer_padding_for_border + outer_padding_explicit) - table->CellPaddingX;
446
447 table->CurrentColumn = -1;
448 table->CurrentRow = -1;
449 table->RowBgColorCounter = 0;
451 table->InnerClipRect = (inner_window == outer_window) ? table->WorkRect : inner_window->ClipRect;
452 table->InnerClipRect.ClipWith(table->WorkRect); // We need this to honor inner_width
454 table->InnerClipRect.Max.y = (flags & ImGuiTableFlags_NoHostExtendY) ? ImMin(table->InnerClipRect.Max.y, inner_window->WorkRect.Max.y) : inner_window->ClipRect.Max.y;
455
456 table->RowPosY1 = table->RowPosY2 = table->WorkRect.Min.y; // This is needed somehow
457 table->RowTextBaseline = 0.0f; // This will be cleared again by TableBeginRow()
458 table->FreezeRowsRequest = table->FreezeRowsCount = 0; // This will be setup by TableSetupScrollFreeze(), if any
459 table->FreezeColumnsRequest = table->FreezeColumnsCount = 0;
460 table->IsUnfrozenRows = true;
461 table->DeclColumnsCount = 0;
462
463 // Using opaque colors facilitate overlapping elements of the grid
466
467 // Make table current
468 g.CurrentTable = table;
469 outer_window->DC.CurrentTableIdx = table_idx;
470 if (inner_window != outer_window) // So EndChild() within the inner window can restore the table properly.
471 inner_window->DC.CurrentTableIdx = table_idx;
472
473 if ((table_last_flags & ImGuiTableFlags_Reorderable) && (flags & ImGuiTableFlags_Reorderable) == 0)
474 table->IsResetDisplayOrderRequest = true;
475
476 // Mark as used
477 if (table_idx >= g.TablesLastTimeActive.Size)
478 g.TablesLastTimeActive.resize(table_idx + 1, -1.0f);
479 g.TablesLastTimeActive[table_idx] = (float)g.Time;
480 temp_data->LastTimeActive = (float)g.Time;
481 table->MemoryCompacted = false;
482
483 // Setup memory buffer (clear data if columns count changed)
484 ImGuiTableColumn* old_columns_to_preserve = NULL;
485 void* old_columns_raw_data = NULL;
486 const int old_columns_count = table->Columns.size();
487 if (old_columns_count != 0 && old_columns_count != columns_count)
488 {
489 // Attempt to preserve width on column count change (#4046)
490 old_columns_to_preserve = table->Columns.Data;
491 old_columns_raw_data = table->RawData;
492 table->RawData = NULL;
493 }
494 if (table->RawData == NULL)
495 {
496 TableBeginInitMemory(table, columns_count);
497 table->IsInitializing = table->IsSettingsRequestLoad = true;
498 }
499 if (table->IsResetAllRequest)
500 TableResetSettings(table);
501 if (table->IsInitializing)
502 {
503 // Initialize
504 table->SettingsOffset = -1;
505 table->IsSortSpecsDirty = true;
506 table->InstanceInteracted = -1;
507 table->ContextPopupColumn = -1;
508 table->ReorderColumn = table->ResizedColumn = table->LastResizedColumn = -1;
509 table->AutoFitSingleColumn = -1;
510 table->HoveredColumnBody = table->HoveredColumnBorder = -1;
511 for (int n = 0; n < columns_count; n++)
512 {
513 ImGuiTableColumn* column = &table->Columns[n];
514 if (old_columns_to_preserve && n < old_columns_count)
515 {
516 // FIXME: We don't attempt to preserve column order in this path.
517 *column = old_columns_to_preserve[n];
518 }
519 else
520 {
521 float width_auto = column->WidthAuto;
522 *column = ImGuiTableColumn();
523 column->WidthAuto = width_auto;
524 column->IsPreserveWidthAuto = true; // Preserve WidthAuto when reinitializing a live table: not technically necessary but remove a visible flicker
525 column->IsEnabled = column->IsEnabledNextFrame = true;
526 }
528 }
529 }
530 if (old_columns_raw_data)
531 IM_FREE(old_columns_raw_data);
532
533 // Load settings
534 if (table->IsSettingsRequestLoad)
535 TableLoadSettings(table);
536
537 // Handle DPI/font resize
538 // This is designed to facilitate DPI changes with the assumption that e.g. style.CellPadding has been scaled as well.
539 // It will also react to changing fonts with mixed results. It doesn't need to be perfect but merely provide a decent transition.
540 // FIXME-DPI: Provide consistent standards for reference size. Perhaps using g.CurrentDpiScale would be more self explanatory.
541 // This is will lead us to non-rounded WidthRequest in columns, which should work but is a poorly tested path.
542 const float new_ref_scale_unit = g.FontSize; // g.Font->GetCharAdvance('A') ?
543 if (table->RefScale != 0.0f && table->RefScale != new_ref_scale_unit)
544 {
545 const float scale_factor = new_ref_scale_unit / table->RefScale;
546 //IMGUI_DEBUG_LOG("[table] %08X RefScaleUnit %.3f -> %.3f, scaling width by %.3f\n", table->ID, table->RefScaleUnit, new_ref_scale_unit, scale_factor);
547 for (int n = 0; n < columns_count; n++)
548 table->Columns[n].WidthRequest = table->Columns[n].WidthRequest * scale_factor;
549 }
550 table->RefScale = new_ref_scale_unit;
551
552 // Disable output until user calls TableNextRow() or TableNextColumn() leading to the TableUpdateLayout() call..
553 // This is not strictly necessary but will reduce cases were "out of table" output will be misleading to the user.
554 // Because we cannot safely assert in EndTable() when no rows have been created, this seems like our best option.
555 inner_window->SkipItems = true;
556
557 // Clear names
558 // At this point the ->NameOffset field of each column will be invalid until TableUpdateLayout() or the first call to TableSetupColumn()
559 if (table->ColumnsNames.Buf.Size > 0)
560 table->ColumnsNames.Buf.resize(0);
561
562 // Apply queued resizing/reordering/hiding requests
564
565 return true;
566}
@ ImGuiCol_TableBorderLight
Definition imgui.h:1457
@ ImGuiCol_TableBorderStrong
Definition imgui.h:1456
@ ImGuiTableRowFlags_None
Definition imgui.h:1205
signed short ImS16
Definition imgui.h:226
#define IM_FREE(_PTR)
Definition imgui.h:1635
@ ImGuiWindowFlags_None
Definition imgui.h:915
int ImGuiTableFlags
Definition imgui.h:196
@ ImGuiTableFlags_Reorderable
Definition imgui.h:1111
@ ImGuiTableFlags_SizingMask_
Definition imgui.h:1153
@ ImGuiTableFlags_NoPadInnerX
Definition imgui.h:1144
@ ImGuiTableFlags_ScrollY
Definition imgui.h:1147
@ ImGuiTableFlags_PadOuterX
Definition imgui.h:1142
@ ImGuiTableFlags_BordersOuterV
Definition imgui.h:1121
@ ImGuiTableFlags_ScrollX
Definition imgui.h:1146
@ ImGuiTableFlags_BordersInnerV
Definition imgui.h:1120
@ ImGuiTableFlags_NoPadOuterX
Definition imgui.h:1143
@ ImGuiTableFlags_NoHostExtendY
Definition imgui.h:1136
#define IMGUI_TABLE_MAX_COLUMNS
Definition imgui_internal.h:2019
ImS8 ImGuiTableColumnIdx
Definition imgui_internal.h:2023
static const float TABLE_BORDER_SIZE
Definition imgui_tables.cpp:259
ImGuiTableFlags TableFixFlags(ImGuiTableFlags flags, ImGuiWindow *outer_window)
Definition imgui_tables.cpp:264
IMGUI_API void TableResetSettings(ImGuiTable *table)
Definition imgui_tables.cpp:3170
IMGUI_API void TableBeginInitMemory(ImGuiTable *table, int columns_count)
Definition imgui_tables.cpp:576
IMGUI_API bool IsClippedEx(const ImRect &bb, ImGuiID id, bool clip_even_when_logged)
Definition imgui.cpp:3234
IMGUI_API void TableLoadSettings(ImGuiTable *table)
Definition imgui_tables.cpp:3233
IMGUI_API void TableBeginApplyRequests(ImGuiTable *table)
Definition imgui_tables.cpp:592
void Clear()
Definition imgui.h:2300
int CurrentTableStackIdx
Definition imgui_internal.h:1520
ImVector< float > TablesLastTimeActive
Definition imgui_internal.h:1523
ImVector< ImGuiTableTempData > TablesTempDataStack
Definition imgui_internal.h:1522
ImGuiTable * CurrentTable
Definition imgui_internal.h:1519
ImPool< ImGuiTable > Tables
Definition imgui_internal.h:1521
ImVec2 CellPadding
Definition imgui.h:1738
Definition imgui_internal.h:2031
ImGuiTableColumnIdx DisplayOrder
Definition imgui_internal.h:2050
bool IsPreserveWidthAuto
Definition imgui_internal.h:2064
float WidthAuto
Definition imgui_internal.h:2037
bool IsEnabled
Definition imgui_internal.h:2058
bool IsEnabledNextFrame
Definition imgui_internal.h:2059
Definition imgui_internal.h:2096
bool IsUnfrozenRows
Definition imgui_internal.h:2194
float OuterPaddingX
Definition imgui_internal.h:2131
bool IsSortSpecsDirty
Definition imgui_internal.h:2186
bool IsLayoutLocked
Definition imgui_internal.h:2183
ImGuiTableColumnIdx HoveredColumnBorder
Definition imgui_internal.h:2163
int CurrentRow
Definition imgui_internal.h:2112
ImGuiID ID
Definition imgui_internal.h:2097
bool HostSkipItems
Definition imgui_internal.h:2197
float RefScale
Definition imgui_internal.h:2143
bool IsInitializing
Definition imgui_internal.h:2185
bool IsResetAllRequest
Definition imgui_internal.h:2192
ImGuiTableColumnIdx AutoFitSingleColumn
Definition imgui_internal.h:2164
ImGuiTableColumnIdx HoveredColumnBody
Definition imgui_internal.h:2162
float CellSpacingX1
Definition imgui_internal.h:2134
ImRect HostClipRect
Definition imgui_internal.h:2151
float RowPosY2
Definition imgui_internal.h:2117
ImRect WorkRect
Definition imgui_internal.h:2146
ImSpan< ImGuiTableColumnIdx > DisplayOrderToIndex
Definition imgui_internal.h:2102
float CellSpacingX2
Definition imgui_internal.h:2135
float CellPaddingX
Definition imgui_internal.h:2132
ImRect InnerClipRect
Definition imgui_internal.h:2147
ImSpan< ImGuiTableColumn > Columns
Definition imgui_internal.h:2101
int LastFrameActive
Definition imgui_internal.h:2110
ImRect InnerRect
Definition imgui_internal.h:2145
int RowBgColorCounter
Definition imgui_internal.h:2123
ImRect OuterRect
Definition imgui_internal.h:2144
ImGuiTableColumnIdx FreezeColumnsRequest
Definition imgui_internal.h:2177
ImS16 InstanceCurrent
Definition imgui_internal.h:2114
void * RawData
Definition imgui_internal.h:2099
bool IsDefaultSizingPolicy
Definition imgui_internal.h:2195
ImGuiTableTempData * TempData
Definition imgui_internal.h:2100
ImGuiTableColumnIdx DeclColumnsCount
Definition imgui_internal.h:2161
ImU32 BorderColorStrong
Definition imgui_internal.h:2125
int CurrentColumn
Definition imgui_internal.h:2113
bool MemoryCompacted
Definition imgui_internal.h:2196
ImGuiTableColumnIdx FreezeRowsRequest
Definition imgui_internal.h:2175
bool IsResetDisplayOrderRequest
Definition imgui_internal.h:2193
bool IsSettingsRequestLoad
Definition imgui_internal.h:2189
float CellPaddingY
Definition imgui_internal.h:2133
ImGuiWindow * OuterWindow
Definition imgui_internal.h:2153
ImS16 InstanceInteracted
Definition imgui_internal.h:2115
ImGuiTableFlags Flags
Definition imgui_internal.h:2098
ImU32 BorderColorLight
Definition imgui_internal.h:2126
float InnerWidth
Definition imgui_internal.h:2138
ImGuiWindow * InnerWindow
Definition imgui_internal.h:2154
float HostIndentX
Definition imgui_internal.h:2129
ImGuiTableColumnIdx LastResizedColumn
Definition imgui_internal.h:2166
ImGuiTableColumnIdx FreezeRowsCount
Definition imgui_internal.h:2176
ImGuiTableRowFlags LastRowFlags
Definition imgui_internal.h:2122
ImGuiTableColumnIdx FreezeColumnsCount
Definition imgui_internal.h:2178
ImGuiTableColumnIdx ContextPopupColumn
Definition imgui_internal.h:2174
ImGuiTableColumnIdx ResizedColumn
Definition imgui_internal.h:2165
int SettingsOffset
Definition imgui_internal.h:2109
float RowTextBaseline
Definition imgui_internal.h:2119
float RowPosY1
Definition imgui_internal.h:2116
ImGuiTextBuffer ColumnsNames
Definition imgui_internal.h:2155
ImGuiTableColumnIdx ReorderColumn
Definition imgui_internal.h:2168
ImDrawListSplitter * DrawSplitter
Definition imgui_internal.h:2156
int ColumnsCount
Definition imgui_internal.h:2111
Definition imgui_internal.h:2208
float LastTimeActive
Definition imgui_internal.h:2210
ImRect HostBackupWorkRect
Definition imgui_internal.h:2217
ImVec2 HostBackupCursorMaxPos
Definition imgui_internal.h:2221
ImVec2 HostBackupPrevLineSize
Definition imgui_internal.h:2219
ImDrawListSplitter DrawSplitter
Definition imgui_internal.h:2213
ImVec1 HostBackupColumnsOffset
Definition imgui_internal.h:2222
ImVec2 UserOuterSize
Definition imgui_internal.h:2212
ImVec2 HostBackupCurrLineSize
Definition imgui_internal.h:2220
int HostBackupItemWidthStackSize
Definition imgui_internal.h:2224
float HostBackupItemWidth
Definition imgui_internal.h:2223
int TableIndex
Definition imgui_internal.h:2209
ImRect HostBackupParentWorkRect
Definition imgui_internal.h:2218
ImVector< char > Buf
Definition imgui.h:2052
ImPoolIdx GetIndex(const T *p) const
Definition imgui_internal.h:617
int size() const
Definition imgui_internal.h:566
T * Data
Definition imgui_internal.h:556

References ImGuiTable::AutoFitSingleColumn, BeginChildEx(), ImGuiTable::BorderColorLight, ImGuiTable::BorderColorStrong, ImGuiTextBuffer::Buf, CalcItemSize(), ImGuiStyle::CellPadding, ImGuiTable::CellPaddingX, ImGuiTable::CellPaddingY, ImGuiTable::CellSpacingX1, ImGuiTable::CellSpacingX2, ImDrawListSplitter::Clear(), ImGuiWindow::ClipRect, ImRect::ClipWith(), ImRect::ClipWithFull(), ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTable::ColumnsNames, ImGuiWindowTempData::ColumnsOffset, ImGuiTable::ContextPopupColumn, ImGuiTable::CurrentColumn, ImGuiTable::CurrentRow, ImGuiContext::CurrentTable, ImGuiWindowTempData::CurrentTableIdx, ImGuiContext::CurrentTableStackIdx, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CurrLineSize, ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImSpan< T >::Data, ImGuiWindow::DC, ImGuiTable::DeclColumnsCount, ImGuiTableColumn::DisplayOrder, ImGuiTable::DisplayOrderToIndex, ImGuiTable::DrawSplitter, ImGuiTableTempData::DrawSplitter, ImGuiTable::Flags, ImGuiContext::FontSize, ImGuiContext::FrameCount, ImGuiTable::FreezeColumnsCount, ImGuiTable::FreezeColumnsRequest, ImGuiTable::FreezeRowsCount, ImGuiTable::FreezeRowsRequest, GetColorU32(), GetContentRegionAvail(), GetCurrentWindow(), ImPool< T >::GetIndex(), ImPool< T >::GetOrAddByKey(), GImGui, ImGuiTableTempData::HostBackupColumnsOffset, ImGuiTableTempData::HostBackupCurrLineSize, ImGuiTableTempData::HostBackupCursorMaxPos, ImGuiTableTempData::HostBackupItemWidth, ImGuiTableTempData::HostBackupItemWidthStackSize, ImGuiTableTempData::HostBackupParentWorkRect, ImGuiTableTempData::HostBackupPrevLineSize, ImGuiTableTempData::HostBackupWorkRect, ImGuiTable::HostClipRect, ImGuiTable::HostIndentX, ImGuiTable::HostSkipItems, ImGuiTable::HoveredColumnBody, ImGuiTable::HoveredColumnBorder, ImGuiTable::ID, IM_ASSERT, IM_FREE, IMGUI_TABLE_MAX_COLUMNS, ImGuiCol_TableBorderLight, ImGuiCol_TableBorderStrong, ImGuiTableFlags_BordersInnerV, ImGuiTableFlags_BordersOuterV, ImGuiTableFlags_NoHostExtendY, ImGuiTableFlags_NoPadInnerX, ImGuiTableFlags_NoPadOuterX, ImGuiTableFlags_PadOuterX, ImGuiTableFlags_Reorderable, ImGuiTableFlags_ScrollX, ImGuiTableFlags_ScrollY, ImGuiTableFlags_SizingMask_, ImGuiTableRowFlags_None, ImGuiWindowFlags_HorizontalScrollbar, ImGuiWindowFlags_None, ImMax(), ImMin(), ImGuiWindowTempData::Indent, ImGuiTable::InnerClipRect, ImGuiWindow::InnerRect, ImGuiTable::InnerRect, ImGuiTable::InnerWidth, ImGuiTable::InnerWindow, ImGuiTable::InstanceCurrent, ImGuiTable::InstanceInteracted, IsClippedEx(), ImGuiTable::IsDefaultSizingPolicy, ImGuiTableColumn::IsEnabled, ImGuiTableColumn::IsEnabledNextFrame, ImGuiTable::IsInitializing, ImGuiTable::IsLayoutLocked, ImGuiTableColumn::IsPreserveWidthAuto, ImGuiTable::IsResetAllRequest, ImGuiTable::IsResetDisplayOrderRequest, ImGuiTable::IsSettingsRequestLoad, ImGuiTable::IsSortSpecsDirty, ImGuiTable::IsUnfrozenRows, ItemSize(), ImGuiWindowTempData::ItemWidth, ImGuiWindowTempData::ItemWidthStack, ImGuiTable::LastFrameActive, ImGuiTable::LastResizedColumn, ImGuiTable::LastRowFlags, ImGuiTableTempData::LastTimeActive, ImRect::Max, ImGuiTable::MemoryCompacted, ImRect::Min, ImGuiTable::OuterPaddingX, ImGuiTable::OuterRect, ImGuiTable::OuterWindow, ImGuiWindow::ParentWorkRect, ImGuiWindowTempData::PrevLineSize, PushOverrideID(), ImGuiTable::RawData, ImGuiWindow::Rect(), ImGuiTable::RefScale, ImGuiTable::ReorderColumn, ImVector< T >::resize(), ImGuiTable::ResizedColumn, ImGuiTable::RowBgColorCounter, ImGuiTable::RowPosY1, ImGuiTable::RowPosY2, ImGuiTable::RowTextBaseline, SetNextWindowContentSize(), SetNextWindowScroll(), ImGuiTable::SettingsOffset, ImVector< T >::Size, ImSpan< T >::size(), ImGuiWindow::SkipItems, ImGuiContext::Style, TABLE_BORDER_SIZE, TableBeginApplyRequests(), TableBeginInitMemory(), TableFixFlags(), ImGuiTableTempData::TableIndex, TableLoadSettings(), TableResetSettings(), ImGuiContext::Tables, ImGuiContext::TablesLastTimeActive, ImGuiContext::TablesTempDataStack, ImGuiTable::TempData, ImGuiContext::Time, ImGuiTableTempData::UserOuterSize, ImGuiTableColumn::WidthAuto, ImGuiWindow::WindowBorderSize, ImGuiWindow::WindowPadding, ImGuiWindow::WorkRect, ImGuiTable::WorkRect, ImVec2::x, ImVec1::x, and ImVec2::y.

Referenced by BeginTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginTooltip()

void ImGui::BeginTooltip ( )
8009{
8011}
@ ImGuiTooltipFlags_None
Definition imgui_internal.h:840
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, ImGuiTooltipFlags tooltip_flags)
Definition imgui.cpp:8013

References BeginTooltipEx(), ImGuiTooltipFlags_None, and ImGuiWindowFlags_None.

Referenced by BeginDragDropSource(), EditTableSizingFlags(), HelpMarker(), MetricsHelpMarker(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::HintNotification::render_documentation_button(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_eject_button(), Slic3r::GUI::GCodeViewer::render_legend(), Slic3r::GUI::GLCanvas3D::LayersEditing::render_overlay(), Slic3r::GUI::NotificationManager::HintNotification::render_preferences_button(), Slic3r::GUI::GLCanvas3D::SLAView::render_switch_button(), ShowDemoWindowWidgets(), ShowFont(), ShowStyleEditor(), Slic3r::GUI::ImGuiWrapper::tooltip(), and UpdateDebugToolItemPicker().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginTooltipEx()

void ImGui::BeginTooltipEx ( ImGuiWindowFlags  extra_flags,
ImGuiTooltipFlags  tooltip_flags 
)
8014{
8015 ImGuiContext& g = *GImGui;
8016
8018 {
8019 // The default tooltip position is a little offset to give space to see the context menu (it's also clamped within the current viewport/monitor)
8020 // In the context of a dragging tooltip we try to reduce that offset and we enforce following the cursor.
8021 // Whatever we do we want to call SetNextWindowPos() to enforce a tooltip position and disable clipping the tooltip without our display area, like regular tooltip do.
8022 //ImVec2 tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding;
8023 ImVec2 tooltip_pos = g.IO.MousePos + ImVec2(16 * g.Style.MouseCursorScale, 8 * g.Style.MouseCursorScale);
8024 SetNextWindowPos(tooltip_pos);
8026 //PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.60f); // This would be nice but e.g ColorButton with checkboard has issue with transparent colors :(
8028 }
8029
8030 char window_name[16];
8031 ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", g.TooltipOverrideCount);
8033 if (ImGuiWindow* window = FindWindowByName(window_name))
8034 if (window->Active)
8035 {
8036 // Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one.
8037 window->Hidden = true;
8038 window->HiddenFramesCanSkipItems = 1; // FIXME: This may not be necessary?
8039 ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", ++g.TooltipOverrideCount);
8040 }
8042 Begin(window_name, NULL, flags | extra_flags);
8043}
@ ImGuiCol_PopupBg
Definition imgui.h:1417
@ ImGuiTooltipFlags_OverridePreviousTooltip
Definition imgui_internal.h:841
IMGUI_API void SetNextWindowBgAlpha(float alpha)
Definition imgui.cpp:6919
int TooltipOverrideCount
Definition imgui_internal.h:1548
ImVec4 Colors[ImGuiCol_COUNT]
Definition imgui.h:1761
float MouseCursorScale
Definition imgui.h:1755
float w
Definition imgui.h:259

References Begin(), ImGuiStyle::Colors, ImGuiContext::DragDropWithinSource, ImGuiContext::DragDropWithinTarget, FindWindowByName(), GImGui, IM_ARRAYSIZE, ImFormatString(), ImGuiCol_PopupBg, ImGuiTooltipFlags_OverridePreviousTooltip, ImGuiWindowFlags_AlwaysAutoResize, ImGuiWindowFlags_NoInputs, ImGuiWindowFlags_NoMove, ImGuiWindowFlags_NoResize, ImGuiWindowFlags_NoSavedSettings, ImGuiWindowFlags_NoTitleBar, ImGuiWindowFlags_Tooltip, ImGuiContext::IO, ImGuiStyle::MouseCursorScale, ImGuiIO::MousePos, SetNextWindowBgAlpha(), SetNextWindowPos(), ImGuiContext::Style, ImGuiContext::TooltipOverrideCount, and ImVec4::w.

Referenced by BeginTooltip(), ColorTooltip(), and SetTooltipV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BeginViewportSideBar()

bool ImGui::BeginViewportSideBar ( const char *  name,
ImGuiViewport viewport,
ImGuiDir  dir,
float  size,
ImGuiWindowFlags  window_flags 
)
6624{
6625 IM_ASSERT(dir != ImGuiDir_None);
6626
6627 ImGuiWindow* bar_window = FindWindowByName(name);
6628 if (bar_window == NULL || bar_window->BeginCount == 0)
6629 {
6630 // Calculate and set window size/position
6631 ImGuiViewportP* viewport = (ImGuiViewportP*)(void*)(viewport_p ? viewport_p : GetMainViewport());
6632 ImRect avail_rect = viewport->GetBuildWorkRect();
6633 ImGuiAxis axis = (dir == ImGuiDir_Up || dir == ImGuiDir_Down) ? ImGuiAxis_Y : ImGuiAxis_X;
6634 ImVec2 pos = avail_rect.Min;
6635 if (dir == ImGuiDir_Right || dir == ImGuiDir_Down)
6636 pos[axis] = avail_rect.Max[axis] - axis_size;
6637 ImVec2 size = avail_rect.GetSize();
6638 size[axis] = axis_size;
6639 SetNextWindowPos(pos);
6640 SetNextWindowSize(size);
6641
6642 // Report our size into work area (for next frame) using actual window size
6643 if (dir == ImGuiDir_Up || dir == ImGuiDir_Left)
6644 viewport->BuildWorkOffsetMin[axis] += axis_size;
6645 else if (dir == ImGuiDir_Down || dir == ImGuiDir_Right)
6646 viewport->BuildWorkOffsetMax[axis] -= axis_size;
6647 }
6648
6650 PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
6651 PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0, 0)); // Lift normal size constraint
6652 bool is_open = Begin(name, NULL, window_flags);
6653 PopStyleVar(2);
6654
6655 return is_open;
6656}
@ ImGuiStyleVar_WindowRounding
Definition imgui.h:1481
@ ImGuiStyleVar_WindowMinSize
Definition imgui.h:1483
ImGuiAxis
Definition imgui_internal.h:863
ImVec2 BuildWorkOffsetMax
Definition imgui_internal.h:1237
ImRect GetBuildWorkRect() const
Definition imgui_internal.h:1250
ImVec2 BuildWorkOffsetMin
Definition imgui_internal.h:1236

References Begin(), ImGuiWindow::BeginCount, ImGuiViewportP::BuildWorkOffsetMax, ImGuiViewportP::BuildWorkOffsetMin, FindWindowByName(), ImGuiViewportP::GetBuildWorkRect(), GetMainViewport(), ImRect::GetSize(), IM_ASSERT, ImGuiAxis_X, ImGuiAxis_Y, ImGuiDir_Down, ImGuiDir_Left, ImGuiDir_None, ImGuiDir_Right, ImGuiDir_Up, ImGuiStyleVar_WindowMinSize, ImGuiStyleVar_WindowRounding, ImGuiWindowFlags_NoMove, ImGuiWindowFlags_NoResize, ImGuiWindowFlags_NoTitleBar, ImRect::Max, ImRect::Min, PopStyleVar(), PushStyleVar(), SetNextWindowPos(), and SetNextWindowSize().

Referenced by BeginMainMenuBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BringWindowToDisplayBack()

void ImGui::BringWindowToDisplayBack ( ImGuiWindow window)
6437{
6438 ImGuiContext& g = *GImGui;
6439 if (g.Windows[0] == window)
6440 return;
6441 for (int i = 0; i < g.Windows.Size; i++)
6442 if (g.Windows[i] == window)
6443 {
6444 memmove(&g.Windows[1], &g.Windows[0], (size_t)i * sizeof(ImGuiWindow*));
6445 g.Windows[0] = window;
6446 break;
6447 }
6448}
ImVector< ImGuiWindow * > Windows
Definition imgui_internal.h:1373

References GImGui, ImVector< T >::Size, and ImGuiContext::Windows.

◆ BringWindowToDisplayFront()

void ImGui::BringWindowToDisplayFront ( ImGuiWindow window)
6422{
6423 ImGuiContext& g = *GImGui;
6424 ImGuiWindow* current_front_window = g.Windows.back();
6425 if (current_front_window == window || current_front_window->RootWindow == window) // Cheap early out (could be better)
6426 return;
6427 for (int i = g.Windows.Size - 2; i >= 0; i--) // We can ignore the top-most window
6428 if (g.Windows[i] == window)
6429 {
6430 memmove(&g.Windows[i], &g.Windows[i + 1], (size_t)(g.Windows.Size - i - 1) * sizeof(ImGuiWindow*));
6431 g.Windows[g.Windows.Size - 1] = window;
6432 break;
6433 }
6434}

References ImVector< T >::back(), GImGui, ImGuiWindow::RootWindow, ImVector< T >::Size, and ImGuiContext::Windows.

Referenced by FocusWindow(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GLCanvas3D::Tooltip::render(), and Slic3r::GUI::GLGizmoMeasure::render_dimensioning().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BringWindowToFocusFront()

void ImGui::BringWindowToFocusFront ( ImGuiWindow window)
6401{
6402 ImGuiContext& g = *GImGui;
6403 IM_ASSERT(window == window->RootWindow);
6404
6405 const int cur_order = window->FocusOrder;
6406 IM_ASSERT(g.WindowsFocusOrder[cur_order] == window);
6407 if (g.WindowsFocusOrder.back() == window)
6408 return;
6409
6410 const int new_order = g.WindowsFocusOrder.Size - 1;
6411 for (int n = cur_order; n < new_order; n++)
6412 {
6413 g.WindowsFocusOrder[n] = g.WindowsFocusOrder[n + 1];
6414 g.WindowsFocusOrder[n]->FocusOrder--;
6415 IM_ASSERT(g.WindowsFocusOrder[n]->FocusOrder == n);
6416 }
6417 g.WindowsFocusOrder[new_order] = window;
6418 window->FocusOrder = (short)new_order;
6419}
ImVector< ImGuiWindow * > WindowsFocusOrder
Definition imgui_internal.h:1374
short FocusOrder
Definition imgui_internal.h:1844

References ImVector< T >::back(), ImGuiWindow::FocusOrder, GImGui, IM_ASSERT, ImGuiWindow::RootWindow, ImVector< T >::Size, and ImGuiContext::WindowsFocusOrder.

Referenced by FocusWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Bullet()

void ImGui::Bullet ( )
1277{
1278 ImGuiWindow* window = GetCurrentWindow();
1279 if (window->SkipItems)
1280 return;
1281
1282 ImGuiContext& g = *GImGui;
1283 const ImGuiStyle& style = g.Style;
1284 const float line_height = ImMax(ImMin(window->DC.CurrLineSize.y, g.FontSize + g.Style.FramePadding.y * 2), g.FontSize);
1285 const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize, line_height));
1286 ItemSize(bb);
1287 if (!ItemAdd(bb, 0))
1288 {
1289 SameLine(0, style.FramePadding.x * 2);
1290 return;
1291 }
1292
1293 // Render and stay on same line
1294 ImU32 text_col = GetColorU32(ImGuiCol_Text);
1295 RenderBullet(window->DrawList, bb.Min + ImVec2(style.FramePadding.x + g.FontSize * 0.5f, line_height * 0.5f), text_col);
1296 SameLine(0, style.FramePadding.x * 2.0f);
1297}
IMGUI_API void SameLine(float offset_from_start_x=0.0f, float spacing=-1.0f)
Definition imgui.cpp:7455

References ImGuiWindowTempData::CurrLineSize, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, ImGuiContext::FontSize, ImGuiStyle::FramePadding, GetColorU32(), GetCurrentWindow(), GImGui, ImGuiCol_Text, ImMax(), ImMin(), ItemAdd(), ItemSize(), ImRect::Min, RenderBullet(), SameLine(), ImGuiWindow::SkipItems, ImGuiContext::Style, style, and ImVec2::y.

Referenced by DebugNodeTable(), ShowDemoWindowMisc(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BulletText()

void ImGui::BulletText ( const char *  fmt,
  ... 
)
376{
377 va_list args;
378 va_start(args, fmt);
379 BulletTextV(fmt, args);
380 va_end(args);
381}
IMGUI_API void BulletTextV(const char *fmt, va_list args) IM_FMTLIST(1)
Definition imgui_widgets.cpp:384

References BulletTextV().

Referenced by DebugNodeColumns(), DebugNodeDrawList(), DebugNodeStorage(), DebugNodeTable(), DebugNodeTableSettings(), DebugNodeViewport(), DebugNodeWindow(), ShowDemoWindow(), ShowDemoWindowLayout(), ShowDemoWindowMisc(), ShowDemoWindowWidgets(), ShowFont(), ShowMetricsWindow(), and ShowUserGuide().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BulletTextV()

void ImGui::BulletTextV ( const char *  fmt,
va_list  args 
)
385{
386 ImGuiWindow* window = GetCurrentWindow();
387 if (window->SkipItems)
388 return;
389
390 ImGuiContext& g = *GImGui;
391 const ImGuiStyle& style = g.Style;
392
393 const char* text_begin = g.TempBuffer;
394 const char* text_end = text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
395 const ImVec2 label_size = CalcTextSize(text_begin, text_end, false);
396 const ImVec2 total_size = ImVec2(g.FontSize + (label_size.x > 0.0f ? (label_size.x + style.FramePadding.x * 2) : 0.0f), label_size.y); // Empty text doesn't add padding
397 ImVec2 pos = window->DC.CursorPos;
398 pos.y += window->DC.CurrLineTextBaseOffset;
399 ItemSize(total_size, 0.0f);
400 const ImRect bb(pos, pos + total_size);
401 if (!ItemAdd(bb, 0))
402 return;
403
404 // Render
405 ImU32 text_col = GetColorU32(ImGuiCol_Text);
406 RenderBullet(window->DrawList, bb.Min + ImVec2(style.FramePadding.x + g.FontSize * 0.5f, g.FontSize * 0.5f), text_col);
407 RenderText(bb.Min + ImVec2(g.FontSize + style.FramePadding.x * 2, 0.0f), text_begin, text_end, false);
408}
int ImFormatStringV(char *buf, size_t buf_size, const char *fmt, va_list args)
Definition imgui.cpp:1453
IMGUI_API void RenderBullet(ImDrawList *draw_list, ImVec2 pos, ImU32 col)
Definition imgui_draw.cpp:3769

References CalcTextSize(), ImGuiWindowTempData::CurrLineTextBaseOffset, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, ImGuiContext::FontSize, GetColorU32(), GetCurrentWindow(), GImGui, IM_ARRAYSIZE, ImFormatStringV(), ImGuiCol_Text, ItemAdd(), ItemSize(), ImRect::Min, RenderBullet(), RenderText(), ImGuiWindow::SkipItems, ImGuiContext::Style, style, ImGuiContext::TempBuffer, ImVec2::x, and ImVec2::y.

Referenced by BulletText().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Button()

bool ImGui::Button ( const char *  label,
const ImVec2 size = ImVec2(0, 0) 
)
716{
717 return ButtonEx(label, size_arg, ImGuiButtonFlags_None);
718}
IMGUI_API bool ButtonEx(const char *label, const ImVec2 &size_arg=ImVec2(0, 0), ImGuiButtonFlags flags=0)
Definition imgui_widgets.cpp:672

References ButtonEx(), and ImGuiButtonFlags_None.

Referenced by Slic3r::GUI::ImGuiWrapper::button(), Slic3r::GUI::ImGuiWrapper::button(), Slic3r::GUI::ImGuiWrapper::button(), ColorEditOptionsPopup(), MyDocument::DisplayContents(), ExampleAppConsole::Draw(), ExampleAppLog::Draw(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoEmboss::draw_font_list_line(), Slic3r::GUI::GLGizmoEmboss::draw_style_rename_popup(), Slic3r::GUI::GLGizmoEmboss::draw_style_save_as_popup(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), Slic3r::GUI::GLGizmoEmboss::draw_window(), LogButtons(), Slic3r::GUI::GLGizmoCut3D::render_reset_button(), ShowAboutWindow(), ShowDemoWindow(), ShowDemoWindowColumns(), ShowDemoWindowLayout(), ShowDemoWindowMisc(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppConstrainedResize(), ShowExampleAppDocuments(), ShowExampleAppFullscreen(), ShowExampleAppLayout(), ShowExampleAppLongText(), ShowMetricsWindow(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ButtonBehavior()

bool ImGui::ButtonBehavior ( const ImRect bb,
ImGuiID  id,
bool *  out_hovered,
bool *  out_held,
ImGuiButtonFlags  flags = 0 
)
489{
490 ImGuiContext& g = *GImGui;
491 ImGuiWindow* window = GetCurrentWindow();
492
493 if (flags & ImGuiButtonFlags_Disabled)
494 {
495 if (out_hovered) *out_hovered = false;
496 if (out_held) *out_held = false;
497 if (g.ActiveId == id) ClearActiveID();
498 return false;
499 }
500
501 // Default only reacts to left mouse button
502 if ((flags & ImGuiButtonFlags_MouseButtonMask_) == 0)
504
505 // Default behavior requires click + release inside bounding box
506 if ((flags & ImGuiButtonFlags_PressedOnMask_) == 0)
508
509 ImGuiWindow* backup_hovered_window = g.HoveredWindow;
510 const bool flatten_hovered_children = (flags & ImGuiButtonFlags_FlattenChildren) && g.HoveredWindow && g.HoveredWindow->RootWindow == window;
511 if (flatten_hovered_children)
512 g.HoveredWindow = window;
513
514#ifdef IMGUI_ENABLE_TEST_ENGINE
515 if (id != 0 && window->DC.LastItemId != id)
517#endif
518
519 bool pressed = false;
520 bool hovered = ItemHoverable(bb, id);
521
522 // Drag source doesn't report as hovered
524 hovered = false;
525
526 // Special mode for Drag and Drop where holding button pressed for a long time while dragging another item triggers the button
529 {
530 hovered = true;
531 SetHoveredID(id);
532 if (CalcTypematicRepeatAmount(g.HoveredIdTimer + 0.0001f - g.IO.DeltaTime, g.HoveredIdTimer + 0.0001f, DRAGDROP_HOLD_TO_OPEN_TIMER, 0.00f))
533 {
534 pressed = true;
536 FocusWindow(window);
537 }
538 }
539
540 if (flatten_hovered_children)
541 g.HoveredWindow = backup_hovered_window;
542
543 // AllowOverlap mode (rarely used) requires previous frame HoveredId to be null or to match. This allows using patterns where a later submitted widget overlaps a previous one.
544 if (hovered && (flags & ImGuiButtonFlags_AllowItemOverlap) && (g.HoveredIdPreviousFrame != id && g.HoveredIdPreviousFrame != 0))
545 hovered = false;
546
547 // Mouse handling
548 if (hovered)
549 {
550 if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))
551 {
552 // Poll buttons
553 int mouse_button_clicked = -1;
554 int mouse_button_released = -1;
555 if ((flags & ImGuiButtonFlags_MouseButtonLeft) && g.IO.MouseClicked[0]) { mouse_button_clicked = 0; }
556 else if ((flags & ImGuiButtonFlags_MouseButtonRight) && g.IO.MouseClicked[1]) { mouse_button_clicked = 1; }
557 else if ((flags & ImGuiButtonFlags_MouseButtonMiddle) && g.IO.MouseClicked[2]) { mouse_button_clicked = 2; }
558 if ((flags & ImGuiButtonFlags_MouseButtonLeft) && g.IO.MouseReleased[0]) { mouse_button_released = 0; }
559 else if ((flags & ImGuiButtonFlags_MouseButtonRight) && g.IO.MouseReleased[1]) { mouse_button_released = 1; }
560 else if ((flags & ImGuiButtonFlags_MouseButtonMiddle) && g.IO.MouseReleased[2]) { mouse_button_released = 2; }
561
562 if (mouse_button_clicked != -1 && g.ActiveId != id)
563 {
565 {
566 SetActiveID(id, window);
567 g.ActiveIdMouseButton = mouse_button_clicked;
568 if (!(flags & ImGuiButtonFlags_NoNavFocus))
569 SetFocusID(id, window);
570 FocusWindow(window);
571 }
572 if ((flags & ImGuiButtonFlags_PressedOnClick) || ((flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDoubleClicked[mouse_button_clicked]))
573 {
574 pressed = true;
577 else
578 SetActiveID(id, window); // Hold on ID
579 g.ActiveIdMouseButton = mouse_button_clicked;
580 FocusWindow(window);
581 }
582 }
583 if ((flags & ImGuiButtonFlags_PressedOnRelease) && mouse_button_released != -1)
584 {
585 // Repeat mode trumps on release behavior
586 const bool has_repeated_at_least_once = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay;
587 if (!has_repeated_at_least_once)
588 pressed = true;
590 }
591
592 // 'Repeat' mode acts when held regardless of _PressedOn flags (see table above).
593 // Relies on repeat logic of IsMouseClicked() but we may as well do it ourselves if we end up exposing finer RepeatDelay/RepeatRate settings.
594 if (g.ActiveId == id && (flags & ImGuiButtonFlags_Repeat))
596 pressed = true;
597 }
598
599 if (pressed)
600 g.NavDisableHighlight = true;
601 }
602
603 // Gamepad/Keyboard navigation
604 // We report navigated item as hovered but we don't set g.HoveredId to not interfere with mouse.
605 if (g.NavId == id && !g.NavDisableHighlight && g.NavDisableMouseHover && (g.ActiveId == 0 || g.ActiveId == id || g.ActiveId == window->MoveId))
607 hovered = true;
608 if (g.NavActivateDownId == id)
609 {
610 bool nav_activated_by_code = (g.NavActivateId == id);
612 if (nav_activated_by_code || nav_activated_by_inputs)
613 pressed = true;
614 if (nav_activated_by_code || nav_activated_by_inputs || g.ActiveId == id)
615 {
616 // Set active id so it can be queried by user via IsItemActive(), equivalent of holding the mouse button.
617 g.NavActivateId = id; // This is so SetActiveId assign a Nav source
618 SetActiveID(id, window);
619 if ((nav_activated_by_code || nav_activated_by_inputs) && !(flags & ImGuiButtonFlags_NoNavFocus))
620 SetFocusID(id, window);
621 }
622 }
623
624 // Process while held
625 bool held = false;
626 if (g.ActiveId == id)
627 {
629 {
632
633 const int mouse_button = g.ActiveIdMouseButton;
634 IM_ASSERT(mouse_button >= 0 && mouse_button < ImGuiMouseButton_COUNT);
635 if (g.IO.MouseDown[mouse_button])
636 {
637 held = true;
638 }
639 else
640 {
641 bool release_in = hovered && (flags & ImGuiButtonFlags_PressedOnClickRelease) != 0;
642 bool release_anywhere = (flags & ImGuiButtonFlags_PressedOnClickReleaseAnywhere) != 0;
643 if ((release_in || release_anywhere) && !g.DragDropActive)
644 {
645 // Report as pressed when releasing the mouse (this is the most common path)
646 bool is_double_click_release = (flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDownWasDoubleClick[mouse_button];
647 bool is_repeating_already = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button] >= g.IO.KeyRepeatDelay; // Repeat mode trumps <on release>
648 if (!is_double_click_release && !is_repeating_already)
649 pressed = true;
650 }
652 }
653 if (!(flags & ImGuiButtonFlags_NoNavFocus))
654 g.NavDisableHighlight = true;
655 }
657 {
658 // When activated using Nav, we hold on the ActiveID until activation button is released
659 if (g.NavActivateDownId != id)
661 }
662 if (pressed)
664 }
665
666 if (out_hovered) *out_hovered = hovered;
667 if (out_held) *out_held = held;
668
669 return pressed;
670}
@ ImGuiDragDropFlags_SourceNoHoldToOpenOthers
Definition imgui.h:1261
@ ImGuiHoveredFlags_AllowWhenBlockedByActiveItem
Definition imgui.h:1247
@ ImGuiNavInput_Activate
Definition imgui.h:1356
@ ImGuiButtonFlags_MouseButtonRight
Definition imgui.h:1511
@ ImGuiButtonFlags_MouseButtonDefault_
Definition imgui.h:1516
@ ImGuiButtonFlags_MouseButtonMask_
Definition imgui.h:1515
@ ImGuiButtonFlags_MouseButtonLeft
Definition imgui.h:1510
@ ImGuiButtonFlags_MouseButtonMiddle
Definition imgui.h:1512
@ ImGuiMouseButton_COUNT
Definition imgui.h:1589
@ ImGuiButtonFlags_PressedOnMask_
Definition imgui_internal.h:794
@ ImGuiButtonFlags_FlattenChildren
Definition imgui_internal.h:785
@ ImGuiButtonFlags_NoHoveredOnFocus
Definition imgui_internal.h:793
@ ImGuiButtonFlags_NoKeyModifiers
Definition imgui_internal.h:790
@ ImGuiButtonFlags_PressedOnDoubleClick
Definition imgui_internal.h:782
@ ImGuiButtonFlags_NoHoldingActiveId
Definition imgui_internal.h:791
@ ImGuiButtonFlags_PressedOnDefault_
Definition imgui_internal.h:795
@ ImGuiButtonFlags_PressedOnClickRelease
Definition imgui_internal.h:779
@ ImGuiButtonFlags_NoNavFocus
Definition imgui_internal.h:792
@ ImGuiButtonFlags_PressedOnDragDropHold
Definition imgui_internal.h:783
@ ImGuiButtonFlags_PressedOnClickReleaseAnywhere
Definition imgui_internal.h:780
@ ImGuiButtonFlags_PressedOnRelease
Definition imgui_internal.h:781
@ ImGuiButtonFlags_Disabled
Definition imgui_internal.h:788
@ ImGuiButtonFlags_AllowItemOverlap
Definition imgui_internal.h:786
@ ImGuiButtonFlags_PressedOnClick
Definition imgui_internal.h:778
@ ImGuiInputReadMode_Pressed
Definition imgui_internal.h:890
@ ImGuiInputReadMode_Repeat
Definition imgui_internal.h:892
@ ImGuiInputSource_Mouse
Definition imgui_internal.h:878
static const float DRAGDROP_HOLD_TO_OPEN_TIMER
Definition imgui_widgets.cpp:94
IMGUI_API void ClearActiveID()
Definition imgui.cpp:3084
IMGUI_API bool IsMouseClicked(ImGuiMouseButton button, bool repeat=false)
Definition imgui.cpp:4700
IMGUI_API void SetFocusID(ImGuiID id, ImGuiWindow *window)
Definition imgui.cpp:8594
bool IsNavInputTest(ImGuiNavInput n, ImGuiInputReadMode rm)
Definition imgui_internal.h:2430
float HoveredIdTimer
Definition imgui_internal.h:1396
ImGuiID NavActivateDownId
Definition imgui_internal.h:1444
bool NavDisableHighlight
Definition imgui_internal.h:1459
ImVec2 ActiveIdClickOffset
Definition imgui_internal.h:1411
ImGuiID DragDropHoldJustPressedId
Definition imgui_internal.h:1514
bool ActiveIdHasBeenPressedBefore
Definition imgui_internal.h:1404
bool ActiveIdIsJustActivated
Definition imgui_internal.h:1401
bool NavDisableMouseHover
Definition imgui_internal.h:1460
bool KeyAlt
Definition imgui.h:1843
float KeyRepeatDelay
Definition imgui.h:1791
bool MouseReleased[5]
Definition imgui.h:1885
bool KeyShift
Definition imgui.h:1842
float DeltaTime
Definition imgui.h:1783
bool KeyCtrl
Definition imgui.h:1841
float MouseDownDurationPrev[5]
Definition imgui.h:1889
bool MouseDownWasDoubleClick[5]
Definition imgui.h:1887
float MouseDownDuration[5]
Definition imgui.h:1888

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdClickOffset, ImGuiContext::ActiveIdHasBeenPressedBefore, ImGuiContext::ActiveIdIsJustActivated, ImGuiContext::ActiveIdMouseButton, ImGuiContext::ActiveIdSource, CalcTypematicRepeatAmount(), ClearActiveID(), ImGuiWindow::DC, ImGuiIO::DeltaTime, DRAGDROP_HOLD_TO_OPEN_TIMER, ImGuiContext::DragDropActive, ImGuiContext::DragDropHoldJustPressedId, ImGuiContext::DragDropPayload, ImGuiContext::DragDropSourceFlags, FocusWindow(), GetCurrentWindow(), GImGui, ImGuiContext::HoveredIdPreviousFrame, ImGuiContext::HoveredIdTimer, ImGuiContext::HoveredWindow, IM_ASSERT, IMGUI_TEST_ENGINE_ITEM_ADD, ImGuiButtonFlags_AllowItemOverlap, ImGuiButtonFlags_Disabled, ImGuiButtonFlags_FlattenChildren, ImGuiButtonFlags_MouseButtonDefault_, ImGuiButtonFlags_MouseButtonLeft, ImGuiButtonFlags_MouseButtonMask_, ImGuiButtonFlags_MouseButtonMiddle, ImGuiButtonFlags_MouseButtonRight, ImGuiButtonFlags_NoHoldingActiveId, ImGuiButtonFlags_NoHoveredOnFocus, ImGuiButtonFlags_NoKeyModifiers, ImGuiButtonFlags_NoNavFocus, ImGuiButtonFlags_PressedOnClick, ImGuiButtonFlags_PressedOnClickRelease, ImGuiButtonFlags_PressedOnClickReleaseAnywhere, ImGuiButtonFlags_PressedOnDefault_, ImGuiButtonFlags_PressedOnDoubleClick, ImGuiButtonFlags_PressedOnDragDropHold, ImGuiButtonFlags_PressedOnMask_, ImGuiButtonFlags_PressedOnRelease, ImGuiButtonFlags_Repeat, ImGuiDragDropFlags_SourceNoDisableHover, ImGuiDragDropFlags_SourceNoHoldToOpenOthers, ImGuiHoveredFlags_AllowWhenBlockedByActiveItem, ImGuiInputReadMode_Pressed, ImGuiInputReadMode_Repeat, ImGuiInputSource_Mouse, ImGuiInputSource_Nav, ImGuiMouseButton_COUNT, ImGuiNavInput_Activate, ImGuiContext::IO, IsItemHovered(), IsMouseClicked(), IsNavInputTest(), ItemHoverable(), ImGuiIO::KeyAlt, ImGuiIO::KeyCtrl, ImGuiIO::KeyRepeatDelay, ImGuiIO::KeyShift, ImGuiWindowTempData::LastItemId, ImRect::Min, ImGuiIO::MouseClicked, ImGuiIO::MouseDoubleClicked, ImGuiIO::MouseDown, ImGuiIO::MouseDownDuration, ImGuiIO::MouseDownDurationPrev, ImGuiIO::MouseDownWasDoubleClick, ImGuiIO::MousePos, ImGuiIO::MouseReleased, ImGuiWindow::MoveId, ImGuiContext::NavActivateDownId, ImGuiContext::NavActivateId, ImGuiContext::NavDisableHighlight, ImGuiContext::NavDisableMouseHover, ImGuiContext::NavId, ImGuiWindow::RootWindow, SetActiveID(), SetFocusID(), SetHoveredID(), and ImGuiPayload::SourceId.

Referenced by ArrowButtonEx(), BeginCombo(), ButtonEx(), Checkbox(), CloseButton(), CollapseButton(), ColorButton(), Slic3r::GUI::ImGuiWrapper::draw_radio_button(), EndColumns(), Slic3r::GUI::image_button_ex(), ImageButtonEx(), InvisibleButton(), RadioButton(), ScrollbarEx(), Slic3r::GUI::selectable(), Selectable(), SplitterBehavior(), TabItemEx(), TableHeader(), TableUpdateBorders(), TreeNodeBehavior(), and UpdateWindowManualResize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ButtonEx()

bool ImGui::ButtonEx ( const char *  label,
const ImVec2 size_arg = ImVec2(0, 0),
ImGuiButtonFlags  flags = 0 
)
673{
674 ImGuiWindow* window = GetCurrentWindow();
675 if (window->SkipItems)
676 return false;
677
678 ImGuiContext& g = *GImGui;
679 const ImGuiStyle& style = g.Style;
680 const ImGuiID id = window->GetID(label);
681 const ImVec2 label_size = CalcTextSize(label, NULL, true);
682
683 ImVec2 pos = window->DC.CursorPos;
684 if ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrLineTextBaseOffset) // Try to vertically align buttons that are smaller/have no padding so that text baseline matches (bit hacky, since it shouldn't be a flag)
685 pos.y += window->DC.CurrLineTextBaseOffset - style.FramePadding.y;
686 ImVec2 size = CalcItemSize(size_arg, label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f);
687
688 const ImRect bb(pos, pos + size);
689 ItemSize(size, style.FramePadding.y);
690 if (!ItemAdd(bb, id))
691 return false;
692
695 bool hovered, held;
696 bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
697
698 // Render
699 const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
700 RenderNavHighlight(bb, id);
701 RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
702
703 if (g.LogEnabled)
704 LogSetNextTextDecoration("[", "]");
705 RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb);
706
707 // Automatically close popups
708 //if (pressed && !(flags & ImGuiButtonFlags_DontClosePopups) && (window->Flags & ImGuiWindowFlags_Popup))
709 // CloseCurrentPopup();
710
712 return pressed;
713}
@ ImGuiButtonFlags_AlignTextBaseLine
Definition imgui_internal.h:789
IMGUI_API void LogSetNextTextDecoration(const char *prefix, const char *suffix)
Definition imgui.cpp:10188
IMGUI_API void RenderTextClipped(const ImVec2 &pos_min, const ImVec2 &pos_max, const char *text, const char *text_end, const ImVec2 *text_size_if_known, const ImVec2 &align=ImVec2(0, 0), const ImRect *clip_rect=NULL)
Definition imgui.cpp:2737

References ButtonBehavior(), CalcItemSize(), CalcTextSize(), col(), ImGuiContext::CurrentItemFlags, ImGuiWindowTempData::CurrLineTextBaseOffset, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetColorU32(), GetCurrentWindow(), ImGuiWindow::GetID(), GImGui, IMGUI_TEST_ENGINE_ITEM_INFO, ImGuiButtonFlags_AlignTextBaseLine, ImGuiButtonFlags_Repeat, ImGuiCol_Button, ImGuiCol_ButtonActive, ImGuiCol_ButtonHovered, ImGuiItemFlags_ButtonRepeat, ItemAdd(), ItemSize(), ImGuiWindowTempData::LastItemStatusFlags, ImGuiContext::LogEnabled, LogSetNextTextDecoration(), ImRect::Max, ImRect::Min, RenderFrame(), RenderNavHighlight(), RenderTextClipped(), ImGuiWindow::SkipItems, ImGuiContext::Style, style, ImVec2::x, and ImVec2::y.

Referenced by Button(), InputScalar(), and SmallButton().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalcItemSize()

ImVec2 ImGui::CalcItemSize ( ImVec2  size,
float  default_w,
float  default_h 
)
7619{
7620 ImGuiWindow* window = GImGui->CurrentWindow;
7621
7622 ImVec2 region_max;
7623 if (size.x < 0.0f || size.y < 0.0f)
7624 region_max = GetContentRegionMaxAbs();
7625
7626 if (size.x == 0.0f)
7627 size.x = default_w;
7628 else if (size.x < 0.0f)
7629 size.x = ImMax(4.0f, region_max.x - window->DC.CursorPos.x + size.x);
7630
7631 if (size.y == 0.0f)
7632 size.y = default_h;
7633 else if (size.y < 0.0f)
7634 size.y = ImMax(4.0f, region_max.y - window->DC.CursorPos.y + size.y);
7635
7636 return size;
7637}
IMGUI_API ImVec2 GetContentRegionMaxAbs()
Definition imgui.cpp:7677

References ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetContentRegionMaxAbs(), GImGui, ImMax(), ImVec2::x, and ImVec2::y.

Referenced by BeginListBox(), BeginTableEx(), ButtonEx(), Slic3r::GUI::ImGuiWrapper::calc_button_size(), InputTextEx(), InvisibleButton(), ProgressBar(), and Slic3r::GUI::ImGuiWrapper::search_list().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalcItemWidth()

float ImGui::CalcItemWidth ( )
7597{
7598 ImGuiContext& g = *GImGui;
7599 ImGuiWindow* window = g.CurrentWindow;
7600 float w;
7602 w = g.NextItemData.Width;
7603 else
7604 w = window->DC.ItemWidth;
7605 if (w < 0.0f)
7606 {
7607 float region_max_x = GetContentRegionMaxAbs().x;
7608 w = ImMax(1.0f, region_max_x - window->DC.CursorPos.x + w);
7609 }
7610 w = IM_FLOOR(w);
7611 return w;
7612}
@ ImGuiNextItemDataFlags_HasWidth
Definition imgui_internal.h:1118
ImGuiNextItemDataFlags Flags
Definition imgui_internal.h:1124
float Width
Definition imgui_internal.h:1125

References ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiNextItemData::Flags, GetContentRegionMaxAbs(), GImGui, IM_FLOOR, ImGuiNextItemDataFlags_HasWidth, ImMax(), ImGuiWindowTempData::ItemWidth, ImGuiContext::NextItemData, ImGuiNextItemData::Width, and ImVec2::x.

Referenced by BeginCombo(), BeginListBox(), ColorEdit4(), ColorPicker4(), DragFloatRange2(), DragIntRange2(), DragScalar(), DragScalarN(), InputScalar(), InputScalarN(), InputTextEx(), LabelTextV(), PlotEx(), ProgressBar(), Slic3r::GUI::ImGuiWrapper::search_list(), ShowExampleAppCustomRendering(), SliderScalar(), and SliderScalarN().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalcListClipping()

void ImGui::CalcListClipping ( int  items_count,
float  items_height,
int *  out_items_display_start,
int *  out_items_display_end 
)
2208{
2209 ImGuiContext& g = *GImGui;
2210 ImGuiWindow* window = g.CurrentWindow;
2211 if (g.LogEnabled)
2212 {
2213 // If logging is active, do not perform any clipping
2214 *out_items_display_start = 0;
2215 *out_items_display_end = items_count;
2216 return;
2217 }
2219 {
2220 *out_items_display_start = *out_items_display_end = 0;
2221 return;
2222 }
2223
2224 // We create the union of the ClipRect and the NavScoringRect which at worst should be 1 page away from ClipRect
2225 ImRect unclipped_rect = window->ClipRect;
2226 if (g.NavMoveRequest)
2227 unclipped_rect.Add(g.NavScoringRect);
2228 if (g.NavJustMovedToId && window->NavLastIds[0] == g.NavJustMovedToId)
2229 unclipped_rect.Add(ImRect(window->Pos + window->NavRectRel[0].Min, window->Pos + window->NavRectRel[0].Max));
2230
2231 const ImVec2 pos = window->DC.CursorPos;
2232 int start = (int)((unclipped_rect.Min.y - pos.y) / items_height);
2233 int end = (int)((unclipped_rect.Max.y - pos.y) / items_height);
2234
2235 // When performing a navigation request, ensure we have one item extra in the direction we are moving to
2237 start--;
2239 end++;
2240
2241 start = ImClamp(start, 0, items_count);
2242 end = ImClamp(end + 1, start, items_count);
2243 *out_items_display_start = start;
2244 *out_items_display_end = end;
2245}
static bool GetSkipItemForListClipping()
Definition imgui.cpp:2198
S::iterator end(S &sh, const PathTag &)
Definition geometry_traits.hpp:620
ImGuiID NavJustMovedToId
Definition imgui_internal.h:1448
ImRect NavScoringRect
Definition imgui_internal.h:1453
ImGuiDir NavMoveClipDir
Definition imgui_internal.h:1471
ImRect NavRectRel[ImGuiNavLayer_COUNT]
Definition imgui_internal.h:1892
void Add(const ImVec2 &p)
Definition imgui_internal.h:492

References ImRect::Add(), ImGuiWindow::ClipRect, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetSkipItemForListClipping(), GImGui, ImClamp(), ImGuiDir_Down, ImGuiDir_Up, ImGuiContext::LogEnabled, ImRect::Max, ImRect::Min, ImGuiContext::NavJustMovedToId, ImGuiWindow::NavLastIds, ImGuiContext::NavMoveClipDir, ImGuiContext::NavMoveRequest, ImGuiWindow::NavRectRel, ImGuiContext::NavScoringRect, ImGuiWindow::Pos, and ImVec2::y.

Referenced by ImGuiListClipper::Step().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalcTextSize()

ImVec2 ImGui::CalcTextSize ( const char *  text,
const char *  text_end = NULL,
bool  hide_text_after_double_hash = false,
float  wrap_width = -1.0f 
)
4525{
4526 ImGuiContext& g = *GImGui;
4527
4528 const char* text_display_end;
4529 if (hide_text_after_double_hash)
4530 text_display_end = FindRenderedTextEnd(text, text_end); // Hide anything after a '##' string
4531 else
4532 text_display_end = text_end;
4533
4534 ImFont* font = g.Font;
4535 const float font_size = g.FontSize;
4536 if (text == text_display_end)
4537 return ImVec2(0.0f, font_size);
4538 ImVec2 text_size = font->CalcTextSizeA(font_size, FLT_MAX, wrap_width, text, text_display_end, NULL);
4539
4540 // Round
4541 // FIXME: This has been here since Dec 2015 (7b0bf230) but down the line we want this out.
4542 // FIXME: Investigate using ceilf or e.g.
4543 // - https://git.musl-libc.org/cgit/musl/tree/src/math/ceilf.c
4544 // - https://embarkstudios.github.io/rust-gpu/api/src/libm/math/ceilf.rs.html
4545 text_size.x = IM_FLOOR(text_size.x + 0.99999f);
4546
4547 return text_size;
4548}
IMGUI_API const char * FindRenderedTextEnd(const char *text, const char *text_end=NULL)
Definition imgui.cpp:2652
Definition imgui.h:2690
IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char *text_begin, const char *text_end=NULL, const char **remaining=NULL) const
Definition imgui_draw.cpp:3402

References ImFont::CalcTextSizeA(), FindRenderedTextEnd(), ImGuiContext::Font, ImGuiContext::FontSize, GImGui, IM_FLOOR, and ImVec2::x.

Referenced by Slic3r::GUI::GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(), BeginCombo(), BeginListBox(), BeginMenu(), BulletTextV(), ButtonEx(), Slic3r::GUI::ImGuiWrapper::calc_text_size(), Slic3r::GUI::ImGuiWrapper::calc_text_size(), Slic3r::GUI::ImGuiWrapper::calc_text_size(), Checkbox(), ColorEdit4(), Slic3r::GUI::NotificationManager::PopNotification::count_lines(), Slic3r::GUI::NotificationManager::HintNotification::count_lines(), Slic3r::GUI::NotificationManager::PopNotification::count_spaces(), Slic3r::GUI::NotificationManager::HintNotification::count_spaces(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::count_spaces(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::count_spaces(), Slic3r::GUI::NotificationManager::UpdatedItemsInfoNotification::count_spaces(), Slic3r::GUI::GLGizmoEmboss::create_gui_configuration(), DragScalar(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::generate_text(), InputTextEx(), LabelTextV(), MenuItem(), NavScoreItem(), PlotEx(), ProgressBar(), RadioButton(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::NotificationManager::PopNotification::render(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_bar(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressBarWithCancelNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::PopNotification::render_close_button(), Slic3r::GUI::NotificationManager::HintNotification::render_close_button(), Slic3r::GUI::NotificationManager::ProgressBarWithCancelNotification::render_close_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_close_button_inner(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::NotificationManager::HintNotification::render_documentation_button(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_eject_button(), Slic3r::GUI::NotificationManager::PopNotification::render_hypertext(), Slic3r::GUI::GCodeViewer::render_legend(), Slic3r::GUI::NotificationManager::HintNotification::render_logo(), Slic3r::GUI::NotificationManager::PopNotification::render_minimize_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_open_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_pause_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_preferences_button(), Slic3r::GUI::NotificationManager::HintNotification::render_right_arrow_button(), Slic3r::GUI::NotificationManager::PopNotification::render_text(), Slic3r::GUI::NotificationManager::HintNotification::render_text(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_text(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_text(), RenderTextClippedEx(), RenderTextEllipsis(), RenderWindowTitleBarContents(), Slic3r::GUI::selectable(), Selectable(), ShowDemoWindowTables(), ShowStyleEditor(), SliderScalar(), TabItemCalcSize(), TabItemLabelAndCloseButton(), TableGetHeaderRowHeight(), TableHeader(), TableMergeDrawChannels(), TextEx(), TreeNodeBehavior(), Slic3r::GUI::ImGuiWrapper::trunc(), and VSliderScalar().

+ Here is the call graph for this function:

◆ CalcTypematicRepeatAmount()

int ImGui::CalcTypematicRepeatAmount ( float  t0,
float  t1,
float  repeat_delay,
float  repeat_rate 
)
4648{
4649 if (t1 == 0.0f)
4650 return 1;
4651 if (t0 >= t1)
4652 return 0;
4653 if (repeat_rate <= 0.0f)
4654 return (t0 < repeat_delay) && (t1 >= repeat_delay);
4655 const int count_t0 = (t0 < repeat_delay) ? -1 : (int)((t0 - repeat_delay) / repeat_rate);
4656 const int count_t1 = (t1 < repeat_delay) ? -1 : (int)((t1 - repeat_delay) / repeat_rate);
4657 const int count = count_t1 - count_t0;
4658 return count;
4659}

Referenced by ButtonBehavior(), GetKeyPressedAmount(), GetNavInputAmount(), and IsMouseClicked().

+ Here is the caller graph for this function:

◆ CalcWindowNextAutoFitSize()

ImVec2 ImGui::CalcWindowNextAutoFitSize ( ImGuiWindow window)
5270{
5271 ImVec2 size_contents_current;
5272 ImVec2 size_contents_ideal;
5273 CalcWindowContentSizes(window, &size_contents_current, &size_contents_ideal);
5274 ImVec2 size_auto_fit = CalcWindowAutoFitSize(window, size_contents_ideal);
5275 ImVec2 size_final = CalcWindowSizeAfterConstraint(window, size_auto_fit);
5276 return size_final;
5277}

References CalcWindowAutoFitSize(), CalcWindowContentSizes(), and CalcWindowSizeAfterConstraint().

Referenced by BeginCombo(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GLCanvas3D::Tooltip::render(), and Slic3r::GUI::GCodeViewer::render_legend().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalcWrapWidthForPos()

float ImGui::CalcWrapWidthForPos ( const ImVec2 pos,
float  wrap_pos_x 
)
3301{
3302 if (wrap_pos_x < 0.0f)
3303 return 0.0f;
3304
3305 ImGuiContext& g = *GImGui;
3306 ImGuiWindow* window = g.CurrentWindow;
3307 if (wrap_pos_x == 0.0f)
3308 {
3309 // We could decide to setup a default wrapping max point for auto-resizing windows,
3310 // or have auto-wrap (with unspecified wrapping pos) behave as a ContentSize extending function?
3311 //if (window->Hidden && (window->Flags & ImGuiWindowFlags_AlwaysAutoResize))
3312 // wrap_pos_x = ImMax(window->WorkRect.Min.x + g.FontSize * 10.0f, window->WorkRect.Max.x);
3313 //else
3314 wrap_pos_x = window->WorkRect.Max.x;
3315 }
3316 else if (wrap_pos_x > 0.0f)
3317 {
3318 wrap_pos_x += window->Pos.x - window->Scroll.x; // wrap_pos_x is provided is window local space
3319 }
3320
3321 return ImMax(wrap_pos_x - pos.x, 1.0f);
3322}

References ImGuiContext::CurrentWindow, GImGui, ImMax(), ImRect::Max, ImGuiWindow::Pos, ImGuiWindow::Scroll, ImGuiWindow::WorkRect, and ImVec2::x.

Referenced by TextEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CallContextHooks()

void ImGui::CallContextHooks ( ImGuiContext context,
ImGuiContextHookType  type 
)
3432{
3433 ImGuiContext& g = *ctx;
3434 for (int n = 0; n < g.Hooks.Size; n++)
3435 if (g.Hooks[n].Type == hook_type)
3436 g.Hooks[n].Callback(&g, &g.Hooks[n]);
3437}

References ImGuiContext::Hooks, and ImVector< T >::Size.

Referenced by EndFrame(), NewFrame(), Render(), and Shutdown().

+ Here is the caller graph for this function:

◆ CaptureKeyboardFromApp()

void ImGui::CaptureKeyboardFromApp ( bool  want_capture_keyboard_value = true)
4822{
4823 GImGui->WantCaptureKeyboardNextFrame = capture ? 1 : 0;
4824}
int WantCaptureKeyboardNextFrame
Definition imgui_internal.h:1592

References GImGui, and ImGuiContext::WantCaptureKeyboardNextFrame.

Referenced by ShowDemoWindowMisc().

+ Here is the caller graph for this function:

◆ CaptureMouseFromApp()

void ImGui::CaptureMouseFromApp ( bool  want_capture_mouse_value = true)
4827{
4828 GImGui->WantCaptureMouseNextFrame = capture ? 1 : 0;
4829}
int WantCaptureMouseNextFrame
Definition imgui_internal.h:1591

References GImGui, and ImGuiContext::WantCaptureMouseNextFrame.

◆ Checkbox()

bool ImGui::Checkbox ( const char *  label,
bool *  v 
)
1072{
1073 ImGuiWindow* window = GetCurrentWindow();
1074 if (window->SkipItems)
1075 return false;
1076
1077 ImGuiContext& g = *GImGui;
1078 const ImGuiStyle& style = g.Style;
1079 const ImGuiID id = window->GetID(label);
1080 const ImVec2 label_size = CalcTextSize(label, NULL, true);
1081
1082 const float square_sz = GetFrameHeight();
1083 const ImVec2 pos = window->DC.CursorPos;
1084 const ImRect total_bb(pos, pos + ImVec2(square_sz + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), label_size.y + style.FramePadding.y * 2.0f));
1085 ItemSize(total_bb, style.FramePadding.y);
1086 if (!ItemAdd(total_bb, id))
1087 {
1088 IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.LastItemStatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
1089 return false;
1090 }
1091
1092 bool hovered, held;
1093 bool pressed = ButtonBehavior(total_bb, id, &hovered, &held);
1094 if (pressed)
1095 {
1096 *v = !(*v);
1097 MarkItemEdited(id);
1098 }
1099
1100 const ImRect check_bb(pos, pos + ImVec2(square_sz, square_sz));
1101 RenderNavHighlight(total_bb, id);
1102 RenderFrame(check_bb.Min, check_bb.Max, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding);
1104 bool mixed_value = (g.CurrentItemFlags & ImGuiItemFlags_MixedValue) != 0;
1105 if (mixed_value)
1106 {
1107 // Undocumented tristate/mixed/indeterminate checkbox (#2644)
1108 // This may seem awkwardly designed because the aim is to make ImGuiItemFlags_MixedValue supported by all widgets (not just checkbox)
1109 ImVec2 pad(ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)), ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)));
1110 window->DrawList->AddRectFilled(check_bb.Min + pad, check_bb.Max - pad, check_col, style.FrameRounding);
1111 }
1112 else if (*v)
1113 {
1114 const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f));
1115 RenderCheckMark(window->DrawList, check_bb.Min + ImVec2(pad, pad), check_col, square_sz - pad * 2.0f);
1116 }
1117
1118 ImVec2 label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y);
1119 if (g.LogEnabled)
1120 LogRenderedText(&label_pos, mixed_value ? "[~]" : *v ? "[x]" : "[ ]");
1121 if (label_size.x > 0.0f)
1122 RenderText(label_pos, label);
1123
1124 IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.LastItemStatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
1125 return pressed;
1126}
@ ImGuiCol_FrameBgActive
Definition imgui.h:1422
@ ImGuiCol_CheckMark
Definition imgui.h:1431
@ ImGuiItemFlags_MixedValue
Definition imgui_internal.h:729
IMGUI_API void RenderCheckMark(ImDrawList *draw_list, ImVec2 pos, ImU32 col, float sz)
Definition imgui_draw.cpp:3774
IMGUI_API void LogRenderedText(const ImVec2 *ref_pos, const char *text, const char *text_end=NULL)
Definition imgui.cpp:10112

References ImDrawList::AddRectFilled(), ButtonBehavior(), CalcTextSize(), ImGuiContext::CurrentItemFlags, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, GetColorU32(), GetCurrentWindow(), GetFrameHeight(), ImGuiWindow::GetID(), GImGui, IM_FLOOR, IMGUI_TEST_ENGINE_ITEM_INFO, ImGuiCol_CheckMark, ImGuiCol_FrameBg, ImGuiCol_FrameBgActive, ImGuiCol_FrameBgHovered, ImGuiItemFlags_MixedValue, ImMax(), ItemAdd(), ItemSize(), ImGuiWindowTempData::LastItemStatusFlags, ImGuiContext::LogEnabled, LogRenderedText(), MarkItemEdited(), ImRect::Max, ImRect::Min, RenderCheckMark(), RenderFrame(), RenderNavHighlight(), RenderText(), ImGuiWindow::SkipItems, ImGuiContext::Style, style, ImVec2::x, and ImVec2::y.

Referenced by Slic3r::GUI::ImGuiWrapper::checkbox(), ExampleAppConsole::Draw(), ExampleAppLog::Draw(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), Slic3r::GUI::GLGizmoEmboss::draw_window(), Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), Slic3r::GUI::GLGizmoEmboss::rev_checkbox(), ShowAboutWindow(), ShowDemoWindow(), ShowDemoWindowColumns(), ShowDemoWindowLayout(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppConstrainedResize(), ShowExampleAppCustomRendering(), ShowExampleAppDocuments(), ShowExampleAppFullscreen(), ShowExampleMenuFile(), ShowMetricsWindow(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckboxFlags() [1/4]

bool ImGui::CheckboxFlags ( const char *  label,
ImS64 flags,
ImS64  flags_value 
)
1168{
1169 return CheckboxFlagsT(label, flags, flags_value);
1170}
IMGUI_API bool CheckboxFlagsT(const char *label, T *flags, T flags_value)

References CheckboxFlagsT().

+ Here is the call graph for this function:

◆ CheckboxFlags() [2/4]

bool ImGui::CheckboxFlags ( const char *  label,
ImU64 flags,
ImU64  flags_value 
)
1173{
1174 return CheckboxFlagsT(label, flags, flags_value);
1175}

References CheckboxFlagsT().

+ Here is the call graph for this function:

◆ CheckboxFlags() [3/4]

bool ImGui::CheckboxFlags ( const char *  label,
int *  flags,
int  flags_value 
)
1158{
1159 return CheckboxFlagsT(label, flags, flags_value);
1160}

References CheckboxFlagsT().

Referenced by ColorPickerOptionsPopup(), EditTableColumnsFlags(), ShowDemoWindow(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppFullscreen(), and ShowTableColumnsStatusFlags().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckboxFlags() [4/4]

bool ImGui::CheckboxFlags ( const char *  label,
unsigned int *  flags,
unsigned int  flags_value 
)
1163{
1164 return CheckboxFlagsT(label, flags, flags_value);
1165}

References CheckboxFlagsT().

+ Here is the call graph for this function:

◆ CheckboxFlagsT()

template<typename T >
IMGUI_API bool ImGui::CheckboxFlagsT ( const char *  label,
T *  flags,
flags_value 
)

Referenced by CheckboxFlags(), CheckboxFlags(), CheckboxFlags(), and CheckboxFlags().

+ Here is the caller graph for this function:

◆ ClearActiveID()

void ImGui::ClearActiveID ( )
3085{
3086 SetActiveID(0, NULL); // g.ActiveId = 0;
3087}

References SetActiveID().

Referenced by ButtonBehavior(), DragBehavior(), FocusWindow(), InputTextEx(), ItemFocusable(), Slic3r::GUI::ImGuiWrapper::left_inputs(), NavUpdate(), NavUpdateMoveResult(), NavUpdateWindowing(), NewFrame(), Slic3r::GUI::ImGuiWrapper::slider_float(), TableUpdateBorders(), TempInputText(), UpdateMouseMovingWindowNewFrame(), and UpdateWindowManualResize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearDragDrop()

void ImGui::ClearDragDrop ( )
9755{
9756 ImGuiContext& g = *GImGui;
9757 g.DragDropActive = false;
9763
9765 memset(&g.DragDropPayloadBufLocal, 0, sizeof(g.DragDropPayloadBufLocal));
9766}
@ ImGuiDragDropFlags_None
Definition imgui.h:1257
unsigned char DragDropPayloadBufLocal[16]
Definition imgui_internal.h:1516
ImVector< unsigned char > DragDropPayloadBufHeap
Definition imgui_internal.h:1515
void Clear()
Definition imgui.h:1971
void clear()
Definition imgui.h:1678

References ImVector< T >::clear(), ImGuiPayload::Clear(), ImGuiContext::DragDropAcceptFlags, ImGuiContext::DragDropAcceptFrameCount, ImGuiContext::DragDropAcceptIdCurr, ImGuiContext::DragDropAcceptIdCurrRectSurface, ImGuiContext::DragDropAcceptIdPrev, ImGuiContext::DragDropActive, ImGuiContext::DragDropPayload, ImGuiContext::DragDropPayloadBufHeap, ImGuiContext::DragDropPayloadBufLocal, GImGui, and ImGuiDragDropFlags_None.

Referenced by BeginDragDropSource(), EndDragDropSource(), and EndFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearIniSettings()

void ImGui::ClearIniSettings ( )
10422{
10423 ImGuiContext& g = *GImGui;
10425 for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++)
10426 if (g.SettingsHandlers[handler_n].ClearAllFn)
10427 g.SettingsHandlers[handler_n].ClearAllFn(&g, &g.SettingsHandlers[handler_n]);
10428}
ImGuiTextBuffer SettingsIniData
Definition imgui_internal.h:1561
ImVector< ImGuiSettingsHandler > SettingsHandlers
Definition imgui_internal.h:1562
void clear()
Definition imgui.h:2061

References ImGuiTextBuffer::clear(), GImGui, ImGuiContext::SettingsHandlers, ImGuiContext::SettingsIniData, and ImVector< T >::Size.

Referenced by ShowMetricsWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CloseButton()

bool ImGui::CloseButton ( ImGuiID  id,
const ImVec2 pos 
)
793{
794 ImGuiContext& g = *GImGui;
795 ImGuiWindow* window = g.CurrentWindow;
796
797 // Tweak 1: Shrink hit-testing area if button covers an abnormally large proportion of the visible region. That's in order to facilitate moving the window away. (#3825)
798 // This may better be applied as a general hit-rect reduction mechanism for all widgets to ensure the area to move window is always accessible?
799 const ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize) + g.Style.FramePadding * 2.0f);
800 ImRect bb_interact = bb;
801 const float area_to_visible_ratio = window->OuterRectClipped.GetArea() / bb.GetArea();
802 if (area_to_visible_ratio < 1.5f)
803 bb_interact.Expand(ImFloor(bb_interact.GetSize() * -0.25f));
804
805 // Tweak 2: We intentionally allow interaction when clipped so that a mechanical Alt,Right,Activate sequence can always close a window.
806 // (this isn't the regular behavior of buttons, but it doesn't affect the user much because navigation tends to keep items visible).
807 bool is_clipped = !ItemAdd(bb_interact, id);
808
809 bool hovered, held;
810 bool pressed = ButtonBehavior(bb_interact, id, &hovered, &held);
811 if (is_clipped)
812 return pressed;
813
814 // Render
815 // FIXME: Clarify this mess
817 ImVec2 center = bb.GetCenter();
818 if (hovered)
819 window->DrawList->AddCircleFilled(center, ImMax(2.0f, g.FontSize * 0.5f + 1.0f), col, 12);
820
821 float cross_extent = g.FontSize * 0.5f * 0.7071f - 1.0f;
822 ImU32 cross_col = GetColorU32(ImGuiCol_Text);
823 center -= ImVec2(0.5f, 0.5f);
824 window->DrawList->AddLine(center + ImVec2(+cross_extent, +cross_extent), center + ImVec2(-cross_extent, -cross_extent), cross_col, 1.0f);
825 window->DrawList->AddLine(center + ImVec2(+cross_extent, -cross_extent), center + ImVec2(-cross_extent, +cross_extent), cross_col, 1.0f);
826
827 return pressed;
828}
IMGUI_API void AddCircleFilled(const ImVec2 &center, float radius, ImU32 col, int num_segments=0)
Definition imgui_draw.cpp:1492
float GetArea() const
Definition imgui_internal.h:484

References ImDrawList::AddCircleFilled(), ImDrawList::AddLine(), ButtonBehavior(), col(), ImGuiContext::CurrentWindow, ImGuiWindow::DrawList, ImRect::Expand(), ImGuiContext::FontSize, ImGuiStyle::FramePadding, ImRect::GetArea(), ImRect::GetCenter(), GetColorU32(), ImRect::GetSize(), GImGui, ImFloor(), ImGuiCol_ButtonActive, ImGuiCol_ButtonHovered, ImGuiCol_Text, ImMax(), ItemAdd(), ImGuiWindow::OuterRectClipped, and ImGuiContext::Style.

Referenced by CollapsingHeader(), RenderWindowTitleBarContents(), and TabItemLabelAndCloseButton().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CloseCurrentPopup()

void ImGui::CloseCurrentPopup ( )
8258{
8259 ImGuiContext& g = *GImGui;
8260 int popup_idx = g.BeginPopupStack.Size - 1;
8261 if (popup_idx < 0 || popup_idx >= g.OpenPopupStack.Size || g.BeginPopupStack[popup_idx].PopupId != g.OpenPopupStack[popup_idx].PopupId)
8262 return;
8263
8264 // Closing a menu closes its top-most parent popup (unless a modal)
8265 while (popup_idx > 0)
8266 {
8267 ImGuiWindow* popup_window = g.OpenPopupStack[popup_idx].Window;
8268 ImGuiWindow* parent_popup_window = g.OpenPopupStack[popup_idx - 1].Window;
8269 bool close_parent = false;
8270 if (popup_window && (popup_window->Flags & ImGuiWindowFlags_ChildMenu))
8271 if (parent_popup_window == NULL || !(parent_popup_window->Flags & ImGuiWindowFlags_Modal))
8272 close_parent = true;
8273 if (!close_parent)
8274 break;
8275 popup_idx--;
8276 }
8277 IMGUI_DEBUG_LOG_POPUP("CloseCurrentPopup %d -> %d\n", g.BeginPopupStack.Size - 1, popup_idx);
8278 ClosePopupToLevel(popup_idx, true);
8279
8280 // A common pattern is to close a popup when selecting a menu item/selectable that will open another window.
8281 // To improve this usage pattern, we avoid nav highlight for a single frame in the parent window.
8282 // Similarly, we could avoid mouse hover highlight in this window but it is less visually problematic.
8283 if (ImGuiWindow* window = g.NavWindow)
8284 window->DC.NavHideHighlightOneFrame = true;
8285}
#define IMGUI_DEBUG_LOG_POPUP(...)
Definition imgui_internal.h:196

References ImGuiContext::BeginPopupStack, ClosePopupToLevel(), ImGuiWindow::Flags, GImGui, IMGUI_DEBUG_LOG_POPUP, ImGuiWindowFlags_ChildMenu, ImGuiWindowFlags_Modal, ImGuiContext::NavWindow, ImGuiContext::OpenPopupStack, and ImVector< T >::Size.

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_font_list(), Slic3r::GUI::GLGizmoEmboss::draw_style_rename_popup(), Slic3r::GUI::GLGizmoEmboss::draw_style_save_as_popup(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::selectable(), Selectable(), ShowDemoWindowPopups(), ShowDemoWindowTables(), and ShowExampleAppDocuments().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClosePopupsOverWindow()

void ImGui::ClosePopupsOverWindow ( ImGuiWindow ref_window,
bool  restore_focus_to_window_under_popup 
)
8186{
8187 ImGuiContext& g = *GImGui;
8188 if (g.OpenPopupStack.Size == 0)
8189 return;
8190
8191 // Don't close our own child popup windows.
8192 int popup_count_to_keep = 0;
8193 if (ref_window)
8194 {
8195 // Find the highest popup which is a descendant of the reference window (generally reference window = NavWindow)
8196 for (; popup_count_to_keep < g.OpenPopupStack.Size; popup_count_to_keep++)
8197 {
8198 ImGuiPopupData& popup = g.OpenPopupStack[popup_count_to_keep];
8199 if (!popup.Window)
8200 continue;
8203 continue;
8204
8205 // Trim the stack unless the popup is a direct parent of the reference window (the reference window is often the NavWindow)
8206 // - With this stack of window, clicking/focusing Popup1 will close Popup2 and Popup3:
8207 // Window -> Popup1 -> Popup2 -> Popup3
8208 // - Each popups may contain child windows, which is why we compare ->RootWindow!
8209 // Window -> Popup1 -> Popup1_Child -> Popup2 -> Popup2_Child
8210 bool ref_window_is_descendent_of_popup = false;
8211 for (int n = popup_count_to_keep; n < g.OpenPopupStack.Size; n++)
8212 if (ImGuiWindow* popup_window = g.OpenPopupStack[n].Window)
8213 if (popup_window->RootWindow == ref_window->RootWindow)
8214 {
8215 ref_window_is_descendent_of_popup = true;
8216 break;
8217 }
8218 if (!ref_window_is_descendent_of_popup)
8219 break;
8220 }
8221 }
8222 if (popup_count_to_keep < g.OpenPopupStack.Size) // This test is not required but it allows to set a convenient breakpoint on the statement below
8223 {
8224 IMGUI_DEBUG_LOG_POPUP("ClosePopupsOverWindow(\"%s\") -> ClosePopupToLevel(%d)\n", ref_window->Name, popup_count_to_keep);
8225 ClosePopupToLevel(popup_count_to_keep, restore_focus_to_window_under_popup);
8226 }
8227}

References ClosePopupToLevel(), ImGuiWindow::Flags, GImGui, IM_ASSERT, IMGUI_DEBUG_LOG_POPUP, ImGuiWindowFlags_ChildWindow, ImGuiWindowFlags_Popup, ImGuiWindow::Name, ImGuiContext::OpenPopupStack, ImGuiWindow::RootWindow, ImVector< T >::Size, and ImGuiPopupData::Window.

Referenced by FocusWindow(), NavUpdateWindowing(), NewFrame(), and UpdateMouseMovingWindowEndFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClosePopupToLevel()

void ImGui::ClosePopupToLevel ( int  remaining,
bool  restore_focus_to_window_under_popup 
)
8230{
8231 ImGuiContext& g = *GImGui;
8232 IMGUI_DEBUG_LOG_POPUP("ClosePopupToLevel(%d), restore_focus_to_window_under_popup=%d\n", remaining, restore_focus_to_window_under_popup);
8233 IM_ASSERT(remaining >= 0 && remaining < g.OpenPopupStack.Size);
8234
8235 // Trim open popup stack
8236 ImGuiWindow* focus_window = g.OpenPopupStack[remaining].SourceWindow;
8237 ImGuiWindow* popup_window = g.OpenPopupStack[remaining].Window;
8238 g.OpenPopupStack.resize(remaining);
8239
8240 if (restore_focus_to_window_under_popup)
8241 {
8242 if (focus_window && !focus_window->WasActive && popup_window)
8243 {
8244 // Fallback
8245 FocusTopMostWindowUnderOne(popup_window, NULL);
8246 }
8247 else
8248 {
8249 if (g.NavLayer == ImGuiNavLayer_Main && focus_window)
8250 focus_window = NavRestoreLastChildNavWindow(focus_window);
8251 FocusWindow(focus_window);
8252 }
8253 }
8254}
IMGUI_API void FocusTopMostWindowUnderOne(ImGuiWindow *under_this_window, ImGuiWindow *ignore_window)
Definition imgui.cpp:6494
ImGuiNavLayer NavLayer
Definition imgui_internal.h:1455
bool WasActive
Definition imgui_internal.h:1831

References FocusTopMostWindowUnderOne(), FocusWindow(), GImGui, IM_ASSERT, IMGUI_DEBUG_LOG_POPUP, ImGuiNavLayer_Main, ImGuiContext::NavLayer, NavRestoreLastChildNavWindow(), ImGuiContext::OpenPopupStack, ImVector< T >::resize(), ImVector< T >::Size, and ImGuiWindow::WasActive.

Referenced by BeginMenu(), BeginPopupModal(), CloseCurrentPopup(), ClosePopupsOverWindow(), EndMenu(), NavUpdate(), and OpenPopupEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CollapseButton()

bool ImGui::CollapseButton ( ImGuiID  id,
const ImVec2 pos 
)
831{
832 ImGuiContext& g = *GImGui;
833 ImGuiWindow* window = g.CurrentWindow;
834
835 ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize) + g.Style.FramePadding * 2.0f);
836 ItemAdd(bb, id);
837 bool hovered, held;
838 bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_None);
839
840 // Render
841 ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
842 ImU32 text_col = GetColorU32(ImGuiCol_Text);
843 ImVec2 center = bb.GetCenter();
844 if (hovered || held)
845 window->DrawList->AddCircleFilled(center/*+ ImVec2(0.0f, -0.5f)*/, g.FontSize * 0.5f + 1.0f, bg_col, 12);
846 RenderArrow(window->DrawList, bb.Min + g.Style.FramePadding, text_col, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f);
847
848 // Switch to moving the window after mouse is moved beyond the initial drag threshold
849 if (IsItemActive() && IsMouseDragging(0))
851
852 return pressed;
853}
IMGUI_API bool IsItemActive()
Definition imgui.cpp:4831
IMGUI_API void StartMouseMovingWindow(ImGuiWindow *window)
Definition imgui.cpp:3514

References ImDrawList::AddCircleFilled(), ButtonBehavior(), ImGuiWindow::Collapsed, ImGuiContext::CurrentWindow, ImGuiWindow::DrawList, ImGuiContext::FontSize, ImGuiStyle::FramePadding, ImRect::GetCenter(), GetColorU32(), GImGui, ImGuiButtonFlags_None, ImGuiCol_Button, ImGuiCol_ButtonActive, ImGuiCol_ButtonHovered, ImGuiCol_Text, ImGuiDir_Down, ImGuiDir_Right, IsItemActive(), IsMouseDragging(), ItemAdd(), ImRect::Min, RenderArrow(), StartMouseMovingWindow(), and ImGuiContext::Style.

Referenced by RenderWindowTitleBarContents().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CollapsingHeader() [1/2]

bool ImGui::CollapsingHeader ( const char *  label,
bool *  p_visible,
ImGuiTreeNodeFlags  flags = 0 
)
5974{
5975 ImGuiWindow* window = GetCurrentWindow();
5976 if (window->SkipItems)
5977 return false;
5978
5979 if (p_visible && !*p_visible)
5980 return false;
5981
5982 ImGuiID id = window->GetID(label);
5984 if (p_visible)
5986 bool is_open = TreeNodeBehavior(id, flags, label);
5987 if (p_visible != NULL)
5988 {
5989 // Create a small overlapping close button
5990 // FIXME: We can evolve this into user accessible helpers to add extra buttons on title bars, headers, etc.
5991 // FIXME: CloseButton can overlap into text, need find a way to clip the text somehow.
5992 ImGuiContext& g = *GImGui;
5993 ImGuiLastItemDataBackup last_item_backup;
5994 float button_size = g.FontSize;
5995 float button_x = ImMax(window->DC.LastItemRect.Min.x, window->DC.LastItemRect.Max.x - g.Style.FramePadding.x * 2.0f - button_size);
5996 float button_y = window->DC.LastItemRect.Min.y;
5997 ImGuiID close_button_id = GetIDWithSeed("#CLOSE", NULL, id);
5998 if (CloseButton(close_button_id, ImVec2(button_x, button_y)))
5999 *p_visible = false;
6000 last_item_backup.Restore();
6001 }
6002
6003 return is_open;
6004}
@ ImGuiTreeNodeFlags_AllowItemOverlap
Definition imgui.h:989
@ ImGuiTreeNodeFlags_CollapsingHeader
Definition imgui.h:1002
@ ImGuiTreeNodeFlags_ClipLabelForTrailingButton
Definition imgui_internal.h:821
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2 &pos)
Definition imgui_widgets.cpp:792
IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char *label, const char *label_end=NULL)
Definition imgui_widgets.cpp:5706
IMGUI_API ImGuiID GetIDWithSeed(const char *str_id_begin, const char *str_id_end, ImGuiID seed)
Definition imgui.cpp:7061
Definition imgui_internal.h:1921
void Restore() const
Definition imgui_internal.h:1929

References CloseButton(), ImGuiWindow::DC, ImGuiContext::FontSize, ImGuiStyle::FramePadding, GetCurrentWindow(), ImGuiWindow::GetID(), GetIDWithSeed(), GImGui, ImGuiTreeNodeFlags_AllowItemOverlap, ImGuiTreeNodeFlags_ClipLabelForTrailingButton, ImGuiTreeNodeFlags_CollapsingHeader, ImMax(), ImGuiWindowTempData::LastItemRect, ImRect::Max, ImRect::Min, ImGuiLastItemDataBackup::Restore(), ImGuiWindow::SkipItems, ImGuiContext::Style, TreeNodeBehavior(), ImVec2::x, and ImVec2::y.

+ Here is the call graph for this function:

◆ CollapsingHeader() [2/2]

bool ImGui::CollapsingHeader ( const char *  label,
ImGuiTreeNodeFlags  flags = 0 
)
5961{
5962 ImGuiWindow* window = GetCurrentWindow();
5963 if (window->SkipItems)
5964 return false;
5965
5966 return TreeNodeBehavior(window->GetID(label), flags | ImGuiTreeNodeFlags_CollapsingHeader, label);
5967}

References GetCurrentWindow(), ImGuiWindow::GetID(), ImGuiTreeNodeFlags_CollapsingHeader, ImGuiWindow::SkipItems, and TreeNodeBehavior().

Referenced by igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), ShowDemoWindow(), ShowDemoWindowColumns(), ShowDemoWindowLayout(), ShowDemoWindowMisc(), ShowDemoWindowPopups(), ShowDemoWindowTables(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ColorButton()

bool ImGui::ColorButton ( const char *  desc_id,
const ImVec4 col,
ImGuiColorEditFlags  flags = 0,
ImVec2  size = ImVec2(0, 0) 
)
5335{
5336 ImGuiWindow* window = GetCurrentWindow();
5337 if (window->SkipItems)
5338 return false;
5339
5340 ImGuiContext& g = *GImGui;
5341 const ImGuiID id = window->GetID(desc_id);
5342 float default_size = GetFrameHeight();
5343 if (size.x == 0.0f)
5344 size.x = default_size;
5345 if (size.y == 0.0f)
5346 size.y = default_size;
5347 const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
5348 ItemSize(bb, (size.y >= default_size) ? g.Style.FramePadding.y : 0.0f);
5349 if (!ItemAdd(bb, id))
5350 return false;
5351
5352 bool hovered, held;
5353 bool pressed = ButtonBehavior(bb, id, &hovered, &held);
5354
5355 if (flags & ImGuiColorEditFlags_NoAlpha)
5357
5358 ImVec4 col_rgb = col;
5359 if (flags & ImGuiColorEditFlags_InputHSV)
5360 ColorConvertHSVtoRGB(col_rgb.x, col_rgb.y, col_rgb.z, col_rgb.x, col_rgb.y, col_rgb.z);
5361
5362 ImVec4 col_rgb_without_alpha(col_rgb.x, col_rgb.y, col_rgb.z, 1.0f);
5363 float grid_step = ImMin(size.x, size.y) / 2.99f;
5364 float rounding = ImMin(g.Style.FrameRounding, grid_step * 0.5f);
5365 ImRect bb_inner = bb;
5366 float off = 0.0f;
5367 if ((flags & ImGuiColorEditFlags_NoBorder) == 0)
5368 {
5369 off = -0.75f; // The border (using Col_FrameBg) tends to look off when color is near-opaque and rounding is enabled. This offset seemed like a good middle ground to reduce those artifacts.
5370 bb_inner.Expand(off);
5371 }
5372 if ((flags & ImGuiColorEditFlags_AlphaPreviewHalf) && col_rgb.w < 1.0f)
5373 {
5374 float mid_x = IM_ROUND((bb_inner.Min.x + bb_inner.Max.x) * 0.5f);
5375 RenderColorRectWithAlphaCheckerboard(window->DrawList, ImVec2(bb_inner.Min.x + grid_step, bb_inner.Min.y), bb_inner.Max, GetColorU32(col_rgb), grid_step, ImVec2(-grid_step + off, off), rounding, ImDrawFlags_RoundCornersRight);
5376 window->DrawList->AddRectFilled(bb_inner.Min, ImVec2(mid_x, bb_inner.Max.y), GetColorU32(col_rgb_without_alpha), rounding, ImDrawFlags_RoundCornersLeft);
5377 }
5378 else
5379 {
5380 // Because GetColorU32() multiplies by the global style Alpha and we don't want to display a checkerboard if the source code had no alpha
5381 ImVec4 col_source = (flags & ImGuiColorEditFlags_AlphaPreview) ? col_rgb : col_rgb_without_alpha;
5382 if (col_source.w < 1.0f)
5383 RenderColorRectWithAlphaCheckerboard(window->DrawList, bb_inner.Min, bb_inner.Max, GetColorU32(col_source), grid_step, ImVec2(off, off), rounding);
5384 else
5385 window->DrawList->AddRectFilled(bb_inner.Min, bb_inner.Max, GetColorU32(col_source), rounding);
5386 }
5387 RenderNavHighlight(bb, id);
5388 if ((flags & ImGuiColorEditFlags_NoBorder) == 0)
5389 {
5390 if (g.Style.FrameBorderSize > 0.0f)
5391 RenderFrameBorder(bb.Min, bb.Max, rounding);
5392 else
5393 window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), rounding); // Color button are often in need of some sort of border
5394 }
5395
5396 // Drag and Drop Source
5397 // NB: The ActiveId test is merely an optional micro-optimization, BeginDragDropSource() does the same test.
5398 if (g.ActiveId == id && !(flags & ImGuiColorEditFlags_NoDragDrop) && BeginDragDropSource())
5399 {
5400 if (flags & ImGuiColorEditFlags_NoAlpha)
5401 SetDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F, &col_rgb, sizeof(float) * 3, ImGuiCond_Once);
5402 else
5403 SetDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F, &col_rgb, sizeof(float) * 4, ImGuiCond_Once);
5404 ColorButton(desc_id, col, flags);
5405 SameLine();
5406 TextEx("Color");
5408 }
5409
5410 // Tooltip
5411 if (!(flags & ImGuiColorEditFlags_NoTooltip) && hovered)
5413
5414 return pressed;
5415}
#define IMGUI_PAYLOAD_TYPE_COLOR_4F
Definition imgui.h:1274
@ ImGuiColorEditFlags_AlphaPreview
Definition imgui.h:1536
@ ImGuiColorEditFlags_NoAlpha
Definition imgui.h:1523
@ ImGuiColorEditFlags_InputHSV
Definition imgui.h:1547
@ ImGuiColorEditFlags_NoBorder
Definition imgui.h:1532
@ ImGuiColorEditFlags_AlphaPreviewHalf
Definition imgui.h:1537
@ ImGuiColorEditFlags__InputMask
Definition imgui.h:1557
@ ImGuiColorEditFlags_NoDragDrop
Definition imgui.h:1531
@ ImGuiColorEditFlags_NoTooltip
Definition imgui.h:1528
#define IMGUI_PAYLOAD_TYPE_COLOR_3F
Definition imgui.h:1273
IMGUI_API void EndDragDropSource()
Definition imgui.cpp:9889
IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float &out_r, float &out_g, float &out_b)
Definition imgui.cpp:1843
IMGUI_API void RenderColorRectWithAlphaCheckerboard(ImDrawList *draw_list, ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding=0.0f, ImDrawFlags flags=0)
Definition imgui_draw.cpp:3912
IMGUI_API bool SetDragDropPayload(const char *type, const void *data, size_t sz, ImGuiCond cond=0)
Definition imgui.cpp:9905
IMGUI_API bool ColorButton(const char *desc_id, const ImVec4 &col, ImGuiColorEditFlags flags=0, ImVec2 size=ImVec2(0, 0))
Definition imgui_widgets.cpp:5334
IMGUI_API void TextEx(const char *text, const char *text_end=NULL, ImGuiTextFlags flags=0)
Definition imgui_widgets.cpp:152
IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags=0)
Definition imgui.cpp:9775
IMGUI_API void RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding=0.0f)
Definition imgui.cpp:2847
IMGUI_API void ColorTooltip(const char *text, const float *col, ImGuiColorEditFlags flags)
Definition imgui_widgets.cpp:5437
float FrameBorderSize
Definition imgui.h:1735
float x
Definition imgui.h:259
float y
Definition imgui.h:259
float z
Definition imgui.h:259

References ImGuiContext::ActiveId, ImDrawList::AddRect(), ImDrawList::AddRectFilled(), BeginDragDropSource(), ButtonBehavior(), col(), ColorButton(), ColorConvertHSVtoRGB(), ColorTooltip(), ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, EndDragDropSource(), ImRect::Expand(), ImGuiStyle::FrameBorderSize, ImGuiStyle::FramePadding, ImGuiStyle::FrameRounding, GetColorU32(), GetCurrentWindow(), GetFrameHeight(), ImGuiWindow::GetID(), GImGui, IM_ROUND, ImDrawFlags_RoundCornersLeft, ImDrawFlags_RoundCornersRight, IMGUI_PAYLOAD_TYPE_COLOR_3F, IMGUI_PAYLOAD_TYPE_COLOR_4F, ImGuiCol_FrameBg, ImGuiColorEditFlags__InputMask, ImGuiColorEditFlags_AlphaPreview, ImGuiColorEditFlags_AlphaPreviewHalf, ImGuiColorEditFlags_InputHSV, ImGuiColorEditFlags_NoAlpha, ImGuiColorEditFlags_NoBorder, ImGuiColorEditFlags_NoDragDrop, ImGuiColorEditFlags_NoTooltip, ImGuiCond_Once, ImMin(), ItemAdd(), ItemSize(), ImRect::Max, ImRect::Min, RenderColorRectWithAlphaCheckerboard(), RenderFrameBorder(), RenderNavHighlight(), SameLine(), SetDragDropPayload(), ImGuiWindow::SkipItems, ImGuiContext::Style, TextEx(), ImVec4::w, ImVec2::x, ImVec4::x, ImVec2::y, ImVec4::y, and ImVec4::z.

Referenced by ColorButton(), ColorEdit4(), ColorPicker4(), ColorTooltip(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ColorConvertFloat4ToU32()

ImU32 ImGui::ColorConvertFloat4ToU32 ( const ImVec4 in)
1810{
1811 ImU32 out;
1813 out |= ((ImU32)IM_F32_TO_INT8_SAT(in.y)) << IM_COL32_G_SHIFT;
1814 out |= ((ImU32)IM_F32_TO_INT8_SAT(in.z)) << IM_COL32_B_SHIFT;
1815 out |= ((ImU32)IM_F32_TO_INT8_SAT(in.w)) << IM_COL32_A_SHIFT;
1816 return out;
1817}
#define IM_COL32_G_SHIFT
Definition imgui.h:2172
#define IM_COL32_R_SHIFT
Definition imgui.h:2171
#define IM_COL32_B_SHIFT
Definition imgui.h:2173
#define IM_COL32_A_SHIFT
Definition imgui.h:2174
#define IM_F32_TO_INT8_SAT(_VAL)
Definition imgui_internal.h:231

References IM_COL32_A_SHIFT, IM_COL32_B_SHIFT, IM_COL32_G_SHIFT, IM_COL32_R_SHIFT, IM_F32_TO_INT8_SAT, ImVec4::w, ImVec4::x, ImVec4::y, and ImVec4::z.

Referenced by ColorPicker4(), GetColorU32(), GetColorU32(), and ImColor::operator ImU32().

+ Here is the caller graph for this function:

◆ ColorConvertHSVtoRGB()

void ImGui::ColorConvertHSVtoRGB ( float  h,
float  s,
float  v,
float &  out_r,
float &  out_g,
float &  out_b 
)
1844{
1845 if (s == 0.0f)
1846 {
1847 // gray
1848 out_r = out_g = out_b = v;
1849 return;
1850 }
1851
1852 h = ImFmod(h, 1.0f) / (60.0f / 360.0f);
1853 int i = (int)h;
1854 float f = h - (float)i;
1855 float p = v * (1.0f - s);
1856 float q = v * (1.0f - s * f);
1857 float t = v * (1.0f - s * (1.0f - f));
1858
1859 switch (i)
1860 {
1861 case 0: out_r = v; out_g = t; out_b = p; break;
1862 case 1: out_r = q; out_g = v; out_b = p; break;
1863 case 2: out_r = p; out_g = v; out_b = t; break;
1864 case 3: out_r = p; out_g = q; out_b = v; break;
1865 case 4: out_r = t; out_g = p; out_b = v; break;
1866 case 5: default: out_r = v; out_g = p; out_b = q; break;
1867 }
1868}
#define ImFmod(X, Y)
Definition imgui_internal.h:383

References ImFmod.

Referenced by ColorButton(), ColorEdit4(), ColorPicker4(), ImColor::HSV(), ImColor::SetHSV(), and ShowDemoWindowWidgets().

+ Here is the caller graph for this function:

◆ ColorConvertRGBtoHSV()

void ImGui::ColorConvertRGBtoHSV ( float  r,
float  g,
float  b,
float &  out_h,
float &  out_s,
float &  out_v 
)
1822{
1823 float K = 0.f;
1824 if (g < b)
1825 {
1826 ImSwap(g, b);
1827 K = -1.f;
1828 }
1829 if (r < g)
1830 {
1831 ImSwap(r, g);
1832 K = -2.f / 6.f - K;
1833 }
1834
1835 const float chroma = r - (g < b ? g : b);
1836 out_h = ImFabs(K + (g - b) / (6.f * chroma + 1e-20f));
1837 out_s = chroma / (r + 1e-20f);
1838 out_v = r;
1839}
static void ImSwap(T &a, T &b)
Definition imgui_internal.h:413

References ImFabs, and ImSwap().

Referenced by ColorEdit4(), and ColorPicker4().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ColorConvertU32ToFloat4()

ImVec4 ImGui::ColorConvertU32ToFloat4 ( ImU32  in)
1800{
1801 float s = 1.0f / 255.0f;
1802 return ImVec4(
1803 ((in >> IM_COL32_R_SHIFT) & 0xFF) * s,
1804 ((in >> IM_COL32_G_SHIFT) & 0xFF) * s,
1805 ((in >> IM_COL32_B_SHIFT) & 0xFF) * s,
1806 ((in >> IM_COL32_A_SHIFT) & 0xFF) * s);
1807}

References IM_COL32_A_SHIFT, IM_COL32_B_SHIFT, IM_COL32_G_SHIFT, and IM_COL32_R_SHIFT.

Referenced by Slic3r::GUI::ImGuiWrapper::from_ImU32(), and PushStyleColor().

+ Here is the caller graph for this function:

◆ ColorEdit3()

bool ImGui::ColorEdit3 ( const char *  label,
float  col[3],
ImGuiColorEditFlags  flags = 0 
)
4685{
4686 return ColorEdit4(label, col, flags | ImGuiColorEditFlags_NoAlpha);
4687}
IMGUI_API bool ColorEdit4(const char *label, float col[4], ImGuiColorEditFlags flags=0, const char *current_label=NULL, const char *original_label=NULL)
Definition imgui_widgets.cpp:4692

References col(), ColorEdit4(), and ImGuiColorEditFlags_NoAlpha.

Referenced by MyDocument::DisplayContents(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ColorEdit4()

bool ImGui::ColorEdit4 ( const char *  label,
float  col[4],
ImGuiColorEditFlags  flags = 0,
const char *  current_label = NULL,
const char *  original_label = NULL 
)
4693{
4694 ImGuiWindow* window = GetCurrentWindow();
4695 if (window->SkipItems)
4696 return false;
4697
4698 ImGuiContext& g = *GImGui;
4699 const ImGuiStyle& style = g.Style;
4700 const float square_sz = GetFrameHeight();
4701 const float w_full = CalcItemWidth();
4702 const float w_button = (flags & ImGuiColorEditFlags_NoSmallPreview) ? 0.0f : (square_sz + style.ItemInnerSpacing.x);
4703 const float w_inputs = w_full - w_button;
4704 const char* label_display_end = FindRenderedTextEnd(label);
4706
4707 BeginGroup();
4708 PushID(label);
4709
4710 // If we're not showing any slider there's no point in doing any HSV conversions
4711 const ImGuiColorEditFlags flags_untouched = flags;
4712 if (flags & ImGuiColorEditFlags_NoInputs)
4713 flags = (flags & (~ImGuiColorEditFlags__DisplayMask)) | ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_NoOptions;
4714
4715 // Context menu: display and modify options (before defaults are applied)
4716 if (!(flags & ImGuiColorEditFlags_NoOptions))
4717 ColorEditOptionsPopup(col, flags);
4718
4719 // Read stored options
4720 if (!(flags & ImGuiColorEditFlags__DisplayMask))
4722 if (!(flags & ImGuiColorEditFlags__DataTypeMask))
4724 if (!(flags & ImGuiColorEditFlags__PickerMask))
4726 if (!(flags & ImGuiColorEditFlags__InputMask))
4729 IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags__DisplayMask)); // Check that only 1 is selected
4730 IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags__InputMask)); // Check that only 1 is selected
4731
4732 const bool alpha = (flags & ImGuiColorEditFlags_NoAlpha) == 0;
4733 const bool hdr = (flags & ImGuiColorEditFlags_HDR) != 0;
4734 const int components = alpha ? 4 : 3;
4735
4736 // Convert to the formats we need
4737 float f[4] = { col[0], col[1], col[2], alpha ? col[3] : 1.0f };
4739 ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]);
4740 else if ((flags & ImGuiColorEditFlags_InputRGB) && (flags & ImGuiColorEditFlags_DisplayHSV))
4741 {
4742 // Hue is lost when converting from greyscale rgb (saturation=0). Restore it.
4743 ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);
4744 if (memcmp(g.ColorEditLastColor, col, sizeof(float) * 3) == 0)
4745 {
4746 if (f[1] == 0)
4747 f[0] = g.ColorEditLastHue;
4748 if (f[2] == 0)
4749 f[1] = g.ColorEditLastSat;
4750 }
4751 }
4753
4754 bool value_changed = false;
4755 bool value_changed_as_float = false;
4756
4757 const ImVec2 pos = window->DC.CursorPos;
4758 const float inputs_offset_x = (style.ColorButtonPosition == ImGuiDir_Left) ? w_button : 0.0f;
4759 window->DC.CursorPos.x = pos.x + inputs_offset_x;
4760
4762 {
4763 // RGB/HSV 0..255 Sliders
4764 const float w_item_one = ImMax(1.0f, IM_FLOOR((w_inputs - (style.ItemInnerSpacing.x) * (components - 1)) / (float)components));
4765 const float w_item_last = ImMax(1.0f, IM_FLOOR(w_inputs - (w_item_one + style.ItemInnerSpacing.x) * (components - 1)));
4766
4767 const bool hide_prefix = (w_item_one <= CalcTextSize((flags & ImGuiColorEditFlags_Float) ? "M:0.000" : "M:000").x);
4768 static const char* ids[4] = { "##X", "##Y", "##Z", "##W" };
4769 static const char* fmt_table_int[3][4] =
4770 {
4771 { "%3d", "%3d", "%3d", "%3d" }, // Short display
4772 { "R:%3d", "G:%3d", "B:%3d", "A:%3d" }, // Long display for RGBA
4773 { "H:%3d", "S:%3d", "V:%3d", "A:%3d" } // Long display for HSVA
4774 };
4775 static const char* fmt_table_float[3][4] =
4776 {
4777 { "%0.3f", "%0.3f", "%0.3f", "%0.3f" }, // Short display
4778 { "R:%0.3f", "G:%0.3f", "B:%0.3f", "A:%0.3f" }, // Long display for RGBA
4779 { "H:%0.3f", "S:%0.3f", "V:%0.3f", "A:%0.3f" } // Long display for HSVA
4780 };
4781 const int fmt_idx = hide_prefix ? 0 : (flags & ImGuiColorEditFlags_DisplayHSV) ? 2 : 1;
4782
4783 for (int n = 0; n < components; n++)
4784 {
4785 if (n > 0)
4786 SameLine(0, style.ItemInnerSpacing.x);
4787 SetNextItemWidth((n + 1 < components) ? w_item_one : w_item_last);
4788
4789 // FIXME: When ImGuiColorEditFlags_HDR flag is passed HS values snap in weird ways when SV values go below 0.
4790 if (flags & ImGuiColorEditFlags_Float)
4791 {
4792 value_changed |= DragFloat(ids[n], &f[n], 1.0f / 255.0f, 0.0f, hdr ? 0.0f : 1.0f, fmt_table_float[fmt_idx][n]);
4793 value_changed_as_float |= value_changed;
4794 }
4795 else
4796 {
4797 value_changed |= DragInt(ids[n], &i[n], 1.0f, 0, hdr ? 0 : 255, fmt_table_int[fmt_idx][n]);
4798 }
4799 if (!(flags & ImGuiColorEditFlags_NoOptions))
4800 OpenPopupOnItemClick("context");
4801 }
4802 }
4803 else if ((flags & ImGuiColorEditFlags_DisplayHex) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0)
4804 {
4805 // RGB Hexadecimal Input
4806 char buf[64];
4807 if (alpha)
4808 ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X%02X", ImClamp(i[0], 0, 255), ImClamp(i[1], 0, 255), ImClamp(i[2], 0, 255), ImClamp(i[3], 0, 255));
4809 else
4810 ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X", ImClamp(i[0], 0, 255), ImClamp(i[1], 0, 255), ImClamp(i[2], 0, 255));
4811 SetNextItemWidth(w_inputs);
4813 {
4814 value_changed = true;
4815 char* p = buf;
4816 while (*p == '#' || ImCharIsBlankA(*p))
4817 p++;
4818 i[0] = i[1] = i[2] = 0;
4819 i[3] = 0xFF; // alpha default to 255 is not parsed by scanf (e.g. inputting #FFFFFF omitting alpha)
4820 int r;
4821 if (alpha)
4822 r = sscanf(p, "%02X%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2], (unsigned int*)&i[3]); // Treat at unsigned (%X is unsigned)
4823 else
4824 r = sscanf(p, "%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]);
4825 IM_UNUSED(r); // Fixes C6031: Return value ignored: 'sscanf'.
4826 }
4827 if (!(flags & ImGuiColorEditFlags_NoOptions))
4828 OpenPopupOnItemClick("context");
4829 }
4830
4831 ImGuiWindow* picker_active_window = NULL;
4833 {
4834 const float button_offset_x = ((flags & ImGuiColorEditFlags_NoInputs) || (style.ColorButtonPosition == ImGuiDir_Left)) ? 0.0f : w_inputs + style.ItemInnerSpacing.x;
4835 window->DC.CursorPos = ImVec2(pos.x + button_offset_x, pos.y);
4836
4837 const ImVec4 col_v4(col[0], col[1], col[2], alpha ? col[3] : 1.0f);
4838 if (ColorButton("##ColorButton", col_v4, flags))
4839 {
4840 if (!(flags & ImGuiColorEditFlags_NoPicker))
4841 {
4842 // Store current color and open a picker
4843 g.ColorPickerRef = col_v4;
4844 OpenPopup("picker");
4845 SetNextWindowPos(window->DC.LastItemRect.GetBL() + ImVec2(-1, style.ItemSpacing.y));
4846 }
4847 }
4848 if (!(flags & ImGuiColorEditFlags_NoOptions))
4849 OpenPopupOnItemClick("context");
4850
4851 if (BeginPopup("picker"))
4852 {
4853 picker_active_window = g.CurrentWindow;
4854 if (label != label_display_end)
4855 {
4856 TextEx(label, label_display_end);
4857 Spacing();
4858 }
4861 SetNextItemWidth(square_sz * 12.0f); // Use 256 + bar sizes?
4862 value_changed |= ColorPicker4("##picker", col, picker_flags, &g.ColorPickerRef.x, current_label, original_label);
4863 EndPopup();
4864 }
4865 }
4866
4867 if (label != label_display_end && !(flags & ImGuiColorEditFlags_NoLabel))
4868 {
4869 const float text_offset_x = (flags & ImGuiColorEditFlags_NoInputs) ? w_button : w_full + style.ItemInnerSpacing.x;
4870 window->DC.CursorPos = ImVec2(pos.x + text_offset_x, pos.y + style.FramePadding.y);
4871 TextEx(label, label_display_end);
4872 }
4873
4874 // Convert back
4875 if (value_changed && picker_active_window == NULL)
4876 {
4877 if (!value_changed_as_float)
4878 for (int n = 0; n < 4; n++)
4879 f[n] = i[n] / 255.0f;
4881 {
4882 g.ColorEditLastHue = f[0];
4883 g.ColorEditLastSat = f[1];
4884 ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]);
4885 memcpy(g.ColorEditLastColor, f, sizeof(float) * 3);
4886 }
4888 ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);
4889
4890 col[0] = f[0];
4891 col[1] = f[1];
4892 col[2] = f[2];
4893 if (alpha)
4894 col[3] = f[3];
4895 }
4896
4897 PopID();
4898 EndGroup();
4899
4900 // Drag and Drop Target
4901 // NB: The flag test is merely an optional micro-optimization, BeginDragDropTarget() does the same test.
4903 {
4904 bool accepted_drag_drop = false;
4906 {
4907 memcpy((float*)col, payload->Data, sizeof(float) * 3); // Preserve alpha if any //-V512
4908 value_changed = accepted_drag_drop = true;
4909 }
4911 {
4912 memcpy((float*)col, payload->Data, sizeof(float) * components);
4913 value_changed = accepted_drag_drop = true;
4914 }
4915
4916 // Drag-drop payloads are always RGB
4917 if (accepted_drag_drop && (flags & ImGuiColorEditFlags_InputHSV))
4918 ColorConvertRGBtoHSV(col[0], col[1], col[2], col[0], col[1], col[2]);
4920 }
4921
4922 // When picker is being actively used, use its active id so IsItemActive() will function on ColorEdit4().
4923 if (picker_active_window && g.ActiveId != 0 && g.ActiveIdWindow == picker_active_window)
4924 window->DC.LastItemId = g.ActiveId;
4925
4926 if (value_changed)
4927 MarkItemEdited(window->DC.LastItemId);
4928
4929 return value_changed;
4930}
#define IM_UNUSED(_VAR)
Definition imgui.h:84
int ImGuiColorEditFlags
Definition imgui.h:183
@ ImGuiInputTextFlags_CharsHexadecimal
Definition imgui.h:957
@ ImGuiInputTextFlags_CharsUppercase
Definition imgui.h:958
@ ImGuiColorEditFlags_InputRGB
Definition imgui.h:1546
@ ImGuiColorEditFlags_DisplayRGB
Definition imgui.h:1539
@ ImGuiColorEditFlags_NoSmallPreview
Definition imgui.h:1526
@ ImGuiColorEditFlags_DisplayHex
Definition imgui.h:1541
@ ImGuiColorEditFlags_NoOptions
Definition imgui.h:1525
@ ImGuiColorEditFlags_NoPicker
Definition imgui.h:1524
@ ImGuiColorEditFlags_NoLabel
Definition imgui.h:1529
@ ImGuiColorEditFlags__DisplayMask
Definition imgui.h:1554
@ ImGuiColorEditFlags_NoInputs
Definition imgui.h:1527
@ ImGuiColorEditFlags_AlphaBar
Definition imgui.h:1535
@ ImGuiColorEditFlags_HDR
Definition imgui.h:1538
@ ImGuiColorEditFlags__DataTypeMask
Definition imgui.h:1555
@ ImGuiColorEditFlags__PickerMask
Definition imgui.h:1556
@ ImGuiColorEditFlags_DisplayHSV
Definition imgui.h:1540
@ ImGuiColorEditFlags_Float
Definition imgui.h:1543
#define IM_F32_TO_INT8_UNBOUND(_VAL)
Definition imgui_internal.h:230
static bool ImCharIsBlankA(char c)
Definition imgui_internal.h:321
IMGUI_API void EndGroup()
Definition imgui.cpp:7741
IMGUI_API bool BeginPopup(const char *str_id, ImGuiWindowFlags flags=0)
Definition imgui.cpp:8311
IMGUI_API void SetNextItemWidth(float item_width)
Definition imgui.cpp:7555
IMGUI_API void Spacing()
Definition imgui_widgets.cpp:1312
IMGUI_API bool DragInt(const char *label, int *v, float v_speed=1.0f, int v_min=0, int v_max=0, const char *format="%d", ImGuiSliderFlags flags=0)
Definition imgui_widgets.cpp:2479
IMGUI_API void OpenPopupOnItemClick(const char *str_id=NULL, ImGuiPopupFlags popup_flags=1)
Definition imgui.cpp:8378
IMGUI_API const ImGuiPayload * AcceptDragDropPayload(const char *type, ImGuiDragDropFlags flags=0)
Definition imgui.cpp:10008
IMGUI_API void ColorEditOptionsPopup(const float *col, ImGuiColorEditFlags flags)
Definition imgui_widgets.cpp:5471
IMGUI_API void MarkItemEdited(ImGuiID id)
Definition imgui.cpp:3114
IMGUI_API bool InputText(const char *label, char *buf, size_t buf_size, ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=NULL, void *user_data=NULL)
Definition imgui_widgets.cpp:3506
IMGUI_API bool DragFloat(const char *label, float *v, float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *format="%.3f", ImGuiSliderFlags flags=0)
Definition imgui_widgets.cpp:2426
IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float &out_h, float &out_s, float &out_v)
Definition imgui.cpp:1821
IMGUI_API void PopID()
Definition imgui.cpp:7072
IMGUI_API bool BeginDragDropTarget()
Definition imgui.cpp:9975
IMGUI_API bool ColorPicker4(const char *label, float col[4], ImGuiColorEditFlags flags=0, const float *ref_col=NULL, const char *current_label=NULL, const char *original_label=NULL)
Definition imgui_widgets.cpp:4955
IMGUI_API void EndDragDropTarget()
Definition imgui.cpp:10058
IGL_INLINE void components(const Eigen::SparseMatrix< AScalar > &A, Eigen::PlainObjectBase< DerivedC > &C, Eigen::PlainObjectBase< Derivedcounts > &counts)
Definition components.cpp:14
ImGuiColorEditFlags ColorEditOptions
Definition imgui_internal.h:1537
float ColorEditLastColor[3]
Definition imgui_internal.h:1540
float ColorEditLastSat
Definition imgui_internal.h:1539
float ColorEditLastHue
Definition imgui_internal.h:1538
ImVec4 ColorPickerRef
Definition imgui_internal.h:1541

References AcceptDragDropPayload(), ImGuiContext::ActiveId, ImGuiContext::ActiveIdWindow, BeginDragDropTarget(), BeginGroup(), BeginPopup(), CalcItemWidth(), CalcTextSize(), ImGuiNextItemData::ClearFlags(), col(), ColorButton(), ColorConvertHSVtoRGB(), ColorConvertRGBtoHSV(), ImGuiContext::ColorEditLastColor, ImGuiContext::ColorEditLastHue, ImGuiContext::ColorEditLastSat, ImGuiContext::ColorEditOptions, ColorEditOptionsPopup(), ColorPicker4(), ImGuiContext::ColorPickerRef, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, DragFloat(), DragInt(), EndDragDropTarget(), EndGroup(), EndPopup(), FindRenderedTextEnd(), ImRect::GetBL(), GetCurrentWindow(), GetFrameHeight(), GImGui, IM_ARRAYSIZE, IM_ASSERT, IM_F32_TO_INT8_UNBOUND, IM_FLOOR, IM_UNUSED, ImCharIsBlankA(), ImClamp(), ImFormatString(), IMGUI_PAYLOAD_TYPE_COLOR_3F, IMGUI_PAYLOAD_TYPE_COLOR_4F, ImGuiColorEditFlags__DataTypeMask, ImGuiColorEditFlags__DisplayMask, ImGuiColorEditFlags__InputMask, ImGuiColorEditFlags__PickerMask, ImGuiColorEditFlags_AlphaBar, ImGuiColorEditFlags_AlphaPreviewHalf, ImGuiColorEditFlags_DisplayHex, ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditFlags_Float, ImGuiColorEditFlags_HDR, ImGuiColorEditFlags_InputHSV, ImGuiColorEditFlags_InputRGB, ImGuiColorEditFlags_NoAlpha, ImGuiColorEditFlags_NoDragDrop, ImGuiColorEditFlags_NoInputs, ImGuiColorEditFlags_NoLabel, ImGuiColorEditFlags_NoOptions, ImGuiColorEditFlags_NoPicker, ImGuiColorEditFlags_NoSmallPreview, ImGuiDir_Left, ImGuiInputTextFlags_CharsHexadecimal, ImGuiInputTextFlags_CharsUppercase, ImGuiItemStatusFlags_HoveredRect, ImIsPowerOfTwo(), ImMax(), InputText(), ImGuiWindowTempData::LastItemId, ImGuiWindowTempData::LastItemRect, ImGuiWindowTempData::LastItemStatusFlags, MarkItemEdited(), ImGuiContext::NextItemData, OpenPopup(), OpenPopupOnItemClick(), PopID(), PushID(), SameLine(), SetNextItemWidth(), SetNextWindowPos(), ImGuiWindow::SkipItems, Spacing(), ImGuiContext::Style, style, TextEx(), ImVec2::x, and ImVec4::x.

Referenced by ColorEdit3(), ColorPicker4(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), ShowDemoWindowPopups(), ShowDemoWindowWidgets(), ShowExampleAppCustomRendering(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ColorEditOptionsPopup()

void ImGui::ColorEditOptionsPopup ( const float *  col,
ImGuiColorEditFlags  flags 
)
5472{
5473 bool allow_opt_inputs = !(flags & ImGuiColorEditFlags__DisplayMask);
5474 bool allow_opt_datatype = !(flags & ImGuiColorEditFlags__DataTypeMask);
5475 if ((!allow_opt_inputs && !allow_opt_datatype) || !BeginPopup("context"))
5476 return;
5477 ImGuiContext& g = *GImGui;
5479 if (allow_opt_inputs)
5480 {
5484 }
5485 if (allow_opt_datatype)
5486 {
5487 if (allow_opt_inputs) Separator();
5488 if (RadioButton("0..255", (opts & ImGuiColorEditFlags_Uint8) != 0)) opts = (opts & ~ImGuiColorEditFlags__DataTypeMask) | ImGuiColorEditFlags_Uint8;
5489 if (RadioButton("0.00..1.00", (opts & ImGuiColorEditFlags_Float) != 0)) opts = (opts & ~ImGuiColorEditFlags__DataTypeMask) | ImGuiColorEditFlags_Float;
5490 }
5491
5492 if (allow_opt_inputs || allow_opt_datatype)
5493 Separator();
5494 if (Button("Copy as..", ImVec2(-1, 0)))
5495 OpenPopup("Copy");
5496 if (BeginPopup("Copy"))
5497 {
5498 int cr = IM_F32_TO_INT8_SAT(col[0]), cg = IM_F32_TO_INT8_SAT(col[1]), cb = IM_F32_TO_INT8_SAT(col[2]), ca = (flags & ImGuiColorEditFlags_NoAlpha) ? 255 : IM_F32_TO_INT8_SAT(col[3]);
5499 char buf[64];
5500 ImFormatString(buf, IM_ARRAYSIZE(buf), "(%.3ff, %.3ff, %.3ff, %.3ff)", col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]);
5501 if (Selectable(buf))
5502 SetClipboardText(buf);
5503 ImFormatString(buf, IM_ARRAYSIZE(buf), "(%d,%d,%d,%d)", cr, cg, cb, ca);
5504 if (Selectable(buf))
5505 SetClipboardText(buf);
5506 ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X", cr, cg, cb);
5507 if (Selectable(buf))
5508 SetClipboardText(buf);
5509 if (!(flags & ImGuiColorEditFlags_NoAlpha))
5510 {
5511 ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X%02X", cr, cg, cb, ca);
5512 if (Selectable(buf))
5513 SetClipboardText(buf);
5514 }
5515 EndPopup();
5516 }
5517
5518 g.ColorEditOptions = opts;
5519 EndPopup();
5520}
@ ImGuiColorEditFlags_Uint8
Definition imgui.h:1542
IMGUI_API void Separator()
Definition imgui_widgets.cpp:1419
IMGUI_API bool Button(const char *label, const ImVec2 &size=ImVec2(0, 0))
Definition imgui_widgets.cpp:715
IMGUI_API bool RadioButton(const char *label, bool active)
Definition imgui_widgets.cpp:1177
IMGUI_API void SetClipboardText(const char *text)
Definition imgui.cpp:3347

References BeginPopup(), Button(), col(), ImGuiContext::ColorEditOptions, EndPopup(), GImGui, IM_ARRAYSIZE, IM_F32_TO_INT8_SAT, ImFormatString(), ImGuiColorEditFlags__DataTypeMask, ImGuiColorEditFlags__DisplayMask, ImGuiColorEditFlags_DisplayHex, ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditFlags_Float, ImGuiColorEditFlags_NoAlpha, ImGuiColorEditFlags_Uint8, OpenPopup(), RadioButton(), Selectable(), Separator(), and SetClipboardText().

Referenced by ColorEdit4().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ColorPicker3()

bool ImGui::ColorPicker3 ( const char *  label,
float  col[3],
ImGuiColorEditFlags  flags = 0 
)
4933{
4934 float col4[4] = { col[0], col[1], col[2], 1.0f };
4935 if (!ColorPicker4(label, col4, flags | ImGuiColorEditFlags_NoAlpha))
4936 return false;
4937 col[0] = col4[0]; col[1] = col4[1]; col[2] = col4[2];
4938 return true;
4939}

References col(), ColorPicker4(), and ImGuiColorEditFlags_NoAlpha.

+ Here is the call graph for this function:

◆ ColorPicker4()

bool ImGui::ColorPicker4 ( const char *  label,
float  col[4],
ImGuiColorEditFlags  flags = 0,
const float *  ref_col = NULL,
const char *  current_label = NULL,
const char *  original_label = NULL 
)
4956{
4957 ImGuiContext& g = *GImGui;
4958 ImGuiWindow* window = GetCurrentWindow();
4959 if (window->SkipItems)
4960 return false;
4961
4962 ImDrawList* draw_list = window->DrawList;
4963 ImGuiStyle& style = g.Style;
4964 ImGuiIO& io = g.IO;
4965
4966 const float width = CalcItemWidth();
4968
4969 PushID(label);
4970 BeginGroup();
4971
4972 if (!(flags & ImGuiColorEditFlags_NoSidePreview))
4974
4975 // Context menu: display and store options.
4976 if (!(flags & ImGuiColorEditFlags_NoOptions))
4978
4979 // Read stored options
4980 if (!(flags & ImGuiColorEditFlags__PickerMask))
4982 if (!(flags & ImGuiColorEditFlags__InputMask))
4984 IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags__PickerMask)); // Check that only 1 is selected
4985 IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags__InputMask)); // Check that only 1 is selected
4986 if (!(flags & ImGuiColorEditFlags_NoOptions))
4988
4989 // Setup
4990 int components = (flags & ImGuiColorEditFlags_NoAlpha) ? 3 : 4;
4991 bool alpha_bar = (flags & ImGuiColorEditFlags_AlphaBar) && !(flags & ImGuiColorEditFlags_NoAlpha);
4992 ImVec2 picker_pos = window->DC.CursorPos;
4993 float square_sz = GetFrameHeight();
4994 float bars_width = square_sz; // Arbitrary smallish width of Hue/Alpha picking bars
4995 float sv_picker_size = ImMax(bars_width * 1, width - (alpha_bar ? 2 : 1) * (bars_width + style.ItemInnerSpacing.x)); // Saturation/Value picking box
4996 float bar0_pos_x = picker_pos.x + sv_picker_size + style.ItemInnerSpacing.x;
4997 float bar1_pos_x = bar0_pos_x + bars_width + style.ItemInnerSpacing.x;
4998 float bars_triangles_half_sz = IM_FLOOR(bars_width * 0.20f);
4999
5000 float backup_initial_col[4];
5001 memcpy(backup_initial_col, col, components * sizeof(float));
5002
5003 float wheel_thickness = sv_picker_size * 0.08f;
5004 float wheel_r_outer = sv_picker_size * 0.50f;
5005 float wheel_r_inner = wheel_r_outer - wheel_thickness;
5006 ImVec2 wheel_center(picker_pos.x + (sv_picker_size + bars_width)*0.5f, picker_pos.y + sv_picker_size * 0.5f);
5007
5008 // Note: the triangle is displayed rotated with triangle_pa pointing to Hue, but most coordinates stays unrotated for logic.
5009 float triangle_r = wheel_r_inner - (int)(sv_picker_size * 0.027f);
5010 ImVec2 triangle_pa = ImVec2(triangle_r, 0.0f); // Hue point.
5011 ImVec2 triangle_pb = ImVec2(triangle_r * -0.5f, triangle_r * -0.866025f); // Black point.
5012 ImVec2 triangle_pc = ImVec2(triangle_r * -0.5f, triangle_r * +0.866025f); // White point.
5013
5014 float H = col[0], S = col[1], V = col[2];
5015 float R = col[0], G = col[1], B = col[2];
5016 if (flags & ImGuiColorEditFlags_InputRGB)
5017 {
5018 // Hue is lost when converting from greyscale rgb (saturation=0). Restore it.
5019 ColorConvertRGBtoHSV(R, G, B, H, S, V);
5020 if (memcmp(g.ColorEditLastColor, col, sizeof(float) * 3) == 0)
5021 {
5022 if (S == 0)
5023 H = g.ColorEditLastHue;
5024 if (V == 0)
5025 S = g.ColorEditLastSat;
5026 }
5027 }
5028 else if (flags & ImGuiColorEditFlags_InputHSV)
5029 {
5030 ColorConvertHSVtoRGB(H, S, V, R, G, B);
5031 }
5032
5033 bool value_changed = false, value_changed_h = false, value_changed_sv = false;
5034
5037 {
5038 // Hue wheel + SV triangle logic
5039 InvisibleButton("hsv", ImVec2(sv_picker_size + style.ItemInnerSpacing.x + bars_width, sv_picker_size));
5040 if (IsItemActive())
5041 {
5042 ImVec2 initial_off = g.IO.MouseClickedPos[0] - wheel_center;
5043 ImVec2 current_off = g.IO.MousePos - wheel_center;
5044 float initial_dist2 = ImLengthSqr(initial_off);
5045 if (initial_dist2 >= (wheel_r_inner - 1) * (wheel_r_inner - 1) && initial_dist2 <= (wheel_r_outer + 1) * (wheel_r_outer + 1))
5046 {
5047 // Interactive with Hue wheel
5048 H = ImAtan2(current_off.y, current_off.x) / IM_PI * 0.5f;
5049 if (H < 0.0f)
5050 H += 1.0f;
5051 value_changed = value_changed_h = true;
5052 }
5053 float cos_hue_angle = ImCos(-H * 2.0f * IM_PI);
5054 float sin_hue_angle = ImSin(-H * 2.0f * IM_PI);
5055 if (ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, ImRotate(initial_off, cos_hue_angle, sin_hue_angle)))
5056 {
5057 // Interacting with SV triangle
5058 ImVec2 current_off_unrotated = ImRotate(current_off, cos_hue_angle, sin_hue_angle);
5059 if (!ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated))
5060 current_off_unrotated = ImTriangleClosestPoint(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated);
5061 float uu, vv, ww;
5062 ImTriangleBarycentricCoords(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated, uu, vv, ww);
5063 V = ImClamp(1.0f - vv, 0.0001f, 1.0f);
5064 S = ImClamp(uu / V, 0.0001f, 1.0f);
5065 value_changed = value_changed_sv = true;
5066 }
5067 }
5068 if (!(flags & ImGuiColorEditFlags_NoOptions))
5069 OpenPopupOnItemClick("context");
5070 }
5071 else if (flags & ImGuiColorEditFlags_PickerHueBar)
5072 {
5073 // SV rectangle logic
5074 InvisibleButton("sv", ImVec2(sv_picker_size, sv_picker_size));
5075 if (IsItemActive())
5076 {
5077 S = ImSaturate((io.MousePos.x - picker_pos.x) / (sv_picker_size - 1));
5078 V = 1.0f - ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size - 1));
5079 value_changed = value_changed_sv = true;
5080 }
5081 if (!(flags & ImGuiColorEditFlags_NoOptions))
5082 OpenPopupOnItemClick("context");
5083
5084 // Hue bar logic
5085 SetCursorScreenPos(ImVec2(bar0_pos_x, picker_pos.y));
5086 InvisibleButton("hue", ImVec2(bars_width, sv_picker_size));
5087 if (IsItemActive())
5088 {
5089 H = ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size - 1));
5090 value_changed = value_changed_h = true;
5091 }
5092 }
5093
5094 // Alpha bar logic
5095 if (alpha_bar)
5096 {
5097 SetCursorScreenPos(ImVec2(bar1_pos_x, picker_pos.y));
5098 InvisibleButton("alpha", ImVec2(bars_width, sv_picker_size));
5099 if (IsItemActive())
5100 {
5101 col[3] = 1.0f - ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size - 1));
5102 value_changed = true;
5103 }
5104 }
5105 PopItemFlag(); // ImGuiItemFlags_NoNav
5106
5107 if (!(flags & ImGuiColorEditFlags_NoSidePreview))
5108 {
5109 SameLine(0, style.ItemInnerSpacing.x);
5110 BeginGroup();
5111 }
5112
5113 if (!(flags & ImGuiColorEditFlags_NoLabel))
5114 {
5115 const char* label_display_end = FindRenderedTextEnd(label);
5116 if (label != label_display_end)
5117 {
5119 SameLine(0, style.ItemInnerSpacing.x);
5120 TextEx(label, label_display_end);
5121 }
5122 }
5123
5124 if (!(flags & ImGuiColorEditFlags_NoSidePreview))
5125 {
5127 ImVec4 col_v4(col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]);
5128 if ((flags & ImGuiColorEditFlags_NoLabel))
5129 Text("%s", current_label ? current_label : "Current");
5130
5132 ColorButton("##current", col_v4, (flags & sub_flags_to_forward), ImVec2(square_sz * 3, square_sz * 2));
5133 if (ref_col != NULL)
5134 {
5135 Text("%s", original_label ? original_label : "Original");
5136 ImVec4 ref_col_v4(ref_col[0], ref_col[1], ref_col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : ref_col[3]);
5137 if (ColorButton("##original", ref_col_v4, (flags & sub_flags_to_forward), ImVec2(square_sz * 3, square_sz * 2)))
5138 {
5139 memcpy(col, ref_col, components * sizeof(float));
5140 value_changed = true;
5141 }
5142 }
5143 PopItemFlag();
5144 EndGroup();
5145 }
5146
5147 // Convert back color to RGB
5148 if (value_changed_h || value_changed_sv)
5149 {
5150 if (flags & ImGuiColorEditFlags_InputRGB)
5151 {
5152 ColorConvertHSVtoRGB(H >= 1.0f ? H - 10 * 1e-6f : H, S > 0.0f ? S : 10 * 1e-6f, V > 0.0f ? V : 1e-6f, col[0], col[1], col[2]);
5153 g.ColorEditLastHue = H;
5154 g.ColorEditLastSat = S;
5155 memcpy(g.ColorEditLastColor, col, sizeof(float) * 3);
5156 }
5157 else if (flags & ImGuiColorEditFlags_InputHSV)
5158 {
5159 col[0] = H;
5160 col[1] = S;
5161 col[2] = V;
5162 }
5163 }
5164
5165 // R,G,B and H,S,V slider color editor
5166 bool value_changed_fix_hue_wrap = false;
5167 if ((flags & ImGuiColorEditFlags_NoInputs) == 0)
5168 {
5169 PushItemWidth((alpha_bar ? bar1_pos_x : bar0_pos_x) + bars_width - picker_pos.x);
5171 ImGuiColorEditFlags sub_flags = (flags & sub_flags_to_forward) | ImGuiColorEditFlags_NoPicker;
5173 if (ColorEdit4("##rgb", col, sub_flags | ImGuiColorEditFlags_DisplayRGB))
5174 {
5175 // FIXME: Hackily differentiating using the DragInt (ActiveId != 0 && !ActiveIdAllowOverlap) vs. using the InputText or DropTarget.
5176 // For the later we don't want to run the hue-wrap canceling code. If you are well versed in HSV picker please provide your input! (See #2050)
5177 value_changed_fix_hue_wrap = (g.ActiveId != 0 && !g.ActiveIdAllowOverlap);
5178 value_changed = true;
5179 }
5181 value_changed |= ColorEdit4("##hsv", col, sub_flags | ImGuiColorEditFlags_DisplayHSV);
5183 value_changed |= ColorEdit4("##hex", col, sub_flags | ImGuiColorEditFlags_DisplayHex);
5184 PopItemWidth();
5185 }
5186
5187 // Try to cancel hue wrap (after ColorEdit4 call), if any
5188 if (value_changed_fix_hue_wrap && (flags & ImGuiColorEditFlags_InputRGB))
5189 {
5190 float new_H, new_S, new_V;
5191 ColorConvertRGBtoHSV(col[0], col[1], col[2], new_H, new_S, new_V);
5192 if (new_H <= 0 && H > 0)
5193 {
5194 if (new_V <= 0 && V != new_V)
5195 ColorConvertHSVtoRGB(H, S, new_V <= 0 ? V * 0.5f : new_V, col[0], col[1], col[2]);
5196 else if (new_S <= 0)
5197 ColorConvertHSVtoRGB(H, new_S <= 0 ? S * 0.5f : new_S, new_V, col[0], col[1], col[2]);
5198 }
5199 }
5200
5201 if (value_changed)
5202 {
5203 if (flags & ImGuiColorEditFlags_InputRGB)
5204 {
5205 R = col[0];
5206 G = col[1];
5207 B = col[2];
5208 ColorConvertRGBtoHSV(R, G, B, H, S, V);
5209 if (memcmp(g.ColorEditLastColor, col, sizeof(float) * 3) == 0) // Fix local Hue as display below will use it immediately.
5210 {
5211 if (S == 0)
5212 H = g.ColorEditLastHue;
5213 if (V == 0)
5214 S = g.ColorEditLastSat;
5215 }
5216 }
5217 else if (flags & ImGuiColorEditFlags_InputHSV)
5218 {
5219 H = col[0];
5220 S = col[1];
5221 V = col[2];
5222 ColorConvertHSVtoRGB(H, S, V, R, G, B);
5223 }
5224 }
5225
5226 const int style_alpha8 = IM_F32_TO_INT8_SAT(style.Alpha);
5227 const ImU32 col_black = IM_COL32(0,0,0,style_alpha8);
5228 const ImU32 col_white = IM_COL32(255,255,255,style_alpha8);
5229 const ImU32 col_midgrey = IM_COL32(128,128,128,style_alpha8);
5230 const ImU32 col_hues[6 + 1] = { IM_COL32(255,0,0,style_alpha8), IM_COL32(255,255,0,style_alpha8), IM_COL32(0,255,0,style_alpha8), IM_COL32(0,255,255,style_alpha8), IM_COL32(0,0,255,style_alpha8), IM_COL32(255,0,255,style_alpha8), IM_COL32(255,0,0,style_alpha8) };
5231
5232 ImVec4 hue_color_f(1, 1, 1, style.Alpha); ColorConvertHSVtoRGB(H, 1, 1, hue_color_f.x, hue_color_f.y, hue_color_f.z);
5233 ImU32 hue_color32 = ColorConvertFloat4ToU32(hue_color_f);
5234 ImU32 user_col32_striped_of_alpha = ColorConvertFloat4ToU32(ImVec4(R, G, B, style.Alpha)); // Important: this is still including the main rendering/style alpha!!
5235
5236 ImVec2 sv_cursor_pos;
5237
5239 {
5240 // Render Hue Wheel
5241 const float aeps = 0.5f / wheel_r_outer; // Half a pixel arc length in radians (2pi cancels out).
5242 const int segment_per_arc = ImMax(4, (int)wheel_r_outer / 12);
5243 for (int n = 0; n < 6; n++)
5244 {
5245 const float a0 = (n) /6.0f * 2.0f * IM_PI - aeps;
5246 const float a1 = (n+1.0f)/6.0f * 2.0f * IM_PI + aeps;
5247 const int vert_start_idx = draw_list->VtxBuffer.Size;
5248 draw_list->PathArcTo(wheel_center, (wheel_r_inner + wheel_r_outer)*0.5f, a0, a1, segment_per_arc);
5249 draw_list->PathStroke(col_white, 0, wheel_thickness);
5250 const int vert_end_idx = draw_list->VtxBuffer.Size;
5251
5252 // Paint colors over existing vertices
5253 ImVec2 gradient_p0(wheel_center.x + ImCos(a0) * wheel_r_inner, wheel_center.y + ImSin(a0) * wheel_r_inner);
5254 ImVec2 gradient_p1(wheel_center.x + ImCos(a1) * wheel_r_inner, wheel_center.y + ImSin(a1) * wheel_r_inner);
5255 ShadeVertsLinearColorGradientKeepAlpha(draw_list, vert_start_idx, vert_end_idx, gradient_p0, gradient_p1, col_hues[n], col_hues[n + 1]);
5256 }
5257
5258 // Render Cursor + preview on Hue Wheel
5259 float cos_hue_angle = ImCos(H * 2.0f * IM_PI);
5260 float sin_hue_angle = ImSin(H * 2.0f * IM_PI);
5261 ImVec2 hue_cursor_pos(wheel_center.x + cos_hue_angle * (wheel_r_inner + wheel_r_outer) * 0.5f, wheel_center.y + sin_hue_angle * (wheel_r_inner + wheel_r_outer) * 0.5f);
5262 float hue_cursor_rad = value_changed_h ? wheel_thickness * 0.65f : wheel_thickness * 0.55f;
5263 int hue_cursor_segments = ImClamp((int)(hue_cursor_rad / 1.4f), 9, 32);
5264 draw_list->AddCircleFilled(hue_cursor_pos, hue_cursor_rad, hue_color32, hue_cursor_segments);
5265 draw_list->AddCircle(hue_cursor_pos, hue_cursor_rad + 1, col_midgrey, hue_cursor_segments);
5266 draw_list->AddCircle(hue_cursor_pos, hue_cursor_rad, col_white, hue_cursor_segments);
5267
5268 // Render SV triangle (rotated according to hue)
5269 ImVec2 tra = wheel_center + ImRotate(triangle_pa, cos_hue_angle, sin_hue_angle);
5270 ImVec2 trb = wheel_center + ImRotate(triangle_pb, cos_hue_angle, sin_hue_angle);
5271 ImVec2 trc = wheel_center + ImRotate(triangle_pc, cos_hue_angle, sin_hue_angle);
5272 ImVec2 uv_white = GetFontTexUvWhitePixel();
5273 draw_list->PrimReserve(6, 6);
5274 draw_list->PrimVtx(tra, uv_white, hue_color32);
5275 draw_list->PrimVtx(trb, uv_white, hue_color32);
5276 draw_list->PrimVtx(trc, uv_white, col_white);
5277 draw_list->PrimVtx(tra, uv_white, 0);
5278 draw_list->PrimVtx(trb, uv_white, col_black);
5279 draw_list->PrimVtx(trc, uv_white, 0);
5280 draw_list->AddTriangle(tra, trb, trc, col_midgrey, 1.5f);
5281 sv_cursor_pos = ImLerp(ImLerp(trc, tra, ImSaturate(S)), trb, ImSaturate(1 - V));
5282 }
5283 else if (flags & ImGuiColorEditFlags_PickerHueBar)
5284 {
5285 // Render SV Square
5286 draw_list->AddRectFilledMultiColor(picker_pos, picker_pos + ImVec2(sv_picker_size, sv_picker_size), col_white, hue_color32, hue_color32, col_white);
5287 draw_list->AddRectFilledMultiColor(picker_pos, picker_pos + ImVec2(sv_picker_size, sv_picker_size), 0, 0, col_black, col_black);
5288 RenderFrameBorder(picker_pos, picker_pos + ImVec2(sv_picker_size, sv_picker_size), 0.0f);
5289 sv_cursor_pos.x = ImClamp(IM_ROUND(picker_pos.x + ImSaturate(S) * sv_picker_size), picker_pos.x + 2, picker_pos.x + sv_picker_size - 2); // Sneakily prevent the circle to stick out too much
5290 sv_cursor_pos.y = ImClamp(IM_ROUND(picker_pos.y + ImSaturate(1 - V) * sv_picker_size), picker_pos.y + 2, picker_pos.y + sv_picker_size - 2);
5291
5292 // Render Hue Bar
5293 for (int i = 0; i < 6; ++i)
5294 draw_list->AddRectFilledMultiColor(ImVec2(bar0_pos_x, picker_pos.y + i * (sv_picker_size / 6)), ImVec2(bar0_pos_x + bars_width, picker_pos.y + (i + 1) * (sv_picker_size / 6)), col_hues[i], col_hues[i], col_hues[i + 1], col_hues[i + 1]);
5295 float bar0_line_y = IM_ROUND(picker_pos.y + H * sv_picker_size);
5296 RenderFrameBorder(ImVec2(bar0_pos_x, picker_pos.y), ImVec2(bar0_pos_x + bars_width, picker_pos.y + sv_picker_size), 0.0f);
5297 RenderArrowsForVerticalBar(draw_list, ImVec2(bar0_pos_x - 1, bar0_line_y), ImVec2(bars_triangles_half_sz + 1, bars_triangles_half_sz), bars_width + 2.0f, style.Alpha);
5298 }
5299
5300 // Render cursor/preview circle (clamp S/V within 0..1 range because floating points colors may lead HSV values to be out of range)
5301 float sv_cursor_rad = value_changed_sv ? 10.0f : 6.0f;
5302 draw_list->AddCircleFilled(sv_cursor_pos, sv_cursor_rad, user_col32_striped_of_alpha, 12);
5303 draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad + 1, col_midgrey, 12);
5304 draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad, col_white, 12);
5305
5306 // Render alpha bar
5307 if (alpha_bar)
5308 {
5309 float alpha = ImSaturate(col[3]);
5310 ImRect bar1_bb(bar1_pos_x, picker_pos.y, bar1_pos_x + bars_width, picker_pos.y + sv_picker_size);
5311 RenderColorRectWithAlphaCheckerboard(draw_list, bar1_bb.Min, bar1_bb.Max, 0, bar1_bb.GetWidth() / 2.0f, ImVec2(0.0f, 0.0f));
5312 draw_list->AddRectFilledMultiColor(bar1_bb.Min, bar1_bb.Max, user_col32_striped_of_alpha, user_col32_striped_of_alpha, user_col32_striped_of_alpha & ~IM_COL32_A_MASK, user_col32_striped_of_alpha & ~IM_COL32_A_MASK);
5313 float bar1_line_y = IM_ROUND(picker_pos.y + (1.0f - alpha) * sv_picker_size);
5314 RenderFrameBorder(bar1_bb.Min, bar1_bb.Max, 0.0f);
5315 RenderArrowsForVerticalBar(draw_list, ImVec2(bar1_pos_x - 1, bar1_line_y), ImVec2(bars_triangles_half_sz + 1, bars_triangles_half_sz), bars_width + 2.0f, style.Alpha);
5316 }
5317
5318 EndGroup();
5319
5320 if (value_changed && memcmp(backup_initial_col, col, components * sizeof(float)) == 0)
5321 value_changed = false;
5322 if (value_changed)
5323 MarkItemEdited(window->DC.LastItemId);
5324
5325 PopID();
5326
5327 return value_changed;
5328}
void ImTriangleBarycentricCoords(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &p, float &out_u, float &out_v, float &out_w)
Definition imgui.cpp:1268
ImVec2 ImTriangleClosestPoint(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c, const ImVec2 &p)
Definition imgui.cpp:1279
#define IM_COL32(R, G, B, A)
Definition imgui.h:2177
#define IM_COL32_A_MASK
Definition imgui.h:2175
@ ImGuiColorEditFlags_NoSidePreview
Definition imgui.h:1530
@ ImGuiColorEditFlags__OptionsDefault
Definition imgui.h:1551
@ ImGuiColorEditFlags_PickerHueWheel
Definition imgui.h:1545
@ ImGuiColorEditFlags_PickerHueBar
Definition imgui.h:1544
static ImVec2 ImRotate(const ImVec2 &v, float cos_a, float sin_a)
Definition imgui_internal.h:432
static T ImLerp(T a, T b, float t)
Definition imgui_internal.h:412
#define ImCos(X)
Definition imgui_internal.h:384
@ ImGuiItemFlags_NoNavDefaultFocus
Definition imgui_internal.h:727
@ ImGuiItemFlags_NoNav
Definition imgui_internal.h:726
#define ImSin(X)
Definition imgui_internal.h:385
#define ImAtan2(Y, X)
Definition imgui_internal.h:387
#define IM_PI
Definition imgui_internal.h:222
static float ImSaturate(float f)
Definition imgui_internal.h:423
static void RenderArrowsForVerticalBar(ImDrawList *draw_list, ImVec2 pos, ImVec2 half_sz, float bar_w, float alpha)
Definition imgui_widgets.cpp:4942
IMGUI_API bool InvisibleButton(const char *str_id, const ImVec2 &size, ImGuiButtonFlags flags=0)
Definition imgui_widgets.cpp:733
IMGUI_API ImVec2 GetFontTexUvWhitePixel()
Definition imgui.cpp:6942
IMGUI_API void SetCursorScreenPos(const ImVec2 &pos)
Definition imgui.cpp:7484
IMGUI_API void ColorPickerOptionsPopup(const float *ref_col, ImGuiColorEditFlags flags)
Definition imgui_widgets.cpp:5522
IMGUI_API void Text(const char *fmt,...) IM_FMTARGS(1)
Definition imgui_widgets.cpp:260
IMGUI_API void PopItemFlag()
Definition imgui.cpp:6563
IMGUI_API ImU32 ColorConvertFloat4ToU32(const ImVec4 &in)
Definition imgui.cpp:1809
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled)
Definition imgui.cpp:6550
IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha(ImDrawList *draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1)
Definition imgui_draw.cpp:1846
IMGUI_API void PopItemWidth()
Definition imgui.cpp:7587
Definition imgui.h:2348
IMGUI_API void AddTriangle(const ImVec2 &p1, const ImVec2 &p2, const ImVec2 &p3, ImU32 col, float thickness=1.0f)
Definition imgui_draw.cpp:1444
void PrimVtx(const ImVec2 &pos, const ImVec2 &uv, ImU32 col)
Definition imgui.h:2450
void PathStroke(ImU32 col, ImDrawFlags flags=0, float thickness=1.0f)
Definition imgui.h:2418
IMGUI_API void AddRectFilledMultiColor(const ImVec2 &p_min, const ImVec2 &p_max, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left)
Definition imgui_draw.cpp:1405
IMGUI_API void PrimReserve(int idx_count, int vtx_count)
Definition imgui_draw.cpp:616
IMGUI_API void AddCircle(const ImVec2 &center, float radius, ImU32 col, int num_segments=0, float thickness=1.0f)
Definition imgui_draw.cpp:1466
ImVector< ImDrawVert > VtxBuffer
Definition imgui.h:2352
IMGUI_API void PathArcTo(const ImVec2 &center, float radius, float a_min, float a_max, int num_segments=0)
Definition imgui_draw.cpp:1163
Definition imgui.h:1775
ImVec2 MouseClickedPos[5]
Definition imgui.h:1881

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdAllowOverlap, ImDrawList::AddCircle(), ImDrawList::AddCircleFilled(), ImDrawList::AddRectFilledMultiColor(), ImDrawList::AddTriangle(), BeginGroup(), CalcItemWidth(), ImGuiNextItemData::ClearFlags(), col(), ColorButton(), ColorConvertFloat4ToU32(), ColorConvertHSVtoRGB(), ColorConvertRGBtoHSV(), ColorEdit4(), ImGuiContext::ColorEditLastColor, ImGuiContext::ColorEditLastHue, ImGuiContext::ColorEditLastSat, ImGuiContext::ColorEditOptions, ColorPickerOptionsPopup(), ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, EndGroup(), FindRenderedTextEnd(), GetCurrentWindow(), GetFontTexUvWhitePixel(), GetFrameHeight(), ImRect::GetWidth(), GImGui, IM_ASSERT, IM_COL32, IM_COL32_A_MASK, IM_F32_TO_INT8_SAT, IM_FLOOR, IM_PI, IM_ROUND, ImAtan2, ImClamp(), ImCos, ImGuiColorEditFlags__DataTypeMask, ImGuiColorEditFlags__DisplayMask, ImGuiColorEditFlags__InputMask, ImGuiColorEditFlags__OptionsDefault, ImGuiColorEditFlags__PickerMask, ImGuiColorEditFlags_AlphaBar, ImGuiColorEditFlags_AlphaPreview, ImGuiColorEditFlags_AlphaPreviewHalf, ImGuiColorEditFlags_DisplayHex, ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditFlags_HDR, ImGuiColorEditFlags_InputHSV, ImGuiColorEditFlags_InputRGB, ImGuiColorEditFlags_NoAlpha, ImGuiColorEditFlags_NoInputs, ImGuiColorEditFlags_NoLabel, ImGuiColorEditFlags_NoOptions, ImGuiColorEditFlags_NoPicker, ImGuiColorEditFlags_NoSidePreview, ImGuiColorEditFlags_NoSmallPreview, ImGuiColorEditFlags_NoTooltip, ImGuiColorEditFlags_PickerHueBar, ImGuiColorEditFlags_PickerHueWheel, ImGuiItemFlags_NoNav, ImGuiItemFlags_NoNavDefaultFocus, ImIsPowerOfTwo(), ImLengthSqr(), ImLerp(), ImMax(), ImRotate(), ImSaturate(), ImSin, ImTriangleBarycentricCoords(), ImTriangleClosestPoint(), ImTriangleContainsPoint(), InvisibleButton(), ImGuiContext::IO, IsItemActive(), ImGuiWindowTempData::LastItemId, MarkItemEdited(), ImRect::Max, ImRect::Min, ImGuiIO::MouseClickedPos, ImGuiIO::MousePos, ImGuiContext::NextItemData, OpenPopupOnItemClick(), ImDrawList::PathArcTo(), ImDrawList::PathStroke(), PopID(), PopItemFlag(), PopItemWidth(), ImDrawList::PrimReserve(), ImDrawList::PrimVtx(), PushID(), PushItemFlag(), PushItemWidth(), RenderArrowsForVerticalBar(), RenderColorRectWithAlphaCheckerboard(), RenderFrameBorder(), SameLine(), SetCursorScreenPos(), ShadeVertsLinearColorGradientKeepAlpha(), ImVector< T >::Size, ImGuiWindow::SkipItems, ImGuiContext::Style, style, Text(), TextEx(), ImDrawList::VtxBuffer, ImVec2::x, ImVec4::x, ImVec2::y, ImVec4::y, and ImVec4::z.

Referenced by ColorEdit4(), ColorPicker3(), ColorPickerOptionsPopup(), and ShowDemoWindowWidgets().

+ Here is the caller graph for this function:

◆ ColorPickerOptionsPopup()

void ImGui::ColorPickerOptionsPopup ( const float *  ref_col,
ImGuiColorEditFlags  flags 
)
5523{
5524 bool allow_opt_picker = !(flags & ImGuiColorEditFlags__PickerMask);
5525 bool allow_opt_alpha_bar = !(flags & ImGuiColorEditFlags_NoAlpha) && !(flags & ImGuiColorEditFlags_AlphaBar);
5526 if ((!allow_opt_picker && !allow_opt_alpha_bar) || !BeginPopup("context"))
5527 return;
5528 ImGuiContext& g = *GImGui;
5529 if (allow_opt_picker)
5530 {
5531 ImVec2 picker_size(g.FontSize * 8, ImMax(g.FontSize * 8 - (GetFrameHeight() + g.Style.ItemInnerSpacing.x), 1.0f)); // FIXME: Picker size copied from main picker function
5532 PushItemWidth(picker_size.x);
5533 for (int picker_type = 0; picker_type < 2; picker_type++)
5534 {
5535 // Draw small/thumbnail version of each picker type (over an invisible button for selection)
5536 if (picker_type > 0) Separator();
5537 PushID(picker_type);
5539 if (picker_type == 0) picker_flags |= ImGuiColorEditFlags_PickerHueBar;
5540 if (picker_type == 1) picker_flags |= ImGuiColorEditFlags_PickerHueWheel;
5541 ImVec2 backup_pos = GetCursorScreenPos();
5542 if (Selectable("##selectable", false, 0, picker_size)) // By default, Selectable() is closing popup
5543 g.ColorEditOptions = (g.ColorEditOptions & ~ImGuiColorEditFlags__PickerMask) | (picker_flags & ImGuiColorEditFlags__PickerMask);
5544 SetCursorScreenPos(backup_pos);
5545 ImVec4 previewing_ref_col;
5546 memcpy(&previewing_ref_col, ref_col, sizeof(float) * ((picker_flags & ImGuiColorEditFlags_NoAlpha) ? 3 : 4));
5547 ColorPicker4("##previewing_picker", &previewing_ref_col.x, picker_flags);
5548 PopID();
5549 }
5550 PopItemWidth();
5551 }
5552 if (allow_opt_alpha_bar)
5553 {
5554 if (allow_opt_picker) Separator();
5556 }
5557 EndPopup();
5558}
IMGUI_API bool CheckboxFlags(const char *label, int *flags, int flags_value)
Definition imgui_widgets.cpp:1157
IMGUI_API ImVec2 GetCursorScreenPos()
Definition imgui.cpp:7478
ImVec2 ItemInnerSpacing
Definition imgui.h:1737

References BeginPopup(), CheckboxFlags(), ImGuiContext::ColorEditOptions, ColorPicker4(), EndPopup(), ImGuiContext::FontSize, GetCursorScreenPos(), GetFrameHeight(), GImGui, ImGuiColorEditFlags__PickerMask, ImGuiColorEditFlags_AlphaBar, ImGuiColorEditFlags_NoAlpha, ImGuiColorEditFlags_NoInputs, ImGuiColorEditFlags_NoLabel, ImGuiColorEditFlags_NoOptions, ImGuiColorEditFlags_NoSidePreview, ImGuiColorEditFlags_PickerHueBar, ImGuiColorEditFlags_PickerHueWheel, ImMax(), ImGuiStyle::ItemInnerSpacing, PopID(), PopItemWidth(), PushID(), PushItemWidth(), Selectable(), Separator(), SetCursorScreenPos(), ImGuiContext::Style, ImVec2::x, and ImVec4::x.

Referenced by ColorPicker4().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ColorTooltip()

void ImGui::ColorTooltip ( const char *  text,
const float *  col,
ImGuiColorEditFlags  flags 
)
5438{
5439 ImGuiContext& g = *GImGui;
5440
5442 const char* text_end = text ? FindRenderedTextEnd(text, NULL) : text;
5443 if (text_end > text)
5444 {
5445 TextEx(text, text_end);
5446 Separator();
5447 }
5448
5449 ImVec2 sz(g.FontSize * 3 + g.Style.FramePadding.y * 2, g.FontSize * 3 + g.Style.FramePadding.y * 2);
5450 ImVec4 cf(col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]);
5451 int cr = IM_F32_TO_INT8_SAT(col[0]), cg = IM_F32_TO_INT8_SAT(col[1]), cb = IM_F32_TO_INT8_SAT(col[2]), ca = (flags & ImGuiColorEditFlags_NoAlpha) ? 255 : IM_F32_TO_INT8_SAT(col[3]);
5453 SameLine();
5455 {
5456 if (flags & ImGuiColorEditFlags_NoAlpha)
5457 Text("#%02X%02X%02X\nR: %d, G: %d, B: %d\n(%.3f, %.3f, %.3f)", cr, cg, cb, cr, cg, cb, col[0], col[1], col[2]);
5458 else
5459 Text("#%02X%02X%02X%02X\nR:%d, G:%d, B:%d, A:%d\n(%.3f, %.3f, %.3f, %.3f)", cr, cg, cb, ca, cr, cg, cb, ca, col[0], col[1], col[2], col[3]);
5460 }
5461 else if (flags & ImGuiColorEditFlags_InputHSV)
5462 {
5463 if (flags & ImGuiColorEditFlags_NoAlpha)
5464 Text("H: %.3f, S: %.3f, V: %.3f", col[0], col[1], col[2]);
5465 else
5466 Text("H: %.3f, S: %.3f, V: %.3f, A: %.3f", col[0], col[1], col[2], col[3]);
5467 }
5468 EndTooltip();
5469}
IMGUI_API void EndTooltip()
Definition imgui.cpp:8045

References BeginTooltipEx(), col(), ColorButton(), EndTooltip(), FindRenderedTextEnd(), ImGuiContext::FontSize, ImGuiStyle::FramePadding, GImGui, IM_F32_TO_INT8_SAT, ImGuiColorEditFlags__InputMask, ImGuiColorEditFlags_AlphaPreview, ImGuiColorEditFlags_AlphaPreviewHalf, ImGuiColorEditFlags_InputHSV, ImGuiColorEditFlags_InputRGB, ImGuiColorEditFlags_NoAlpha, ImGuiColorEditFlags_NoTooltip, ImGuiTooltipFlags_OverridePreviousTooltip, SameLine(), Separator(), ImGuiContext::Style, Text(), TextEx(), and ImVec2::y.

Referenced by ColorButton().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Columns()

void ImGui::Columns ( int  count = 1,
const char *  id = NULL,
bool  border = true 
)
4009{
4010 ImGuiWindow* window = GetCurrentWindow();
4011 IM_ASSERT(columns_count >= 1);
4012
4014 //flags |= ImGuiOldColumnFlags_NoPreserveWidths; // NB: Legacy behavior
4015 ImGuiOldColumns* columns = window->DC.CurrentColumns;
4016 if (columns != NULL && columns->Count == columns_count && columns->Flags == flags)
4017 return;
4018
4019 if (columns != NULL)
4020 EndColumns();
4021
4022 if (columns_count != 1)
4023 BeginColumns(id, columns_count, flags);
4024}
@ ImGuiOldColumnFlags_NoBorder
Definition imgui_internal.h:1157
int ImGuiOldColumnFlags
Definition imgui_internal.h:145
IMGUI_API void BeginColumns(const char *str_id, int count, ImGuiOldColumnFlags flags=0)
Definition imgui_tables.cpp:3800
IMGUI_API void EndColumns()
Definition imgui_tables.cpp:3932

References BeginColumns(), ImGuiOldColumns::Count, ImGuiWindowTempData::CurrentColumns, ImGuiWindow::DC, EndColumns(), ImGuiOldColumns::Flags, GetCurrentWindow(), IM_ASSERT, and ImGuiOldColumnFlags_NoBorder.

Referenced by GetColumnOffset(), SetColumnOffset(), ShowDemoWindowColumns(), and ShowDemoWindowLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Combo() [1/5]

IMGUI_API bool ImGui::Combo ( const char *  label,
int *  current_item,
bool(*)(void *data, int idx, const char **out_text)  items_getter,
void data,
int  items_count,
int  popup_max_height_in_items = -1 
)

◆ Combo() [2/5]

bool ImGui::Combo ( const char *  label,
int *  current_item,
const char *const  items[],
int  items_count,
int  popup_max_height_in_items = -1 
)
1755{
1756 const bool value_changed = Combo(label, current_item, Items_ArrayGetter, (void*)items, items_count, height_in_items);
1757 return value_changed;
1758}
static bool Items_ArrayGetter(void *data, int idx, const char **out_text)
Definition imgui_widgets.cpp:1680
IMGUI_API bool Combo(const char *label, int *current_item, const char *const items[], int items_count, int popup_max_height_in_items=-1)
Definition imgui_widgets.cpp:1754

References Combo(), and Items_ArrayGetter().

Referenced by Combo(), Combo(), Combo(), Combo(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), ShowDemoWindowLayout(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppConstrainedResize(), ShowExampleAppLongText(), ShowExampleMenuFile(), ShowMetricsWindow(), ShowStyleEditor(), and ShowStyleSelector().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Combo() [3/5]

bool ImGui::Combo ( const char *  label,
int *  current_item,
const char *  items_separated_by_zeros,
int  popup_max_height_in_items = -1 
)
1762{
1763 int items_count = 0;
1764 const char* p = items_separated_by_zeros; // FIXME-OPT: Avoid computing this, or at least only when combo is open
1765 while (*p)
1766 {
1767 p += strlen(p) + 1;
1768 items_count++;
1769 }
1770 bool value_changed = Combo(label, current_item, Items_SingleStringGetter, (void*)items_separated_by_zeros, items_count, height_in_items);
1771 return value_changed;
1772}
static bool Items_SingleStringGetter(void *data, int idx, const char **out_text)
Definition imgui_widgets.cpp:1689

References Combo(), and Items_SingleStringGetter().

+ Here is the call graph for this function:

◆ Combo() [4/5]

bool ImGui::Combo ( const char *  label,
int *  idx,
std::function< const char *(int)>  getter,
int  items_count 
)
inline
42{
43 auto func = [](void* data, int i, const char** out_text) {
44 auto &getter = *reinterpret_cast<std::function<const char *(int)> *>(data);
45 const char *s = getter(i);
46 if (s) { *out_text = s; return true; }
47 else { return false; }
48 };
49 return Combo(label, idx, func, reinterpret_cast<void *>(&getter), items_count);
50}

References Combo().

+ Here is the call graph for this function:

◆ Combo() [5/5]

bool ImGui::Combo ( const char *  label,
int *  idx,
std::vector< std::string > &  values 
)
inline
35{
36 if (values.empty()) { return false; }
37 return Combo(label, idx, vector_getter,
38 static_cast<void*>(&values), values.size());
39}

References Combo(), and vector_getter.

+ Here is the call graph for this function:

◆ CreateContext()

ImGuiContext * ImGui::CreateContext ( ImFontAtlas shared_font_atlas = NULL)
3391{
3392 ImGuiContext* ctx = IM_NEW(ImGuiContext)(shared_font_atlas);
3393 if (GImGui == NULL)
3394 SetCurrentContext(ctx);
3395 Initialize(ctx);
3396 return ctx;
3397}
#define IM_NEW(_TYPE)
Definition imgui.h:1637
IMGUI_API void SetCurrentContext(ImGuiContext *ctx)
Definition imgui.cpp:3366
IMGUI_API void Initialize(ImGuiContext *context)
Definition imgui.cpp:4126

References GImGui, IM_NEW, Initialize(), and SetCurrentContext().

Referenced by Slic3r::GUI::ImGuiWrapper::ImGuiWrapper(), and igl::opengl::glfw::imgui::ImGuiMenu::init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateNewWindowSettings()

ImGuiWindowSettings * ImGui::CreateNewWindowSettings ( const char *  name)
10374{
10375 ImGuiContext& g = *GImGui;
10376
10377#if !IMGUI_DEBUG_INI_SETTINGS
10378 // Skip to the "###" marker if any. We don't skip past to match the behavior of GetID()
10379 // Preserve the full string when IMGUI_DEBUG_INI_SETTINGS is set to make .ini inspection easier.
10380 if (const char* p = strstr(name, "###"))
10381 name = p;
10382#endif
10383 const size_t name_len = strlen(name);
10384
10385 // Allocate chunk
10386 const size_t chunk_size = sizeof(ImGuiWindowSettings) + name_len + 1;
10387 ImGuiWindowSettings* settings = g.SettingsWindows.alloc_chunk(chunk_size);
10389 settings->ID = ImHashStr(name, name_len);
10390 memcpy(settings->GetName(), name, name_len + 1); // Store with zero terminator
10391
10392 return settings;
10393}
#define IM_PLACEMENT_NEW(_PTR)
Definition imgui.h:1636
T * alloc_chunk(size_t sz)
Definition imgui_internal.h:641
ImChunkStream< ImGuiWindowSettings > SettingsWindows
Definition imgui_internal.h:1563
Definition imgui_internal.h:1261
ImGuiID ID
Definition imgui_internal.h:1262
char * GetName()
Definition imgui_internal.h:1269

References ImChunkStream< T >::alloc_chunk(), ImGuiWindowSettings::GetName(), GImGui, ImGuiWindowSettings::ID, IM_PLACEMENT_NEW, ImHashStr(), and ImGuiContext::SettingsWindows.

Referenced by FindOrCreateWindowSettings(), and WindowSettingsHandler_WriteAll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DataTypeApplyOp()

void ImGui::DataTypeApplyOp ( ImGuiDataType  data_type,
int  op,
void output,
const void arg_1,
const void arg_2 
)
1861{
1862 IM_ASSERT(op == '+' || op == '-');
1863 switch (data_type)
1864 {
1865 case ImGuiDataType_S8:
1866 if (op == '+') { *(ImS8*)output = ImAddClampOverflow(*(const ImS8*)arg1, *(const ImS8*)arg2, IM_S8_MIN, IM_S8_MAX); }
1867 if (op == '-') { *(ImS8*)output = ImSubClampOverflow(*(const ImS8*)arg1, *(const ImS8*)arg2, IM_S8_MIN, IM_S8_MAX); }
1868 return;
1869 case ImGuiDataType_U8:
1870 if (op == '+') { *(ImU8*)output = ImAddClampOverflow(*(const ImU8*)arg1, *(const ImU8*)arg2, IM_U8_MIN, IM_U8_MAX); }
1871 if (op == '-') { *(ImU8*)output = ImSubClampOverflow(*(const ImU8*)arg1, *(const ImU8*)arg2, IM_U8_MIN, IM_U8_MAX); }
1872 return;
1873 case ImGuiDataType_S16:
1874 if (op == '+') { *(ImS16*)output = ImAddClampOverflow(*(const ImS16*)arg1, *(const ImS16*)arg2, IM_S16_MIN, IM_S16_MAX); }
1875 if (op == '-') { *(ImS16*)output = ImSubClampOverflow(*(const ImS16*)arg1, *(const ImS16*)arg2, IM_S16_MIN, IM_S16_MAX); }
1876 return;
1877 case ImGuiDataType_U16:
1878 if (op == '+') { *(ImU16*)output = ImAddClampOverflow(*(const ImU16*)arg1, *(const ImU16*)arg2, IM_U16_MIN, IM_U16_MAX); }
1879 if (op == '-') { *(ImU16*)output = ImSubClampOverflow(*(const ImU16*)arg1, *(const ImU16*)arg2, IM_U16_MIN, IM_U16_MAX); }
1880 return;
1881 case ImGuiDataType_S32:
1882 if (op == '+') { *(ImS32*)output = ImAddClampOverflow(*(const ImS32*)arg1, *(const ImS32*)arg2, IM_S32_MIN, IM_S32_MAX); }
1883 if (op == '-') { *(ImS32*)output = ImSubClampOverflow(*(const ImS32*)arg1, *(const ImS32*)arg2, IM_S32_MIN, IM_S32_MAX); }
1884 return;
1885 case ImGuiDataType_U32:
1886 if (op == '+') { *(ImU32*)output = ImAddClampOverflow(*(const ImU32*)arg1, *(const ImU32*)arg2, IM_U32_MIN, IM_U32_MAX); }
1887 if (op == '-') { *(ImU32*)output = ImSubClampOverflow(*(const ImU32*)arg1, *(const ImU32*)arg2, IM_U32_MIN, IM_U32_MAX); }
1888 return;
1889 case ImGuiDataType_S64:
1890 if (op == '+') { *(ImS64*)output = ImAddClampOverflow(*(const ImS64*)arg1, *(const ImS64*)arg2, IM_S64_MIN, IM_S64_MAX); }
1891 if (op == '-') { *(ImS64*)output = ImSubClampOverflow(*(const ImS64*)arg1, *(const ImS64*)arg2, IM_S64_MIN, IM_S64_MAX); }
1892 return;
1893 case ImGuiDataType_U64:
1894 if (op == '+') { *(ImU64*)output = ImAddClampOverflow(*(const ImU64*)arg1, *(const ImU64*)arg2, IM_U64_MIN, IM_U64_MAX); }
1895 if (op == '-') { *(ImU64*)output = ImSubClampOverflow(*(const ImU64*)arg1, *(const ImU64*)arg2, IM_U64_MIN, IM_U64_MAX); }
1896 return;
1898 if (op == '+') { *(float*)output = *(const float*)arg1 + *(const float*)arg2; }
1899 if (op == '-') { *(float*)output = *(const float*)arg1 - *(const float*)arg2; }
1900 return;
1902 if (op == '+') { *(double*)output = *(const double*)arg1 + *(const double*)arg2; }
1903 if (op == '-') { *(double*)output = *(const double*)arg1 - *(const double*)arg2; }
1904 return;
1905 case ImGuiDataType_COUNT: break;
1906 }
1907 IM_ASSERT(0);
1908}
@ ImGuiDataType_Float
Definition imgui.h:1287
@ ImGuiDataType_U32
Definition imgui.h:1284
@ ImGuiDataType_U16
Definition imgui.h:1282
@ ImGuiDataType_S8
Definition imgui.h:1279
@ ImGuiDataType_U64
Definition imgui.h:1286
@ ImGuiDataType_S32
Definition imgui.h:1283
@ ImGuiDataType_COUNT
Definition imgui.h:1289
@ ImGuiDataType_S16
Definition imgui.h:1281
@ ImGuiDataType_S64
Definition imgui.h:1285
@ ImGuiDataType_Double
Definition imgui.h:1288
@ ImGuiDataType_U8
Definition imgui.h:1280
unsigned char ImU8
Definition imgui.h:225
unsigned short ImU16
Definition imgui.h:227
signed long long ImS64
Definition imgui.h:238
signed int ImS32
Definition imgui.h:228
static T ImAddClampOverflow(T a, T b, T mn, T mx)
Definition imgui_internal.h:414
static T ImSubClampOverflow(T a, T b, T mn, T mx)
Definition imgui_internal.h:415
static const unsigned short IM_U16_MIN
Definition imgui_widgets.cpp:104
static const ImS64 IM_S64_MIN
Definition imgui_widgets.cpp:114
static const ImU64 IM_U64_MAX
Definition imgui_widgets.cpp:121
static const unsigned char IM_U8_MIN
Definition imgui_widgets.cpp:100
static const ImU32 IM_U32_MIN
Definition imgui_widgets.cpp:108
static const ImU64 IM_U64_MIN
Definition imgui_widgets.cpp:117
static const ImS64 IM_S64_MAX
Definition imgui_widgets.cpp:115
static const signed short IM_S16_MIN
Definition imgui_widgets.cpp:102
static const signed char IM_S8_MIN
Definition imgui_widgets.cpp:98
static const signed short IM_S16_MAX
Definition imgui_widgets.cpp:103
static const ImS32 IM_S32_MIN
Definition imgui_widgets.cpp:106
static const ImS32 IM_S32_MAX
Definition imgui_widgets.cpp:107
static const signed char IM_S8_MAX
Definition imgui_widgets.cpp:99
static const unsigned short IM_U16_MAX
Definition imgui_widgets.cpp:105
static const unsigned char IM_U8_MAX
Definition imgui_widgets.cpp:101
static const ImU32 IM_U32_MAX
Definition imgui_widgets.cpp:109

References IM_ASSERT, IM_S16_MAX, IM_S16_MIN, IM_S32_MAX, IM_S32_MIN, IM_S64_MAX, IM_S64_MIN, IM_S8_MAX, IM_S8_MIN, IM_U16_MAX, IM_U16_MIN, IM_U32_MAX, IM_U32_MIN, IM_U64_MAX, IM_U64_MIN, IM_U8_MAX, IM_U8_MIN, ImAddClampOverflow(), ImGuiDataType_COUNT, ImGuiDataType_Double, ImGuiDataType_Float, ImGuiDataType_S16, ImGuiDataType_S32, ImGuiDataType_S64, ImGuiDataType_S8, ImGuiDataType_U16, ImGuiDataType_U32, ImGuiDataType_U64, ImGuiDataType_U8, and ImSubClampOverflow().

Referenced by InputScalar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DataTypeApplyOpFromText()

bool ImGui::DataTypeApplyOpFromText ( const char *  buf,
const char *  initial_value_buf,
ImGuiDataType  data_type,
void p_data,
const char *  format 
)
1913{
1914 while (ImCharIsBlankA(*buf))
1915 buf++;
1916
1917 // We don't support '-' op because it would conflict with inputing negative value.
1918 // Instead you can use +-100 to subtract from an existing value
1919 char op = buf[0];
1920 if (op == '+' || op == '*' || op == '/')
1921 {
1922 buf++;
1923 while (ImCharIsBlankA(*buf))
1924 buf++;
1925 }
1926 else
1927 {
1928 op = 0;
1929 }
1930 if (!buf[0])
1931 return false;
1932
1933 // Copy the value in an opaque buffer so we can compare at the end of the function if it changed at all.
1934 const ImGuiDataTypeInfo* type_info = DataTypeGetInfo(data_type);
1935 ImGuiDataTypeTempStorage data_backup;
1936 memcpy(&data_backup, p_data, type_info->Size);
1937
1938 if (format == NULL)
1939 format = type_info->ScanFmt;
1940
1941 // FIXME-LEGACY: The aim is to remove those operators and write a proper expression evaluator at some point..
1942 int arg1i = 0;
1943 if (data_type == ImGuiDataType_S32)
1944 {
1945 int* v = (int*)p_data;
1946 int arg0i = *v;
1947 float arg1f = 0.0f;
1948 if (op && sscanf(initial_value_buf, format, &arg0i) < 1)
1949 return false;
1950 // Store operand in a float so we can use fractional value for multipliers (*1.1), but constant always parsed as integer so we can fit big integers (e.g. 2000000003) past float precision
1951 if (op == '+') { if (sscanf(buf, "%d", &arg1i)) *v = (int)(arg0i + arg1i); } // Add (use "+-" to subtract)
1952 else if (op == '*') { if (sscanf(buf, "%f", &arg1f)) *v = (int)(arg0i * arg1f); } // Multiply
1953 else if (op == '/') { if (sscanf(buf, "%f", &arg1f) && arg1f != 0.0f) *v = (int)(arg0i / arg1f); } // Divide
1954 else { if (sscanf(buf, format, &arg1i) == 1) *v = arg1i; } // Assign constant
1955 }
1956 else if (data_type == ImGuiDataType_Float)
1957 {
1958 // For floats we have to ignore format with precision (e.g. "%.2f") because sscanf doesn't take them in
1959 format = "%f";
1960 float* v = (float*)p_data;
1961 float arg0f = *v, arg1f = 0.0f;
1962 if (op && sscanf(initial_value_buf, format, &arg0f) < 1)
1963 return false;
1964 if (sscanf(buf, format, &arg1f) < 1)
1965 return false;
1966 if (op == '+') { *v = arg0f + arg1f; } // Add (use "+-" to subtract)
1967 else if (op == '*') { *v = arg0f * arg1f; } // Multiply
1968 else if (op == '/') { if (arg1f != 0.0f) *v = arg0f / arg1f; } // Divide
1969 else { *v = arg1f; } // Assign constant
1970 }
1971 else if (data_type == ImGuiDataType_Double)
1972 {
1973 format = "%lf"; // scanf differentiate float/double unlike printf which forces everything to double because of ellipsis
1974 double* v = (double*)p_data;
1975 double arg0f = *v, arg1f = 0.0;
1976 if (op && sscanf(initial_value_buf, format, &arg0f) < 1)
1977 return false;
1978 if (sscanf(buf, format, &arg1f) < 1)
1979 return false;
1980 if (op == '+') { *v = arg0f + arg1f; } // Add (use "+-" to subtract)
1981 else if (op == '*') { *v = arg0f * arg1f; } // Multiply
1982 else if (op == '/') { if (arg1f != 0.0f) *v = arg0f / arg1f; } // Divide
1983 else { *v = arg1f; } // Assign constant
1984 }
1985 else if (data_type == ImGuiDataType_U32 || data_type == ImGuiDataType_S64 || data_type == ImGuiDataType_U64)
1986 {
1987 // All other types assign constant
1988 // We don't bother handling support for legacy operators since they are a little too crappy. Instead we will later implement a proper expression evaluator in the future.
1989 if (sscanf(buf, format, p_data) < 1)
1990 return false;
1991 }
1992 else
1993 {
1994 // Small types need a 32-bit buffer to receive the result from scanf()
1995 int v32;
1996 if (sscanf(buf, format, &v32) < 1)
1997 return false;
1998 if (data_type == ImGuiDataType_S8)
1999 *(ImS8*)p_data = (ImS8)ImClamp(v32, (int)IM_S8_MIN, (int)IM_S8_MAX);
2000 else if (data_type == ImGuiDataType_U8)
2001 *(ImU8*)p_data = (ImU8)ImClamp(v32, (int)IM_U8_MIN, (int)IM_U8_MAX);
2002 else if (data_type == ImGuiDataType_S16)
2003 *(ImS16*)p_data = (ImS16)ImClamp(v32, (int)IM_S16_MIN, (int)IM_S16_MAX);
2004 else if (data_type == ImGuiDataType_U16)
2005 *(ImU16*)p_data = (ImU16)ImClamp(v32, (int)IM_U16_MIN, (int)IM_U16_MAX);
2006 else
2007 IM_ASSERT(0);
2008 }
2009
2010 return memcmp(&data_backup, p_data, type_info->Size) != 0;
2011}
size_t Size
Definition imgui_internal.h:955
const char * ScanFmt
Definition imgui_internal.h:958
Definition imgui_internal.h:954
Definition imgui_internal.h:948
IMGUI_API const ImGuiDataTypeInfo * DataTypeGetInfo(ImGuiDataType data_type)
Definition imgui_widgets.cpp:1831
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:44

References DataTypeGetInfo(), IM_ASSERT, IM_S16_MAX, IM_S16_MIN, IM_S8_MAX, IM_S8_MIN, IM_U16_MAX, IM_U16_MIN, IM_U8_MAX, IM_U8_MIN, ImCharIsBlankA(), ImClamp(), ImGuiDataType_Double, ImGuiDataType_Float, ImGuiDataType_S16, ImGuiDataType_S32, ImGuiDataType_S64, ImGuiDataType_S8, ImGuiDataType_U16, ImGuiDataType_U32, ImGuiDataType_U64, ImGuiDataType_U8, ImGuiDataTypeInfo::ScanFmt, and ImGuiDataTypeInfo::Size.

Referenced by InputScalar(), and TempInputScalar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DataTypeClamp()

bool ImGui::DataTypeClamp ( ImGuiDataType  data_type,
void p_data,
const void p_min,
const void p_max 
)
2051{
2052 switch (data_type)
2053 {
2054 case ImGuiDataType_S8: return DataTypeClampT<ImS8 >((ImS8* )p_data, (const ImS8* )p_min, (const ImS8* )p_max);
2055 case ImGuiDataType_U8: return DataTypeClampT<ImU8 >((ImU8* )p_data, (const ImU8* )p_min, (const ImU8* )p_max);
2056 case ImGuiDataType_S16: return DataTypeClampT<ImS16 >((ImS16* )p_data, (const ImS16* )p_min, (const ImS16* )p_max);
2057 case ImGuiDataType_U16: return DataTypeClampT<ImU16 >((ImU16* )p_data, (const ImU16* )p_min, (const ImU16* )p_max);
2058 case ImGuiDataType_S32: return DataTypeClampT<ImS32 >((ImS32* )p_data, (const ImS32* )p_min, (const ImS32* )p_max);
2059 case ImGuiDataType_U32: return DataTypeClampT<ImU32 >((ImU32* )p_data, (const ImU32* )p_min, (const ImU32* )p_max);
2060 case ImGuiDataType_S64: return DataTypeClampT<ImS64 >((ImS64* )p_data, (const ImS64* )p_min, (const ImS64* )p_max);
2061 case ImGuiDataType_U64: return DataTypeClampT<ImU64 >((ImU64* )p_data, (const ImU64* )p_min, (const ImU64* )p_max);
2062 case ImGuiDataType_Float: return DataTypeClampT<float >((float* )p_data, (const float* )p_min, (const float* )p_max);
2063 case ImGuiDataType_Double: return DataTypeClampT<double>((double*)p_data, (const double*)p_min, (const double*)p_max);
2064 case ImGuiDataType_COUNT: break;
2065 }
2066 IM_ASSERT(0);
2067 return false;
2068}

References IM_ASSERT, ImGuiDataType_COUNT, ImGuiDataType_Double, ImGuiDataType_Float, ImGuiDataType_S16, ImGuiDataType_S32, ImGuiDataType_S64, ImGuiDataType_S8, ImGuiDataType_U16, ImGuiDataType_U32, ImGuiDataType_U64, and ImGuiDataType_U8.

Referenced by TempInputScalar().

+ Here is the caller graph for this function:

◆ DataTypeCompare()

int ImGui::DataTypeCompare ( ImGuiDataType  data_type,
const void arg_1,
const void arg_2 
)
2022{
2023 switch (data_type)
2024 {
2025 case ImGuiDataType_S8: return DataTypeCompareT<ImS8 >((const ImS8* )arg_1, (const ImS8* )arg_2);
2026 case ImGuiDataType_U8: return DataTypeCompareT<ImU8 >((const ImU8* )arg_1, (const ImU8* )arg_2);
2027 case ImGuiDataType_S16: return DataTypeCompareT<ImS16 >((const ImS16* )arg_1, (const ImS16* )arg_2);
2028 case ImGuiDataType_U16: return DataTypeCompareT<ImU16 >((const ImU16* )arg_1, (const ImU16* )arg_2);
2029 case ImGuiDataType_S32: return DataTypeCompareT<ImS32 >((const ImS32* )arg_1, (const ImS32* )arg_2);
2030 case ImGuiDataType_U32: return DataTypeCompareT<ImU32 >((const ImU32* )arg_1, (const ImU32* )arg_2);
2031 case ImGuiDataType_S64: return DataTypeCompareT<ImS64 >((const ImS64* )arg_1, (const ImS64* )arg_2);
2032 case ImGuiDataType_U64: return DataTypeCompareT<ImU64 >((const ImU64* )arg_1, (const ImU64* )arg_2);
2033 case ImGuiDataType_Float: return DataTypeCompareT<float >((const float* )arg_1, (const float* )arg_2);
2034 case ImGuiDataType_Double: return DataTypeCompareT<double>((const double*)arg_1, (const double*)arg_2);
2035 case ImGuiDataType_COUNT: break;
2036 }
2037 IM_ASSERT(0);
2038 return 0;
2039}

References IM_ASSERT, ImGuiDataType_COUNT, ImGuiDataType_Double, ImGuiDataType_Float, ImGuiDataType_S16, ImGuiDataType_S32, ImGuiDataType_S64, ImGuiDataType_S8, ImGuiDataType_U16, ImGuiDataType_U32, ImGuiDataType_U64, and ImGuiDataType_U8.

Referenced by DragScalar(), and TempInputScalar().

+ Here is the caller graph for this function:

◆ DataTypeFormatString()

int ImGui::DataTypeFormatString ( char *  buf,
int  buf_size,
ImGuiDataType  data_type,
const void p_data,
const char *  format 
)
1838{
1839 // Signedness doesn't matter when pushing integer arguments
1840 if (data_type == ImGuiDataType_S32 || data_type == ImGuiDataType_U32)
1841 return ImFormatString(buf, buf_size, format, *(const ImU32*)p_data);
1842 if (data_type == ImGuiDataType_S64 || data_type == ImGuiDataType_U64)
1843 return ImFormatString(buf, buf_size, format, *(const ImU64*)p_data);
1844 if (data_type == ImGuiDataType_Float)
1845 return ImFormatString(buf, buf_size, format, *(const float*)p_data);
1846 if (data_type == ImGuiDataType_Double)
1847 return ImFormatString(buf, buf_size, format, *(const double*)p_data);
1848 if (data_type == ImGuiDataType_S8)
1849 return ImFormatString(buf, buf_size, format, *(const ImS8*)p_data);
1850 if (data_type == ImGuiDataType_U8)
1851 return ImFormatString(buf, buf_size, format, *(const ImU8*)p_data);
1852 if (data_type == ImGuiDataType_S16)
1853 return ImFormatString(buf, buf_size, format, *(const ImS16*)p_data);
1854 if (data_type == ImGuiDataType_U16)
1855 return ImFormatString(buf, buf_size, format, *(const ImU16*)p_data);
1856 IM_ASSERT(0);
1857 return 0;
1858}

References IM_ASSERT, ImFormatString(), ImGuiDataType_Double, ImGuiDataType_Float, ImGuiDataType_S16, ImGuiDataType_S32, ImGuiDataType_S64, ImGuiDataType_S8, ImGuiDataType_U16, ImGuiDataType_U32, ImGuiDataType_U64, and ImGuiDataType_U8.

Referenced by DragScalar(), InputScalar(), SliderScalar(), TempInputScalar(), and VSliderScalar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DataTypeGetInfo()

const ImGuiDataTypeInfo * ImGui::DataTypeGetInfo ( ImGuiDataType  data_type)
1832{
1833 IM_ASSERT(data_type >= 0 && data_type < ImGuiDataType_COUNT);
1834 return &GDataTypeInfo[data_type];
1835}
static const ImGuiDataTypeInfo GDataTypeInfo[]
Definition imgui_widgets.cpp:1787

References GDataTypeInfo, IM_ASSERT, and ImGuiDataType_COUNT.

Referenced by DataTypeApplyOpFromText(), DragScalar(), InputScalar(), SliderScalar(), TempInputScalar(), and VSliderScalar().

+ Here is the caller graph for this function:

◆ DebugCheckVersionAndDataLayout()

bool ImGui::DebugCheckVersionAndDataLayout ( const char *  version_str,
size_t  sz_io,
size_t  sz_style,
size_t  sz_vec2,
size_t  sz_vec4,
size_t  sz_drawvert,
size_t  sz_drawidx 
)
7120{
7121 bool error = false;
7122 if (strcmp(version, IMGUI_VERSION) != 0) { error = true; IM_ASSERT(strcmp(version, IMGUI_VERSION) == 0 && "Mismatched version string!"); }
7123 if (sz_io != sizeof(ImGuiIO)) { error = true; IM_ASSERT(sz_io == sizeof(ImGuiIO) && "Mismatched struct layout!"); }
7124 if (sz_style != sizeof(ImGuiStyle)) { error = true; IM_ASSERT(sz_style == sizeof(ImGuiStyle) && "Mismatched struct layout!"); }
7125 if (sz_vec2 != sizeof(ImVec2)) { error = true; IM_ASSERT(sz_vec2 == sizeof(ImVec2) && "Mismatched struct layout!"); }
7126 if (sz_vec4 != sizeof(ImVec4)) { error = true; IM_ASSERT(sz_vec4 == sizeof(ImVec4) && "Mismatched struct layout!"); }
7127 if (sz_vert != sizeof(ImDrawVert)) { error = true; IM_ASSERT(sz_vert == sizeof(ImDrawVert) && "Mismatched struct layout!"); }
7128 if (sz_idx != sizeof(ImDrawIdx)) { error = true; IM_ASSERT(sz_idx == sizeof(ImDrawIdx) && "Mismatched struct layout!"); }
7129 return !error;
7130}
#define IMGUI_VERSION
Definition imgui.h:63
unsigned short ImDrawIdx
Definition imgui.h:2255
Definition imgui.h:2261
char * version
Definition main.c:59
static char error[256]
Definition tga.cpp:50

References error, IM_ASSERT, IMGUI_VERSION, and version.

◆ DebugDrawItemRect()

void ImGui::DebugDrawItemRect ( ImU32  col = IM_COL32(255,0,0,255))
inline
IMGUI_API ImGuiContext * GImGui
Definition imgui.cpp:960
IMGUI_API ImDrawList * GetForegroundDrawList()
Definition imgui.cpp:3503

References ImDrawList::AddRect(), col(), ImGuiContext::CurrentWindow, ImGuiWindow::DC, GetForegroundDrawList(), GImGui, ImGuiWindowTempData::LastItemRect, ImRect::Max, and ImRect::Min.

+ Here is the call graph for this function:

◆ DebugNodeColumns()

void ImGui::DebugNodeColumns ( ImGuiOldColumns columns)
11285{
11286 if (!TreeNode((void*)(uintptr_t)columns->ID, "Columns Id: 0x%08X, Count: %d, Flags: 0x%04X", columns->ID, columns->Count, columns->Flags))
11287 return;
11288 BulletText("Width: %.1f (MinX: %.1f, MaxX: %.1f)", columns->OffMaxX - columns->OffMinX, columns->OffMinX, columns->OffMaxX);
11289 for (int column_n = 0; column_n < columns->Columns.Size; column_n++)
11290 BulletText("Column %02d: OffsetNorm %.3f (= %.1f px)", column_n, columns->Columns[column_n].OffsetNorm, GetColumnOffsetFromNorm(columns, columns->Columns[column_n].OffsetNorm));
11291 TreePop();
11292}
IMGUI_API void TreePop()
Definition imgui_widgets.cpp:5918
IMGUI_API bool TreeNode(const char *label)
Definition imgui_widgets.cpp:5593
IMGUI_API float GetColumnOffsetFromNorm(const ImGuiOldColumns *columns, float offset_norm)
Definition imgui_tables.cpp:3633
IMGUI_API void BulletText(const char *fmt,...) IM_FMTARGS(1)
Definition imgui_widgets.cpp:375

References BulletText(), ImGuiOldColumns::Columns, ImGuiOldColumns::Count, ImGuiOldColumns::Flags, GetColumnOffsetFromNorm(), ImGuiOldColumns::ID, ImGuiOldColumns::OffMaxX, ImGuiOldColumns::OffMinX, ImVector< T >::Size, TreeNode(), and TreePop().

Referenced by DebugNodeWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DebugNodeDrawCmdShowMeshAndBoundingBox()

void ImGui::DebugNodeDrawCmdShowMeshAndBoundingBox ( ImDrawList out_draw_list,
const ImDrawList draw_list,
const ImDrawCmd draw_cmd,
bool  show_mesh,
bool  show_aabb 
)
11390{
11391 IM_ASSERT(show_mesh || show_aabb);
11392 ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL;
11393 ImDrawVert* vtx_buffer = draw_list->VtxBuffer.Data + draw_cmd->VtxOffset;
11394
11395 // Draw wire-frame version of all triangles
11396 ImRect clip_rect = draw_cmd->ClipRect;
11397 ImRect vtxs_rect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX);
11398 ImDrawListFlags backup_flags = out_draw_list->Flags;
11399 out_draw_list->Flags &= ~ImDrawListFlags_AntiAliasedLines; // Disable AA on triangle outlines is more readable for very large and thin triangles.
11400 for (unsigned int idx_n = draw_cmd->IdxOffset; idx_n < draw_cmd->IdxOffset + draw_cmd->ElemCount; )
11401 {
11402 ImVec2 triangle[3];
11403 for (int n = 0; n < 3; n++, idx_n++)
11404 vtxs_rect.Add((triangle[n] = vtx_buffer[idx_buffer ? idx_buffer[idx_n] : idx_n].pos));
11405 if (show_mesh)
11406 out_draw_list->AddPolyline(triangle, 3, IM_COL32(255, 255, 0, 255), ImDrawFlags_Closed, 1.0f); // In yellow: mesh triangles
11407 }
11408 // Draw bounding boxes
11409 if (show_aabb)
11410 {
11411 out_draw_list->AddRect(ImFloor(clip_rect.Min), ImFloor(clip_rect.Max), IM_COL32(255, 0, 255, 255)); // In pink: clipping rectangle submitted to GPU
11412 out_draw_list->AddRect(ImFloor(vtxs_rect.Min), ImFloor(vtxs_rect.Max), IM_COL32(0, 255, 255, 255)); // In cyan: bounding box of triangles
11413 }
11414 out_draw_list->Flags = backup_flags;
11415}
int ImDrawListFlags
Definition imgui.h:179
@ ImDrawFlags_Closed
Definition imgui.h:2312
unsigned int VtxOffset
Definition imgui.h:2239
ImVec4 ClipRect
Definition imgui.h:2237
unsigned int IdxOffset
Definition imgui.h:2240
IMGUI_API void AddPolyline(const ImVec2 *points, int num_points, ImU32 col, ImDrawFlags flags, float thickness)
Definition imgui_draw.cpp:705
ImDrawListFlags Flags
Definition imgui.h:2353
ImVector< ImDrawIdx > IdxBuffer
Definition imgui.h:2351

References ImRect::Add(), ImDrawList::AddPolyline(), ImDrawList::AddRect(), ImDrawCmd::ClipRect, ImVector< T >::Data, ImDrawCmd::ElemCount, ImDrawList::Flags, ImDrawList::IdxBuffer, ImDrawCmd::IdxOffset, IM_ASSERT, IM_COL32, ImDrawFlags_Closed, ImFloor(), ImRect::Max, ImRect::Min, ImDrawVert::pos, ImVector< T >::Size, ImDrawList::VtxBuffer, and ImDrawCmd::VtxOffset.

Referenced by DebugNodeDrawList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DebugNodeDrawList()

void ImGui::DebugNodeDrawList ( ImGuiWindow window,
const ImDrawList draw_list,
const char *  label 
)
11296{
11297 ImGuiContext& g = *GImGui;
11299 int cmd_count = draw_list->CmdBuffer.Size;
11300 if (cmd_count > 0 && draw_list->CmdBuffer.back().ElemCount == 0 && draw_list->CmdBuffer.back().UserCallback == NULL)
11301 cmd_count--;
11302 bool node_open = TreeNode(draw_list, "%s: '%s' %d vtx, %d indices, %d cmds", label, draw_list->_OwnerName ? draw_list->_OwnerName : "", draw_list->VtxBuffer.Size, draw_list->IdxBuffer.Size, cmd_count);
11303 if (draw_list == GetWindowDrawList())
11304 {
11305 SameLine();
11306 TextColored(ImVec4(1.0f, 0.4f, 0.4f, 1.0f), "CURRENTLY APPENDING"); // Can't display stats for active draw list! (we don't have the data double-buffered)
11307 if (node_open)
11308 TreePop();
11309 return;
11310 }
11311
11312 ImDrawList* fg_draw_list = GetForegroundDrawList(window); // Render additional visuals into the top-most draw list
11313 if (window && IsItemHovered())
11314 fg_draw_list->AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255, 255, 0, 255));
11315 if (!node_open)
11316 return;
11317
11318 if (window && !window->WasActive)
11319 TextDisabled("Warning: owning Window is inactive. This DrawList is not being rendered!");
11320
11321 for (const ImDrawCmd* pcmd = draw_list->CmdBuffer.Data; pcmd < draw_list->CmdBuffer.Data + cmd_count; pcmd++)
11322 {
11323 if (pcmd->UserCallback)
11324 {
11325 BulletText("Callback %p, user_data %p", pcmd->UserCallback, pcmd->UserCallbackData);
11326 continue;
11327 }
11328
11329 char buf[300];
11330 ImFormatString(buf, IM_ARRAYSIZE(buf), "DrawCmd:%5d tris, Tex 0x%p, ClipRect (%4.0f,%4.0f)-(%4.0f,%4.0f)",
11331 pcmd->ElemCount / 3, (void*)(intptr_t)pcmd->TextureId,
11332 pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
11333 bool pcmd_node_open = TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "%s", buf);
11334 if (IsItemHovered() && (cfg->ShowDrawCmdMesh || cfg->ShowDrawCmdBoundingBoxes) && fg_draw_list)
11335 DebugNodeDrawCmdShowMeshAndBoundingBox(fg_draw_list, draw_list, pcmd, cfg->ShowDrawCmdMesh, cfg->ShowDrawCmdBoundingBoxes);
11336 if (!pcmd_node_open)
11337 continue;
11338
11339 // Calculate approximate coverage area (touched pixel count)
11340 // This will be in pixels squared as long there's no post-scaling happening to the renderer output.
11341 const ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL;
11342 const ImDrawVert* vtx_buffer = draw_list->VtxBuffer.Data + pcmd->VtxOffset;
11343 float total_area = 0.0f;
11344 for (unsigned int idx_n = pcmd->IdxOffset; idx_n < pcmd->IdxOffset + pcmd->ElemCount; )
11345 {
11346 ImVec2 triangle[3];
11347 for (int n = 0; n < 3; n++, idx_n++)
11348 triangle[n] = vtx_buffer[idx_buffer ? idx_buffer[idx_n] : idx_n].pos;
11349 total_area += ImTriangleArea(triangle[0], triangle[1], triangle[2]);
11350 }
11351
11352 // Display vertex information summary. Hover to get all triangles drawn in wire-frame
11353 ImFormatString(buf, IM_ARRAYSIZE(buf), "Mesh: ElemCount: %d, VtxOffset: +%d, IdxOffset: +%d, Area: ~%0.f px", pcmd->ElemCount, pcmd->VtxOffset, pcmd->IdxOffset, total_area);
11354 Selectable(buf);
11355 if (IsItemHovered() && fg_draw_list)
11356 DebugNodeDrawCmdShowMeshAndBoundingBox(fg_draw_list, draw_list, pcmd, true, false);
11357
11358 // Display individual triangles/vertices. Hover on to get the corresponding triangle highlighted.
11359 ImGuiListClipper clipper;
11360 clipper.Begin(pcmd->ElemCount / 3); // Manually coarse clip our print out of individual vertices to save CPU, only items that may be visible.
11361 while (clipper.Step())
11362 for (int prim = clipper.DisplayStart, idx_i = pcmd->IdxOffset + clipper.DisplayStart * 3; prim < clipper.DisplayEnd; prim++)
11363 {
11364 char* buf_p = buf, * buf_end = buf + IM_ARRAYSIZE(buf);
11365 ImVec2 triangle[3];
11366 for (int n = 0; n < 3; n++, idx_i++)
11367 {
11368 const ImDrawVert& v = vtx_buffer[idx_buffer ? idx_buffer[idx_i] : idx_i];
11369 triangle[n] = v.pos;
11370 buf_p += ImFormatString(buf_p, buf_end - buf_p, "%s %04d: pos (%8.2f,%8.2f), uv (%.6f,%.6f), col %08X\n",
11371 (n == 0) ? "Vert:" : " ", idx_i, v.pos.x, v.pos.y, v.uv.x, v.uv.y, v.col);
11372 }
11373
11374 Selectable(buf, false);
11375 if (fg_draw_list && IsItemHovered())
11376 {
11377 ImDrawListFlags backup_flags = fg_draw_list->Flags;
11378 fg_draw_list->Flags &= ~ImDrawListFlags_AntiAliasedLines; // Disable AA on triangle outlines is more readable for very large and thin triangles.
11379 fg_draw_list->AddPolyline(triangle, 3, IM_COL32(255, 255, 0, 255), ImDrawFlags_Closed, 1.0f);
11380 fg_draw_list->Flags = backup_flags;
11381 }
11382 }
11383 TreePop();
11384 }
11385 TreePop();
11386}
ImVec2 pos
Definition imgui.h:2262
float ImTriangleArea(const ImVec2 &a, const ImVec2 &b, const ImVec2 &c)
Definition imgui_internal.h:446
IMGUI_API void DebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList *out_draw_list, const ImDrawList *draw_list, const ImDrawCmd *draw_cmd, bool show_mesh, bool show_aabb)
Definition imgui.cpp:11389
IMGUI_API void TextColored(const ImVec4 &col, const char *fmt,...) IM_FMTARGS(2)
Definition imgui_widgets.cpp:279
IMGUI_API ImDrawList * GetWindowDrawList()
Definition imgui.cpp:6926
Definition imgui.h:2236
ImDrawCallback UserCallback
Definition imgui.h:2242
const char * _OwnerName
Definition imgui.h:2358
ImGuiMetricsConfig DebugMetricsConfig
Definition imgui_internal.h:1584
Definition imgui.h:2138
IMGUI_API void Begin(int items_count, float items_height=-1.0f)
Definition imgui.cpp:2286
int DisplayStart
Definition imgui.h:2139
int DisplayEnd
Definition imgui.h:2140
IMGUI_API bool Step()
Definition imgui.cpp:2316
Definition imgui_internal.h:1292
bool ShowDrawCmdBoundingBoxes
Definition imgui_internal.h:1297
bool ShowDrawCmdMesh
Definition imgui_internal.h:1296
T * begin()
Definition imgui.h:1679

References ImDrawList::_OwnerName, ImDrawList::AddPolyline(), ImDrawList::AddRect(), ImVector< T >::back(), ImVector< T >::begin(), ImGuiListClipper::Begin(), BulletText(), ImDrawList::CmdBuffer, ImDrawVert::col, ImVector< T >::Data, ImGuiContext::DebugMetricsConfig, DebugNodeDrawCmdShowMeshAndBoundingBox(), ImGuiListClipper::DisplayEnd, ImGuiListClipper::DisplayStart, ImDrawCmd::ElemCount, ImDrawList::Flags, GetForegroundDrawList(), GetWindowDrawList(), GImGui, ImDrawList::IdxBuffer, IM_ARRAYSIZE, IM_COL32, ImDrawFlags_Closed, ImFormatString(), ImTriangleArea(), IsItemHovered(), ImDrawVert::pos, ImGuiWindow::Pos, SameLine(), Selectable(), ImGuiMetricsConfig::ShowDrawCmdBoundingBoxes, ImGuiMetricsConfig::ShowDrawCmdMesh, ImVector< T >::Size, ImGuiWindow::Size, ImGuiListClipper::Step(), TextColored(), TextDisabled(), TreeNode(), TreePop(), ImDrawCmd::UserCallback, ImDrawVert::uv, ImDrawList::VtxBuffer, ImGuiWindow::WasActive, ImVec2::x, and ImVec2::y.

Referenced by DebugNodeViewport(), DebugNodeWindow(), and ShowMetricsWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DebugNodeStorage()

void ImGui::DebugNodeStorage ( ImGuiStorage storage,
const char *  label 
)
11419{
11420 if (!TreeNode(label, "%s: %d entries, %d bytes", label, storage->Data.Size, storage->Data.size_in_bytes()))
11421 return;
11422 for (int n = 0; n < storage->Data.Size; n++)
11423 {
11424 const ImGuiStorage::ImGuiStoragePair& p = storage->Data[n];
11425 BulletText("Key 0x%08X Value { i: %d }", p.key, p.val_i); // Important: we currently don't store a type, real value may not be integer.
11426 }
11427 TreePop();
11428}
Definition imgui.h:2081
ImGuiID key
Definition imgui.h:2082
ImVector< ImGuiStoragePair > Data
Definition imgui.h:2089

References BulletText(), ImGuiStorage::Data, ImGuiStorage::ImGuiStoragePair::key, TreeNode(), and TreePop().

Referenced by DebugNodeWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DebugNodeTabBar()

void ImGui::DebugNodeTabBar ( ImGuiTabBar tab_bar,
const char *  label 
)
11432{
11433 // Standalone tab bars (not associated to docking/windows functionality) currently hold no discernible strings.
11434 char buf[256];
11435 char* p = buf;
11436 const char* buf_end = buf + IM_ARRAYSIZE(buf);
11437 const bool is_active = (tab_bar->PrevFrameVisible >= GetFrameCount() - 2);
11438 p += ImFormatString(p, buf_end - p, "%s 0x%08X (%d tabs)%s", label, tab_bar->ID, tab_bar->Tabs.Size, is_active ? "" : " *Inactive*");
11439 IM_UNUSED(p);
11441 bool open = TreeNode(tab_bar, "%s", buf);
11442 if (!is_active) { PopStyleColor(); }
11443 if (is_active && IsItemHovered())
11444 {
11445 ImDrawList* draw_list = GetForegroundDrawList();
11446 draw_list->AddRect(tab_bar->BarRect.Min, tab_bar->BarRect.Max, IM_COL32(255, 255, 0, 255));
11447 draw_list->AddLine(ImVec2(tab_bar->ScrollingRectMinX, tab_bar->BarRect.Min.y), ImVec2(tab_bar->ScrollingRectMinX, tab_bar->BarRect.Max.y), IM_COL32(0, 255, 0, 255));
11448 draw_list->AddLine(ImVec2(tab_bar->ScrollingRectMaxX, tab_bar->BarRect.Min.y), ImVec2(tab_bar->ScrollingRectMaxX, tab_bar->BarRect.Max.y), IM_COL32(0, 255, 0, 255));
11449 }
11450 if (open)
11451 {
11452 for (int tab_n = 0; tab_n < tab_bar->Tabs.Size; tab_n++)
11453 {
11454 const ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
11455 PushID(tab);
11456 if (SmallButton("<")) { TabBarQueueReorder(tab_bar, tab, -1); } SameLine(0, 2);
11457 if (SmallButton(">")) { TabBarQueueReorder(tab_bar, tab, +1); } SameLine();
11458 Text("%02d%c Tab 0x%08X '%s' Offset: %.1f, Width: %.1f/%.1f",
11459 tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID, (tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : "", tab->Offset, tab->Width, tab->ContentWidth);
11460 PopID();
11461 }
11462 TreePop();
11463 }
11464}
IMGUI_API int GetFrameCount()
Definition imgui.cpp:3458
IMGUI_API bool SmallButton(const char *label)
Definition imgui_widgets.cpp:721
IMGUI_API void TabBarQueueReorder(ImGuiTabBar *tab_bar, const ImGuiTabItem *tab, int offset)
Definition imgui_widgets.cpp:7463
IMGUI_API const ImVec4 & GetStyleColorVec4(ImGuiCol idx)
Definition imgui.cpp:2445
float ScrollingRectMaxX
Definition imgui_internal.h:1991
ImGuiID SelectedTabId
Definition imgui_internal.h:1976
float ScrollingRectMinX
Definition imgui_internal.h:1990

References ImDrawList::AddLine(), ImDrawList::AddRect(), ImGuiTabBar::BarRect, ImGuiTabItem::ContentWidth, GetForegroundDrawList(), GetFrameCount(), GetStyleColorVec4(), ImGuiTabBar::GetTabName(), ImGuiTabItem::ID, ImGuiTabBar::ID, IM_ARRAYSIZE, IM_COL32, IM_UNUSED, ImFormatString(), ImGuiCol_Text, ImGuiCol_TextDisabled, IsItemHovered(), ImRect::Max, ImRect::Min, ImGuiTabItem::NameOffset, ImGuiTabItem::Offset, PopID(), PopStyleColor(), ImGuiTabBar::PrevFrameVisible, PushID(), PushStyleColor(), SameLine(), ImGuiTabBar::ScrollingRectMaxX, ImGuiTabBar::ScrollingRectMinX, ImGuiTabBar::SelectedTabId, ImVector< T >::Size, SmallButton(), TabBarQueueReorder(), ImGuiTabBar::Tabs, Text(), TreeNode(), TreePop(), ImGuiTabItem::Width, and ImVec2::y.

Referenced by ShowMetricsWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DebugNodeTable()

void ImGui::DebugNodeTable ( ImGuiTable table)
3498{
3499 char buf[512];
3500 char* p = buf;
3501 const char* buf_end = buf + IM_ARRAYSIZE(buf);
3502 const bool is_active = (table->LastFrameActive >= ImGui::GetFrameCount() - 2); // Note that fully clipped early out scrolling tables will appear as inactive here.
3503 ImFormatString(p, buf_end - p, "Table 0x%08X (%d columns, in '%s')%s", table->ID, table->ColumnsCount, table->OuterWindow->Name, is_active ? "" : " *Inactive*");
3505 bool open = TreeNode(table, "%s", buf);
3506 if (!is_active) { PopStyleColor(); }
3507 if (IsItemHovered())
3508 GetForegroundDrawList()->AddRect(table->OuterRect.Min, table->OuterRect.Max, IM_COL32(255, 255, 0, 255));
3509 if (IsItemVisible() && table->HoveredColumnBody != -1)
3511 if (!open)
3512 return;
3513 bool clear_settings = SmallButton("Clear settings");
3514 BulletText("OuterRect: Pos: (%.1f,%.1f) Size: (%.1f,%.1f) Sizing: '%s'", table->OuterRect.Min.x, table->OuterRect.Min.y, table->OuterRect.GetWidth(), table->OuterRect.GetHeight(), DebugNodeTableGetSizingPolicyDesc(table->Flags));
3515 BulletText("ColumnsGivenWidth: %.1f, ColumnsAutoFitWidth: %.1f, InnerWidth: %.1f%s", table->ColumnsGivenWidth, table->ColumnsAutoFitWidth, table->InnerWidth, table->InnerWidth == 0.0f ? " (auto)" : "");
3516 BulletText("CellPaddingX: %.1f, CellSpacingX: %.1f/%.1f, OuterPaddingX: %.1f", table->CellPaddingX, table->CellSpacingX1, table->CellSpacingX2, table->OuterPaddingX);
3517 BulletText("HoveredColumnBody: %d, HoveredColumnBorder: %d", table->HoveredColumnBody, table->HoveredColumnBorder);
3518 BulletText("ResizedColumn: %d, ReorderColumn: %d, HeldHeaderColumn: %d", table->ResizedColumn, table->ReorderColumn, table->HeldHeaderColumn);
3519 //BulletText("BgDrawChannels: %d/%d", 0, table->BgDrawChannelUnfrozen);
3520 float sum_weights = 0.0f;
3521 for (int n = 0; n < table->ColumnsCount; n++)
3522 if (table->Columns[n].Flags & ImGuiTableColumnFlags_WidthStretch)
3523 sum_weights += table->Columns[n].StretchWeight;
3524 for (int n = 0; n < table->ColumnsCount; n++)
3525 {
3526 ImGuiTableColumn* column = &table->Columns[n];
3527 const char* name = TableGetColumnName(table, n);
3528 ImFormatString(buf, IM_ARRAYSIZE(buf),
3529 "Column %d order %d '%s': offset %+.2f to %+.2f%s\n"
3530 "Enabled: %d, VisibleX/Y: %d/%d, RequestOutput: %d, SkipItems: %d, DrawChannels: %d,%d\n"
3531 "WidthGiven: %.1f, Request/Auto: %.1f/%.1f, StretchWeight: %.3f (%.1f%%)\n"
3532 "MinX: %.1f, MaxX: %.1f (%+.1f), ClipRect: %.1f to %.1f (+%.1f)\n"
3533 "ContentWidth: %.1f,%.1f, HeadersUsed/Ideal %.1f/%.1f\n"
3534 "Sort: %d%s, UserID: 0x%08X, Flags: 0x%04X: %s%s%s..",
3535 n, column->DisplayOrder, name, column->MinX - table->WorkRect.Min.x, column->MaxX - table->WorkRect.Min.x, (n < table->FreezeColumnsRequest) ? " (Frozen)" : "",
3536 column->IsEnabled, column->IsVisibleX, column->IsVisibleY, column->IsRequestOutput, column->IsSkipItems, column->DrawChannelFrozen, column->DrawChannelUnfrozen,
3537 column->WidthGiven, column->WidthRequest, column->WidthAuto, column->StretchWeight, column->StretchWeight > 0.0f ? (column->StretchWeight / sum_weights) * 100.0f : 0.0f,
3538 column->MinX, column->MaxX, column->MaxX - column->MinX, column->ClipRect.Min.x, column->ClipRect.Max.x, column->ClipRect.Max.x - column->ClipRect.Min.x,
3539 column->ContentMaxXFrozen - column->WorkMinX, column->ContentMaxXUnfrozen - column->WorkMinX, column->ContentMaxXHeadersUsed - column->WorkMinX, column->ContentMaxXHeadersIdeal - column->WorkMinX,
3540 column->SortOrder, (column->SortDirection == ImGuiSortDirection_Ascending) ? " (Asc)" : (column->SortDirection == ImGuiSortDirection_Descending) ? " (Des)" : "", column->UserID, column->Flags,
3541 (column->Flags & ImGuiTableColumnFlags_WidthStretch) ? "WidthStretch " : "",
3542 (column->Flags & ImGuiTableColumnFlags_WidthFixed) ? "WidthFixed " : "",
3543 (column->Flags & ImGuiTableColumnFlags_NoResize) ? "NoResize " : "");
3544 Bullet();
3545 Selectable(buf);
3546 if (IsItemHovered())
3547 {
3548 ImRect r(column->MinX, table->OuterRect.Min.y, column->MaxX, table->OuterRect.Max.y);
3549 GetForegroundDrawList()->AddRect(r.Min, r.Max, IM_COL32(255, 255, 0, 255));
3550 }
3551 }
3552 if (ImGuiTableSettings* settings = TableGetBoundSettings(table))
3553 DebugNodeTableSettings(settings);
3554 if (clear_settings)
3555 table->IsResetAllRequest = true;
3556 TreePop();
3557}
@ ImGuiTableColumnFlags_WidthFixed
Definition imgui.h:1170
@ ImGuiTableColumnFlags_WidthStretch
Definition imgui.h:1169
@ ImGuiTableColumnFlags_NoResize
Definition imgui.h:1171
@ ImGuiSortDirection_Descending
Definition imgui.h:1308
@ ImGuiSortDirection_Ascending
Definition imgui.h:1307
static const char * DebugNodeTableGetSizingPolicyDesc(ImGuiTableFlags sizing_policy)
Definition imgui_tables.cpp:3487
IMGUI_API bool IsItemVisible()
Definition imgui.cpp:4917
IMGUI_API const char * TableGetColumnName(int column_n=-1)
Definition imgui_tables.cpp:1507
IMGUI_API ImVec2 GetItemRectMax()
Definition imgui.cpp:4957
IMGUI_API void DebugNodeTableSettings(ImGuiTableSettings *settings)
Definition imgui_tables.cpp:3559
IMGUI_API ImGuiTableSettings * TableGetBoundSettings(ImGuiTable *table)
Definition imgui_tables.cpp:3155
IMGUI_API ImVec2 GetItemRectMin()
Definition imgui.cpp:4951
IMGUI_API void Bullet()
Definition imgui_widgets.cpp:1276
float MinX
Definition imgui_internal.h:2034
float MaxX
Definition imgui_internal.h:2035
float ColumnsAutoFitWidth
Definition imgui_internal.h:2140
float ColumnsGivenWidth
Definition imgui_internal.h:2139
ImGuiTableColumnIdx HeldHeaderColumn
Definition imgui_internal.h:2167
Definition imgui_internal.h:2255

References ImDrawList::AddRect(), Bullet(), BulletText(), ImGuiTable::CellPaddingX, ImGuiTable::CellSpacingX1, ImGuiTable::CellSpacingX2, ImGuiTableColumn::ClipRect, ImGuiTable::Columns, ImGuiTable::ColumnsAutoFitWidth, ImGuiTable::ColumnsCount, ImGuiTable::ColumnsGivenWidth, ImGuiTableColumn::ContentMaxXFrozen, ImGuiTableColumn::ContentMaxXHeadersIdeal, ImGuiTableColumn::ContentMaxXHeadersUsed, ImGuiTableColumn::ContentMaxXUnfrozen, DebugNodeTableGetSizingPolicyDesc(), DebugNodeTableSettings(), ImGuiTableColumn::DisplayOrder, ImGuiTableColumn::DrawChannelFrozen, ImGuiTableColumn::DrawChannelUnfrozen, ImGuiTableColumn::Flags, ImGuiTable::Flags, GetForegroundDrawList(), GetFrameCount(), ImRect::GetHeight(), GetItemRectMax(), GetItemRectMin(), GetStyleColorVec4(), ImRect::GetWidth(), ImGuiTable::HeldHeaderColumn, ImGuiTable::HoveredColumnBody, ImGuiTable::HoveredColumnBorder, ImGuiTable::ID, IM_ARRAYSIZE, IM_COL32, ImFormatString(), ImGuiCol_Text, ImGuiCol_TextDisabled, ImGuiSortDirection_Ascending, ImGuiSortDirection_Descending, ImGuiTableColumnFlags_NoResize, ImGuiTableColumnFlags_WidthFixed, ImGuiTableColumnFlags_WidthStretch, ImGuiTable::InnerWidth, ImGuiTableColumn::IsEnabled, IsItemHovered(), IsItemVisible(), ImGuiTableColumn::IsRequestOutput, ImGuiTable::IsResetAllRequest, ImGuiTableColumn::IsSkipItems, ImGuiTableColumn::IsVisibleX, ImGuiTableColumn::IsVisibleY, ImGuiTable::LastFrameActive, ImRect::Max, ImGuiTableColumn::MaxX, ImRect::Min, ImGuiTableColumn::MinX, ImGuiWindow::Name, ImGuiTable::OuterPaddingX, ImGuiTable::OuterRect, ImGuiTable::OuterWindow, PopStyleColor(), PushStyleColor(), ImGuiTable::ReorderColumn, ImGuiTable::ResizedColumn, Selectable(), SmallButton(), ImGuiTableColumn::SortDirection, ImGuiTableColumn::SortOrder, ImGuiTableColumn::StretchWeight, TableGetBoundSettings(), TableGetColumnName(), TreeNode(), TreePop(), ImGuiTableColumn::UserID, ImGuiTableColumn::WidthAuto, ImGuiTableColumn::WidthGiven, ImGuiTableColumn::WidthRequest, ImGuiTableColumn::WorkMinX, ImGuiTable::WorkRect, ImVec2::x, and ImVec2::y.

Referenced by ShowMetricsWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DebugNodeTableSettings()

void ImGui::DebugNodeTableSettings ( ImGuiTableSettings settings)
3560{
3561 if (!TreeNode((void*)(intptr_t)settings->ID, "Settings 0x%08X (%d columns)", settings->ID, settings->ColumnsCount))
3562 return;
3563 BulletText("SaveFlags: 0x%08X", settings->SaveFlags);
3564 BulletText("ColumnsCount: %d (max %d)", settings->ColumnsCount, settings->ColumnsCountMax);
3565 for (int n = 0; n < settings->ColumnsCount; n++)
3566 {
3567 ImGuiTableColumnSettings* column_settings = &settings->GetColumnSettings()[n];
3568 ImGuiSortDirection sort_dir = (column_settings->SortOrder != -1) ? (ImGuiSortDirection)column_settings->SortDirection : ImGuiSortDirection_None;
3569 BulletText("Column %d Order %d SortOrder %d %s Vis %d %s %7.3f UserID 0x%08X",
3570 n, column_settings->DisplayOrder, column_settings->SortOrder,
3571 (sort_dir == ImGuiSortDirection_Ascending) ? "Asc" : (sort_dir == ImGuiSortDirection_Descending) ? "Des" : "---",
3572 column_settings->IsEnabled, column_settings->IsStretch ? "Weight" : "Width ", column_settings->WidthOrWeight, column_settings->UserID);
3573 }
3574 TreePop();
3575}
@ ImGuiSortDirection_None
Definition imgui.h:1306
int ImGuiSortDirection
Definition imgui.h:175
Definition imgui_internal.h:2231
ImGuiTableColumnIdx SortOrder
Definition imgui_internal.h:2236
ImGuiTableColumnIdx DisplayOrder
Definition imgui_internal.h:2235
ImU8 SortDirection
Definition imgui_internal.h:2237
ImGuiTableFlags SaveFlags
Definition imgui_internal.h:2257
ImGuiTableColumnIdx ColumnsCountMax
Definition imgui_internal.h:2260
ImGuiTableColumnSettings * GetColumnSettings()
Definition imgui_internal.h:2264
ImGuiTableColumnIdx ColumnsCount
Definition imgui_internal.h:2259
ImGuiID ID
Definition imgui_internal.h:2256

References BulletText(), ImGuiTableSettings::ColumnsCount, ImGuiTableSettings::ColumnsCountMax, ImGuiTableColumnSettings::DisplayOrder, ImGuiTableSettings::GetColumnSettings(), ImGuiTableSettings::ID, ImGuiSortDirection_Ascending, ImGuiSortDirection_Descending, ImGuiSortDirection_None, ImGuiTableColumnSettings::IsEnabled, ImGuiTableColumnSettings::IsStretch, ImGuiTableSettings::SaveFlags, ImGuiTableColumnSettings::SortDirection, ImGuiTableColumnSettings::SortOrder, TreeNode(), TreePop(), ImGuiTableColumnSettings::UserID, and ImGuiTableColumnSettings::WidthOrWeight.

Referenced by DebugNodeTable(), and ShowMetricsWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DebugNodeViewport()

void ImGui::DebugNodeViewport ( ImGuiViewportP viewport)
11467{
11469 if (TreeNode("viewport0", "Viewport #%d", 0))
11470 {
11471 ImGuiWindowFlags flags = viewport->Flags;
11472 BulletText("Main Pos: (%.0f,%.0f), Size: (%.0f,%.0f)\nWorkArea Offset Left: %.0f Top: %.0f, Right: %.0f, Bottom: %.0f",
11473 viewport->Pos.x, viewport->Pos.y, viewport->Size.x, viewport->Size.y,
11474 viewport->WorkOffsetMin.x, viewport->WorkOffsetMin.y, viewport->WorkOffsetMax.x, viewport->WorkOffsetMax.y);
11475 BulletText("Flags: 0x%04X =%s%s%s", viewport->Flags,
11476 (flags & ImGuiViewportFlags_IsPlatformWindow) ? " IsPlatformWindow" : "",
11477 (flags & ImGuiViewportFlags_IsPlatformMonitor) ? " IsPlatformMonitor" : "",
11478 (flags & ImGuiViewportFlags_OwnedByApp) ? " OwnedByApp" : "");
11479 for (int layer_i = 0; layer_i < IM_ARRAYSIZE(viewport->DrawDataBuilder.Layers); layer_i++)
11480 for (int draw_list_i = 0; draw_list_i < viewport->DrawDataBuilder.Layers[layer_i].Size; draw_list_i++)
11481 DebugNodeDrawList(NULL, viewport->DrawDataBuilder.Layers[layer_i][draw_list_i], "DrawList");
11482 TreePop();
11483 }
11484}
@ ImGuiViewportFlags_OwnedByApp
Definition imgui.h:2750
@ ImGuiViewportFlags_IsPlatformWindow
Definition imgui.h:2748
@ ImGuiViewportFlags_IsPlatformMonitor
Definition imgui.h:2749
IMGUI_API void SetNextItemOpen(bool is_open, ImGuiCond cond=0)
Definition imgui_widgets.cpp:5948
IMGUI_API void DebugNodeDrawList(ImGuiWindow *window, const ImDrawList *draw_list, const char *label)
Definition imgui.cpp:11295
ImVector< ImDrawList * > Layers[2]
Definition imgui_internal.h:706
ImGuiViewportFlags Flags
Definition imgui.h:2762
ImVec2 Pos
Definition imgui.h:2763
ImVec2 Size
Definition imgui.h:2764
ImDrawDataBuilder DrawDataBuilder
Definition imgui_internal.h:1232
ImVec2 WorkOffsetMax
Definition imgui_internal.h:1235
ImVec2 WorkOffsetMin
Definition imgui_internal.h:1234

References BulletText(), DebugNodeDrawList(), ImGuiViewportP::DrawDataBuilder, ImGuiViewport::Flags, IM_ARRAYSIZE, ImGuiCond_Once, ImGuiViewportFlags_IsPlatformMonitor, ImGuiViewportFlags_IsPlatformWindow, ImGuiViewportFlags_OwnedByApp, ImDrawDataBuilder::Layers, ImGuiViewport::Pos, SetNextItemOpen(), ImVector< T >::Size, ImGuiViewport::Size, TreeNode(), TreePop(), ImGuiViewportP::WorkOffsetMax, ImGuiViewportP::WorkOffsetMin, ImVec2::x, and ImVec2::y.

Referenced by ShowMetricsWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DebugNodeWindow()

void ImGui::DebugNodeWindow ( ImGuiWindow window,
const char *  label 
)
11487{
11488 if (window == NULL)
11489 {
11490 BulletText("%s: NULL", label);
11491 return;
11492 }
11493
11494 ImGuiContext& g = *GImGui;
11495 const bool is_active = window->WasActive;
11497 if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); }
11498 const bool open = TreeNodeEx(label, tree_node_flags, "%s '%s'%s", label, window->Name, is_active ? "" : " *Inactive*");
11499 if (!is_active) { PopStyleColor(); }
11500 if (IsItemHovered() && is_active)
11501 GetForegroundDrawList(window)->AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255, 255, 0, 255));
11502 if (!open)
11503 return;
11504
11505 if (window->MemoryCompacted)
11506 TextDisabled("Note: some memory buffers have been compacted/freed.");
11507
11508 ImGuiWindowFlags flags = window->Flags;
11509 DebugNodeDrawList(window, window->DrawList, "DrawList");
11510 BulletText("Pos: (%.1f,%.1f), Size: (%.1f,%.1f), ContentSize (%.1f,%.1f) Ideal (%.1f,%.1f)", window->Pos.x, window->Pos.y, window->Size.x, window->Size.y, window->ContentSize.x, window->ContentSize.y, window->ContentSizeIdeal.x, window->ContentSizeIdeal.y);
11511 BulletText("Flags: 0x%08X (%s%s%s%s%s%s%s%s%s..)", flags,
11512 (flags & ImGuiWindowFlags_ChildWindow) ? "Child " : "", (flags & ImGuiWindowFlags_Tooltip) ? "Tooltip " : "", (flags & ImGuiWindowFlags_Popup) ? "Popup " : "",
11513 (flags & ImGuiWindowFlags_Modal) ? "Modal " : "", (flags & ImGuiWindowFlags_ChildMenu) ? "ChildMenu " : "", (flags & ImGuiWindowFlags_NoSavedSettings) ? "NoSavedSettings " : "",
11514 (flags & ImGuiWindowFlags_NoMouseInputs)? "NoMouseInputs":"", (flags & ImGuiWindowFlags_NoNavInputs) ? "NoNavInputs" : "", (flags & ImGuiWindowFlags_AlwaysAutoResize) ? "AlwaysAutoResize" : "");
11515 BulletText("Scroll: (%.2f/%.2f,%.2f/%.2f) Scrollbar:%s%s", window->Scroll.x, window->ScrollMax.x, window->Scroll.y, window->ScrollMax.y, window->ScrollbarX ? "X" : "", window->ScrollbarY ? "Y" : "");
11516 BulletText("Active: %d/%d, WriteAccessed: %d, BeginOrderWithinContext: %d", window->Active, window->WasActive, window->WriteAccessed, (window->Active || window->WasActive) ? window->BeginOrderWithinContext : -1);
11517 BulletText("Appearing: %d, Hidden: %d (CanSkip %d Cannot %d), SkipItems: %d", window->Appearing, window->Hidden, window->HiddenFramesCanSkipItems, window->HiddenFramesCannotSkipItems, window->SkipItems);
11518 for (int layer = 0; layer < ImGuiNavLayer_COUNT; layer++)
11519 {
11520 ImRect r = window->NavRectRel[layer];
11521 if (r.Min.x >= r.Max.y && r.Min.y >= r.Max.y)
11522 {
11523 BulletText("NavLastIds[%d]: 0x%08X", layer, window->NavLastIds[layer]);
11524 continue;
11525 }
11526 BulletText("NavLastIds[%d]: 0x%08X at +(%.1f,%.1f)(%.1f,%.1f)", layer, window->NavLastIds[layer], r.Min.x, r.Min.y, r.Max.x, r.Max.y);
11527 if (IsItemHovered())
11528 GetForegroundDrawList(window)->AddRect(r.Min + window->Pos, r.Max + window->Pos, IM_COL32(255, 255, 0, 255));
11529 }
11530 BulletText("NavLayersActiveMask: %X, NavLastChildNavWindow: %s", window->DC.NavLayersActiveMask, window->NavLastChildNavWindow ? window->NavLastChildNavWindow->Name : "NULL");
11531 if (window->RootWindow != window) { DebugNodeWindow(window->RootWindow, "RootWindow"); }
11532 if (window->ParentWindow != NULL) { DebugNodeWindow(window->ParentWindow, "ParentWindow"); }
11533 if (window->DC.ChildWindows.Size > 0) { DebugNodeWindowsList(&window->DC.ChildWindows, "ChildWindows"); }
11534 if (window->ColumnsStorage.Size > 0 && TreeNode("Columns", "Columns sets (%d)", window->ColumnsStorage.Size))
11535 {
11536 for (int n = 0; n < window->ColumnsStorage.Size; n++)
11537 DebugNodeColumns(&window->ColumnsStorage[n]);
11538 TreePop();
11539 }
11540 DebugNodeStorage(&window->StateStorage, "Storage");
11541 TreePop();
11542}
int ImGuiTreeNodeFlags
Definition imgui.h:199
@ ImGuiTreeNodeFlags_Selected
Definition imgui.h:987
@ ImGuiTreeNodeFlags_None
Definition imgui.h:986
@ ImGuiWindowFlags_NoNavInputs
Definition imgui.h:933
@ ImGuiWindowFlags_NoMouseInputs
Definition imgui.h:925
@ ImGuiNavLayer_COUNT
Definition imgui_internal.h:937
IMGUI_API bool TreeNodeEx(const char *label, ImGuiTreeNodeFlags flags=0)
Definition imgui_widgets.cpp:5611
IMGUI_API void DebugNodeColumns(ImGuiOldColumns *columns)
Definition imgui.cpp:11284
IMGUI_API void DebugNodeWindowsList(ImVector< ImGuiWindow * > *windows, const char *label)
Definition imgui.cpp:11550
IMGUI_API void DebugNodeStorage(ImGuiStorage *storage, const char *label)
Definition imgui.cpp:11418
IMGUI_API void TextDisabled(const char *fmt,...) IM_FMTARGS(1)
Definition imgui_widgets.cpp:297
IMGUI_API void DebugNodeWindow(ImGuiWindow *window, const char *label)
Definition imgui.cpp:11486
ImGuiWindow * ParentWindow
Definition imgui_internal.h:1885
ImGuiWindow * NavLastChildNavWindow
Definition imgui_internal.h:1890
ImVector< ImGuiOldColumns > ColumnsStorage
Definition imgui_internal.h:1879

References ImGuiWindow::Active, ImDrawList::AddRect(), ImGuiWindow::Appearing, ImGuiWindow::BeginOrderWithinContext, BulletText(), ImGuiWindowTempData::ChildWindows, ImGuiWindow::ColumnsStorage, ImGuiWindow::ContentSize, ImGuiWindow::ContentSizeIdeal, ImGuiWindow::DC, DebugNodeColumns(), DebugNodeDrawList(), DebugNodeStorage(), DebugNodeWindow(), DebugNodeWindowsList(), ImGuiWindow::DrawList, ImGuiWindow::Flags, GetForegroundDrawList(), GetStyleColorVec4(), GImGui, ImGuiWindow::Hidden, ImGuiWindow::HiddenFramesCannotSkipItems, ImGuiWindow::HiddenFramesCanSkipItems, IM_COL32, ImGuiCol_Text, ImGuiCol_TextDisabled, ImGuiNavLayer_COUNT, ImGuiTreeNodeFlags_None, ImGuiTreeNodeFlags_Selected, ImGuiWindowFlags_AlwaysAutoResize, ImGuiWindowFlags_ChildMenu, ImGuiWindowFlags_ChildWindow, ImGuiWindowFlags_Modal, ImGuiWindowFlags_NoMouseInputs, ImGuiWindowFlags_NoNavInputs, ImGuiWindowFlags_NoSavedSettings, ImGuiWindowFlags_Popup, ImGuiWindowFlags_Tooltip, IsItemHovered(), ImRect::Max, ImGuiWindow::MemoryCompacted, ImRect::Min, ImGuiWindow::Name, ImGuiWindow::NavLastChildNavWindow, ImGuiWindow::NavLastIds, ImGuiWindowTempData::NavLayersActiveMask, ImGuiWindow::NavRectRel, ImGuiContext::NavWindow, ImGuiWindow::ParentWindow, PopStyleColor(), ImGuiWindow::Pos, PushStyleColor(), ImGuiWindow::RootWindow, ImGuiWindow::Scroll, ImGuiWindow::ScrollbarX, ImGuiWindow::ScrollbarY, ImGuiWindow::ScrollMax, ImVector< T >::Size, ImGuiWindow::Size, ImGuiWindow::SkipItems, ImGuiWindow::StateStorage, TextDisabled(), TreeNode(), TreeNodeEx(), TreePop(), ImGuiWindow::WasActive, ImGuiWindow::WriteAccessed, ImVec2::x, and ImVec2::y.

Referenced by DebugNodeWindow(), and DebugNodeWindowsList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DebugNodeWindowSettings()

void ImGui::DebugNodeWindowSettings ( ImGuiWindowSettings settings)
11545{
11546 Text("0x%08X \"%s\" Pos (%d,%d) Size (%d,%d) Collapsed=%d",
11547 settings->ID, settings->GetName(), settings->Pos.x, settings->Pos.y, settings->Size.x, settings->Size.y, settings->Collapsed);
11548}
bool Collapsed
Definition imgui_internal.h:1265
ImVec2ih Size
Definition imgui_internal.h:1264
ImVec2ih Pos
Definition imgui_internal.h:1263

References ImGuiWindowSettings::Collapsed, ImGuiWindowSettings::GetName(), ImGuiWindowSettings::ID, ImGuiWindowSettings::Pos, ImGuiWindowSettings::Size, Text(), ImVec2ih::x, and ImVec2ih::y.

Referenced by ShowMetricsWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DebugNodeWindowsList()

void ImGui::DebugNodeWindowsList ( ImVector< ImGuiWindow * > *  windows,
const char *  label 
)
11551{
11552 if (!TreeNode(label, "%s (%d)", label, windows->Size))
11553 return;
11554 Text("(In front-to-back order:)");
11555 for (int i = windows->Size - 1; i >= 0; i--) // Iterate front to back
11556 {
11557 PushID((*windows)[i]);
11558 DebugNodeWindow((*windows)[i], "Window");
11559 PopID();
11560 }
11561 TreePop();
11562}

References DebugNodeWindow(), PopID(), PushID(), ImVector< T >::Size, Text(), TreeNode(), and TreePop().

Referenced by DebugNodeWindow(), and ShowMetricsWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DebugRenderViewportThumbnail()

void ImGui::DebugRenderViewportThumbnail ( ImDrawList draw_list,
ImGuiViewportP viewport,
const ImRect bb 
)
10849{
10850 ImGuiContext& g = *GImGui;
10851 ImGuiWindow* window = g.CurrentWindow;
10852
10853 ImVec2 scale = bb.GetSize() / viewport->Size;
10854 ImVec2 off = bb.Min - viewport->Pos * scale;
10855 float alpha_mul = 1.0f;
10856 window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_Border, alpha_mul * 0.40f));
10857 for (int i = 0; i != g.Windows.Size; i++)
10858 {
10859 ImGuiWindow* thumb_window = g.Windows[i];
10860 if (!thumb_window->WasActive || (thumb_window->Flags & ImGuiWindowFlags_ChildWindow))
10861 continue;
10862
10863 ImRect thumb_r = thumb_window->Rect();
10864 ImRect title_r = thumb_window->TitleBarRect();
10865 thumb_r = ImRect(ImFloor(off + thumb_r.Min * scale), ImFloor(off + thumb_r.Max * scale));
10866 title_r = ImRect(ImFloor(off + title_r.Min * scale), ImFloor(off + ImVec2(title_r.Max.x, title_r.Min.y) * scale) + ImVec2(0,5)); // Exaggerate title bar height
10867 thumb_r.ClipWithFull(bb);
10868 title_r.ClipWithFull(bb);
10869 const bool window_is_focused = (g.NavWindow && thumb_window->RootWindowForTitleBarHighlight == g.NavWindow->RootWindowForTitleBarHighlight);
10870 window->DrawList->AddRectFilled(thumb_r.Min, thumb_r.Max, GetColorU32(ImGuiCol_WindowBg, alpha_mul));
10871 window->DrawList->AddRectFilled(title_r.Min, title_r.Max, GetColorU32(window_is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg, alpha_mul));
10872 window->DrawList->AddRect(thumb_r.Min, thumb_r.Max, GetColorU32(ImGuiCol_Border, alpha_mul));
10873 window->DrawList->AddText(g.Font, g.FontSize * 1.0f, title_r.Min, GetColorU32(ImGuiCol_Text, alpha_mul), thumb_window->Name, FindRenderedTextEnd(thumb_window->Name));
10874 }
10875 draw_list->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_Border, alpha_mul));
10876}
int scale(const int val)
Definition WipeTowerDialog.cpp:14
@ ImGuiCol_Border
Definition imgui.h:1418
@ ImGuiCol_WindowBg
Definition imgui.h:1415
@ ImGuiCol_TitleBgActive
Definition imgui.h:1424
@ ImGuiCol_TitleBg
Definition imgui.h:1423
IMGUI_API void AddText(const ImVec2 &pos, ImU32 col, const char *text_begin, const char *text_end=NULL)
Definition imgui_draw.cpp:1593

References ImDrawList::AddRect(), ImDrawList::AddRectFilled(), ImDrawList::AddText(), ImRect::ClipWithFull(), ImGuiContext::CurrentWindow, ImGuiWindow::DrawList, FindRenderedTextEnd(), ImGuiWindow::Flags, ImGuiContext::Font, ImGuiContext::FontSize, GetColorU32(), ImRect::GetSize(), GImGui, ImFloor(), ImGuiCol_Border, ImGuiCol_Text, ImGuiCol_TitleBg, ImGuiCol_TitleBgActive, ImGuiCol_WindowBg, ImGuiWindowFlags_ChildWindow, ImRect::Max, ImRect::Min, ImGuiWindow::Name, ImGuiContext::NavWindow, ImGuiViewport::Pos, ImGuiWindow::Rect(), ImGuiWindow::RootWindowForTitleBarHighlight, scale(), ImVector< T >::Size, ImGuiViewport::Size, ImGuiWindow::TitleBarRect(), ImGuiWindow::WasActive, ImGuiContext::Windows, ImVec2::x, and ImVec2::y.

Referenced by RenderViewportsThumbnails().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DebugStartItemPicker()

void ImGui::DebugStartItemPicker ( )
inline
2614{ ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; }
bool DebugItemPickerActive
Definition imgui_internal.h:1582

References ImGuiContext::DebugItemPickerActive, and GImGui.

Referenced by ShowMetricsWindow().

+ Here is the caller graph for this function:

◆ DestroyContext()

void ImGui::DestroyContext ( ImGuiContext ctx = NULL)
3400{
3401 if (ctx == NULL)
3402 ctx = GImGui;
3403 Shutdown(ctx);
3404 if (GImGui == ctx)
3405 SetCurrentContext(NULL);
3406 IM_DELETE(ctx);
3407}
void IM_DELETE(T *p)
Definition imgui.h:1638
IMGUI_API void Shutdown(ImGuiContext *context)
Definition imgui.cpp:4158

References GImGui, IM_DELETE(), SetCurrentContext(), and Shutdown().

Referenced by Slic3r::GUI::ImGuiWrapper::~ImGuiWrapper(), and igl::opengl::glfw::imgui::ImGuiMenu::shutdown().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DragBehavior()

bool ImGui::DragBehavior ( ImGuiID  id,
ImGuiDataType  data_type,
void p_v,
float  v_speed,
const void p_min,
const void p_max,
const char *  format,
ImGuiSliderFlags  flags 
)
2270{
2271 // Read imgui.cpp "API BREAKING CHANGES" section for 1.78 if you hit this assert.
2272 IM_ASSERT((flags == 1 || (flags & ImGuiSliderFlags_InvalidMask_) == 0) && "Invalid ImGuiSliderFlags flags! Has the 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.");
2273
2274 ImGuiContext& g = *GImGui;
2275 if (g.ActiveId == id)
2276 {
2278 ClearActiveID();
2280 ClearActiveID();
2281 }
2282 if (g.ActiveId != id)
2283 return false;
2285 return false;
2286
2287 switch (data_type)
2288 {
2289 case ImGuiDataType_S8: { ImS32 v32 = (ImS32)*(ImS8*)p_v; bool r = DragBehaviorT<ImS32, ImS32, float>(ImGuiDataType_S32, &v32, v_speed, p_min ? *(const ImS8*) p_min : IM_S8_MIN, p_max ? *(const ImS8*)p_max : IM_S8_MAX, format, flags); if (r) *(ImS8*)p_v = (ImS8)v32; return r; }
2290 case ImGuiDataType_U8: { ImU32 v32 = (ImU32)*(ImU8*)p_v; bool r = DragBehaviorT<ImU32, ImS32, float>(ImGuiDataType_U32, &v32, v_speed, p_min ? *(const ImU8*) p_min : IM_U8_MIN, p_max ? *(const ImU8*)p_max : IM_U8_MAX, format, flags); if (r) *(ImU8*)p_v = (ImU8)v32; return r; }
2291 case ImGuiDataType_S16: { ImS32 v32 = (ImS32)*(ImS16*)p_v; bool r = DragBehaviorT<ImS32, ImS32, float>(ImGuiDataType_S32, &v32, v_speed, p_min ? *(const ImS16*)p_min : IM_S16_MIN, p_max ? *(const ImS16*)p_max : IM_S16_MAX, format, flags); if (r) *(ImS16*)p_v = (ImS16)v32; return r; }
2292 case ImGuiDataType_U16: { ImU32 v32 = (ImU32)*(ImU16*)p_v; bool r = DragBehaviorT<ImU32, ImS32, float>(ImGuiDataType_U32, &v32, v_speed, p_min ? *(const ImU16*)p_min : IM_U16_MIN, p_max ? *(const ImU16*)p_max : IM_U16_MAX, format, flags); if (r) *(ImU16*)p_v = (ImU16)v32; return r; }
2293 case ImGuiDataType_S32: return DragBehaviorT<ImS32, ImS32, float >(data_type, (ImS32*)p_v, v_speed, p_min ? *(const ImS32* )p_min : IM_S32_MIN, p_max ? *(const ImS32* )p_max : IM_S32_MAX, format, flags);
2294 case ImGuiDataType_U32: return DragBehaviorT<ImU32, ImS32, float >(data_type, (ImU32*)p_v, v_speed, p_min ? *(const ImU32* )p_min : IM_U32_MIN, p_max ? *(const ImU32* )p_max : IM_U32_MAX, format, flags);
2295 case ImGuiDataType_S64: return DragBehaviorT<ImS64, ImS64, double>(data_type, (ImS64*)p_v, v_speed, p_min ? *(const ImS64* )p_min : IM_S64_MIN, p_max ? *(const ImS64* )p_max : IM_S64_MAX, format, flags);
2296 case ImGuiDataType_U64: return DragBehaviorT<ImU64, ImS64, double>(data_type, (ImU64*)p_v, v_speed, p_min ? *(const ImU64* )p_min : IM_U64_MIN, p_max ? *(const ImU64* )p_max : IM_U64_MAX, format, flags);
2297 case ImGuiDataType_Float: return DragBehaviorT<float, float, float >(data_type, (float*)p_v, v_speed, p_min ? *(const float* )p_min : -FLT_MAX, p_max ? *(const float* )p_max : FLT_MAX, format, flags);
2298 case ImGuiDataType_Double: return DragBehaviorT<double,double,double>(data_type, (double*)p_v, v_speed, p_min ? *(const double*)p_min : -DBL_MAX, p_max ? *(const double*)p_max : DBL_MAX, format, flags);
2299 case ImGuiDataType_COUNT: break;
2300 }
2301 IM_ASSERT(0);
2302 return false;
2303}
#define const
Definition getopt.c:38
@ ImGuiSliderFlags_InvalidMask_
Definition imgui.h:1574
@ ImGuiSliderFlags_ReadOnly
Definition imgui_internal.h:802
@ ImGuiItemFlags_ReadOnly
Definition imgui_internal.h:730
ImGuiID NavActivatePressedId
Definition imgui_internal.h:1445

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdIsJustActivated, ImGuiContext::ActiveIdSource, ClearActiveID(), ImGuiContext::CurrentItemFlags, GImGui, IM_ASSERT, IM_S16_MAX, IM_S16_MIN, IM_S32_MAX, IM_S32_MIN, IM_S64_MAX, IM_S64_MIN, IM_S8_MAX, IM_S8_MIN, IM_U16_MAX, IM_U16_MIN, IM_U32_MAX, IM_U32_MIN, IM_U64_MAX, IM_U64_MIN, IM_U8_MAX, IM_U8_MIN, ImGuiDataType_COUNT, ImGuiDataType_Double, ImGuiDataType_Float, ImGuiDataType_S16, ImGuiDataType_S32, ImGuiDataType_S64, ImGuiDataType_S8, ImGuiDataType_U16, ImGuiDataType_U32, ImGuiDataType_U64, ImGuiDataType_U8, ImGuiInputSource_Mouse, ImGuiInputSource_Nav, ImGuiItemFlags_ReadOnly, ImGuiSliderFlags_InvalidMask_, ImGuiSliderFlags_ReadOnly, ImGuiContext::IO, ImGuiIO::MouseDown, and ImGuiContext::NavActivatePressedId.

Referenced by DragScalar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DragBehaviorT()

template<typename T , typename SIGNED_T , typename FLOAT_T >
IMGUI_API bool ImGui::DragBehaviorT ( ImGuiDataType  data_type,
T *  v,
float  v_speed,
v_min,
v_max,
const char *  format,
ImGuiSliderFlags  flags 
)

◆ DragFloat() [1/2]

static bool ImGui::DragFloat ( const char *  label,
float *  v,
float  v_speed,
float  v_min,
float  v_max,
const char *  format,
float  power 
)
inlinestatic
2795{ return DragScalar(label, ImGuiDataType_Float, v, v_speed, &v_min, &v_max, format, power); }
IMGUI_API bool DragScalar(const char *label, ImGuiDataType data_type, void *p_data, float v_speed=1.0f, const void *p_min=NULL, const void *p_max=NULL, const char *format=NULL, ImGuiSliderFlags flags=0)
Definition imgui_widgets.cpp:2307

References DragFloat(), DragScalar(), and ImGuiDataType_Float.

+ Here is the call graph for this function:

◆ DragFloat() [2/2]

bool ImGui::DragFloat ( const char *  label,
float *  v,
float  v_speed = 1.0f,
float  v_min = 0.0f,
float  v_max = 0.0f,
const char *  format = "%.3f",
ImGuiSliderFlags  flags = 0 
)
2427{
2428 return DragScalar(label, ImGuiDataType_Float, v, v_speed, &v_min, &v_max, format, flags);
2429}

References DragScalar(), and ImGuiDataType_Float.

Referenced by ColorEdit4(), Slic3r::GUI::ImGuiWrapper::drag_optional_float(), DragFloat(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), ShowDemoWindowLayout(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppCustomRendering(), ShowFont(), ShowPlaceholderObject(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DragFloat2() [1/2]

static bool ImGui::DragFloat2 ( const char *  label,
float  v[2],
float  v_speed,
float  v_min,
float  v_max,
const char *  format,
float  power 
)
inlinestatic
2796{ return DragScalarN(label, ImGuiDataType_Float, v, 2, v_speed, &v_min, &v_max, format, power); }
IMGUI_API bool DragScalarN(const char *label, ImGuiDataType data_type, void *p_data, int components, float v_speed=1.0f, const void *p_min=NULL, const void *p_max=NULL, const char *format=NULL, ImGuiSliderFlags flags=0)
Definition imgui_widgets.cpp:2391

References DragFloat2(), DragScalarN(), and ImGuiDataType_Float.

+ Here is the call graph for this function:

◆ DragFloat2() [2/2]

bool ImGui::DragFloat2 ( const char *  label,
float  v[2],
float  v_speed = 1.0f,
float  v_min = 0.0f,
float  v_max = 0.0f,
const char *  format = "%.3f",
ImGuiSliderFlags  flags = 0 
)
2432{
2433 return DragScalarN(label, ImGuiDataType_Float, v, 2, v_speed, &v_min, &v_max, format, flags);
2434}

References DragScalarN(), and ImGuiDataType_Float.

Referenced by DragFloat2(), ShowDemoWindowLayout(), ShowDemoWindowTables(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DragFloat3() [1/2]

static bool ImGui::DragFloat3 ( const char *  label,
float  v[3],
float  v_speed,
float  v_min,
float  v_max,
const char *  format,
float  power 
)
inlinestatic
2797{ return DragScalarN(label, ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, power); }

References DragFloat3(), DragScalarN(), and ImGuiDataType_Float.

+ Here is the call graph for this function:

◆ DragFloat3() [2/2]

bool ImGui::DragFloat3 ( const char *  label,
float  v[3],
float  v_speed = 1.0f,
float  v_min = 0.0f,
float  v_max = 0.0f,
const char *  format = "%.3f",
ImGuiSliderFlags  flags = 0 
)
2437{
2438 return DragScalarN(label, ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, flags);
2439}

References DragScalarN(), and ImGuiDataType_Float.

Referenced by DragFloat3(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DragFloat4() [1/2]

static bool ImGui::DragFloat4 ( const char *  label,
float  v[4],
float  v_speed,
float  v_min,
float  v_max,
const char *  format,
float  power 
)
inlinestatic
2798{ return DragScalarN(label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, power); }

References DragFloat4(), DragScalarN(), and ImGuiDataType_Float.

+ Here is the call graph for this function:

◆ DragFloat4() [2/2]

bool ImGui::DragFloat4 ( const char *  label,
float  v[4],
float  v_speed = 1.0f,
float  v_min = 0.0f,
float  v_max = 0.0f,
const char *  format = "%.3f",
ImGuiSliderFlags  flags = 0 
)
2442{
2443 return DragScalarN(label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, flags);
2444}

References DragScalarN(), and ImGuiDataType_Float.

Referenced by DragFloat4(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DragFloatRange2()

bool ImGui::DragFloatRange2 ( const char *  label,
float *  v_current_min,
float *  v_current_max,
float  v_speed = 1.0f,
float  v_min = 0.0f,
float  v_max = 0.0f,
const char *  format = "%.3f",
const char *  format_max = NULL,
ImGuiSliderFlags  flags = 0 
)
2448{
2449 ImGuiWindow* window = GetCurrentWindow();
2450 if (window->SkipItems)
2451 return false;
2452
2453 ImGuiContext& g = *GImGui;
2454 PushID(label);
2455 BeginGroup();
2457
2458 float min_min = (v_min >= v_max) ? -FLT_MAX : v_min;
2459 float min_max = (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max);
2460 ImGuiSliderFlags min_flags = flags | ((min_min == min_max) ? ImGuiSliderFlags_ReadOnly : 0);
2461 bool value_changed = DragScalar("##min", ImGuiDataType_Float, v_current_min, v_speed, &min_min, &min_max, format, min_flags);
2462 PopItemWidth();
2464
2465 float max_min = (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min);
2466 float max_max = (v_min >= v_max) ? FLT_MAX : v_max;
2467 ImGuiSliderFlags max_flags = flags | ((max_min == max_max) ? ImGuiSliderFlags_ReadOnly : 0);
2468 value_changed |= DragScalar("##max", ImGuiDataType_Float, v_current_max, v_speed, &max_min, &max_max, format_max ? format_max : format, max_flags);
2469 PopItemWidth();
2471
2472 TextEx(label, FindRenderedTextEnd(label));
2473 EndGroup();
2474 PopID();
2475 return value_changed;
2476}
int ImGuiSliderFlags
Definition imgui.h:193
IMGUI_API void PushMultiItemsWidths(int components, float width_full)
Definition imgui.cpp:7572

References BeginGroup(), CalcItemWidth(), DragScalar(), EndGroup(), FindRenderedTextEnd(), GetCurrentWindow(), GImGui, ImGuiDataType_Float, ImGuiSliderFlags_ReadOnly, ImMax(), ImMin(), ImGuiStyle::ItemInnerSpacing, PopID(), PopItemWidth(), PushID(), PushMultiItemsWidths(), SameLine(), ImGuiWindow::SkipItems, ImGuiContext::Style, TextEx(), and ImVec2::x.

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DragInt()

bool ImGui::DragInt ( const char *  label,
int *  v,
float  v_speed = 1.0f,
int  v_min = 0,
int  v_max = 0,
const char *  format = "%d",
ImGuiSliderFlags  flags = 0 
)
2480{
2481 return DragScalar(label, ImGuiDataType_S32, v, v_speed, &v_min, &v_max, format, flags);
2482}

References DragScalar(), and ImGuiDataType_S32.

Referenced by ColorEdit4(), DragIntRange2(), ShowDemoWindowColumns(), ShowDemoWindowLayout(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), and ShowExampleAppConstrainedResize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DragInt2()

bool ImGui::DragInt2 ( const char *  label,
int  v[2],
float  v_speed = 1.0f,
int  v_min = 0,
int  v_max = 0,
const char *  format = "%d",
ImGuiSliderFlags  flags = 0 
)
2485{
2486 return DragScalarN(label, ImGuiDataType_S32, v, 2, v_speed, &v_min, &v_max, format, flags);
2487}

References DragScalarN(), and ImGuiDataType_S32.

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DragInt3()

bool ImGui::DragInt3 ( const char *  label,
int  v[3],
float  v_speed = 1.0f,
int  v_min = 0,
int  v_max = 0,
const char *  format = "%d",
ImGuiSliderFlags  flags = 0 
)
2490{
2491 return DragScalarN(label, ImGuiDataType_S32, v, 3, v_speed, &v_min, &v_max, format, flags);
2492}

References DragScalarN(), and ImGuiDataType_S32.

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DragInt4()

bool ImGui::DragInt4 ( const char *  label,
int  v[4],
float  v_speed = 1.0f,
int  v_min = 0,
int  v_max = 0,
const char *  format = "%d",
ImGuiSliderFlags  flags = 0 
)
2495{
2496 return DragScalarN(label, ImGuiDataType_S32, v, 4, v_speed, &v_min, &v_max, format, flags);
2497}

References DragScalarN(), and ImGuiDataType_S32.

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DragIntRange2()

bool ImGui::DragIntRange2 ( const char *  label,
int *  v_current_min,
int *  v_current_max,
float  v_speed = 1.0f,
int  v_min = 0,
int  v_max = 0,
const char *  format = "%d",
const char *  format_max = NULL,
ImGuiSliderFlags  flags = 0 
)
2501{
2502 ImGuiWindow* window = GetCurrentWindow();
2503 if (window->SkipItems)
2504 return false;
2505
2506 ImGuiContext& g = *GImGui;
2507 PushID(label);
2508 BeginGroup();
2510
2511 int min_min = (v_min >= v_max) ? INT_MIN : v_min;
2512 int min_max = (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max);
2513 ImGuiSliderFlags min_flags = flags | ((min_min == min_max) ? ImGuiSliderFlags_ReadOnly : 0);
2514 bool value_changed = DragInt("##min", v_current_min, v_speed, min_min, min_max, format, min_flags);
2515 PopItemWidth();
2517
2518 int max_min = (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min);
2519 int max_max = (v_min >= v_max) ? INT_MAX : v_max;
2520 ImGuiSliderFlags max_flags = flags | ((max_min == max_max) ? ImGuiSliderFlags_ReadOnly : 0);
2521 value_changed |= DragInt("##max", v_current_max, v_speed, max_min, max_max, format_max ? format_max : format, max_flags);
2522 PopItemWidth();
2524
2525 TextEx(label, FindRenderedTextEnd(label));
2526 EndGroup();
2527 PopID();
2528
2529 return value_changed;
2530}

References BeginGroup(), CalcItemWidth(), DragInt(), EndGroup(), FindRenderedTextEnd(), GetCurrentWindow(), GImGui, ImGuiSliderFlags_ReadOnly, ImMax(), ImMin(), ImGuiStyle::ItemInnerSpacing, PopID(), PopItemWidth(), PushID(), PushMultiItemsWidths(), SameLine(), ImGuiWindow::SkipItems, ImGuiContext::Style, TextEx(), and ImVec2::x.

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DragScalar() [1/2]

bool ImGui::DragScalar ( const char *  label,
ImGuiDataType  data_type,
void p_data,
float  v_speed,
const void p_min,
const void p_max,
const char *  format,
float  power 
)
2536{
2538 if (power != 1.0f)
2539 {
2540 IM_ASSERT(power == 1.0f && "Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!");
2541 IM_ASSERT(p_min != NULL && p_max != NULL); // When using a power curve the drag needs to have known bounds
2542 drag_flags |= ImGuiSliderFlags_Logarithmic; // Fallback for non-asserting paths
2543 }
2544 return DragScalar(label, data_type, p_data, v_speed, p_min, p_max, format, drag_flags);
2545}
@ ImGuiSliderFlags_Logarithmic
Definition imgui.h:1571
@ ImGuiSliderFlags_None
Definition imgui.h:1569

References DragScalar(), IM_ASSERT, ImGuiSliderFlags_Logarithmic, and ImGuiSliderFlags_None.

+ Here is the call graph for this function:

◆ DragScalar() [2/2]

bool ImGui::DragScalar ( const char *  label,
ImGuiDataType  data_type,
void p_data,
float  v_speed = 1.0f,
const void p_min = NULL,
const void p_max = NULL,
const char *  format = NULL,
ImGuiSliderFlags  flags = 0 
)
2308{
2309 ImGuiWindow* window = GetCurrentWindow();
2310 if (window->SkipItems)
2311 return false;
2312
2313 ImGuiContext& g = *GImGui;
2314 const ImGuiStyle& style = g.Style;
2315 const ImGuiID id = window->GetID(label);
2316 const float w = CalcItemWidth();
2317
2318 const ImVec2 label_size = CalcTextSize(label, NULL, true);
2319 const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f));
2320 const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
2321
2322 const bool temp_input_allowed = (flags & ImGuiSliderFlags_NoInput) == 0;
2323 ItemSize(total_bb, style.FramePadding.y);
2324 if (!ItemAdd(total_bb, id, &frame_bb, temp_input_allowed ? ImGuiItemAddFlags_Focusable : 0))
2325 return false;
2326
2327 // Default format string when passing NULL
2328 if (format == NULL)
2329 format = DataTypeGetInfo(data_type)->PrintFmt;
2330 else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) // (FIXME-LEGACY: Patch old "%.0f" format string to use "%d", read function more details.)
2331 format = PatchFormatStringFloatToInt(format);
2332
2333 // Tabbing or CTRL-clicking on Drag turns it into an InputText
2334 const bool hovered = ItemHoverable(frame_bb, id);
2335 bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
2336 if (!temp_input_is_active)
2337 {
2338 const bool focus_requested = temp_input_allowed && (window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_Focused) != 0;
2339 const bool clicked = (hovered && g.IO.MouseClicked[0]);
2340 const bool double_clicked = (hovered && g.IO.MouseDoubleClicked[0]);
2341 if (focus_requested || clicked || double_clicked || g.NavActivateId == id || g.NavInputId == id)
2342 {
2343 SetActiveID(id, window);
2344 SetFocusID(id, window);
2345 FocusWindow(window);
2347 if (temp_input_allowed && (focus_requested || (clicked && g.IO.KeyCtrl) || double_clicked || g.NavInputId == id))
2348 temp_input_is_active = true;
2349 }
2350 // Experimental: simple click (without moving) turns Drag into an InputText
2351 // FIXME: Currently polling ImGuiConfigFlags_IsTouchScreen, may either poll an hypothetical ImGuiBackendFlags_HasKeyboard and/or an explicit drag settings.
2352 if (g.IO.ConfigDragClickToInputText && temp_input_allowed && !temp_input_is_active)
2353 if (g.ActiveId == id && hovered && g.IO.MouseReleased[0] && !IsMouseDragPastThreshold(0, g.IO.MouseDragThreshold * DRAG_MOUSE_THRESHOLD_FACTOR))
2354 {
2355 g.NavInputId = id;
2356 temp_input_is_active = true;
2357 }
2358 }
2359
2360 if (temp_input_is_active)
2361 {
2362 // Only clamp CTRL+Click input when ImGuiSliderFlags_AlwaysClamp is set
2363 const bool is_clamp_input = (flags & ImGuiSliderFlags_AlwaysClamp) != 0 && (p_min == NULL || p_max == NULL || DataTypeCompare(data_type, p_min, p_max) < 0);
2364 return TempInputScalar(frame_bb, id, label, data_type, p_data, format, is_clamp_input ? p_min : NULL, is_clamp_input ? p_max : NULL);
2365 }
2366
2367 // Draw frame
2368 const ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : g.HoveredId == id ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);
2369 RenderNavHighlight(frame_bb, id);
2370 RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, style.FrameRounding);
2371
2372 // Drag behavior
2373 const bool value_changed = DragBehavior(id, data_type, p_data, v_speed, p_min, p_max, format, flags);
2374 if (value_changed)
2375 MarkItemEdited(id);
2376
2377 // Display value using user-provided display format so user can add prefix/suffix/decorations to the value.
2378 char value_buf[64];
2379 const char* value_buf_end = value_buf + DataTypeFormatString(value_buf, IM_ARRAYSIZE(value_buf), data_type, p_data, format);
2380 if (g.LogEnabled)
2381 LogSetNextTextDecoration("{", "}");
2382 RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f, 0.5f));
2383
2384 if (label_size.x > 0.0f)
2385 RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
2386
2388 return value_changed;
2389}
@ ImGuiSliderFlags_AlwaysClamp
Definition imgui.h:1570
@ ImGuiSliderFlags_NoInput
Definition imgui.h:1573
@ ImGuiItemStatusFlags_Focused
Definition imgui_internal.h:755
const char * PrintFmt
Definition imgui_internal.h:957
@ ImGuiItemAddFlags_Focusable
Definition imgui_internal.h:738
static const float DRAG_MOUSE_THRESHOLD_FACTOR
Definition imgui_widgets.cpp:95
static const char * PatchFormatStringFloatToInt(const char *fmt)
Definition imgui_widgets.cpp:1810
IMGUI_API bool DragBehavior(ImGuiID id, ImGuiDataType data_type, void *p_v, float v_speed, const void *p_min, const void *p_max, const char *format, ImGuiSliderFlags flags)
Definition imgui_widgets.cpp:2269
IMGUI_API bool TempInputScalar(const ImRect &bb, ImGuiID id, const char *label, ImGuiDataType data_type, void *p_data, const char *format, const void *p_clamp_min=NULL, const void *p_clamp_max=NULL)
Definition imgui_widgets.cpp:3302
bool TempInputIsActive(ImGuiID id)
Definition imgui_internal.h:2591
IMGUI_API int DataTypeFormatString(char *buf, int buf_size, ImGuiDataType data_type, const void *p_data, const char *format)
Definition imgui_widgets.cpp:1837
IMGUI_API int DataTypeCompare(ImGuiDataType data_type, const void *arg_1, const void *arg_2)
Definition imgui_widgets.cpp:2021
ImGuiID NavInputId
Definition imgui_internal.h:1446
bool ConfigDragClickToInputText
Definition imgui.h:1805
float MouseDragThreshold
Definition imgui.h:1789

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdUsingNavDirMask, CalcItemWidth(), CalcTextSize(), ImGuiIO::ConfigDragClickToInputText, ImGuiWindowTempData::CursorPos, DataTypeCompare(), DataTypeFormatString(), DataTypeGetInfo(), ImGuiWindow::DC, DRAG_MOUSE_THRESHOLD_FACTOR, DragBehavior(), FocusWindow(), GetColorU32(), GetCurrentWindow(), ImGuiWindow::GetID(), GImGui, ImGuiContext::HoveredId, IM_ARRAYSIZE, IMGUI_TEST_ENGINE_ITEM_INFO, ImGuiCol_FrameBg, ImGuiCol_FrameBgActive, ImGuiCol_FrameBgHovered, ImGuiDataType_S32, ImGuiDir_Left, ImGuiDir_Right, ImGuiItemAddFlags_Focusable, ImGuiItemStatusFlags_Focused, ImGuiSliderFlags_AlwaysClamp, ImGuiSliderFlags_NoInput, ImGuiContext::IO, IsMouseDragPastThreshold(), ItemAdd(), ItemHoverable(), ItemSize(), ImGuiIO::KeyCtrl, ImGuiWindowTempData::LastItemStatusFlags, ImGuiContext::LogEnabled, LogSetNextTextDecoration(), MarkItemEdited(), ImRect::Max, ImRect::Min, ImGuiIO::MouseClicked, ImGuiIO::MouseDoubleClicked, ImGuiIO::MouseDragThreshold, ImGuiIO::MouseReleased, ImGuiContext::NavActivateId, ImGuiContext::NavInputId, PatchFormatStringFloatToInt(), ImGuiDataTypeInfo::PrintFmt, RenderFrame(), RenderNavHighlight(), RenderText(), RenderTextClipped(), SetActiveID(), SetFocusID(), ImGuiWindow::SkipItems, ImGuiContext::Style, style, TempInputIsActive(), TempInputScalar(), ImVec2::x, and ImVec2::y.

Referenced by DragFloat(), DragFloat(), DragFloatRange2(), DragInt(), DragScalar(), DragScalarN(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DragScalarN() [1/2]

bool ImGui::DragScalarN ( const char *  label,
ImGuiDataType  data_type,
void p_data,
int  components,
float  v_speed,
const void p_min,
const void p_max,
const char *  format,
float  power 
)
2548{
2550 if (power != 1.0f)
2551 {
2552 IM_ASSERT(power == 1.0f && "Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!");
2553 IM_ASSERT(p_min != NULL && p_max != NULL); // When using a power curve the drag needs to have known bounds
2554 drag_flags |= ImGuiSliderFlags_Logarithmic; // Fallback for non-asserting paths
2555 }
2556 return DragScalarN(label, data_type, p_data, components, v_speed, p_min, p_max, format, drag_flags);
2557}

References DragScalarN(), IM_ASSERT, ImGuiSliderFlags_Logarithmic, and ImGuiSliderFlags_None.

+ Here is the call graph for this function:

◆ DragScalarN() [2/2]

bool ImGui::DragScalarN ( const char *  label,
ImGuiDataType  data_type,
void p_data,
int  components,
float  v_speed = 1.0f,
const void p_min = NULL,
const void p_max = NULL,
const char *  format = NULL,
ImGuiSliderFlags  flags = 0 
)
2392{
2393 ImGuiWindow* window = GetCurrentWindow();
2394 if (window->SkipItems)
2395 return false;
2396
2397 ImGuiContext& g = *GImGui;
2398 bool value_changed = false;
2399 BeginGroup();
2400 PushID(label);
2401 PushMultiItemsWidths(components, CalcItemWidth());
2402 size_t type_size = GDataTypeInfo[data_type].Size;
2403 for (int i = 0; i < components; i++)
2404 {
2405 PushID(i);
2406 if (i > 0)
2408 value_changed |= DragScalar("", data_type, p_data, v_speed, p_min, p_max, format, flags);
2409 PopID();
2410 PopItemWidth();
2411 p_data = (void*)((char*)p_data + type_size);
2412 }
2413 PopID();
2414
2415 const char* label_end = FindRenderedTextEnd(label);
2416 if (label != label_end)
2417 {
2418 SameLine(0, g.Style.ItemInnerSpacing.x);
2419 TextEx(label, label_end);
2420 }
2421
2422 EndGroup();
2423 return value_changed;
2424}

References BeginGroup(), CalcItemWidth(), DragScalar(), EndGroup(), FindRenderedTextEnd(), GDataTypeInfo, GetCurrentWindow(), GImGui, ImGuiStyle::ItemInnerSpacing, PopID(), PopItemWidth(), PushID(), PushMultiItemsWidths(), SameLine(), ImGuiDataTypeInfo::Size, ImGuiWindow::SkipItems, ImGuiContext::Style, TextEx(), and ImVec2::x.

Referenced by DragFloat2(), DragFloat2(), DragFloat3(), DragFloat3(), DragFloat4(), DragFloat4(), DragInt2(), DragInt3(), DragInt4(), and DragScalarN().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Dummy()

void ImGui::Dummy ( const ImVec2 size)
1321{
1322 ImGuiWindow* window = GetCurrentWindow();
1323 if (window->SkipItems)
1324 return;
1325
1326 const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
1327 ItemSize(size);
1328 ItemAdd(bb, 0);
1329}

References ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetCurrentWindow(), ItemAdd(), ItemSize(), and ImGuiWindow::SkipItems.

Referenced by InputTextEx(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::GCodeViewer::render_legend(), RenderViewportsThumbnails(), ShowDemoWindowLayout(), ShowExampleAppCustomRendering(), ShowExampleMenuFile(), ShowFont(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ End()

void ImGui::End ( )
6367{
6368 ImGuiContext& g = *GImGui;
6369 ImGuiWindow* window = g.CurrentWindow;
6370
6371 // Error checking: verify that user hasn't called End() too many times!
6373 {
6374 IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size > 1, "Calling End() too many times!");
6375 return;
6376 }
6378
6379 // Error checking: verify that user doesn't directly call End() on a child window.
6380 if (window->Flags & ImGuiWindowFlags_ChildWindow)
6381 IM_ASSERT_USER_ERROR(g.WithinEndChild, "Must call EndChild() and not End()!");
6382
6383 // Close anything that is open
6384 if (window->DC.CurrentColumns)
6385 EndColumns();
6386 PopClipRect(); // Inner window clip rectangle
6387
6388 // Stop logging
6389 if (!(window->Flags & ImGuiWindowFlags_ChildWindow)) // FIXME: add more options for scope of logging
6390 LogFinish();
6391
6392 // Pop from window stack
6394 if (window->Flags & ImGuiWindowFlags_Popup)
6397 SetCurrentWindow(g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back());
6398}
bool WithinEndChild
Definition imgui_internal.h:1366
void CompareWithCurrentState()
Definition imgui.cpp:7292
void pop_back()
Definition imgui.h:1697

References ImVector< T >::back(), ImGuiContext::BeginPopupStack, ImGuiStackSizes::CompareWithCurrentState(), ImGuiWindowTempData::CurrentColumns, ImGuiContext::CurrentWindow, ImGuiContext::CurrentWindowStack, ImGuiWindow::DC, ImVector< T >::empty(), EndColumns(), ImGuiWindow::Flags, GImGui, IM_ASSERT, IM_ASSERT_USER_ERROR, ImGuiWindowFlags_ChildWindow, ImGuiWindowFlags_Popup, LogFinish(), ImVector< T >::pop_back(), PopClipRect(), SetCurrentWindow(), ImVector< T >::Size, ImGuiWindowTempData::StackSizesOnBegin, ImGuiContext::WithinEndChild, and ImGuiContext::WithinFrameScopeWithImplicitWindow.

Referenced by BeginMainMenuBar(), ExampleAppConsole::Draw(), ExampleAppLog::Draw(), igl::opengl::glfw::imgui::ImGuiMenu::draw_labels_window(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_window(), Slic3r::GUI::ImGuiWrapper::end(), EndChild(), EndFrame(), EndMainMenuBar(), EndPopup(), EndTooltip(), ErrorCheckEndFrameRecover(), ErrorCheckEndFrameSanityChecks(), NavUpdateWindowingOverlay(), Slic3r::GUI::GLGizmoEmboss::on_render_input_window(), ShowAboutWindow(), ShowDemoWindow(), ShowDemoWindowLayout(), ShowDemoWindowWidgets(), ShowExampleAppAutoResize(), ShowExampleAppConstrainedResize(), ShowExampleAppCustomRendering(), ShowExampleAppDocuments(), ShowExampleAppFullscreen(), ShowExampleAppLayout(), ShowExampleAppLog(), ShowExampleAppLongText(), ShowExampleAppPropertyEditor(), ShowExampleAppSimpleOverlay(), ShowExampleAppWindowTitles(), and ShowMetricsWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndChild()

void ImGui::EndChild ( )
5032{
5033 ImGuiContext& g = *GImGui;
5034 ImGuiWindow* window = g.CurrentWindow;
5035
5036 IM_ASSERT(g.WithinEndChild == false);
5037 IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() calls
5038
5039 g.WithinEndChild = true;
5040 if (window->BeginCount > 1)
5041 {
5042 End();
5043 }
5044 else
5045 {
5046 ImVec2 sz = window->Size;
5047 if (window->AutoFitChildAxises & (1 << ImGuiAxis_X)) // Arbitrary minimum zero-ish child size of 4.0f causes less trouble than a 0.0f
5048 sz.x = ImMax(4.0f, sz.x);
5049 if (window->AutoFitChildAxises & (1 << ImGuiAxis_Y))
5050 sz.y = ImMax(4.0f, sz.y);
5051 End();
5052
5053 ImGuiWindow* parent_window = g.CurrentWindow;
5054 ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz);
5055 ItemSize(sz);
5056 if ((window->DC.NavLayersActiveMask != 0 || window->DC.NavHasScroll) && !(window->Flags & ImGuiWindowFlags_NavFlattened))
5057 {
5058 ItemAdd(bb, window->ChildId);
5059 RenderNavHighlight(bb, window->ChildId);
5060
5061 // When browsing a window that has no activable items (scroll only) we keep a highlight on the child
5062 if (window->DC.NavLayersActiveMask == 0 && window == g.NavWindow)
5063 RenderNavHighlight(ImRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2)), g.NavId, ImGuiNavHighlightFlags_TypeThin);
5064 }
5065 else
5066 {
5067 // Not navigable into
5068 ItemAdd(bb, 0);
5069 }
5070 if (g.HoveredWindow == window)
5072 }
5073 g.WithinEndChild = false;
5074 g.LogLinePosY = -FLT_MAX; // To enforce a carriage return
5075}
@ ImGuiNavHighlightFlags_TypeThin
Definition imgui_internal.h:901
@ ImGuiItemStatusFlags_HoveredWindow
Definition imgui_internal.h:752

References ImGuiWindow::AutoFitChildAxises, ImGuiWindow::BeginCount, ImGuiWindow::ChildId, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, End(), ImGuiWindow::Flags, GImGui, ImGuiContext::HoveredWindow, IM_ASSERT, ImGuiAxis_X, ImGuiAxis_Y, ImGuiItemStatusFlags_HoveredWindow, ImGuiNavHighlightFlags_TypeThin, ImGuiWindowFlags_ChildWindow, ImGuiWindowFlags_NavFlattened, ImMax(), ItemAdd(), ItemSize(), ImGuiWindowTempData::LastItemStatusFlags, ImGuiContext::LogLinePosY, ImRect::Max, ImRect::Min, ImGuiWindowTempData::NavHasScroll, ImGuiContext::NavId, ImGuiWindowTempData::NavLayersActiveMask, ImGuiContext::NavWindow, RenderNavHighlight(), ImGuiWindow::Size, ImGuiContext::WithinEndChild, ImVec2::x, and ImVec2::y.

Referenced by ExampleAppConsole::Draw(), ExampleAppLog::Draw(), EndChildFrame(), EndTable(), ErrorCheckEndFrameRecover(), InputTextEx(), Slic3r::GUI::GCodeViewer::render_legend(), ShowDemoWindowColumns(), ShowDemoWindowLayout(), ShowDemoWindowWidgets(), ShowExampleAppLayout(), ShowExampleAppLongText(), ShowExampleMenuFile(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndChildFrame()

void ImGui::EndChildFrame ( )
5093{
5094 EndChild();
5095}
IMGUI_API void EndChild()
Definition imgui.cpp:5031

References EndChild().

Referenced by EndListBox(), ShowAboutWindow(), and ShowExampleAppDocuments().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndColumns()

void ImGui::EndColumns ( )
3933{
3934 ImGuiContext& g = *GImGui;
3935 ImGuiWindow* window = GetCurrentWindow();
3936 ImGuiOldColumns* columns = window->DC.CurrentColumns;
3937 IM_ASSERT(columns != NULL);
3938
3939 PopItemWidth();
3940 if (columns->Count > 1)
3941 {
3942 PopClipRect();
3943 columns->Splitter.Merge(window->DrawList);
3944 }
3945
3946 const ImGuiOldColumnFlags flags = columns->Flags;
3947 columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y);
3948 window->DC.CursorPos.y = columns->LineMaxY;
3950 window->DC.CursorMaxPos.x = columns->HostCursorMaxPosX; // Restore cursor max pos, as columns don't grow parent
3951
3952 // Draw columns borders and handle resize
3953 // The IsBeingResized flag ensure we preserve pre-resize columns width so back-and-forth are not lossy
3954 bool is_being_resized = false;
3955 if (!(flags & ImGuiOldColumnFlags_NoBorder) && !window->SkipItems)
3956 {
3957 // We clip Y boundaries CPU side because very long triangles are mishandled by some GPU drivers.
3958 const float y1 = ImMax(columns->HostCursorPosY, window->ClipRect.Min.y);
3959 const float y2 = ImMin(window->DC.CursorPos.y, window->ClipRect.Max.y);
3960 int dragging_column = -1;
3961 for (int n = 1; n < columns->Count; n++)
3962 {
3963 ImGuiOldColumnData* column = &columns->Columns[n];
3964 float x = window->Pos.x + GetColumnOffset(n);
3965 const ImGuiID column_id = columns->ID + ImGuiID(n);
3966 const float column_hit_hw = COLUMNS_HIT_RECT_HALF_WIDTH;
3967 const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2));
3968 KeepAliveID(column_id);
3969 if (IsClippedEx(column_hit_rect, column_id, false))
3970 continue;
3971
3972 bool hovered = false, held = false;
3973 if (!(flags & ImGuiOldColumnFlags_NoResize))
3974 {
3975 ButtonBehavior(column_hit_rect, column_id, &hovered, &held);
3976 if (hovered || held)
3978 if (held && !(column->Flags & ImGuiOldColumnFlags_NoResize))
3979 dragging_column = n;
3980 }
3981
3982 // Draw column
3984 const float xi = IM_FLOOR(x);
3985 window->DrawList->AddLine(ImVec2(xi, y1 + 1.0f), ImVec2(xi, y2), col);
3986 }
3987
3988 // Apply dragging after drawing the column lines, so our rendered lines are in sync with how items were displayed during the frame.
3989 if (dragging_column != -1)
3990 {
3991 if (!columns->IsBeingResized)
3992 for (int n = 0; n < columns->Count + 1; n++)
3993 columns->Columns[n].OffsetNormBeforeResize = columns->Columns[n].OffsetNorm;
3994 columns->IsBeingResized = is_being_resized = true;
3995 float x = GetDraggedColumnOffset(columns, dragging_column);
3996 SetColumnOffset(dragging_column, x);
3997 }
3998 }
3999 columns->IsBeingResized = is_being_resized;
4000
4001 window->WorkRect = window->ParentWorkRect;
4002 window->ParentWorkRect = columns->HostBackupParentWorkRect;
4003 window->DC.CurrentColumns = NULL;
4004 window->DC.ColumnsOffset.x = 0.0f;
4005 window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
4006}
@ ImGuiMouseCursor_ResizeEW
Definition imgui.h:1601
@ ImGuiCol_SeparatorActive
Definition imgui.h:1442
@ ImGuiCol_SeparatorHovered
Definition imgui.h:1441
@ ImGuiCol_Separator
Definition imgui.h:1440
@ ImGuiOldColumnFlags_GrowParentContentsSize
Definition imgui_internal.h:1161
@ ImGuiOldColumnFlags_NoResize
Definition imgui_internal.h:1158
static float GetDraggedColumnOffset(ImGuiOldColumns *columns, int column_index)
Definition imgui_tables.cpp:3645
static const float COLUMNS_HIT_RECT_HALF_WIDTH
Definition imgui_tables.cpp:3643
IMGUI_API void SetColumnOffset(int column_index, float offset_x)
Definition imgui_tables.cpp:3704
IMGUI_API void PopClipRect()
Definition imgui.cpp:4372
IMGUI_API void Merge(ImDrawList *draw_list)
Definition imgui_draw.cpp:1707
ImGuiMouseCursor MouseCursor
Definition imgui_internal.h:1497
ImGuiOldColumnFlags Flags
Definition imgui_internal.h:1178
bool IsBeingResized
Definition imgui_internal.h:1189

References ImDrawList::AddLine(), ButtonBehavior(), ImGuiWindow::ClipRect, col(), ImGuiOldColumns::Columns, COLUMNS_HIT_RECT_HALF_WIDTH, ImGuiWindowTempData::ColumnsOffset, ImGuiOldColumns::Count, ImGuiWindowTempData::CurrentColumns, ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, ImGuiOldColumnData::Flags, ImGuiOldColumns::Flags, GetColorU32(), GetColumnOffset(), GetCurrentWindow(), GetDraggedColumnOffset(), GImGui, ImGuiOldColumns::HostBackupParentWorkRect, ImGuiOldColumns::HostCursorMaxPosX, ImGuiOldColumns::HostCursorPosY, ImGuiOldColumns::ID, IM_ASSERT, IM_FLOOR, ImGuiCol_Separator, ImGuiCol_SeparatorActive, ImGuiCol_SeparatorHovered, ImGuiMouseCursor_ResizeEW, ImGuiOldColumnFlags_GrowParentContentsSize, ImGuiOldColumnFlags_NoBorder, ImGuiOldColumnFlags_NoResize, ImMax(), ImMin(), ImGuiWindowTempData::Indent, ImGuiOldColumns::IsBeingResized, IsClippedEx(), KeepAliveID(), ImGuiOldColumns::LineMaxY, ImRect::Max, ImDrawListSplitter::Merge(), ImRect::Min, ImGuiContext::MouseCursor, ImGuiWindow::ParentWorkRect, PopClipRect(), PopItemWidth(), ImGuiWindow::Pos, SetColumnOffset(), ImGuiWindow::SkipItems, ImGuiOldColumns::Splitter, ImGuiWindow::WorkRect, ImVec2::x, ImVec1::x, and ImVec2::y.

Referenced by Columns(), and End().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndCombo()

void ImGui::EndCombo ( )
1675{
1676 EndPopup();
1677}

References EndPopup().

Referenced by Slic3r::GUI::GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(), Slic3r::GUI::ImGuiWrapper::combo(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), EditTableSizingFlags(), Slic3r::GUI::render_extruders_combo(), ShowDemoWindowWidgets(), ShowFontSelector(), and TabBarTabListPopupButton().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndDragDropSource()

void ImGui::EndDragDropSource ( )
9890{
9891 ImGuiContext& g = *GImGui;
9893 IM_ASSERT(g.DragDropWithinSource && "Not after a BeginDragDropSource()?");
9894
9896 EndTooltip();
9897
9898 // Discard the drag if have not called SetDragDropPayload()
9899 if (g.DragDropPayload.DataFrameCount == -1)
9900 ClearDragDrop();
9901 g.DragDropWithinSource = false;
9902}

References ClearDragDrop(), ImGuiPayload::DataFrameCount, ImGuiContext::DragDropActive, ImGuiContext::DragDropPayload, ImGuiContext::DragDropSourceFlags, ImGuiContext::DragDropWithinSource, EndTooltip(), GImGui, IM_ASSERT, and ImGuiDragDropFlags_SourceNoPreviewTooltip.

Referenced by ColorButton(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndDragDropTarget()

void ImGui::EndDragDropTarget ( )
10059{
10060 ImGuiContext& g = *GImGui;
10063 g.DragDropWithinTarget = false;
10064}

References ImGuiContext::DragDropActive, ImGuiContext::DragDropWithinTarget, GImGui, and IM_ASSERT.

Referenced by ColorEdit4(), and ShowDemoWindowWidgets().

+ Here is the caller graph for this function:

◆ EndFrame()

void ImGui::EndFrame ( )
4381{
4382 ImGuiContext& g = *GImGui;
4384
4385 // Don't process EndFrame() multiple times.
4386 if (g.FrameCountEnded == g.FrameCount)
4387 return;
4388 IM_ASSERT(g.WithinFrameScope && "Forgot to call ImGui::NewFrame()?");
4389
4391
4393
4394 // Notify OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME)
4396 {
4399 }
4400
4401 // Hide implicit/fallback "Debug" window if it hasn't been used
4404 g.CurrentWindow->Active = false;
4405 End();
4406
4407 // Update navigation: CTRL+Tab, wrap-around requests
4408 NavEndFrame();
4409
4410 // Drag and Drop: Elapse payload (if delivered, or if source stops being submitted)
4411 if (g.DragDropActive)
4412 {
4413 bool is_delivered = g.DragDropPayload.Delivery;
4415 if (is_delivered || is_elapsed)
4416 ClearDragDrop();
4417 }
4418
4419 // Drag and Drop: Fallback for source tooltip. This is not ideal but better than nothing.
4421 {
4422 g.DragDropWithinSource = true;
4423 SetTooltip("...");
4424 g.DragDropWithinSource = false;
4425 }
4426
4427 // End frame
4428 g.WithinFrameScope = false;
4430
4431 // Initiate moving window + handle left-click and right-click focus
4433
4434 // Sort the window list so that all child windows are after their parent
4435 // We cannot do that on FocusWindow() because children may not exist yet
4438 for (int i = 0; i != g.Windows.Size; i++)
4439 {
4440 ImGuiWindow* window = g.Windows[i];
4441 if (window->Active && (window->Flags & ImGuiWindowFlags_ChildWindow)) // if a child is active its parent will add it
4442 continue;
4444 }
4445
4446 // This usually assert if there is a mismatch between the ImGuiWindowFlags_ChildWindow / ParentWindow values and DC.ChildWindows[] in parents, aka we've done something wrong.
4450
4451 // Unlock font atlas
4452 g.IO.Fonts->Locked = false;
4453
4454 // Clear Input data for next frame
4455 g.IO.MouseWheel = g.IO.MouseWheelH = 0.0f;
4457 memset(g.IO.NavInputs, 0, sizeof(g.IO.NavInputs));
4458
4460}
static void AddWindowToSortBuffer(ImVector< ImGuiWindow * > *out_sorted_windows, ImGuiWindow *window)
Definition imgui.cpp:4249
@ ImGuiDragDropFlags_SourceAutoExpirePayload
Definition imgui.h:1264
@ ImGuiContextHookType_EndFramePre
Definition imgui_internal.h:1333
@ ImGuiContextHookType_EndFramePost
Definition imgui_internal.h:1333
IMGUI_API void SetTooltip(const char *fmt,...) IM_FMTARGS(1)
Definition imgui.cpp:8058
IMGUI_API void CallContextHooks(ImGuiContext *context, ImGuiContextHookType type)
Definition imgui.cpp:3431
IMGUI_API void UpdateMouseMovingWindowEndFrame()
Definition imgui.cpp:3578
static void ErrorCheckEndFrameSanityChecks()
Definition imgui.cpp:7169
bool Locked
Definition imgui.h:2657
ImVector< ImGuiWindow * > WindowsTempSortBuffer
Definition imgui_internal.h:1375
bool Initialized
Definition imgui_internal.h:1352
ImVec2 PlatformImeLastPos
Definition imgui_internal.h:1555
ImVec2 PlatformImePos
Definition imgui_internal.h:1554
float NavInputs[ImGuiNavInput_COUNT]
Definition imgui.h:1846
float MouseWheel
Definition imgui.h:1839
ImFontAtlas * Fonts
Definition imgui.h:1795
float MouseWheelH
Definition imgui.h:1840
ImVector< ImWchar > InputQueueCharacters
Definition imgui.h:1898
void(* ImeSetInputScreenPosFn)(int x, int y)
Definition imgui.h:1830
int MetricsActiveWindows
Definition imgui.h:1871
void swap(ImVector< T > &rhs)
Definition imgui.h:1687

References ImGuiWindow::Active, AddWindowToSortBuffer(), CallContextHooks(), ClearDragDrop(), ImGuiContext::CurrentWindow, ImGuiPayload::DataFrameCount, ImGuiPayload::Delivery, ImGuiContext::DragDropActive, ImGuiContext::DragDropMouseButton, ImGuiContext::DragDropPayload, ImGuiContext::DragDropSourceFlags, ImGuiContext::DragDropSourceFrameCount, ImGuiContext::DragDropWithinSource, End(), ErrorCheckEndFrameSanityChecks(), ImGuiWindow::Flags, ImGuiIO::Fonts, ImGuiContext::FrameCount, ImGuiContext::FrameCountEnded, GImGui, IM_ASSERT, ImGuiIO::ImeSetInputScreenPosFn, ImGuiContextHookType_EndFramePost, ImGuiContextHookType_EndFramePre, ImGuiDragDropFlags_SourceAutoExpirePayload, ImGuiDragDropFlags_SourceNoPreviewTooltip, ImGuiWindowFlags_ChildWindow, ImLengthSqr(), ImGuiContext::Initialized, ImGuiIO::InputQueueCharacters, ImGuiContext::IO, IsMouseDown(), ImFontAtlas::Locked, ImGuiIO::MetricsActiveWindows, ImGuiIO::MouseWheel, ImGuiIO::MouseWheelH, NavEndFrame(), ImGuiIO::NavInputs, ImGuiContext::PlatformImeLastPos, ImGuiContext::PlatformImePos, ImVector< T >::reserve(), ImVector< T >::resize(), SetTooltip(), ImVector< T >::Size, ImVector< T >::swap(), UpdateMouseMovingWindowEndFrame(), ImGuiContext::Windows, ImGuiContext::WindowsActiveCount, ImGuiContext::WindowsTempSortBuffer, ImGuiContext::WithinFrameScope, ImGuiContext::WithinFrameScopeWithImplicitWindow, ImGuiWindow::WriteAccessed, ImVec2::x, and ImVec2::y.

Referenced by Render(), and Slic3r::GUI::ImGuiWrapper::set_language().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndGroup()

void ImGui::EndGroup ( )
7742{
7743 ImGuiContext& g = *GImGui;
7744 ImGuiWindow* window = g.CurrentWindow;
7745 IM_ASSERT(g.GroupStack.Size > 0); // Mismatched BeginGroup()/EndGroup() calls
7746
7747 ImGuiGroupData& group_data = g.GroupStack.back();
7748 IM_ASSERT(group_data.WindowID == window->ID); // EndGroup() in wrong window?
7749
7750 ImRect group_bb(group_data.BackupCursorPos, ImMax(window->DC.CursorMaxPos, group_data.BackupCursorPos));
7751
7752 window->DC.CursorPos = group_data.BackupCursorPos;
7753 window->DC.CursorMaxPos = ImMax(group_data.BackupCursorMaxPos, window->DC.CursorMaxPos);
7754 window->DC.Indent = group_data.BackupIndent;
7755 window->DC.GroupOffset = group_data.BackupGroupOffset;
7756 window->DC.CurrLineSize = group_data.BackupCurrLineSize;
7758 if (g.LogEnabled)
7759 g.LogLinePosY = -FLT_MAX; // To enforce a carriage return
7760
7761 if (!group_data.EmitItem)
7762 {
7763 g.GroupStack.pop_back();
7764 return;
7765 }
7766
7767 window->DC.CurrLineTextBaseOffset = ImMax(window->DC.PrevLineTextBaseOffset, group_data.BackupCurrLineTextBaseOffset); // FIXME: Incorrect, we should grab the base offset from the *first line* of the group but it is hard to obtain now.
7768 ItemSize(group_bb.GetSize());
7769 ItemAdd(group_bb, 0);
7770
7771 // If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive(), IsItemDeactivated() etc. will be functional on the entire group.
7772 // It would be be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but would put a little more burden on individual widgets.
7773 // Also if you grep for LastItemId you'll notice it is only used in that context.
7774 // (The two tests not the same because ActiveIdIsAlive is an ID itself, in order to be able to handle ActiveId being overwritten during the frame.)
7775 const bool group_contains_curr_active_id = (group_data.BackupActiveIdIsAlive != g.ActiveId) && (g.ActiveIdIsAlive == g.ActiveId) && g.ActiveId;
7776 const bool group_contains_prev_active_id = (group_data.BackupActiveIdPreviousFrameIsAlive == false) && (g.ActiveIdPreviousFrameIsAlive == true);
7777 if (group_contains_curr_active_id)
7778 window->DC.LastItemId = g.ActiveId;
7779 else if (group_contains_prev_active_id)
7781 window->DC.LastItemRect = group_bb;
7782
7783 // Forward Hovered flag
7784 const bool group_contains_curr_hovered_id = (group_data.BackupHoveredIdIsAlive == false) && g.HoveredId != 0;
7785 if (group_contains_curr_hovered_id)
7787
7788 // Forward Edited flag
7789 if (group_contains_curr_active_id && g.ActiveIdHasBeenEditedThisFrame)
7791
7792 // Forward Deactivated flag
7794 if (group_contains_prev_active_id && g.ActiveId != g.ActiveIdPreviousFrame)
7796
7797 g.GroupStack.pop_back();
7798 //window->DrawList->AddRect(group_bb.Min, group_bb.Max, IM_COL32(255,0,255,255)); // [Debug]
7799}
@ ImGuiItemStatusFlags_Deactivated
Definition imgui_internal.h:751
@ ImGuiItemStatusFlags_Edited
Definition imgui_internal.h:747
@ ImGuiItemStatusFlags_HasDeactivated
Definition imgui_internal.h:750
bool ActiveIdHasBeenEditedThisFrame
Definition imgui_internal.h:1406
ImGuiID ActiveIdPreviousFrame
Definition imgui_internal.h:1415

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdHasBeenEditedThisFrame, ImGuiContext::ActiveIdIsAlive, ImGuiContext::ActiveIdPreviousFrame, ImGuiContext::ActiveIdPreviousFrameIsAlive, ImVector< T >::back(), ImGuiGroupData::BackupActiveIdIsAlive, ImGuiGroupData::BackupActiveIdPreviousFrameIsAlive, ImGuiGroupData::BackupCurrLineSize, ImGuiGroupData::BackupCurrLineTextBaseOffset, ImGuiGroupData::BackupCursorMaxPos, ImGuiGroupData::BackupCursorPos, ImGuiGroupData::BackupGroupOffset, ImGuiGroupData::BackupHoveredIdIsAlive, ImGuiGroupData::BackupIndent, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CurrLineSize, ImGuiWindowTempData::CurrLineTextBaseOffset, ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiGroupData::EmitItem, ImRect::GetSize(), GImGui, ImGuiWindowTempData::GroupOffset, ImGuiContext::GroupStack, ImGuiContext::HoveredId, ImGuiWindow::ID, IM_ASSERT, ImGuiItemStatusFlags_Deactivated, ImGuiItemStatusFlags_Edited, ImGuiItemStatusFlags_HasDeactivated, ImGuiItemStatusFlags_HoveredWindow, ImMax(), ImGuiWindowTempData::Indent, ItemAdd(), ItemSize(), ImGuiWindowTempData::LastItemId, ImGuiWindowTempData::LastItemRect, ImGuiWindowTempData::LastItemStatusFlags, ImGuiContext::LogEnabled, ImGuiContext::LogLinePosY, ImVector< T >::pop_back(), ImGuiWindowTempData::PrevLineTextBaseOffset, ImVector< T >::Size, and ImGuiGroupData::WindowID.

Referenced by ColorEdit4(), ColorPicker4(), DragFloatRange2(), DragIntRange2(), DragScalarN(), EndListBox(), EndMenuBar(), ErrorCheckEndFrameRecover(), InputScalar(), InputScalarN(), InputTextEx(), Slic3r::GUI::render_extruders_combo(), ShowDemoWindowLayout(), ShowDemoWindowWidgets(), ShowExampleAppLayout(), ShowStyleEditor(), and SliderScalarN().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndListBox()

void ImGui::EndListBox ( )
6234{
6235 ImGuiContext& g = *GImGui;
6236 ImGuiWindow* window = g.CurrentWindow;
6237 IM_ASSERT((window->Flags & ImGuiWindowFlags_ChildWindow) && "Mismatched BeginListBox/EndListBox calls. Did you test the return value of BeginListBox?");
6238 IM_UNUSED(window);
6239
6240 EndChildFrame();
6241 EndGroup(); // This is only required to be able to do IsItemXXX query on the whole ListBox including label
6242}
IMGUI_API void EndChildFrame()
Definition imgui.cpp:5092

References ImGuiContext::CurrentWindow, EndChildFrame(), EndGroup(), ImGuiWindow::Flags, GImGui, IM_ASSERT, IM_UNUSED, and ImGuiWindowFlags_ChildWindow.

Referenced by ListBoxFooter(), ShowDemoWindowLayout(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndMainMenuBar()

void ImGui::EndMainMenuBar ( )
6680{
6681 EndMenuBar();
6682
6683 // When the user has left the menu layer (typically: closed menus through activation of an item), we restore focus to the previous window
6684 // FIXME: With this strategy we won't be able to restore a NULL focus.
6685 ImGuiContext& g = *GImGui;
6688
6689 End();
6690}
IMGUI_API void EndMenuBar()
Definition imgui_widgets.cpp:6579
bool NavAnyRequest
Definition imgui_internal.h:1461

References ImGuiContext::CurrentWindow, End(), EndMenuBar(), FocusTopMostWindowUnderOne(), GImGui, ImGuiNavLayer_Main, ImGuiContext::NavAnyRequest, ImGuiContext::NavLayer, and ImGuiContext::NavWindow.

Referenced by ShowExampleAppMainMenuBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndMenu()

void ImGui::EndMenu ( )
6857{
6858 // Nav: When a left move request _within our child menu_ failed, close ourselves (the _parent_ menu).
6859 // A menu doesn't close itself because EndMenuBar() wants the catch the last Left<>Right inputs.
6860 // However, it means that with the current code, a BeginMenu() from outside another menu or a menu-bar won't be closable with the Left direction.
6861 ImGuiContext& g = *GImGui;
6862 ImGuiWindow* window = g.CurrentWindow;
6864 {
6867 }
6868
6869 EndPopup();
6870}
IMGUI_API bool NavMoveRequestButNoResultYet()
Definition imgui.cpp:8849

References ImGuiContext::BeginPopupStack, ClosePopupToLevel(), ImGuiContext::CurrentWindow, ImGuiWindow::DC, EndPopup(), GImGui, ImGuiDir_Left, ImGuiLayoutType_Vertical, ImGuiWindowTempData::LayoutType, ImGuiContext::NavMoveDir, NavMoveRequestButNoResultYet(), NavMoveRequestCancel(), ImGuiContext::NavWindow, ImGuiWindow::ParentWindow, and ImVector< T >::Size.

Referenced by ShowDemoWindow(), ShowDemoWindowLayout(), ShowDemoWindowPopups(), ShowExampleAppDocuments(), ShowExampleAppLayout(), ShowExampleAppMainMenuBar(), and ShowExampleMenuFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndMenuBar()

void ImGui::EndMenuBar ( )
6580{
6581 ImGuiWindow* window = GetCurrentWindow();
6582 if (window->SkipItems)
6583 return;
6584 ImGuiContext& g = *GImGui;
6585
6586 // Nav: When a move request within one of our child menu failed, capture the request to navigate among our siblings.
6588 {
6589 ImGuiWindow* nav_earliest_child = g.NavWindow;
6590 while (nav_earliest_child->ParentWindow && (nav_earliest_child->ParentWindow->Flags & ImGuiWindowFlags_ChildMenu))
6591 nav_earliest_child = nav_earliest_child->ParentWindow;
6592 if (nav_earliest_child->ParentWindow == window && nav_earliest_child->DC.ParentLayoutType == ImGuiLayoutType_Horizontal && g.NavMoveRequestForward == ImGuiNavForward_None)
6593 {
6594 // To do so we claim focus back, restore NavId and then process the movement request for yet another frame.
6595 // This involve a one-frame delay which isn't very problematic in this situation. We could remove it by scoring in advance for multiple window (probably not worth the hassle/cost)
6596 const ImGuiNavLayer layer = ImGuiNavLayer_Menu;
6597 IM_ASSERT(window->DC.NavLayersActiveMaskNext & (1 << layer)); // Sanity check
6598 FocusWindow(window);
6599 SetNavID(window->NavLastIds[layer], layer, 0, window->NavRectRel[layer]);
6600 g.NavDisableHighlight = true; // Hide highlight for the current frame so we don't see the intermediary selection.
6604 }
6605 }
6606
6607 IM_MSVC_WARNING_SUPPRESS(6011); // Static Analysis false positive "warning C6011: Dereferencing NULL pointer 'window'"
6609 IM_ASSERT(window->DC.MenuBarAppending);
6610 PopClipRect();
6611 PopID();
6612 window->DC.MenuBarOffset.x = window->DC.CursorPos.x - window->Pos.x; // Save horizontal position so next append can reuse it. This is kinda equivalent to a per-layer CursorPos.
6613 g.GroupStack.back().EmitItem = false;
6614 EndGroup(); // Restore position on layer 0
6617 window->DC.MenuBarAppending = false;
6618}
@ ImGuiNavForward_None
Definition imgui_internal.h:928
@ ImGuiNavForward_ForwardQueued
Definition imgui_internal.h:929
#define IM_MSVC_WARNING_SUPPRESS(XXXX)
Definition imgui_internal.h:246
ImGuiNavLayer
Definition imgui_internal.h:934
IMGUI_API void SetNavID(ImGuiID id, ImGuiNavLayer nav_layer, ImGuiID focus_scope_id, const ImRect &rect_rel)
Definition imgui.cpp:8580
bool NavMousePosDirty
Definition imgui_internal.h:1458
ImGuiNavForward NavMoveRequestForward
Definition imgui_internal.h:1468

References ImVector< T >::back(), ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiGroupData::EmitItem, EndGroup(), ImGuiWindow::Flags, FocusWindow(), GetCurrentWindow(), GImGui, ImGuiContext::GroupStack, IM_ASSERT, IM_MSVC_WARNING_SUPPRESS, ImGuiDir_Left, ImGuiDir_Right, ImGuiLayoutType_Horizontal, ImGuiLayoutType_Vertical, ImGuiNavForward_ForwardQueued, ImGuiNavForward_None, ImGuiNavLayer_Main, ImGuiNavLayer_Menu, ImGuiWindowFlags_ChildMenu, ImGuiWindowFlags_MenuBar, ImGuiWindowTempData::LayoutType, ImGuiWindowTempData::MenuBarAppending, ImGuiWindowTempData::MenuBarOffset, ImGuiContext::NavDisableHighlight, ImGuiContext::NavDisableMouseHover, ImGuiWindow::NavLastIds, ImGuiWindowTempData::NavLayerCurrent, ImGuiWindowTempData::NavLayersActiveMaskNext, ImGuiContext::NavMousePosDirty, ImGuiContext::NavMoveDir, NavMoveRequestButNoResultYet(), NavMoveRequestCancel(), ImGuiContext::NavMoveRequestForward, ImGuiWindow::NavRectRel, ImGuiContext::NavWindow, ImGuiWindowTempData::ParentLayoutType, ImGuiWindow::ParentWindow, PopClipRect(), PopID(), ImGuiWindow::Pos, SetNavID(), ImGuiWindow::SkipItems, and ImVec2::x.

Referenced by EndMainMenuBar(), ShowDemoWindow(), ShowDemoWindowLayout(), ShowDemoWindowPopups(), ShowExampleAppDocuments(), and ShowExampleAppLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndPopup()

void ImGui::EndPopup ( )
8358{
8359 ImGuiContext& g = *GImGui;
8360 ImGuiWindow* window = g.CurrentWindow;
8361 IM_ASSERT(window->Flags & ImGuiWindowFlags_Popup); // Mismatched BeginPopup()/EndPopup() calls
8363
8364 // Make all menus and popups wrap around for now, may need to expose that policy.
8365 if (g.NavWindow == window)
8367
8368 // Child-popups don't need to be laid out
8369 IM_ASSERT(g.WithinEndChild == false);
8370 if (window->Flags & ImGuiWindowFlags_ChildWindow)
8371 g.WithinEndChild = true;
8372 End();
8373 g.WithinEndChild = false;
8374}
@ ImGuiNavMoveFlags_LoopY
Definition imgui_internal.h:918
IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow *window, ImGuiNavMoveFlags move_flags)
Definition imgui.cpp:8874

References ImGuiContext::BeginPopupStack, ImGuiContext::CurrentWindow, End(), ImGuiWindow::Flags, GImGui, IM_ASSERT, ImGuiNavMoveFlags_LoopY, ImGuiWindowFlags_ChildWindow, ImGuiWindowFlags_Popup, NavMoveRequestTryWrapping(), ImGuiContext::NavWindow, ImVector< T >::Size, and ImGuiContext::WithinEndChild.

Referenced by BeginCombo(), BeginPopupEx(), BeginPopupModal(), ColorEdit4(), ColorEditOptionsPopup(), ColorPickerOptionsPopup(), MyDocument::DisplayContextMenu(), ExampleAppConsole::Draw(), ExampleAppLog::Draw(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), Slic3r::GUI::GLGizmoEmboss::draw_style_add_button(), Slic3r::GUI::GLGizmoEmboss::draw_style_rename_button(), EndCombo(), EndMenu(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppCustomRendering(), ShowExampleAppDocuments(), ShowExampleAppSimpleOverlay(), and TableUpdateLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndTabBar()

void ImGui::EndTabBar ( )
7089{
7090 ImGuiContext& g = *GImGui;
7091 ImGuiWindow* window = g.CurrentWindow;
7092 if (window->SkipItems)
7093 return;
7094
7095 ImGuiTabBar* tab_bar = g.CurrentTabBar;
7096 if (tab_bar == NULL)
7097 {
7098 IM_ASSERT_USER_ERROR(tab_bar != NULL, "Mismatched BeginTabBar()/EndTabBar()!");
7099 return;
7100 }
7101
7102 // Fallback in case no TabItem have been submitted
7103 if (tab_bar->WantLayout)
7104 TabBarLayout(tab_bar);
7105
7106 // Restore the last visible height if no tab is visible, this reduce vertical flicker/movement when a tabs gets removed without calling SetTabItemClosed().
7107 const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount);
7108 if (tab_bar->VisibleTabWasSubmitted || tab_bar->VisibleTabId == 0 || tab_bar_appearing)
7109 {
7110 tab_bar->CurrTabsContentsHeight = ImMax(window->DC.CursorPos.y - tab_bar->BarRect.Max.y, tab_bar->CurrTabsContentsHeight);
7111 window->DC.CursorPos.y = tab_bar->BarRect.Max.y + tab_bar->CurrTabsContentsHeight;
7112 }
7113 else
7114 {
7115 window->DC.CursorPos.y = tab_bar->BarRect.Max.y + tab_bar->PrevTabsContentsHeight;
7116 }
7117 if (tab_bar->BeginCount > 1)
7118 window->DC.CursorPos = tab_bar->BackupCursorPos;
7119
7120 if ((tab_bar->Flags & ImGuiTabBarFlags_DockNode) == 0)
7121 PopID();
7122
7125}
static ImGuiTabBar * GetTabBarFromTabBarRef(const ImGuiPtrOrIndex &ref)
Definition imgui_widgets.cpp:7001
ImGuiID VisibleTabId
Definition imgui_internal.h:1978
bool VisibleTabWasSubmitted
Definition imgui_internal.h:1996

References ImVector< T >::back(), ImGuiTabBar::BackupCursorPos, ImGuiTabBar::BarRect, ImGuiTabBar::BeginCount, ImGuiContext::CurrentTabBar, ImGuiContext::CurrentTabBarStack, ImGuiContext::CurrentWindow, ImGuiTabBar::CurrTabsContentsHeight, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImVector< T >::empty(), ImGuiTabBar::Flags, ImGuiContext::FrameCount, GetTabBarFromTabBarRef(), GImGui, IM_ASSERT_USER_ERROR, ImGuiTabBarFlags_DockNode, ImMax(), ImRect::Max, ImVector< T >::pop_back(), PopID(), ImGuiTabBar::PrevFrameVisible, ImGuiTabBar::PrevTabsContentsHeight, ImGuiWindow::SkipItems, TabBarLayout(), ImGuiTabBar::VisibleTabId, ImGuiTabBar::VisibleTabWasSubmitted, ImGuiTabBar::WantLayout, and ImVec2::y.

Referenced by ErrorCheckEndFrameRecover(), ShowDemoWindowLayout(), ShowDemoWindowWidgets(), ShowExampleAppCustomRendering(), ShowExampleAppDocuments(), ShowExampleAppLayout(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndTabItem()

void ImGui::EndTabItem ( )
7675{
7676 ImGuiContext& g = *GImGui;
7677 ImGuiWindow* window = g.CurrentWindow;
7678 if (window->SkipItems)
7679 return;
7680
7681 ImGuiTabBar* tab_bar = g.CurrentTabBar;
7682 if (tab_bar == NULL)
7683 {
7684 IM_ASSERT_USER_ERROR(tab_bar != NULL, "Needs to be called between BeginTabBar() and EndTabBar()!");
7685 return;
7686 }
7687 IM_ASSERT(tab_bar->LastTabItemIdx >= 0);
7688 ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx];
7689 if (!(tab->Flags & ImGuiTabItemFlags_NoPushId))
7690 PopID();
7691}
ImGuiTabItemFlags Flags
Definition imgui_internal.h:1956

References ImGuiContext::CurrentTabBar, ImGuiContext::CurrentWindow, ImGuiTabItem::Flags, GImGui, IM_ASSERT, IM_ASSERT_USER_ERROR, ImGuiTabItemFlags_NoPushId, ImGuiTabBar::LastTabItemIdx, PopID(), ImGuiWindow::SkipItems, and ImGuiTabBar::Tabs.

Referenced by ShowDemoWindowLayout(), ShowDemoWindowWidgets(), ShowExampleAppCustomRendering(), ShowExampleAppDocuments(), ShowExampleAppLayout(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndTable()

void ImGui::EndTable ( )
1200{
1201 ImGuiContext& g = *GImGui;
1202 ImGuiTable* table = g.CurrentTable;
1203 IM_ASSERT(table != NULL && "Only call EndTable() if BeginTable() returns true!");
1204
1205 // This assert would be very useful to catch a common error... unfortunately it would probably trigger in some
1206 // cases, and for consistency user may sometimes output empty tables (and still benefit from e.g. outer border)
1207 //IM_ASSERT(table->IsLayoutLocked && "Table unused: never called TableNextRow(), is that the intent?");
1208
1209 // If the user never got to call TableNextRow() or TableNextColumn(), we call layout ourselves to ensure all our
1210 // code paths are consistent (instead of just hoping that TableBegin/TableEnd will work), get borders drawn, etc.
1211 if (!table->IsLayoutLocked)
1212 TableUpdateLayout(table);
1213
1214 const ImGuiTableFlags flags = table->Flags;
1215 ImGuiWindow* inner_window = table->InnerWindow;
1216 ImGuiWindow* outer_window = table->OuterWindow;
1217 ImGuiTableTempData* temp_data = table->TempData;
1218 IM_ASSERT(inner_window == g.CurrentWindow);
1219 IM_ASSERT(outer_window == inner_window || outer_window == inner_window->ParentWindow);
1220
1221 if (table->IsInsideRow)
1222 TableEndRow(table);
1223
1224 // Context menu in columns body
1228
1229 // Finalize table height
1230 inner_window->DC.PrevLineSize = temp_data->HostBackupPrevLineSize;
1231 inner_window->DC.CurrLineSize = temp_data->HostBackupCurrLineSize;
1232 inner_window->DC.CursorMaxPos = temp_data->HostBackupCursorMaxPos;
1233 const float inner_content_max_y = table->RowPosY2;
1234 IM_ASSERT(table->RowPosY2 == inner_window->DC.CursorPos.y);
1235 if (inner_window != outer_window)
1236 inner_window->DC.CursorMaxPos.y = inner_content_max_y;
1237 else if (!(flags & ImGuiTableFlags_NoHostExtendY))
1238 table->OuterRect.Max.y = table->InnerRect.Max.y = ImMax(table->OuterRect.Max.y, inner_content_max_y); // Patch OuterRect/InnerRect height
1239 table->WorkRect.Max.y = ImMax(table->WorkRect.Max.y, table->OuterRect.Max.y);
1240 table->LastOuterHeight = table->OuterRect.GetHeight();
1241
1242 // Setup inner scrolling range
1243 // FIXME: This ideally should be done earlier, in BeginTable() SetNextWindowContentSize call, just like writing to inner_window->DC.CursorMaxPos.y,
1244 // but since the later is likely to be impossible to do we'd rather update both axises together.
1245 if (table->Flags & ImGuiTableFlags_ScrollX)
1246 {
1247 const float outer_padding_for_border = (table->Flags & ImGuiTableFlags_BordersOuterV) ? TABLE_BORDER_SIZE : 0.0f;
1248 float max_pos_x = table->InnerWindow->DC.CursorMaxPos.x;
1249 if (table->RightMostEnabledColumn != -1)
1250 max_pos_x = ImMax(max_pos_x, table->Columns[table->RightMostEnabledColumn].WorkMaxX + table->CellPaddingX + table->OuterPaddingX - outer_padding_for_border);
1251 if (table->ResizedColumn != -1)
1252 max_pos_x = ImMax(max_pos_x, table->ResizeLockMinContentsX2);
1253 table->InnerWindow->DC.CursorMaxPos.x = max_pos_x;
1254 }
1255
1256 // Pop clipping rect
1257 if (!(flags & ImGuiTableFlags_NoClip))
1258 inner_window->DrawList->PopClipRect();
1259 inner_window->ClipRect = inner_window->DrawList->_ClipRectStack.back();
1260
1261 // Draw borders
1262 if ((flags & ImGuiTableFlags_Borders) != 0)
1263 TableDrawBorders(table);
1264
1265#if 0
1266 // Strip out dummy channel draw calls
1267 // We have no way to prevent user submitting direct ImDrawList calls into a hidden column (but ImGui:: calls will be clipped out)
1268 // Pros: remove draw calls which will have no effect. since they'll have zero-size cliprect they may be early out anyway.
1269 // Cons: making it harder for users watching metrics/debugger to spot the wasted vertices.
1270 if (table->DummyDrawChannel != (ImGuiTableColumnIdx)-1)
1271 {
1272 ImDrawChannel* dummy_channel = &table->DrawSplitter._Channels[table->DummyDrawChannel];
1273 dummy_channel->_CmdBuffer.resize(0);
1274 dummy_channel->_IdxBuffer.resize(0);
1275 }
1276#endif
1277
1278 // Flatten channels and merge draw calls
1279 ImDrawListSplitter* splitter = table->DrawSplitter;
1280 splitter->SetCurrentChannel(inner_window->DrawList, 0);
1281 if ((table->Flags & ImGuiTableFlags_NoClip) == 0)
1283 splitter->Merge(inner_window->DrawList);
1284
1285 // Update ColumnsAutoFitWidth to get us ahead for host using our size to auto-resize without waiting for next BeginTable()
1286 const float width_spacings = (table->OuterPaddingX * 2.0f) + (table->CellSpacingX1 + table->CellSpacingX2) * (table->ColumnsEnabledCount - 1);
1287 table->ColumnsAutoFitWidth = width_spacings + (table->CellPaddingX * 2.0f) * table->ColumnsEnabledCount;
1288 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
1289 if (table->EnabledMaskByIndex & ((ImU64)1 << column_n))
1290 {
1291 ImGuiTableColumn* column = &table->Columns[column_n];
1293 table->ColumnsAutoFitWidth += column->WidthRequest;
1294 else
1295 table->ColumnsAutoFitWidth += TableGetColumnWidthAuto(table, column);
1296 }
1297
1298 // Update scroll
1299 if ((table->Flags & ImGuiTableFlags_ScrollX) == 0 && inner_window != outer_window)
1300 {
1301 inner_window->Scroll.x = 0.0f;
1302 }
1303 else if (table->LastResizedColumn != -1 && table->ResizedColumn == -1 && inner_window->ScrollbarX && table->InstanceInteracted == table->InstanceCurrent)
1304 {
1305 // When releasing a column being resized, scroll to keep the resulting column in sight
1306 const float neighbor_width_to_keep_visible = table->MinColumnWidth + table->CellPaddingX * 2.0f;
1307 ImGuiTableColumn* column = &table->Columns[table->LastResizedColumn];
1308 if (column->MaxX < table->InnerClipRect.Min.x)
1309 SetScrollFromPosX(inner_window, column->MaxX - inner_window->Pos.x - neighbor_width_to_keep_visible, 1.0f);
1310 else if (column->MaxX > table->InnerClipRect.Max.x)
1311 SetScrollFromPosX(inner_window, column->MaxX - inner_window->Pos.x + neighbor_width_to_keep_visible, 1.0f);
1312 }
1313
1314 // Apply resizing/dragging at the end of the frame
1315 if (table->ResizedColumn != -1 && table->InstanceCurrent == table->InstanceInteracted)
1316 {
1317 ImGuiTableColumn* column = &table->Columns[table->ResizedColumn];
1319 const float new_width = ImFloor(new_x2 - column->MinX - table->CellSpacingX1 - table->CellPaddingX * 2.0f);
1320 table->ResizedColumnNextWidth = new_width;
1321 }
1322
1323 // Pop from id stack
1324 IM_ASSERT_USER_ERROR(inner_window->IDStack.back() == table->ID + table->InstanceCurrent, "Mismatching PushID/PopID!");
1325 IM_ASSERT_USER_ERROR(outer_window->DC.ItemWidthStack.Size >= temp_data->HostBackupItemWidthStackSize, "Too many PopItemWidth!");
1326 PopID();
1327
1328 // Restore window data that we modified
1329 const ImVec2 backup_outer_max_pos = outer_window->DC.CursorMaxPos;
1330 inner_window->WorkRect = temp_data->HostBackupWorkRect;
1331 inner_window->ParentWorkRect = temp_data->HostBackupParentWorkRect;
1332 inner_window->SkipItems = table->HostSkipItems;
1333 outer_window->DC.CursorPos = table->OuterRect.Min;
1334 outer_window->DC.ItemWidth = temp_data->HostBackupItemWidth;
1335 outer_window->DC.ItemWidthStack.Size = temp_data->HostBackupItemWidthStackSize;
1336 outer_window->DC.ColumnsOffset = temp_data->HostBackupColumnsOffset;
1337
1338 // Layout in outer window
1339 // (FIXME: To allow auto-fit and allow desirable effect of SameLine() we dissociate 'used' vs 'ideal' size by overriding
1340 // CursorPosPrevLine and CursorMaxPos manually. That should be a more general layout feature, see same problem e.g. #3414)
1341 if (inner_window != outer_window)
1342 {
1343 EndChild();
1344 }
1345 else
1346 {
1347 ItemSize(table->OuterRect.GetSize());
1348 ItemAdd(table->OuterRect, 0);
1349 }
1350
1351 // Override declared contents width/height to enable auto-resize while not needlessly adding a scrollbar
1353 {
1354 // FIXME-TABLE: Could we remove this section?
1355 // ColumnsAutoFitWidth may be one frame ahead here since for Fixed+NoResize is calculated from latest contents
1356 IM_ASSERT((table->Flags & ImGuiTableFlags_ScrollX) == 0);
1357 outer_window->DC.CursorMaxPos.x = ImMax(backup_outer_max_pos.x, table->OuterRect.Min.x + table->ColumnsAutoFitWidth);
1358 }
1359 else if (temp_data->UserOuterSize.x <= 0.0f)
1360 {
1361 const float decoration_size = (table->Flags & ImGuiTableFlags_ScrollX) ? inner_window->ScrollbarSizes.x : 0.0f;
1362 outer_window->DC.IdealMaxPos.x = ImMax(outer_window->DC.IdealMaxPos.x, table->OuterRect.Min.x + table->ColumnsAutoFitWidth + decoration_size - temp_data->UserOuterSize.x);
1363 outer_window->DC.CursorMaxPos.x = ImMax(backup_outer_max_pos.x, ImMin(table->OuterRect.Max.x, table->OuterRect.Min.x + table->ColumnsAutoFitWidth));
1364 }
1365 else
1366 {
1367 outer_window->DC.CursorMaxPos.x = ImMax(backup_outer_max_pos.x, table->OuterRect.Max.x);
1368 }
1369 if (temp_data->UserOuterSize.y <= 0.0f)
1370 {
1371 const float decoration_size = (table->Flags & ImGuiTableFlags_ScrollY) ? inner_window->ScrollbarSizes.y : 0.0f;
1372 outer_window->DC.IdealMaxPos.y = ImMax(outer_window->DC.IdealMaxPos.y, inner_content_max_y + decoration_size - temp_data->UserOuterSize.y);
1373 outer_window->DC.CursorMaxPos.y = ImMax(backup_outer_max_pos.y, ImMin(table->OuterRect.Max.y, inner_content_max_y));
1374 }
1375 else
1376 {
1377 // OuterRect.Max.y may already have been pushed downward from the initial value (unless ImGuiTableFlags_NoHostExtendY is set)
1378 outer_window->DC.CursorMaxPos.y = ImMax(backup_outer_max_pos.y, table->OuterRect.Max.y);
1379 }
1380
1381 // Save settings
1382 if (table->IsSettingsDirty)
1383 TableSaveSettings(table);
1384 table->IsInitializing = false;
1385
1386 // Clear or restore current table, if any
1387 IM_ASSERT(g.CurrentWindow == outer_window && g.CurrentTable == table);
1390 temp_data = g.CurrentTableStackIdx >= 0 ? &g.TablesTempDataStack[g.CurrentTableStackIdx] : NULL;
1391 g.CurrentTable = temp_data ? g.Tables.GetByIndex(temp_data->TableIndex) : NULL;
1392 if (g.CurrentTable)
1393 {
1394 g.CurrentTable->TempData = temp_data;
1395 g.CurrentTable->DrawSplitter = &temp_data->DrawSplitter;
1396 }
1397 outer_window->DC.CurrentTableIdx = g.CurrentTable ? g.Tables.GetIndex(g.CurrentTable) : -1;
1398}
ImVector< ImDrawCmd > _CmdBuffer
Definition imgui.h:2285
@ ImGuiMouseButton_Right
Definition imgui.h:1587
ImVector< ImDrawIdx > _IdxBuffer
Definition imgui.h:2286
@ ImGuiTableFlags_Borders
Definition imgui.h:1126
@ ImGuiTableFlags_NoClip
Definition imgui.h:1140
@ ImGuiTableFlags_NoHostExtendX
Definition imgui.h:1135
@ ImGuiTableFlags_ContextMenuInBody
Definition imgui.h:1115
Definition imgui.h:2284
static const float TABLE_RESIZE_SEPARATOR_HALF_THICKNESS
Definition imgui_tables.cpp:260
IMGUI_API void TableMergeDrawChannels(ImGuiTable *table)
Definition imgui_tables.cpp:2310
IMGUI_API void TableEndRow(ImGuiTable *table)
Definition imgui_tables.cpp:1715
IMGUI_API void TableUpdateLayout(ImGuiTable *table)
Definition imgui_tables.cpp:719
IMGUI_API void TableSaveSettings(ImGuiTable *table)
Definition imgui_tables.cpp:3178
IMGUI_API void SetScrollFromPosX(float local_x, float center_x_ratio=0.5f)
Definition imgui.cpp:7966
IMGUI_API float TableGetColumnWidthAuto(ImGuiTable *table, ImGuiTableColumn *column)
Definition imgui_tables.cpp:2039
IMGUI_API void TableOpenContextMenu(int column_n=-1)
Definition imgui_tables.cpp:2984
ImVector< ImVec4 > _ClipRectStack
Definition imgui.h:2361
Definition imgui.h:2293
ImVector< ImDrawChannel > _Channels
Definition imgui.h:2296
ImGuiTableColumnFlags Flags
Definition imgui_internal.h:2032
float WidthRequest
Definition imgui_internal.h:2036
float LastOuterHeight
Definition imgui_internal.h:2136
ImGuiTableDrawChannelIdx DummyDrawChannel
Definition imgui_internal.h:2180
bool IsInsideRow
Definition imgui_internal.h:2184
ImU64 EnabledMaskByIndex
Definition imgui_internal.h:2105
bool IsSettingsDirty
Definition imgui_internal.h:2190
float MinColumnWidth
Definition imgui_internal.h:2130
ImGuiTableColumnIdx ColumnsEnabledCount
Definition imgui_internal.h:2159
ImGuiTableColumnIdx RightMostEnabledColumn
Definition imgui_internal.h:2171
float ResizeLockMinContentsX2
Definition imgui_internal.h:2142
float ResizedColumnNextWidth
Definition imgui_internal.h:2141
T * GetByIndex(ImPoolIdx n)
Definition imgui_internal.h:616

References ImDrawListSplitter::_Channels, ImDrawList::_ClipRectStack, ImDrawChannel::_CmdBuffer, ImDrawChannel::_IdxBuffer, ImGuiContext::ActiveIdClickOffset, ImVector< T >::back(), ImGuiTable::CellPaddingX, ImGuiTable::CellSpacingX1, ImGuiTable::CellSpacingX2, ImGuiWindow::ClipRect, ImGuiTable::Columns, ImGuiTable::ColumnsAutoFitWidth, ImGuiTable::ColumnsCount, ImGuiTable::ColumnsEnabledCount, ImGuiWindowTempData::ColumnsOffset, ImGuiContext::CurrentTable, ImGuiWindowTempData::CurrentTableIdx, ImGuiContext::CurrentTableStackIdx, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CurrLineSize, ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, ImGuiTable::DrawSplitter, ImGuiTableTempData::DrawSplitter, ImGuiTable::DummyDrawChannel, ImGuiTable::EnabledMaskByIndex, EndChild(), ImGuiTableColumn::Flags, ImGuiTable::Flags, ImPool< T >::GetByIndex(), ImRect::GetHeight(), ImPool< T >::GetIndex(), ImRect::GetSize(), GImGui, ImGuiTableTempData::HostBackupColumnsOffset, ImGuiTableTempData::HostBackupCurrLineSize, ImGuiTableTempData::HostBackupCursorMaxPos, ImGuiTableTempData::HostBackupItemWidth, ImGuiTableTempData::HostBackupItemWidthStackSize, ImGuiTableTempData::HostBackupParentWorkRect, ImGuiTableTempData::HostBackupPrevLineSize, ImGuiTableTempData::HostBackupWorkRect, ImGuiTable::HostSkipItems, ImGuiTable::HoveredColumnBody, ImGuiTable::ID, ImGuiWindowTempData::IdealMaxPos, ImGuiWindow::IDStack, IM_ASSERT, IM_ASSERT_USER_ERROR, ImFloor(), ImGuiMouseButton_Right, ImGuiTableColumnFlags_NoResize, ImGuiTableColumnFlags_WidthFixed, ImGuiTableFlags_Borders, ImGuiTableFlags_BordersOuterV, ImGuiTableFlags_ContextMenuInBody, ImGuiTableFlags_NoClip, ImGuiTableFlags_NoHostExtendX, ImGuiTableFlags_NoHostExtendY, ImGuiTableFlags_ScrollX, ImGuiTableFlags_ScrollY, ImMax(), ImMin(), ImGuiTable::InnerClipRect, ImGuiTable::InnerRect, ImGuiTable::InnerWindow, ImGuiTable::InstanceCurrent, ImGuiTable::InstanceInteracted, ImGuiContext::IO, IsAnyItemHovered(), ImGuiTable::IsInitializing, ImGuiTable::IsInsideRow, ImGuiTable::IsLayoutLocked, IsMouseReleased(), ImGuiTable::IsSettingsDirty, ItemAdd(), ItemSize(), ImGuiWindowTempData::ItemWidth, ImGuiWindowTempData::ItemWidthStack, ImGuiTable::LastOuterHeight, ImGuiTable::LastResizedColumn, ImRect::Max, ImGuiTableColumn::MaxX, ImDrawListSplitter::Merge(), ImRect::Min, ImGuiTable::MinColumnWidth, ImGuiTableColumn::MinX, ImGuiIO::MousePos, ImGuiTable::OuterPaddingX, ImGuiTable::OuterRect, ImGuiTable::OuterWindow, ImGuiWindow::ParentWindow, ImGuiWindow::ParentWorkRect, ImDrawList::PopClipRect(), PopID(), ImGuiWindow::Pos, ImGuiWindowTempData::PrevLineSize, ImVector< T >::resize(), ImGuiTable::ResizedColumn, ImGuiTable::ResizedColumnNextWidth, ImGuiTable::ResizeLockMinContentsX2, ImGuiTable::RightMostEnabledColumn, ImGuiTable::RowPosY2, ImGuiWindow::Scroll, ImGuiWindow::ScrollbarSizes, ImGuiWindow::ScrollbarX, ImDrawListSplitter::SetCurrentChannel(), SetScrollFromPosX(), ImVector< T >::Size, ImGuiWindow::SkipItems, TABLE_BORDER_SIZE, TABLE_RESIZE_SEPARATOR_HALF_THICKNESS, TableDrawBorders(), TableEndRow(), TableGetColumnWidthAuto(), ImGuiTableTempData::TableIndex, TableMergeDrawChannels(), TableOpenContextMenu(), ImGuiContext::Tables, TableSaveSettings(), ImGuiContext::TablesTempDataStack, TableUpdateLayout(), ImGuiTable::TempData, ImGuiTableTempData::UserOuterSize, ImGuiTableColumn::WidthRequest, ImGuiWindow::WorkRect, ImGuiTable::WorkRect, ImVec2::x, and ImVec2::y.

Referenced by Slic3r::GUI::GLCanvas3D::_picking_pass(), ErrorCheckEndFrameRecover(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::GCodeViewer::render_legend(), ShowDemoWindow(), ShowDemoWindowLayout(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), and ShowExampleAppPropertyEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EndTooltip()

◆ ErrorCheckEndFrameRecover()

void ImGui::ErrorCheckEndFrameRecover ( ImGuiErrorLogCallback  log_callback,
void user_data = NULL 
)
7211{
7212 // PVS-Studio V1044 is "Loop break conditions do not depend on the number of iterations"
7213 ImGuiContext& g = *GImGui;
7214 while (g.CurrentWindowStack.Size > 0)
7215 {
7217 {
7218 if (log_callback) log_callback(user_data, "Recovered from missing EndTable() in '%s'", g.CurrentTable->OuterWindow->Name);
7219 EndTable();
7220 }
7221 ImGuiWindow* window = g.CurrentWindow;
7222 IM_ASSERT(window != NULL);
7223 while (g.CurrentTabBar != NULL) //-V1044
7224 {
7225 if (log_callback) log_callback(user_data, "Recovered from missing EndTabBar() in '%s'", window->Name);
7226 EndTabBar();
7227 }
7228 while (window->DC.TreeDepth > 0)
7229 {
7230 if (log_callback) log_callback(user_data, "Recovered from missing TreePop() in '%s'", window->Name);
7231 TreePop();
7232 }
7234 {
7235 if (log_callback) log_callback(user_data, "Recovered from missing EndGroup() in '%s'", window->Name);
7236 EndGroup();
7237 }
7238 while (window->IDStack.Size > 1)
7239 {
7240 if (log_callback) log_callback(user_data, "Recovered from missing PopID() in '%s'", window->Name);
7241 PopID();
7242 }
7244 {
7245 if (log_callback) log_callback(user_data, "Recovered from missing PopStyleColor() in '%s' for ImGuiCol_%s", window->Name, GetStyleColorName(g.ColorStack.back().Col));
7246 PopStyleColor();
7247 }
7249 {
7250 if (log_callback) log_callback(user_data, "Recovered from missing PopStyleVar() in '%s'", window->Name);
7251 PopStyleVar();
7252 }
7254 {
7255 if (log_callback) log_callback(user_data, "Recovered from missing PopFocusScope() in '%s'", window->Name);
7256 PopFocusScope();
7257 }
7258 if (g.CurrentWindowStack.Size == 1)
7259 {
7261 break;
7262 }
7263 IM_ASSERT(window == g.CurrentWindow);
7264 if (window->Flags & ImGuiWindowFlags_ChildWindow)
7265 {
7266 if (log_callback) log_callback(user_data, "Recovered from missing EndChild() for '%s'", window->Name);
7267 EndChild();
7268 }
7269 else
7270 {
7271 if (log_callback) log_callback(user_data, "Recovered from missing End() for '%s'", window->Name);
7272 End();
7273 }
7274 }
7275}
ImGuiCol Col
Definition imgui_internal.h:972
IMGUI_API const char * GetStyleColorName(ImGuiCol idx)
Definition imgui.cpp:2581
IMGUI_API void PopFocusScope()
Definition imgui.cpp:6970
IMGUI_API void EndTable()
Definition imgui_tables.cpp:1199
ImVector< ImGuiID > FocusScopeStack
Definition imgui_internal.h:1430
ImVector< ImGuiStyleMod > StyleVarStack
Definition imgui_internal.h:1428
ImVector< ImGuiColorMod > ColorStack
Definition imgui_internal.h:1427
short SizeOfStyleVarStack
Definition imgui_internal.h:1317
short SizeOfGroupStack
Definition imgui_internal.h:1320
short SizeOfFocusScopeStack
Definition imgui_internal.h:1319
short SizeOfColorStack
Definition imgui_internal.h:1316

References ImVector< T >::back(), ImGuiColorMod::Col, ImGuiContext::ColorStack, ImGuiContext::CurrentTabBar, ImGuiContext::CurrentTable, ImGuiContext::CurrentWindow, ImGuiContext::CurrentWindowStack, ImGuiWindow::DC, End(), EndChild(), EndGroup(), EndTabBar(), EndTable(), ImGuiWindow::Flags, ImGuiContext::FocusScopeStack, GetStyleColorName(), GImGui, ImGuiContext::GroupStack, ImGuiWindow::IDStack, IM_ASSERT, ImGuiWindowFlags_ChildWindow, ImGuiTable::InnerWindow, ImGuiWindow::IsFallbackWindow, ImGuiWindow::Name, ImGuiTable::OuterWindow, PopFocusScope(), PopID(), PopStyleColor(), PopStyleVar(), ImVector< T >::Size, ImGuiStackSizes::SizeOfColorStack, ImGuiStackSizes::SizeOfFocusScopeStack, ImGuiStackSizes::SizeOfGroupStack, ImGuiStackSizes::SizeOfStyleVarStack, ImGuiWindowTempData::StackSizesOnBegin, ImGuiContext::StyleVarStack, ImGuiWindowTempData::TreeDepth, and TreePop().

+ Here is the call graph for this function:

◆ ErrorCheckEndFrameSanityChecks()

static void ImGui::ErrorCheckEndFrameSanityChecks ( )
static
7170{
7171 ImGuiContext& g = *GImGui;
7172
7173 // Verify that io.KeyXXX fields haven't been tampered with. Key mods should not be modified between NewFrame() and EndFrame()
7174 // One possible reason leading to this assert is that your backends update inputs _AFTER_ NewFrame().
7175 // It is known that when some modal native windows called mid-frame takes focus away, some backends such as GLFW will
7176 // send key release events mid-frame. This would normally trigger this assertion and lead to sheared inputs.
7177 // We silently accommodate for this case by ignoring/ the case where all io.KeyXXX modifiers were released (aka key_mod_flags == 0),
7178 // while still correctly asserting on mid-frame key press events.
7179 const ImGuiKeyModFlags key_mod_flags = GetMergedKeyModFlags();
7180 IM_ASSERT((key_mod_flags == 0 || g.IO.KeyMods == key_mod_flags) && "Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods");
7181 IM_UNUSED(key_mod_flags);
7182
7183 // Recover from errors
7184 //ErrorCheckEndFrameRecover();
7185
7186 // Report when there is a mismatch of Begin/BeginChild vs End/EndChild calls. Important: Remember that the Begin/BeginChild API requires you
7187 // to always call End/EndChild even if Begin/BeginChild returns false! (this is unfortunately inconsistent with most other Begin* API).
7188 if (g.CurrentWindowStack.Size != 1)
7189 {
7190 if (g.CurrentWindowStack.Size > 1)
7191 {
7192 IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?");
7193 while (g.CurrentWindowStack.Size > 1)
7194 End();
7195 }
7196 else
7197 {
7198 IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you call End/EndChild too much?");
7199 }
7200 }
7201
7202 IM_ASSERT_USER_ERROR(g.GroupStack.Size == 0, "Missing EndGroup call!");
7203}
int ImGuiKeyModFlags
Definition imgui.h:190
IMGUI_API ImGuiKeyModFlags GetMergedKeyModFlags()
Definition imgui.cpp:3888
ImGuiKeyModFlags KeyMods
Definition imgui.h:1879

References ImGuiContext::CurrentWindowStack, End(), GetMergedKeyModFlags(), GImGui, ImGuiContext::GroupStack, IM_ASSERT, IM_ASSERT_USER_ERROR, IM_UNUSED, ImGuiContext::IO, ImGuiIO::KeyMods, and ImVector< T >::Size.

Referenced by EndFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ErrorCheckNewFrameSanityChecks()

static void ImGui::ErrorCheckNewFrameSanityChecks ( )
static
7133{
7134 ImGuiContext& g = *GImGui;
7135
7136 // Check user IM_ASSERT macro
7137 // (IF YOU GET A WARNING OR COMPILE ERROR HERE: it means your assert macro is incorrectly defined!
7138 // If your macro uses multiple statements, it NEEDS to be surrounded by a 'do { ... } while (0)' block.
7139 // This is a common C/C++ idiom to allow multiple statements macros to be used in control flow blocks.)
7140 // #define IM_ASSERT(EXPR) if (SomeCode(EXPR)) SomeMoreCode(); // Wrong!
7141 // #define IM_ASSERT(EXPR) do { if (SomeCode(EXPR)) SomeMoreCode(); } while (0) // Correct!
7142 if (true) IM_ASSERT(1); else IM_ASSERT(0);
7143
7144 // Check user data
7145 // (We pass an error message in the assert expression to make it visible to programmers who are not using a debugger, as most assert handlers display their argument)
7147 IM_ASSERT((g.IO.DeltaTime > 0.0f || g.FrameCount == 0) && "Need a positive DeltaTime!");
7148 IM_ASSERT((g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount) && "Forgot to call Render() or EndFrame() at the end of the previous frame?");
7149 IM_ASSERT(g.IO.DisplaySize.x >= 0.0f && g.IO.DisplaySize.y >= 0.0f && "Invalid DisplaySize value!");
7150 IM_ASSERT(g.IO.Fonts->Fonts.Size > 0 && "Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8()?");
7151 IM_ASSERT(g.IO.Fonts->Fonts[0]->IsLoaded() && "Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8()?");
7152 IM_ASSERT(g.Style.CurveTessellationTol > 0.0f && "Invalid style setting!");
7153 IM_ASSERT(g.Style.CircleTessellationMaxError > 0.0f && "Invalid style setting!");
7154 IM_ASSERT(g.Style.Alpha >= 0.0f && g.Style.Alpha <= 1.0f && "Invalid style setting!"); // Allows us to avoid a few clamps in color computations
7155 IM_ASSERT(g.Style.WindowMinSize.x >= 1.0f && g.Style.WindowMinSize.y >= 1.0f && "Invalid style setting.");
7157 for (int n = 0; n < ImGuiKey_COUNT; n++)
7158 IM_ASSERT(g.IO.KeyMap[n] >= -1 && g.IO.KeyMap[n] < IM_ARRAYSIZE(g.IO.KeysDown) && "io.KeyMap[] contains an out of bound value (need to be 0..512, or -1 for unmapped key)");
7159
7160 // Check: required key mapping (we intentionally do NOT check all keys to not pressure user into setting up everything, but Space is required and was only added in 1.60 WIP)
7162 IM_ASSERT(g.IO.KeyMap[ImGuiKey_Space] != -1 && "ImGuiKey_Space is not mapped, required for keyboard navigation.");
7163
7164 // Check: the io.ConfigWindowsResizeFromEdges option requires backend to honor mouse cursor changes and set the ImGuiBackendFlags_HasMouseCursors flag accordingly.
7167}
@ ImGuiConfigFlags_NavEnableKeyboard
Definition imgui.h:1388
@ ImGuiBackendFlags_HasMouseCursors
Definition imgui.h:1405
@ ImGuiKey_Space
Definition imgui.h:1326
@ ImGuiKey_COUNT
Definition imgui.h:1336
ImVector< ImFont * > Fonts
Definition imgui.h:2668
ImVec2 DisplaySize
Definition imgui.h:1782
bool KeysDown[512]
Definition imgui.h:1845
ImGuiConfigFlags ConfigFlags
Definition imgui.h:1780
ImGuiBackendFlags BackendFlags
Definition imgui.h:1781
int KeyMap[ImGuiKey_COUNT]
Definition imgui.h:1790
ImVec2 WindowMinSize
Definition imgui.h:1726
float CurveTessellationTol
Definition imgui.h:1759
float Alpha
Definition imgui.h:1722
ImGuiDir WindowMenuButtonPosition
Definition imgui.h:1728
float CircleTessellationMaxError
Definition imgui.h:1760

References ImGuiStyle::Alpha, ImGuiIO::BackendFlags, ImGuiStyle::CircleTessellationMaxError, ImGuiIO::ConfigFlags, ImGuiIO::ConfigWindowsResizeFromEdges, ImGuiStyle::CurveTessellationTol, ImGuiIO::DeltaTime, ImGuiIO::DisplaySize, ImGuiIO::Fonts, ImFontAtlas::Fonts, ImGuiContext::FrameCount, ImGuiContext::FrameCountEnded, GImGui, IM_ARRAYSIZE, IM_ASSERT, ImGuiBackendFlags_HasMouseCursors, ImGuiConfigFlags_NavEnableKeyboard, ImGuiDir_Left, ImGuiDir_None, ImGuiDir_Right, ImGuiKey_COUNT, ImGuiKey_Space, ImGuiContext::Initialized, ImGuiContext::IO, ImGuiIO::KeyMap, ImGuiIO::KeysDown, ImVector< T >::Size, ImGuiContext::Style, ImGuiStyle::WindowMenuButtonPosition, ImGuiStyle::WindowMinSize, ImVec2::x, and ImVec2::y.

Referenced by NewFrame().

+ Here is the caller graph for this function:

◆ FindBestWindowPosForPopup()

ImVec2 ImGui::FindBestWindowPosForPopup ( ImGuiWindow window)
8536{
8537 ImGuiContext& g = *GImGui;
8538
8539 ImRect r_outer = GetWindowAllowedExtentRect(window);
8540 if (window->Flags & ImGuiWindowFlags_ChildMenu)
8541 {
8542 // Child menus typically request _any_ position within the parent menu item, and then we move the new menu outside the parent bounds.
8543 // This is how we end up with child menus appearing (most-commonly) on the right of the parent menu.
8544 IM_ASSERT(g.CurrentWindow == window);
8545 ImGuiWindow* parent_window = g.CurrentWindowStack[g.CurrentWindowStack.Size - 2];
8546 float horizontal_overlap = g.Style.ItemInnerSpacing.x; // We want some overlap to convey the relative depth of each menu (currently the amount of overlap is hard-coded to style.ItemSpacing.x).
8547 ImRect r_avoid;
8548 if (parent_window->DC.MenuBarAppending)
8549 r_avoid = ImRect(-FLT_MAX, parent_window->ClipRect.Min.y, FLT_MAX, parent_window->ClipRect.Max.y); // Avoid parent menu-bar. If we wanted multi-line menu-bar, we may instead want to have the calling window setup e.g. a NextWindowData.PosConstraintAvoidRect field
8550 else
8551 r_avoid = ImRect(parent_window->Pos.x + horizontal_overlap, -FLT_MAX, parent_window->Pos.x + parent_window->Size.x - horizontal_overlap - parent_window->ScrollbarSizes.x, FLT_MAX);
8552 return FindBestWindowPosForPopupEx(window->Pos, window->Size, &window->AutoPosLastDirection, r_outer, r_avoid, ImGuiPopupPositionPolicy_Default);
8553 }
8554 if (window->Flags & ImGuiWindowFlags_Popup)
8555 {
8556 ImRect r_avoid = ImRect(window->Pos.x - 1, window->Pos.y - 1, window->Pos.x + 1, window->Pos.y + 1);
8557 return FindBestWindowPosForPopupEx(window->Pos, window->Size, &window->AutoPosLastDirection, r_outer, r_avoid, ImGuiPopupPositionPolicy_Default);
8558 }
8559 if (window->Flags & ImGuiWindowFlags_Tooltip)
8560 {
8561 // Position tooltip (always follows mouse)
8562 float sc = g.Style.MouseCursorScale;
8563 ImVec2 ref_pos = NavCalcPreferredRefPos();
8564 ImRect r_avoid;
8566 r_avoid = ImRect(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 16, ref_pos.y + 8);
8567 else
8568 r_avoid = ImRect(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 24 * sc, ref_pos.y + 24 * sc); // FIXME: Hard-coded based on mouse cursor shape expectation. Exact dimension not very important.
8569 return FindBestWindowPosForPopupEx(ref_pos, window->Size, &window->AutoPosLastDirection, r_outer, r_avoid, ImGuiPopupPositionPolicy_Tooltip);
8570 }
8571 IM_ASSERT(0);
8572 return window->Pos;
8573}
@ ImGuiConfigFlags_NavEnableSetMousePos
Definition imgui.h:1390
@ ImGuiPopupPositionPolicy_Tooltip
Definition imgui_internal.h:944
@ ImGuiPopupPositionPolicy_Default
Definition imgui_internal.h:942
static ImVec2 NavCalcPreferredRefPos()
Definition imgui.cpp:8963

References ImGuiWindow::AutoPosLastDirection, ImGuiWindow::ClipRect, ImGuiIO::ConfigFlags, ImGuiContext::CurrentWindow, ImGuiContext::CurrentWindowStack, ImGuiWindow::DC, FindBestWindowPosForPopupEx(), ImGuiWindow::Flags, GetWindowAllowedExtentRect(), GImGui, IM_ASSERT, ImGuiConfigFlags_NavEnableSetMousePos, ImGuiPopupPositionPolicy_Default, ImGuiPopupPositionPolicy_Tooltip, ImGuiWindowFlags_ChildMenu, ImGuiWindowFlags_Popup, ImGuiWindowFlags_Tooltip, ImGuiContext::IO, ImGuiStyle::ItemInnerSpacing, ImRect::Max, ImGuiWindowTempData::MenuBarAppending, ImRect::Min, ImGuiStyle::MouseCursorScale, NavCalcPreferredRefPos(), ImGuiContext::NavDisableHighlight, ImGuiContext::NavDisableMouseHover, ImGuiWindow::Pos, ImGuiWindow::ScrollbarSizes, ImVector< T >::Size, ImGuiWindow::Size, ImGuiContext::Style, ImVec2::x, and ImVec2::y.

Referenced by Begin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindBestWindowPosForPopupEx()

ImVec2 ImGui::FindBestWindowPosForPopupEx ( const ImVec2 ref_pos,
const ImVec2 size,
ImGuiDir last_dir,
const ImRect r_outer,
const ImRect r_avoid,
ImGuiPopupPositionPolicy  policy 
)
8451{
8452 ImVec2 base_pos_clamped = ImClamp(ref_pos, r_outer.Min, r_outer.Max - size);
8453 //GetForegroundDrawList()->AddRect(r_avoid.Min, r_avoid.Max, IM_COL32(255,0,0,255));
8454 //GetForegroundDrawList()->AddRect(r_outer.Min, r_outer.Max, IM_COL32(0,255,0,255));
8455
8456 // Combo Box policy (we want a connecting edge)
8458 {
8460 for (int n = (*last_dir != ImGuiDir_None) ? -1 : 0; n < ImGuiDir_COUNT; n++)
8461 {
8462 const ImGuiDir dir = (n == -1) ? *last_dir : dir_prefered_order[n];
8463 if (n != -1 && dir == *last_dir) // Already tried this direction?
8464 continue;
8465 ImVec2 pos;
8466 if (dir == ImGuiDir_Down) pos = ImVec2(r_avoid.Min.x, r_avoid.Max.y); // Below, Toward Right (default)
8467 if (dir == ImGuiDir_Right) pos = ImVec2(r_avoid.Min.x, r_avoid.Min.y - size.y); // Above, Toward Right
8468 if (dir == ImGuiDir_Left) pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Max.y); // Below, Toward Left
8469 if (dir == ImGuiDir_Up) pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Min.y - size.y); // Above, Toward Left
8470 if (!r_outer.Contains(ImRect(pos, pos + size)))
8471 continue;
8472 *last_dir = dir;
8473 return pos;
8474 }
8475 }
8476
8477 // Tooltip and Default popup policy
8478 // (Always first try the direction we used on the last frame, if any)
8480 {
8482 for (int n = (*last_dir != ImGuiDir_None) ? -1 : 0; n < ImGuiDir_COUNT; n++)
8483 {
8484 const ImGuiDir dir = (n == -1) ? *last_dir : dir_prefered_order[n];
8485 if (n != -1 && dir == *last_dir) // Already tried this direction?
8486 continue;
8487
8488 const float avail_w = (dir == ImGuiDir_Left ? r_avoid.Min.x : r_outer.Max.x) - (dir == ImGuiDir_Right ? r_avoid.Max.x : r_outer.Min.x);
8489 const float avail_h = (dir == ImGuiDir_Up ? r_avoid.Min.y : r_outer.Max.y) - (dir == ImGuiDir_Down ? r_avoid.Max.y : r_outer.Min.y);
8490
8491 // If there not enough room on one axis, there's no point in positioning on a side on this axis (e.g. when not enough width, use a top/bottom position to maximize available width)
8492 if (avail_w < size.x && (dir == ImGuiDir_Left || dir == ImGuiDir_Right))
8493 continue;
8494 if (avail_h < size.y && (dir == ImGuiDir_Up || dir == ImGuiDir_Down))
8495 continue;
8496
8497 ImVec2 pos;
8498 pos.x = (dir == ImGuiDir_Left) ? r_avoid.Min.x - size.x : (dir == ImGuiDir_Right) ? r_avoid.Max.x : base_pos_clamped.x;
8499 pos.y = (dir == ImGuiDir_Up) ? r_avoid.Min.y - size.y : (dir == ImGuiDir_Down) ? r_avoid.Max.y : base_pos_clamped.y;
8500
8501 // Clamp top-left corner of popup
8502 pos.x = ImMax(pos.x, r_outer.Min.x);
8503 pos.y = ImMax(pos.y, r_outer.Min.y);
8504
8505 *last_dir = dir;
8506 return pos;
8507 }
8508 }
8509
8510 // Fallback when not enough room:
8511 *last_dir = ImGuiDir_None;
8512
8513 // For tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible.
8515 return ref_pos + ImVec2(2, 2);
8516
8517 // Otherwise try to keep within display
8518 ImVec2 pos = ref_pos;
8519 pos.x = ImMax(ImMin(pos.x + size.x, r_outer.Max.x) - size.x, r_outer.Min.x);
8520 pos.y = ImMax(ImMin(pos.y + size.y, r_outer.Max.y) - size.y, r_outer.Min.y);
8521 return pos;
8522}
int ImGuiDir
Definition imgui.h:170
@ ImGuiDir_COUNT
Definition imgui.h:1300
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183

References ImRect::Contains(), ImClamp(), ImGuiDir_COUNT, ImGuiDir_Down, ImGuiDir_Left, ImGuiDir_None, ImGuiDir_Right, ImGuiDir_Up, ImGuiPopupPositionPolicy_ComboBox, ImGuiPopupPositionPolicy_Default, ImGuiPopupPositionPolicy_Tooltip, ImMax(), ImMin(), ImRect::Max, ImRect::Min, ImVec2::x, and ImVec2::y.

Referenced by BeginCombo(), and FindBestWindowPosForPopup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindOrCreateColumns()

ImGuiOldColumns * ImGui::FindOrCreateColumns ( ImGuiWindow window,
ImGuiID  id 
)
3775{
3776 // We have few columns per window so for now we don't need bother much with turning this into a faster lookup.
3777 for (int n = 0; n < window->ColumnsStorage.Size; n++)
3778 if (window->ColumnsStorage[n].ID == id)
3779 return &window->ColumnsStorage[n];
3780
3782 ImGuiOldColumns* columns = &window->ColumnsStorage.back();
3783 columns->ID = id;
3784 return columns;
3785}

References ImVector< T >::back(), ImGuiWindow::ColumnsStorage, ImGuiOldColumns::ID, ImVector< T >::push_back(), and ImVector< T >::Size.

Referenced by BeginColumns().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindOrCreateWindowSettings()

ImGuiWindowSettings * ImGui::FindOrCreateWindowSettings ( const char *  name)
10405{
10406 if (ImGuiWindowSettings* settings = FindWindowSettings(ImHashStr(name)))
10407 return settings;
10408 return CreateNewWindowSettings(name);
10409}
IMGUI_API ImGuiWindowSettings * CreateNewWindowSettings(const char *name)
Definition imgui.cpp:10373
IMGUI_API ImGuiWindowSettings * FindWindowSettings(ImGuiID id)
Definition imgui.cpp:10395

References CreateNewWindowSettings(), FindWindowSettings(), and ImHashStr().

Referenced by WindowSettingsHandler_ReadOpen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindRenderedTextEnd()

const char * ImGui::FindRenderedTextEnd ( const char *  text,
const char *  text_end = NULL 
)
2653{
2654 const char* text_display_end = text;
2655 if (!text_end)
2656 text_end = (const char*)-1;
2657
2658 while (text_display_end < text_end && *text_display_end != '\0' && (text_display_end[0] != '#' || text_display_end[1] != '#'))
2659 text_display_end++;
2660 return text_display_end;
2661}

Referenced by CalcTextSize(), ColorEdit4(), ColorPicker4(), ColorTooltip(), DebugRenderViewportThumbnail(), DragFloatRange2(), DragIntRange2(), DragScalarN(), InputScalar(), InputScalarN(), LogRenderedText(), NavUpdateWindowingOverlay(), RenderText(), RenderTextClipped(), RenderTextEllipsis(), SliderScalarN(), TabItemEx(), TableHeader(), and TreeNodeBehavior().

+ Here is the caller graph for this function:

◆ FindSettingsHandler()

ImGuiSettingsHandler * ImGui::FindSettingsHandler ( const char *  type_name)
10412{
10413 ImGuiContext& g = *GImGui;
10414 const ImGuiID type_hash = ImHashStr(type_name);
10415 for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++)
10416 if (g.SettingsHandlers[handler_n].TypeHash == type_hash)
10417 return &g.SettingsHandlers[handler_n];
10418 return NULL;
10419}

References GImGui, ImHashStr(), ImGuiContext::SettingsHandlers, and ImVector< T >::Size.

Referenced by LoadIniSettingsFromMemory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindWindowByID()

ImGuiWindow * ImGui::FindWindowByID ( ImGuiID  id)
5105{
5106 ImGuiContext& g = *GImGui;
5107 return (ImGuiWindow*)g.WindowsById.GetVoidPtr(id);
5108}
ImGuiStorage WindowsById
Definition imgui_internal.h:1377
IMGUI_API void * GetVoidPtr(ImGuiID key) const
Definition imgui.cpp:1936

References ImGuiStorage::GetVoidPtr(), GImGui, and ImGuiContext::WindowsById.

Referenced by FindWindowByName(), and WindowSettingsHandler_ApplyAll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindWindowByName()

ImGuiWindow * ImGui::FindWindowByName ( const char *  name)
5111{
5112 ImGuiID id = ImHashStr(name);
5113 return FindWindowByID(id);
5114}
IMGUI_API ImGuiWindow * FindWindowByID(ImGuiID id)
Definition imgui.cpp:5104

References FindWindowByID(), and ImHashStr().

Referenced by Begin(), BeginCombo(), BeginTooltipEx(), BeginViewportSideBar(), priv::change_window_position(), NavUpdateWindowingOverlay(), SetWindowCollapsed(), SetWindowFocus(), SetWindowPos(), and SetWindowSize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindWindowFocusIndex()

static int ImGui::FindWindowFocusIndex ( ImGuiWindow window)
static
9522{
9523 ImGuiContext& g = *GImGui;
9524 IM_UNUSED(g);
9525 int order = window->FocusOrder;
9526 IM_ASSERT(g.WindowsFocusOrder[order] == window);
9527 return order;
9528}

References ImGuiWindow::FocusOrder, GImGui, IM_ASSERT, IM_UNUSED, and ImGuiContext::WindowsFocusOrder.

Referenced by FocusTopMostWindowUnderOne(), and NavUpdateWindowingHighlightWindow().

+ Here is the caller graph for this function:

◆ FindWindowSettings()

ImGuiWindowSettings * ImGui::FindWindowSettings ( ImGuiID  id)
10396{
10397 ImGuiContext& g = *GImGui;
10398 for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings))
10399 if (settings->ID == id)
10400 return settings;
10401 return NULL;
10402}
T * begin()
Definition imgui_internal.h:642
T * next_chunk(T *p)
Definition imgui_internal.h:643

References ImChunkStream< T >::begin(), GImGui, ImChunkStream< T >::next_chunk(), and ImGuiContext::SettingsWindows.

Referenced by CreateNewWindow(), FindOrCreateWindowSettings(), and WindowSettingsHandler_WriteAll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FocusableItemRegister()

bool ImGui::FocusableItemRegister ( ImGuiWindow window,
ImGuiID  id 
)
inline
2378{ IM_ASSERT(0); IM_UNUSED(window); IM_UNUSED(id); return false; } // -> pass ImGuiItemAddFlags_Focusable flag to ItemAdd()

References IM_ASSERT, and IM_UNUSED.

◆ FocusableItemUnregister()

void ImGui::FocusableItemUnregister ( ImGuiWindow window)
inline
2379{ IM_ASSERT(0); IM_UNUSED(window); } // -> unnecessary: TempInputText() uses ImGuiInputTextFlags_MergedItem

References IM_ASSERT, and IM_UNUSED.

◆ FocusTopMostWindowUnderOne()

void ImGui::FocusTopMostWindowUnderOne ( ImGuiWindow under_this_window,
ImGuiWindow ignore_window 
)
6495{
6496 ImGuiContext& g = *GImGui;
6497
6498 const int start_idx = ((under_this_window != NULL) ? FindWindowFocusIndex(under_this_window) : g.WindowsFocusOrder.Size) - 1;
6499 for (int i = start_idx; i >= 0; i--)
6500 {
6501 // We may later decide to test for different NoXXXInputs based on the active navigation input (mouse vs nav) but that may feel more confusing to the user.
6502 ImGuiWindow* window = g.WindowsFocusOrder[i];
6503 IM_ASSERT(window == window->RootWindow);
6504 if (window != ignore_window && window->WasActive)
6506 {
6507 ImGuiWindow* focus_window = NavRestoreLastChildNavWindow(window);
6508 FocusWindow(focus_window);
6509 return;
6510 }
6511 }
6512 FocusWindow(NULL);
6513}
static int FindWindowFocusIndex(ImGuiWindow *window)
Definition imgui.cpp:9521
static ImGuiWindow * NavRestoreLastChildNavWindow(ImGuiWindow *window)
Definition imgui.cpp:8897

References FindWindowFocusIndex(), ImGuiWindow::Flags, FocusWindow(), GImGui, IM_ASSERT, ImGuiWindowFlags_NoMouseInputs, ImGuiWindowFlags_NoNavInputs, NavRestoreLastChildNavWindow(), ImGuiWindow::RootWindow, ImVector< T >::Size, ImGuiWindow::WasActive, and ImGuiContext::WindowsFocusOrder.

Referenced by ClosePopupToLevel(), EndMainMenuBar(), and NewFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FocusWindow()

void ImGui::FocusWindow ( ImGuiWindow window)
6452{
6453 ImGuiContext& g = *GImGui;
6454
6455 if (g.NavWindow != window)
6456 {
6457 g.NavWindow = window;
6458 if (window && g.NavDisableMouseHover)
6459 g.NavMousePosDirty = true;
6460 g.NavId = window ? window->NavLastIds[0] : 0; // Restore NavId
6461 g.NavFocusScopeId = 0;
6462 g.NavIdIsAlive = false;
6464 g.NavInitRequest = g.NavMoveRequest = false;
6466 //IMGUI_DEBUG_LOG("FocusWindow(\"%s\")\n", window ? window->Name : NULL);
6467 }
6468
6469 // Close popups if any
6470 ClosePopupsOverWindow(window, false);
6471
6472 // Move the root window to the top of the pile
6473 IM_ASSERT(window == NULL || window->RootWindow != NULL);
6474 ImGuiWindow* focus_front_window = window ? window->RootWindow : NULL; // NB: In docking branch this is window->RootWindowDockStop
6475 ImGuiWindow* display_front_window = window ? window->RootWindow : NULL;
6476
6477 // Steal active widgets. Some of the cases it triggers includes:
6478 // - Focus a window while an InputText in another window is active, if focus happens before the old InputText can run.
6479 // - When using Nav to activate menu items (due to timing of activating on press->new window appears->losing ActiveId)
6480 if (g.ActiveId != 0 && g.ActiveIdWindow && g.ActiveIdWindow->RootWindow != focus_front_window)
6482 ClearActiveID();
6483
6484 // Passing NULL allow to disable keyboard focus
6485 if (!window)
6486 return;
6487
6488 // Bring to front
6489 BringWindowToFocusFront(focus_front_window);
6490 if (((window->Flags | display_front_window->Flags) & ImGuiWindowFlags_NoBringToFrontOnFocus) == 0)
6491 BringWindowToDisplayFront(display_front_window);
6492}
@ ImGuiWindowFlags_NoBringToFrontOnFocus
Definition imgui.h:929
static void NavUpdateAnyRequestFlag()
Definition imgui.cpp:8923
bool NavIdIsAlive
Definition imgui_internal.h:1457
bool NavInitRequest
Definition imgui_internal.h:1462
ImGuiID NavFocusScopeId
Definition imgui_internal.h:1442

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdNoClearOnFocusLoss, ImGuiContext::ActiveIdWindow, BringWindowToDisplayFront(), BringWindowToFocusFront(), ClearActiveID(), ClosePopupsOverWindow(), ImGuiWindow::Flags, GImGui, IM_ASSERT, ImGuiNavLayer_Main, ImGuiWindowFlags_NoBringToFrontOnFocus, ImGuiContext::NavDisableMouseHover, ImGuiContext::NavFocusScopeId, ImGuiContext::NavId, ImGuiContext::NavIdIsAlive, ImGuiContext::NavInitRequest, ImGuiWindow::NavLastIds, ImGuiContext::NavLayer, ImGuiContext::NavMousePosDirty, ImGuiContext::NavMoveRequest, NavUpdateAnyRequestFlag(), ImGuiContext::NavWindow, and ImGuiWindow::RootWindow.

Referenced by Begin(), BeginChildEx(), BeginDragDropSource(), ButtonBehavior(), ClosePopupToLevel(), DragScalar(), EndMenuBar(), FocusTopMostWindowUnderOne(), InputTextEx(), NavUpdate(), NavUpdateWindowing(), SetWindowFocus(), SetWindowFocus(), SliderScalar(), StartMouseMovingWindow(), UpdateMouseMovingWindowEndFrame(), UpdateMouseMovingWindowNewFrame(), and VSliderScalar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GcAwakeTransientWindowBuffers()

void ImGui::GcAwakeTransientWindowBuffers ( ImGuiWindow window)
3040{
3041 // We stored capacity of the ImDrawList buffer to reduce growth-caused allocation/copy when awakening.
3042 // The other buffers tends to amortize much faster.
3043 window->MemoryCompacted = false;
3047}
int MemoryDrawListVtxCapacity
Definition imgui_internal.h:1895
int MemoryDrawListIdxCapacity
Definition imgui_internal.h:1894

References ImGuiWindow::DrawList, ImDrawList::IdxBuffer, ImGuiWindow::MemoryCompacted, ImGuiWindow::MemoryDrawListIdxCapacity, ImGuiWindow::MemoryDrawListVtxCapacity, ImVector< T >::reserve(), and ImDrawList::VtxBuffer.

Referenced by Begin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GcCompactTransientMiscBuffers()

void ImGui::GcCompactTransientMiscBuffers ( )
3016{
3017 ImGuiContext& g = *GImGui;
3019 g.GroupStack.clear();
3021}
IMGUI_API void TableGcCompactSettings()
Definition imgui_tables.cpp:3461

References ImVector< T >::clear(), GImGui, ImGuiContext::GroupStack, ImGuiContext::ItemFlagsStack, and TableGcCompactSettings().

Referenced by NewFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GcCompactTransientWindowBuffers()

void ImGui::GcCompactTransientWindowBuffers ( ImGuiWindow window)
3028{
3029 window->MemoryCompacted = true;
3032 window->IDStack.clear();
3033 window->DrawList->_ClearFreeMemory();
3034 window->DC.ChildWindows.clear();
3035 window->DC.ItemWidthStack.clear();
3036 window->DC.TextWrapPosStack.clear();
3037}
IMGUI_API void _ClearFreeMemory()
Definition imgui_draw.cpp:428
int Capacity
Definition imgui.h:1656

References ImDrawList::_ClearFreeMemory(), ImVector< T >::Capacity, ImGuiWindowTempData::ChildWindows, ImVector< T >::clear(), ImGuiWindow::DC, ImGuiWindow::DrawList, ImGuiWindow::IDStack, ImDrawList::IdxBuffer, ImGuiWindowTempData::ItemWidthStack, ImGuiWindow::MemoryCompacted, ImGuiWindow::MemoryDrawListIdxCapacity, ImGuiWindow::MemoryDrawListVtxCapacity, ImGuiWindowTempData::TextWrapPosStack, and ImDrawList::VtxBuffer.

Referenced by NewFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetActiveID()

ImGuiID ImGui::GetActiveID ( )
inline
2343{ ImGuiContext& g = *GImGui; return g.ActiveId; }

References ImGuiContext::ActiveId, and GImGui.

Referenced by Slic3r::GUI::ImGuiWrapper::slider_float().

+ Here is the caller graph for this function:

◆ GetAllocatorFunctions()

void ImGui::GetAllocatorFunctions ( ImGuiMemAllocFunc p_alloc_func,
ImGuiMemFreeFunc p_free_func,
void **  p_user_data 
)
3384{
3385 *p_alloc_func = GImAllocatorAllocFunc;
3386 *p_free_func = GImAllocatorFreeFunc;
3387 *p_user_data = GImAllocatorUserData;
3388}
static ImGuiMemFreeFunc GImAllocatorFreeFunc
Definition imgui.cpp:974
static void * GImAllocatorUserData
Definition imgui.cpp:975
static ImGuiMemAllocFunc GImAllocatorAllocFunc
Definition imgui.cpp:973

References GImAllocatorAllocFunc, GImAllocatorFreeFunc, and GImAllocatorUserData.

◆ GetBackgroundDrawList() [1/2]

ImDrawList * ImGui::GetBackgroundDrawList ( )
3493{
3494 ImGuiContext& g = *GImGui;
3495 return GetBackgroundDrawList(g.Viewports[0]);
3496}
IMGUI_API ImDrawList * GetBackgroundDrawList()
Definition imgui.cpp:3492
ImVector< ImGuiViewportP * > Viewports
Definition imgui_internal.h:1437

References GetBackgroundDrawList(), GImGui, and ImGuiContext::Viewports.

Referenced by GetBackgroundDrawList(), Render(), and ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetBackgroundDrawList() [2/2]

ImDrawList * ImGui::GetBackgroundDrawList ( ImGuiViewport viewport)
3488{
3489 return GetViewportDrawList((ImGuiViewportP*)viewport, 0, "##Background");
3490}
static ImDrawList * GetViewportDrawList(ImGuiViewportP *viewport, size_t drawlist_no, const char *drawlist_name)
Definition imgui.cpp:3463

References GetViewportDrawList().

+ Here is the call graph for this function:

◆ GetClipboardText()

const char * ImGui::GetClipboardText ( )
3342{
3343 ImGuiContext& g = *GImGui;
3345}
void * ClipboardUserData
Definition imgui.h:1826
const char *(* GetClipboardTextFn)(void *user_data)
Definition imgui.h:1824

References ImGuiIO::ClipboardUserData, ImGuiIO::GetClipboardTextFn, GImGui, and ImGuiContext::IO.

Referenced by InputTextEx().

+ Here is the caller graph for this function:

◆ GetColorU32() [1/3]

ImU32 ImGui::GetColorU32 ( const ImVec4 col)
2438{
2440 ImVec4 c = col;
2441 c.w *= style.Alpha;
2442 return ColorConvertFloat4ToU32(c);
2443}

References col(), ColorConvertFloat4ToU32(), GImGui, ImGuiContext::Style, and style.

+ Here is the call graph for this function:

◆ GetColorU32() [2/3]

ImU32 ImGui::GetColorU32 ( ImGuiCol  idx,
float  alpha_mul = 1.0f 
)
2430{
2432 ImVec4 c = style.Colors[idx];
2433 c.w *= style.Alpha * alpha_mul;
2434 return ColorConvertFloat4ToU32(c);
2435}

References ColorConvertFloat4ToU32(), GImGui, ImGuiContext::Style, and style.

Referenced by AcceptDragDropPayload(), ArrowButtonEx(), Begin(), BeginCombo(), BeginMenu(), BeginTabBarEx(), BeginTableEx(), Bullet(), BulletTextV(), ButtonEx(), Checkbox(), CloseButton(), CollapseButton(), ColorButton(), DebugRenderViewportThumbnail(), DragScalar(), Slic3r::GUI::ImGuiWrapper::draw_radio_button(), igl::opengl::glfw::imgui::ImGuiMenu::draw_text(), EndColumns(), Image(), Slic3r::GUI::image_button_ex(), ImageButtonEx(), InputTextEx(), MenuItem(), Slic3r::GUI::GLGizmoEmboss::on_render_input_window(), PlotEx(), ProgressBar(), RadioButton(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::GLGizmoCut3D::render_flip_plane_button(), Slic3r::GUI::GCodeViewer::render_legend(), RenderArrow(), RenderBullet(), RenderColorRectWithAlphaCheckerboard(), RenderFrame(), RenderFrameBorder(), RenderNavHighlight(), ImFont::RenderText(), RenderText(), RenderTextClippedEx(), RenderTextEllipsis(), RenderTextWrapped(), RenderWindowDecorations(), RenderWindowOuterBorders(), ScrollbarEx(), Slic3r::GUI::selectable(), Selectable(), SeparatorEx(), ShowDemoWindowMisc(), ShowDemoWindowTables(), ShowExampleAppCustomRendering(), ShowExampleMenuFile(), ShowFont(), ShowStyleEditor(), SliderScalar(), SplitterBehavior(), TabItemBackground(), TabItemEx(), TableBeginRow(), TableDrawBorders(), TableEndRow(), TableHeader(), Slic3r::GUI::ImGuiWrapper::to_ImU32(), TreeNodeBehavior(), UpdateWindowManualResize(), and VSliderScalar().

+ Here is the call graph for this function:

◆ GetColorU32() [3/3]

ImU32 ImGui::GetColorU32 ( ImU32  col)
2452{
2454 if (style.Alpha >= 1.0f)
2455 return col;
2457 a = (ImU32)(a * style.Alpha); // We don't need to clamp 0..255 because Style.Alpha is in 0..1 range.
2458 return (col & ~IM_COL32_A_MASK) | (a << IM_COL32_A_SHIFT);
2459}

References col(), GImGui, IM_COL32_A_MASK, IM_COL32_A_SHIFT, ImGuiContext::Style, and style.

+ Here is the call graph for this function:

◆ GetColumnIndex()

int ImGui::GetColumnIndex ( )
3622{
3624 return window->DC.CurrentColumns ? window->DC.CurrentColumns->Current : 0;
3625}

References ImGuiOldColumns::Current, ImGuiWindowTempData::CurrentColumns, ImGuiWindow::DC, and GetCurrentWindowRead().

Referenced by ShowDemoWindowColumns().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetColumnNormFromOffset()

float ImGui::GetColumnNormFromOffset ( const ImGuiOldColumns columns,
float  offset 
)
3639{
3640 return offset / (columns->OffMaxX - columns->OffMinX);
3641}

References ImGuiOldColumns::OffMaxX, and ImGuiOldColumns::OffMinX.

Referenced by SetColumnOffset().

+ Here is the caller graph for this function:

◆ GetColumnOffset()

float ImGui::GetColumnOffset ( int  column_index = -1)
3663{
3665 ImGuiOldColumns* columns = window->DC.CurrentColumns;
3666 if (columns == NULL)
3667 return 0.0f;
3668
3669 if (column_index < 0)
3670 column_index = columns->Current;
3671 IM_ASSERT(column_index < columns->Columns.Size);
3672
3673 const float t = columns->Columns[column_index].OffsetNorm;
3674 const float x_offset = ImLerp(columns->OffMinX, columns->OffMaxX, t);
3675 return x_offset;
3676}
IMGUI_API void Columns(int count=1, const char *id=NULL, bool border=true)
Definition imgui_tables.cpp:4008

References Columns(), ImGuiOldColumns::Columns, ImGuiOldColumns::Current, ImGuiWindowTempData::CurrentColumns, ImGuiWindow::DC, GetCurrentWindowRead(), IM_ASSERT, ImLerp(), ImGuiOldColumns::OffMaxX, and ImGuiOldColumns::OffMinX.

Referenced by BeginColumns(), EndColumns(), GetDraggedColumnOffset(), NextColumn(), SetColumnWidth(), and ShowDemoWindowColumns().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetColumnOffsetFromNorm()

float ImGui::GetColumnOffsetFromNorm ( const ImGuiOldColumns columns,
float  offset_norm 
)
3634{
3635 return offset_norm * (columns->OffMaxX - columns->OffMinX);
3636}

References ImGuiOldColumns::OffMaxX, and ImGuiOldColumns::OffMinX.

Referenced by DebugNodeColumns(), GetColumnWidth(), and GetColumnWidthEx().

+ Here is the caller graph for this function:

◆ GetColumnsCount()

int ImGui::GetColumnsCount ( )
3628{
3630 return window->DC.CurrentColumns ? window->DC.CurrentColumns->Count : 1;
3631}

References ImGuiOldColumns::Count, ImGuiWindowTempData::CurrentColumns, ImGuiWindow::DC, and GetCurrentWindowRead().

+ Here is the call graph for this function:

◆ GetColumnsID()

ImGuiID ImGui::GetColumnsID ( const char *  str_id,
int  count 
)
3788{
3789 ImGuiWindow* window = GetCurrentWindow();
3790
3791 // Differentiate column ID with an arbitrary prefix for cases where users name their columns set the same as another widget.
3792 // In addition, when an identifier isn't explicitly provided we include the number of columns in the hash to make it uniquer.
3793 PushID(0x11223347 + (str_id ? 0 : columns_count));
3794 ImGuiID id = window->GetID(str_id ? str_id : "columns");
3795 PopID();
3796
3797 return id;
3798}

References GetCurrentWindow(), ImGuiWindow::GetID(), PopID(), and PushID().

Referenced by BeginColumns().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetColumnWidth()

float ImGui::GetColumnWidth ( int  column_index = -1)
3692{
3693 ImGuiContext& g = *GImGui;
3694 ImGuiWindow* window = g.CurrentWindow;
3695 ImGuiOldColumns* columns = window->DC.CurrentColumns;
3696 if (columns == NULL)
3697 return GetContentRegionAvail().x;
3698
3699 if (column_index < 0)
3700 column_index = columns->Current;
3701 return GetColumnOffsetFromNorm(columns, columns->Columns[column_index + 1].OffsetNorm - columns->Columns[column_index].OffsetNorm);
3702}

References ImGuiOldColumns::Columns, ImGuiOldColumns::Current, ImGuiWindowTempData::CurrentColumns, ImGuiContext::CurrentWindow, ImGuiWindow::DC, GetColumnOffsetFromNorm(), GetContentRegionAvail(), GImGui, and ImVec2::x.

Referenced by ShowDemoWindowColumns(), and ShowDemoWindowLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetContentRegionAvail()

ImVec2 ImGui::GetContentRegionAvail ( )
7688{
7689 ImGuiWindow* window = GImGui->CurrentWindow;
7690 return GetContentRegionMaxAbs() - window->DC.CursorPos;
7691}

References ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetContentRegionMaxAbs(), and GImGui.

Referenced by BeginChildEx(), BeginMenu(), BeginTableEx(), GetColumnWidth(), GetContentRegionAvailWidth(), MenuItem(), ShowDemoWindowColumns(), ShowDemoWindowLayout(), ShowDemoWindowTables(), and ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetContentRegionAvailWidth()

static float ImGui::GetContentRegionAvailWidth ( )
inlinestatic
2812{ return GetContentRegionAvail().x; }

References GetContentRegionAvail(), GetContentRegionAvailWidth(), and ImVec2::x.

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_text_input(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), and GetContentRegionAvailWidth().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetContentRegionMax()

ImVec2 ImGui::GetContentRegionMax ( )

◆ GetContentRegionMaxAbs()

ImVec2 ImGui::GetContentRegionMaxAbs ( )
7678{
7679 ImGuiContext& g = *GImGui;
7680 ImGuiWindow* window = g.CurrentWindow;
7681 ImVec2 mx = window->ContentRegionRect.Max;
7682 if (window->DC.CurrentColumns || g.CurrentTable)
7683 mx.x = window->WorkRect.Max.x;
7684 return mx;
7685}

References ImGuiWindow::ContentRegionRect, ImGuiWindowTempData::CurrentColumns, ImGuiContext::CurrentTable, ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, ImRect::Max, ImGuiWindow::WorkRect, and ImVec2::x.

Referenced by CalcItemSize(), CalcItemWidth(), and GetContentRegionAvail().

+ Here is the caller graph for this function:

◆ GetCurrentContext()

ImGuiContext * ImGui::GetCurrentContext ( )
3362{
3363 return GImGui;
3364}

References GImGui.

Referenced by InputTextFilterCharacter(), and ShowDemoWindow().

+ Here is the caller graph for this function:

◆ GetCurrentTable()

ImGuiTable * ImGui::GetCurrentTable ( )
inline
2460{ ImGuiContext& g = *GImGui; return g.CurrentTable; }

References ImGuiContext::CurrentTable, and GImGui.

◆ GetCurrentWindow()

ImGuiWindow * ImGui::GetCurrentWindow ( )
inline
2280{ ImGuiContext& g = *GImGui; g.CurrentWindow->WriteAccessed = true; return g.CurrentWindow; }

References ImGuiContext::CurrentWindow, GImGui, and ImGuiWindow::WriteAccessed.

Referenced by Slic3r::GUI::GLGizmoCut3D::add_horizontal_scaled_interval(), Slic3r::GUI::GLGizmoCut3D::add_horizontal_shift(), Slic3r::GUI::GLGizmoCut3D::add_vertical_scaled_interval(), AlignTextToFramePadding(), ArrowButtonEx(), BeginChild(), BeginColumns(), BeginCombo(), BeginListBox(), BeginMenu(), BeginMenuBar(), BeginTableEx(), Bullet(), BulletTextV(), ButtonBehavior(), ButtonEx(), Checkbox(), CollapsingHeader(), CollapsingHeader(), ColorButton(), ColorEdit4(), ColorPicker4(), Columns(), DragFloatRange2(), DragIntRange2(), DragScalar(), DragScalarN(), Slic3r::GUI::ImGuiWrapper::draw_radio_button(), Slic3r::GUI::GLGizmoEmboss::draw_text_input(), Dummy(), EndColumns(), EndMenuBar(), GetColumnsID(), GetWindowDrawList(), Image(), Slic3r::GUI::image_button_ex(), ImageButtonEx(), Indent(), InputScalar(), InputScalarN(), InputTextEx(), InvisibleButton(), LabelTextV(), MenuItem(), NewLine(), NextColumn(), PlotEx(), PopClipRect(), PopItemWidth(), PopTextWrapPos(), ProgressBar(), PushClipRect(), PushTextWrapPos(), RadioButton(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GLCanvas3D::Tooltip::render(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::GLGizmoCut3D::render_color_marker(), Slic3r::GUI::GLGizmoCut3D::render_cut_plane_input_window(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::GCodeViewer::render_legend(), RenderArrow(), RenderBullet(), SameLine(), Slic3r::GUI::ImGuiWrapper::search_list(), Slic3r::GUI::selectable(), Selectable(), SeparatorEx(), SetCursorPos(), SetCursorPosX(), SetCursorPosY(), SetCursorScreenPos(), SetWindowFontScale(), Slic3r::GUI::ImGuiWrapper::slider_float(), SliderScalar(), SliderScalarN(), Spacing(), TextEx(), TextV(), TreeNode(), TreeNodeBehavior(), TreeNodeEx(), TreeNodeExV(), TreeNodeExV(), TreePush(), TreePush(), Unindent(), and VSliderScalar().

◆ GetCurrentWindowRead()

◆ GetCursorPos()

ImVec2 ImGui::GetCursorPos ( )
7494{
7496 return window->DC.CursorPos - window->Pos + window->Scroll;
7497}

References ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetCurrentWindowRead(), ImGuiWindow::Pos, and ImGuiWindow::Scroll.

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_text_input(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), ShowDemoWindowWidgets(), and Slic3r::GUI::ImGuiWrapper::text_wrapped().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCursorPosX()

float ImGui::GetCursorPosX ( )
7500{
7502 return window->DC.CursorPos.x - window->Pos.x + window->Scroll.x;
7503}

References ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetCurrentWindowRead(), ImGuiWindow::Pos, ImGuiWindow::Scroll, and ImVec2::x.

Referenced by Slic3r::GUI::clickable(), EditTableSizingFlags(), Slic3r::GUI::GLCanvas3D::LayersEditing::render_overlay(), ShowDemoWindowLayout(), and TreeAdvanceToLabelPos().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCursorPosY()

float ImGui::GetCursorPosY ( )
7506{
7508 return window->DC.CursorPos.y - window->Pos.y + window->Scroll.y;
7509}

References ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetCurrentWindowRead(), ImGuiWindow::Pos, ImGuiWindow::Scroll, and ImVec2::y.

+ Here is the call graph for this function:

◆ GetCursorScreenPos()

ImVec2 ImGui::GetCursorScreenPos ( )
7479{
7481 return window->DC.CursorPos;
7482}

References ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, and GetCurrentWindowRead().

Referenced by ColorPickerOptionsPopup(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::render_extruders_combo(), Slic3r::GUI::GCodeViewer::render_legend(), ShowDemoWindowLayout(), ShowDemoWindowWidgets(), ShowExampleAppCustomRendering(), ShowExampleMenuFile(), ShowFont(), ShowStyleEditor(), and TableHeadersRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCursorStartPos()

ImVec2 ImGui::GetCursorStartPos ( )
7533{
7535 return window->DC.CursorStartPos - window->Pos;
7536}

References ImGuiWindowTempData::CursorStartPos, ImGuiWindow::DC, GetCurrentWindowRead(), and ImGuiWindow::Pos.

Referenced by ShowDemoWindowLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDefaultFont()

ImFont * ImGui::GetDefaultFont ( )
inline
2303{ ImGuiContext& g = *GImGui; return g.IO.FontDefault ? g.IO.FontDefault : g.IO.Fonts->Fonts[0]; }
ImFont * FontDefault
Definition imgui.h:1798

References ImGuiIO::FontDefault, ImGuiIO::Fonts, ImFontAtlas::Fonts, GImGui, and ImGuiContext::IO.

Referenced by NewFrame(), PopFont(), and PushFont().

+ Here is the caller graph for this function:

◆ GetDragDropPayload()

const ImGuiPayload * ImGui::GetDragDropPayload ( )
10052{
10053 ImGuiContext& g = *GImGui;
10054 return g.DragDropActive ? &g.DragDropPayload : NULL;
10055}

References ImGuiContext::DragDropActive, ImGuiContext::DragDropPayload, and GImGui.

◆ GetDrawData()

ImDrawData * ImGui::GetDrawData ( )
3447{
3448 ImGuiContext& g = *GImGui;
3449 ImGuiViewportP* viewport = g.Viewports[0];
3450 return viewport->DrawDataP.Valid ? &viewport->DrawDataP : NULL;
3451}
bool Valid
Definition imgui.h:2474
ImDrawData DrawDataP
Definition imgui_internal.h:1231

References ImGuiViewportP::DrawDataP, GImGui, ImDrawData::Valid, and ImGuiContext::Viewports.

Referenced by Slic3r::GUI::ImGuiWrapper::render().

+ Here is the caller graph for this function:

◆ GetDrawListSharedData()

ImDrawListSharedData * ImGui::GetDrawListSharedData ( )
3510{
3511 return &GImGui->DrawListSharedData;
3512}
ImDrawListSharedData DrawListSharedData
Definition imgui_internal.h:1359

References ImGuiContext::DrawListSharedData, and GImGui.

◆ GetFocusedFocusScope()

ImGuiID ImGui::GetFocusedFocusScope ( )
inline
2418{ ImGuiContext& g = *GImGui; return g.NavFocusScopeId; } // Focus scope which is actually active

References GImGui, and ImGuiContext::NavFocusScopeId.

◆ GetFocusID()

ImGuiID ImGui::GetFocusID ( )
inline
2344{ ImGuiContext& g = *GImGui; return g.NavId; }

References GImGui, and ImGuiContext::NavId.

◆ GetFocusScope()

ImGuiID ImGui::GetFocusScope ( )
inline
2419{ ImGuiContext& g = *GImGui; return g.CurrentWindow->DC.NavFocusScopeIdCurrent; } // Focus scope we are outputting into, set by PushFocusScope()

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, and ImGuiWindowTempData::NavFocusScopeIdCurrent.

◆ GetFont()

ImFont * ImGui::GetFont ( )
6933{
6934 return GImGui->Font;
6935}

References ImGuiContext::Font, and GImGui.

Referenced by igl::opengl::glfw::imgui::ImGuiMenu::draw_text(), ShowDemoWindowLayout(), and ShowFontSelector().

+ Here is the caller graph for this function:

◆ GetFontSize()

◆ GetFontTexUvWhitePixel()

ImVec2 ImGui::GetFontTexUvWhitePixel ( )
6943{
6945}
ImVec2 TexUvWhitePixel
Definition imgui_internal.h:686

References ImGuiContext::DrawListSharedData, GImGui, and ImDrawListSharedData::TexUvWhitePixel.

Referenced by ColorPicker4().

+ Here is the caller graph for this function:

◆ GetForegroundDrawList() [1/3]

ImDrawList * ImGui::GetForegroundDrawList ( )
3504{
3505 ImGuiContext& g = *GImGui;
3506 return GetForegroundDrawList(g.Viewports[0]);
3507}

References GetForegroundDrawList(), GImGui, and ImGuiContext::Viewports.

Referenced by DebugDrawItemRect(), DebugNodeDrawList(), DebugNodeTabBar(), DebugNodeTable(), DebugNodeWindow(), GetForegroundDrawList(), GetForegroundDrawList(), GetOverlayDrawList(), ItemHoverable(), NavScoreItem(), NavUpdate(), Render(), ShowDemoWindowMisc(), ShowExampleAppCustomRendering(), ShowMetricsWindow(), TabItemEx(), and TableMergeDrawChannels().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetForegroundDrawList() [2/3]

ImDrawList * ImGui::GetForegroundDrawList ( ImGuiViewport viewport)
3499{
3500 return GetViewportDrawList((ImGuiViewportP*)viewport, 1, "##Foreground");
3501}

References GetViewportDrawList().

+ Here is the call graph for this function:

◆ GetForegroundDrawList() [3/3]

ImDrawList * ImGui::GetForegroundDrawList ( ImGuiWindow window)
inline
2304{ IM_UNUSED(window); return GetForegroundDrawList(); } // This seemingly unnecessary wrapper simplifies compatibility between the 'master' and 'docking' branches.

References GetForegroundDrawList(), and IM_UNUSED.

+ Here is the call graph for this function:

◆ GetFrameCount()

int ImGui::GetFrameCount ( )
3459{
3460 return GImGui->FrameCount;
3461}

References ImGuiContext::FrameCount, and GImGui.

Referenced by DebugNodeTabBar(), DebugNodeTable(), ImGuiOnceUponAFrame::operator bool(), ShowExampleAppLog(), and ShowExampleAppWindowTitles().

+ Here is the caller graph for this function:

◆ GetFrameHeight()

float ImGui::GetFrameHeight ( )

◆ GetFrameHeightWithSpacing()

float ImGui::GetFrameHeightWithSpacing ( )
7658{
7659 ImGuiContext& g = *GImGui;
7660 return g.FontSize + g.Style.FramePadding.y * 2.0f + g.Style.ItemSpacing.y;
7661}

References ImGuiContext::FontSize, ImGuiStyle::FramePadding, GImGui, ImGuiStyle::ItemSpacing, ImGuiContext::Style, and ImVec2::y.

Referenced by ExampleAppConsole::Draw(), ShowDemoWindowLayout(), and ShowExampleAppLayout().

+ Here is the caller graph for this function:

◆ GetHoveredID()

ImGuiID ImGui::GetHoveredID ( )

◆ GetID() [1/3]

ImGuiID ImGui::GetID ( const char *  str_id)
7080{
7081 ImGuiWindow* window = GImGui->CurrentWindow;
7082 return window->GetID(str_id);
7083}

References ImGuiContext::CurrentWindow, ImGuiWindow::GetID(), and GImGui.

Referenced by BeginListBox(), BeginTable(), Slic3r::GUI::ImGuiWrapper::search_list(), ShowAboutWindow(), ShowDemoWindowLayout(), and ShowExampleAppDocuments().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetID() [2/3]

ImGuiID ImGui::GetID ( const char *  str_id_begin,
const char *  str_id_end 
)
7086{
7087 ImGuiWindow* window = GImGui->CurrentWindow;
7088 return window->GetID(str_id_begin, str_id_end);
7089}

References ImGuiContext::CurrentWindow, ImGuiWindow::GetID(), and GImGui.

+ Here is the call graph for this function:

◆ GetID() [3/3]

ImGuiID ImGui::GetID ( const void ptr_id)
7092{
7093 ImGuiWindow* window = GImGui->CurrentWindow;
7094 return window->GetID(ptr_id);
7095}

References ImGuiContext::CurrentWindow, ImGuiWindow::GetID(), and GImGui.

+ Here is the call graph for this function:

◆ GetIDWithSeed()

ImGuiID ImGui::GetIDWithSeed ( const char *  str_id_begin,
const char *  str_id_end,
ImGuiID  seed 
)
7062{
7063 ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed);
7065#ifdef IMGUI_ENABLE_TEST_ENGINE
7066 ImGuiContext& g = *GImGui;
7068#endif
7069 return id;
7070}
#define IMGUI_TEST_ENGINE_ID_INFO2(_ID, _TYPE, _DATA, _DATA2)
Definition imgui_internal.h:2673
@ ImGuiDataType_String
Definition imgui_internal.h:964
IMGUI_API void KeepAliveID(ImGuiID id)
Definition imgui.cpp:3105

References GImGui, IMGUI_TEST_ENGINE_ID_INFO2, ImGuiDataType_String, ImHashStr(), and KeepAliveID().

Referenced by CollapsingHeader(), and TabItemEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetInputTextState()

ImGuiInputTextState * ImGui::GetInputTextState ( ImGuiID  id)
inline
2592{ ImGuiContext& g = *GImGui; return (g.InputTextState.ID == id) ? &g.InputTextState : NULL; } // Get input text state if active
ImGuiInputTextState InputTextState
Definition imgui_internal.h:1534
ImGuiID ID
Definition imgui_internal.h:1019

References GImGui, ImGuiInputTextState::ID, and ImGuiContext::InputTextState.

Referenced by InputTextEx().

+ Here is the caller graph for this function:

◆ GetIO()

ImGuiIO & ImGui::GetIO ( )
3440{
3441 IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?");
3442 return GImGui->IO;
3443}

References GImGui, IM_ASSERT, and ImGuiContext::IO.

Referenced by Slic3r::GUI::ImGuiWrapper::ImGuiWrapper(), Slic3r::GUI::ImGuiWrapper::destroy_font(), Slic3r::GUI::ImGuiWrapper::display_initialized(), Slic3r::GUI::ImGuiWrapper::draw_icon(), igl::opengl::glfw::imgui::ImGuiMenu::draw_labels_window(), Slic3r::GUI::ImGuiWrapper::GetTextureCustomRect(), Slic3r::GUI::ImGuiWrapper::image_button(), igl::opengl::glfw::imgui::ImGuiMenu::init(), Slic3r::GUI::ImGuiWrapper::init_font(), Slic3r::GUI::ImGuiWrapper::init_input(), igl::opengl::glfw::imgui::ImGuiMenu::key_down(), igl::opengl::glfw::imgui::ImGuiMenu::key_pressed(), igl::opengl::glfw::imgui::ImGuiMenu::key_up(), igl::opengl::glfw::imgui::ImGuiMenu::mouse_down(), igl::opengl::glfw::imgui::ImGuiMenu::mouse_move(), igl::opengl::glfw::imgui::ImGuiMenu::mouse_scroll(), igl::opengl::glfw::imgui::ImGuiMenu::mouse_up(), Slic3r::GUI::ImGuiWrapper::new_frame(), igl::opengl::glfw::imgui::ImGuiMenu::post_resize(), igl::opengl::glfw::imgui::ImGuiMenu::reload_font(), Slic3r::GUI::ImGuiWrapper::render_draw_data(), Slic3r::GUI::ImGuiWrapper::set_display_size(), Slic3r::GUI::ImGuiWrapper::set_language(), SetupViewportDrawData(), ShowAboutWindow(), ShowDemoWindow(), ShowDemoWindowLayout(), ShowDemoWindowMisc(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppCustomRendering(), ShowExampleAppSimpleOverlay(), ShowFont(), ShowFontSelector(), ShowStyleEditor(), ShowUserGuide(), Slic3r::GUI::ImGuiWrapper::slider_float(), Slic3r::GUI::ImGuiWrapper::update_key_data(), Slic3r::GUI::ImGuiWrapper::update_mouse_data(), Slic3r::GUI::ImGuiWrapper::want_any_input(), Slic3r::GUI::ImGuiWrapper::want_keyboard(), Slic3r::GUI::ImGuiWrapper::want_mouse(), and Slic3r::GUI::ImGuiWrapper::want_text_input().

+ Here is the caller graph for this function:

◆ GetItemFlags()

ImGuiItemFlags ImGui::GetItemFlags ( )
inline
2345{ ImGuiContext& g = *GImGui; return g.CurrentItemFlags; }

References ImGuiContext::CurrentItemFlags, and GImGui.

◆ GetItemID()

ImGuiID ImGui::GetItemID ( )
inline
2341{ ImGuiContext& g = *GImGui; return g.CurrentWindow->DC.LastItemId; } // Get ID of last item (~~ often same ImGui::GetID(label) beforehand)

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, and ImGuiWindowTempData::LastItemId.

◆ GetItemRectMax()

ImVec2 ImGui::GetItemRectMax ( )
4958{
4960 return window->DC.LastItemRect.Max;
4961}

References ImGuiWindow::DC, GetCurrentWindowRead(), ImGuiWindowTempData::LastItemRect, and ImRect::Max.

Referenced by DebugNodeTable(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), Slic3r::GUI::NotificationManager::PopNotification::render_hypertext(), ShowDemoWindowLayout(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetItemRectMin()

ImVec2 ImGui::GetItemRectMin ( )
4952{
4954 return window->DC.LastItemRect.Min;
4955}

References ImGuiWindow::DC, GetCurrentWindowRead(), ImGuiWindowTempData::LastItemRect, and ImRect::Min.

Referenced by DebugNodeTable(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), Slic3r::GUI::NotificationManager::PopNotification::render_hypertext(), ShowDemoWindowLayout(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetItemRectSize()

ImVec2 ImGui::GetItemRectSize ( )
4964{
4966 return window->DC.LastItemRect.GetSize();
4967}

References ImGuiWindow::DC, GetCurrentWindowRead(), ImRect::GetSize(), and ImGuiWindowTempData::LastItemRect.

Referenced by Slic3r::GUI::GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(), ShowDemoWindowLayout(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetItemStatusFlags()

◆ GetKeyIndex()

int ImGui::GetKeyIndex ( ImGuiKey  imgui_key)
4626{
4627 IM_ASSERT(imgui_key >= 0 && imgui_key < ImGuiKey_COUNT);
4628 ImGuiContext& g = *GImGui;
4629 return g.IO.KeyMap[imgui_key];
4630}

References GImGui, IM_ASSERT, ImGuiKey_COUNT, ImGuiContext::IO, and ImGuiIO::KeyMap.

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_font_list(), Slic3r::GUI::process_key_down(), and ShowDemoWindow().

+ Here is the caller graph for this function:

◆ GetKeyPressedAmount()

int ImGui::GetKeyPressedAmount ( int  key_index,
float  repeat_delay,
float  rate 
)
4662{
4663 ImGuiContext& g = *GImGui;
4664 if (key_index < 0)
4665 return 0;
4666 IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown));
4667 const float t = g.IO.KeysDownDuration[key_index];
4668 return CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, repeat_delay, repeat_rate);
4669}
IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate)
Definition imgui.cpp:4647
float KeysDownDuration[512]
Definition imgui.h:1892

References CalcTypematicRepeatAmount(), ImGuiIO::DeltaTime, GImGui, IM_ARRAYSIZE, IM_ASSERT, ImGuiContext::IO, ImGuiIO::KeysDown, and ImGuiIO::KeysDownDuration.

Referenced by IsKeyPressed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMainViewport()

ImGuiViewport * ImGui::GetMainViewport ( )
10631{
10632 ImGuiContext& g = *GImGui;
10633 return g.Viewports[0];
10634}

References GImGui, and ImGuiContext::Viewports.

Referenced by Begin(), BeginMainMenuBar(), BeginPopupModal(), BeginViewportSideBar(), CalcWindowAutoFitSize(), priv::change_window_position(), CreateNewWindow(), GetWindowAllowedExtentRect(), NavCalcPreferredRefPos(), NavUpdateWindowingOverlay(), ShowDemoWindow(), ShowDemoWindowPopups(), ShowExampleAppFullscreen(), ShowExampleAppSimpleOverlay(), and ShowExampleAppWindowTitles().

+ Here is the caller graph for this function:

◆ GetMergedKeyModFlags()

ImGuiKeyModFlags ImGui::GetMergedKeyModFlags ( )
3889{
3890 ImGuiContext& g = *GImGui;
3892 if (g.IO.KeyCtrl) { key_mod_flags |= ImGuiKeyModFlags_Ctrl; }
3893 if (g.IO.KeyShift) { key_mod_flags |= ImGuiKeyModFlags_Shift; }
3894 if (g.IO.KeyAlt) { key_mod_flags |= ImGuiKeyModFlags_Alt; }
3895 if (g.IO.KeySuper) { key_mod_flags |= ImGuiKeyModFlags_Super; }
3896 return key_mod_flags;
3897}
@ ImGuiKeyModFlags_Alt
Definition imgui.h:1345
@ ImGuiKeyModFlags_Super
Definition imgui.h:1346
@ ImGuiKeyModFlags_Ctrl
Definition imgui.h:1343
@ ImGuiKeyModFlags_Shift
Definition imgui.h:1344
@ ImGuiKeyModFlags_None
Definition imgui.h:1342
bool KeySuper
Definition imgui.h:1844

References GImGui, ImGuiKeyModFlags_Alt, ImGuiKeyModFlags_Ctrl, ImGuiKeyModFlags_None, ImGuiKeyModFlags_Shift, ImGuiKeyModFlags_Super, ImGuiContext::IO, ImGuiIO::KeyAlt, ImGuiIO::KeyCtrl, ImGuiIO::KeyShift, and ImGuiIO::KeySuper.

Referenced by ErrorCheckEndFrameSanityChecks(), InputTextEx(), and NewFrame().

+ Here is the caller graph for this function:

◆ GetMouseCursor()

ImGuiMouseCursor ImGui::GetMouseCursor ( )
4812{
4813 return GImGui->MouseCursor;
4814}

References GImGui, and ImGuiContext::MouseCursor.

Referenced by ShowDemoWindowMisc().

+ Here is the caller graph for this function:

◆ GetMouseDragDelta()

ImVec2 ImGui::GetMouseDragDelta ( ImGuiMouseButton  button = 0,
float  lock_threshold = -1.0f 
)
4791{
4792 ImGuiContext& g = *GImGui;
4793 IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
4794 if (lock_threshold < 0.0f)
4795 lock_threshold = g.IO.MouseDragThreshold;
4796 if (g.IO.MouseDown[button] || g.IO.MouseReleased[button])
4797 if (g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold)
4799 return g.IO.MousePos - g.IO.MouseClickedPos[button];
4800 return ImVec2(0.0f, 0.0f);
4801}
IMGUI_API bool IsMousePosValid(const ImVec2 *mouse_pos=NULL)
Definition imgui.cpp:4768
float MouseDragMaxDistanceSqr[5]
Definition imgui.h:1891

References GImGui, IM_ARRAYSIZE, IM_ASSERT, ImGuiContext::IO, IsMousePosValid(), ImGuiIO::MouseClickedPos, ImGuiIO::MouseDown, ImGuiIO::MouseDragMaxDistanceSqr, ImGuiIO::MouseDragThreshold, ImGuiIO::MousePos, and ImGuiIO::MouseReleased.

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_style_list(), ShowDemoWindowMisc(), ShowDemoWindowWidgets(), and ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMousePos()

ImVec2 ImGui::GetMousePos ( )
4753{
4754 ImGuiContext& g = *GImGui;
4755 return g.IO.MousePos;
4756}

References GImGui, ImGuiContext::IO, and ImGuiIO::MousePos.

Referenced by Slic3r::GUI::GLGizmoEmboss::on_render_input_window(), Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), Slic3r::GUI::NotificationManager::PopNotification::render(), and TableHeadersRow().

+ Here is the caller graph for this function:

◆ GetMousePosOnOpeningCurrentPopup()

ImVec2 ImGui::GetMousePosOnOpeningCurrentPopup ( )

◆ GetNavInputAmount()

float ImGui::GetNavInputAmount ( ImGuiNavInput  n,
ImGuiInputReadMode  mode 
)
8984{
8985 ImGuiContext& g = *GImGui;
8986 if (mode == ImGuiInputReadMode_Down)
8987 return g.IO.NavInputs[n]; // Instant, read analog input (0.0f..1.0f, as provided by user)
8988
8989 const float t = g.IO.NavInputsDownDuration[n];
8990 if (t < 0.0f && mode == ImGuiInputReadMode_Released) // Return 1.0f when just released, no repeat, ignore analog input.
8991 return (g.IO.NavInputsDownDurationPrev[n] >= 0.0f ? 1.0f : 0.0f);
8992 if (t < 0.0f)
8993 return 0.0f;
8994 if (mode == ImGuiInputReadMode_Pressed) // Return 1.0f when just pressed, no repeat, ignore analog input.
8995 return (t == 0.0f) ? 1.0f : 0.0f;
8996 if (mode == ImGuiInputReadMode_Repeat)
8997 return (float)CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay * 0.72f, g.IO.KeyRepeatRate * 0.80f);
8999 return (float)CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay * 1.25f, g.IO.KeyRepeatRate * 2.00f);
9001 return (float)CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay * 0.72f, g.IO.KeyRepeatRate * 0.30f);
9002 return 0.0f;
9003}
@ ImGuiInputReadMode_RepeatFast
Definition imgui_internal.h:894
@ ImGuiInputReadMode_RepeatSlow
Definition imgui_internal.h:893
@ ImGuiInputReadMode_Released
Definition imgui_internal.h:891
@ ImGuiInputReadMode_Down
Definition imgui_internal.h:889
float NavInputsDownDuration[ImGuiNavInput_COUNT]
Definition imgui.h:1894
float KeyRepeatRate
Definition imgui.h:1792
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT]
Definition imgui.h:1895

References CalcTypematicRepeatAmount(), ImGuiIO::DeltaTime, GImGui, ImGuiInputReadMode_Down, ImGuiInputReadMode_Pressed, ImGuiInputReadMode_Released, ImGuiInputReadMode_Repeat, ImGuiInputReadMode_RepeatFast, ImGuiInputReadMode_RepeatSlow, ImGuiContext::IO, ImGuiIO::KeyRepeatDelay, ImGuiIO::KeyRepeatRate, ImGuiIO::NavInputs, ImGuiIO::NavInputsDownDuration, and ImGuiIO::NavInputsDownDurationPrev.

Referenced by GetNavInputAmount2d(), and IsNavInputTest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetNavInputAmount2d()

ImVec2 ImGui::GetNavInputAmount2d ( ImGuiNavDirSourceFlags  dir_sources,
ImGuiInputReadMode  mode,
float  slow_factor = 0.0f,
float  fast_factor = 0.0f 
)
9006{
9007 ImVec2 delta(0.0f, 0.0f);
9008 if (dir_sources & ImGuiNavDirSourceFlags_Keyboard)
9010 if (dir_sources & ImGuiNavDirSourceFlags_PadDPad)
9012 if (dir_sources & ImGuiNavDirSourceFlags_PadLStick)
9014 if (slow_factor != 0.0f && IsNavInputDown(ImGuiNavInput_TweakSlow))
9015 delta *= slow_factor;
9016 if (fast_factor != 0.0f && IsNavInputDown(ImGuiNavInput_TweakFast))
9017 delta *= fast_factor;
9018 return delta;
9019}
@ ImGuiNavInput_KeyUp_
Definition imgui.h:1378
@ ImGuiNavInput_LStickRight
Definition imgui.h:1365
@ ImGuiNavInput_LStickUp
Definition imgui.h:1366
@ ImGuiNavInput_TweakFast
Definition imgui.h:1371
@ ImGuiNavInput_DpadLeft
Definition imgui.h:1360
@ ImGuiNavInput_DpadRight
Definition imgui.h:1361
@ ImGuiNavInput_DpadDown
Definition imgui.h:1363
@ ImGuiNavInput_LStickLeft
Definition imgui.h:1364
@ ImGuiNavInput_KeyDown_
Definition imgui.h:1379
@ ImGuiNavInput_LStickDown
Definition imgui.h:1367
@ ImGuiNavInput_KeyLeft_
Definition imgui.h:1376
@ ImGuiNavInput_KeyRight_
Definition imgui.h:1377
@ ImGuiNavInput_TweakSlow
Definition imgui.h:1370
@ ImGuiNavInput_DpadUp
Definition imgui.h:1362
@ ImGuiNavDirSourceFlags_PadLStick
Definition imgui_internal.h:911
@ ImGuiNavDirSourceFlags_Keyboard
Definition imgui_internal.h:909
@ ImGuiNavDirSourceFlags_PadDPad
Definition imgui_internal.h:910
IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode)
Definition imgui.cpp:8983
bool IsNavInputDown(ImGuiNavInput n)
Definition imgui_internal.h:2429

References GetNavInputAmount(), ImGuiNavDirSourceFlags_Keyboard, ImGuiNavDirSourceFlags_PadDPad, ImGuiNavDirSourceFlags_PadLStick, ImGuiNavInput_DpadDown, ImGuiNavInput_DpadLeft, ImGuiNavInput_DpadRight, ImGuiNavInput_DpadUp, ImGuiNavInput_KeyDown_, ImGuiNavInput_KeyLeft_, ImGuiNavInput_KeyRight_, ImGuiNavInput_KeyUp_, ImGuiNavInput_LStickDown, ImGuiNavInput_LStickLeft, ImGuiNavInput_LStickRight, ImGuiNavInput_LStickUp, ImGuiNavInput_TweakFast, ImGuiNavInput_TweakSlow, and IsNavInputDown().

Referenced by NavUpdate(), NavUpdateWindowing(), and UpdateWindowManualResize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetOverlayDrawList()

static ImDrawList * ImGui::GetOverlayDrawList ( )
inlinestatic
2814{ return GetForegroundDrawList(); }

References GetForegroundDrawList(), and GetOverlayDrawList().

Referenced by Slic3r::GUI::ImGuiWrapper::draw_cross_hair(), and GetOverlayDrawList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetScrollMaxX()

float ImGui::GetScrollMaxX ( )
7901{
7902 ImGuiWindow* window = GImGui->CurrentWindow;
7903 return window->ScrollMax.x;
7904}

References ImGuiContext::CurrentWindow, GImGui, ImGuiWindow::ScrollMax, and ImVec2::x.

Referenced by ShowDemoWindowLayout(), and ShowDemoWindowTables().

+ Here is the caller graph for this function:

◆ GetScrollMaxY()

float ImGui::GetScrollMaxY ( )
7907{
7908 ImGuiWindow* window = GImGui->CurrentWindow;
7909 return window->ScrollMax.y;
7910}

References ImGuiContext::CurrentWindow, GImGui, ImGuiWindow::ScrollMax, and ImVec2::y.

Referenced by ExampleAppConsole::Draw(), ExampleAppLog::Draw(), InputTextEx(), ShowDemoWindowLayout(), and ShowDemoWindowTables().

+ Here is the caller graph for this function:

◆ GetScrollX()

float ImGui::GetScrollX ( )
7889{
7890 ImGuiWindow* window = GImGui->CurrentWindow;
7891 return window->Scroll.x;
7892}

References ImGuiContext::CurrentWindow, GImGui, ImGuiWindow::Scroll, and ImVec2::x.

Referenced by ShowDemoWindowLayout(), and ShowDemoWindowTables().

+ Here is the caller graph for this function:

◆ GetScrollY()

float ImGui::GetScrollY ( )
7895{
7896 ImGuiWindow* window = GImGui->CurrentWindow;
7897 return window->Scroll.y;
7898}

References ImGuiContext::CurrentWindow, GImGui, ImGuiWindow::Scroll, and ImVec2::y.

Referenced by ExampleAppConsole::Draw(), ExampleAppLog::Draw(), ShowDemoWindowLayout(), and ShowDemoWindowTables().

+ Here is the caller graph for this function:

◆ GetStateStorage()

ImGuiStorage * ImGui::GetStateStorage ( )

◆ GetStyle()

ImGuiStyle & ImGui::GetStyle ( )
2424{
2425 IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?");
2426 return GImGui->Style;
2427}

References GImGui, IM_ASSERT, and ImGuiContext::Style.

Referenced by Slic3r::GUI::GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(), Slic3r::GUI::GLGizmoEmboss::create_gui_configuration(), Slic3r::GUI::ImGuiWrapper::disabled_begin(), ExampleAppConsole::Draw(), Slic3r::GUI::GLGizmoEmboss::draw_font_list_line(), Slic3r::GUI::GLGizmoEmboss::draw_text_input(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), EditTableSizingFlags(), igl::opengl::glfw::imgui::ImGuiMenu::init(), Slic3r::GUI::ImGuiWrapper::init_style(), PushStyleCompact(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GLCanvas3D::Tooltip::render(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::render_extruders_combo(), Slic3r::GUI::GCodeViewer::render_legend(), Slic3r::GUI::GLGizmoCut3D::render_reset_button(), Slic3r::GUI::GLGizmoEmboss::rev_checkbox(), Slic3r::GUI::GLGizmoEmboss::rev_input(), Slic3r::GUI::GLGizmoEmboss::rev_slider(), Slic3r::GUI::GLGizmoEmboss::rev_slider(), Slic3r::GUI::GLGizmoEmboss::rev_slider(), Slic3r::GUI::ImGuiWrapper::set_scaling(), ShowAboutWindow(), ShowDemoWindowLayout(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppCustomRendering(), ShowFont(), ShowStyleEditor(), Slic3r::GUI::ImGuiWrapper::slider_float(), StyleColorsClassic(), StyleColorsDark(), StyleColorsLight(), and TableGetHeaderRowHeight().

+ Here is the caller graph for this function:

◆ GetStyleColorName()

const char * ImGui::GetStyleColorName ( ImGuiCol  idx)
2582{
2583 // Create switch-case from enum with regexp: ImGuiCol_{.*}, --> case ImGuiCol_\1: return "\1";
2584 switch (idx)
2585 {
2586 case ImGuiCol_Text: return "Text";
2587 case ImGuiCol_TextDisabled: return "TextDisabled";
2588 case ImGuiCol_WindowBg: return "WindowBg";
2589 case ImGuiCol_ChildBg: return "ChildBg";
2590 case ImGuiCol_PopupBg: return "PopupBg";
2591 case ImGuiCol_Border: return "Border";
2592 case ImGuiCol_BorderShadow: return "BorderShadow";
2593 case ImGuiCol_FrameBg: return "FrameBg";
2594 case ImGuiCol_FrameBgHovered: return "FrameBgHovered";
2595 case ImGuiCol_FrameBgActive: return "FrameBgActive";
2596 case ImGuiCol_TitleBg: return "TitleBg";
2597 case ImGuiCol_TitleBgActive: return "TitleBgActive";
2598 case ImGuiCol_TitleBgCollapsed: return "TitleBgCollapsed";
2599 case ImGuiCol_MenuBarBg: return "MenuBarBg";
2600 case ImGuiCol_ScrollbarBg: return "ScrollbarBg";
2601 case ImGuiCol_ScrollbarGrab: return "ScrollbarGrab";
2602 case ImGuiCol_ScrollbarGrabHovered: return "ScrollbarGrabHovered";
2603 case ImGuiCol_ScrollbarGrabActive: return "ScrollbarGrabActive";
2604 case ImGuiCol_CheckMark: return "CheckMark";
2605 case ImGuiCol_SliderGrab: return "SliderGrab";
2606 case ImGuiCol_SliderGrabActive: return "SliderGrabActive";
2607 case ImGuiCol_Button: return "Button";
2608 case ImGuiCol_ButtonHovered: return "ButtonHovered";
2609 case ImGuiCol_ButtonActive: return "ButtonActive";
2610 case ImGuiCol_Header: return "Header";
2611 case ImGuiCol_HeaderHovered: return "HeaderHovered";
2612 case ImGuiCol_HeaderActive: return "HeaderActive";
2613 case ImGuiCol_Separator: return "Separator";
2614 case ImGuiCol_SeparatorHovered: return "SeparatorHovered";
2615 case ImGuiCol_SeparatorActive: return "SeparatorActive";
2616 case ImGuiCol_ResizeGrip: return "ResizeGrip";
2617 case ImGuiCol_ResizeGripHovered: return "ResizeGripHovered";
2618 case ImGuiCol_ResizeGripActive: return "ResizeGripActive";
2619 case ImGuiCol_Tab: return "Tab";
2620 case ImGuiCol_TabHovered: return "TabHovered";
2621 case ImGuiCol_TabActive: return "TabActive";
2622 case ImGuiCol_TabUnfocused: return "TabUnfocused";
2623 case ImGuiCol_TabUnfocusedActive: return "TabUnfocusedActive";
2624 case ImGuiCol_PlotLines: return "PlotLines";
2625 case ImGuiCol_PlotLinesHovered: return "PlotLinesHovered";
2626 case ImGuiCol_PlotHistogram: return "PlotHistogram";
2627 case ImGuiCol_PlotHistogramHovered: return "PlotHistogramHovered";
2628 case ImGuiCol_TableHeaderBg: return "TableHeaderBg";
2629 case ImGuiCol_TableBorderStrong: return "TableBorderStrong";
2630 case ImGuiCol_TableBorderLight: return "TableBorderLight";
2631 case ImGuiCol_TableRowBg: return "TableRowBg";
2632 case ImGuiCol_TableRowBgAlt: return "TableRowBgAlt";
2633 case ImGuiCol_TextSelectedBg: return "TextSelectedBg";
2634 case ImGuiCol_DragDropTarget: return "DragDropTarget";
2635 case ImGuiCol_NavHighlight: return "NavHighlight";
2636 case ImGuiCol_NavWindowingHighlight: return "NavWindowingHighlight";
2637 case ImGuiCol_NavWindowingDimBg: return "NavWindowingDimBg";
2638 case ImGuiCol_ModalWindowDimBg: return "ModalWindowDimBg";
2639 }
2640 IM_ASSERT(0);
2641 return "Unknown";
2642}
@ ImGuiCol_BorderShadow
Definition imgui.h:1419
@ ImGuiCol_HeaderActive
Definition imgui.h:1439
@ ImGuiCol_TitleBgCollapsed
Definition imgui.h:1425
@ ImGuiCol_PlotHistogramHovered
Definition imgui.h:1454
@ ImGuiCol_ScrollbarGrab
Definition imgui.h:1428
@ ImGuiCol_TextSelectedBg
Definition imgui.h:1460
@ ImGuiCol_MenuBarBg
Definition imgui.h:1426
@ ImGuiCol_PlotHistogram
Definition imgui.h:1453
@ ImGuiCol_Header
Definition imgui.h:1437
@ ImGuiCol_TabHovered
Definition imgui.h:1447
@ ImGuiCol_HeaderHovered
Definition imgui.h:1438
@ ImGuiCol_TabUnfocused
Definition imgui.h:1449
@ ImGuiCol_TableRowBg
Definition imgui.h:1458
@ ImGuiCol_ScrollbarGrabActive
Definition imgui.h:1430
@ ImGuiCol_TableHeaderBg
Definition imgui.h:1455
@ ImGuiCol_ResizeGripActive
Definition imgui.h:1445
@ ImGuiCol_TableRowBgAlt
Definition imgui.h:1459
@ ImGuiCol_Tab
Definition imgui.h:1446
@ ImGuiCol_ScrollbarBg
Definition imgui.h:1427
@ ImGuiCol_ScrollbarGrabHovered
Definition imgui.h:1429
@ ImGuiCol_PlotLines
Definition imgui.h:1451
@ ImGuiCol_ResizeGripHovered
Definition imgui.h:1444
@ ImGuiCol_SliderGrabActive
Definition imgui.h:1433
@ ImGuiCol_SliderGrab
Definition imgui.h:1432
@ ImGuiCol_ResizeGrip
Definition imgui.h:1443
@ ImGuiCol_NavHighlight
Definition imgui.h:1462
@ ImGuiCol_PlotLinesHovered
Definition imgui.h:1452

References IM_ASSERT, ImGuiCol_Border, ImGuiCol_BorderShadow, ImGuiCol_Button, ImGuiCol_ButtonActive, ImGuiCol_ButtonHovered, ImGuiCol_CheckMark, ImGuiCol_ChildBg, ImGuiCol_DragDropTarget, ImGuiCol_FrameBg, ImGuiCol_FrameBgActive, ImGuiCol_FrameBgHovered, ImGuiCol_Header, ImGuiCol_HeaderActive, ImGuiCol_HeaderHovered, ImGuiCol_MenuBarBg, ImGuiCol_ModalWindowDimBg, ImGuiCol_NavHighlight, ImGuiCol_NavWindowingDimBg, ImGuiCol_NavWindowingHighlight, ImGuiCol_PlotHistogram, ImGuiCol_PlotHistogramHovered, ImGuiCol_PlotLines, ImGuiCol_PlotLinesHovered, ImGuiCol_PopupBg, ImGuiCol_ResizeGrip, ImGuiCol_ResizeGripActive, ImGuiCol_ResizeGripHovered, ImGuiCol_ScrollbarBg, ImGuiCol_ScrollbarGrab, ImGuiCol_ScrollbarGrabActive, ImGuiCol_ScrollbarGrabHovered, ImGuiCol_Separator, ImGuiCol_SeparatorActive, ImGuiCol_SeparatorHovered, ImGuiCol_SliderGrab, ImGuiCol_SliderGrabActive, ImGuiCol_Tab, ImGuiCol_TabActive, ImGuiCol_TabHovered, ImGuiCol_TableBorderLight, ImGuiCol_TableBorderStrong, ImGuiCol_TableHeaderBg, ImGuiCol_TableRowBg, ImGuiCol_TableRowBgAlt, ImGuiCol_TabUnfocused, ImGuiCol_TabUnfocusedActive, ImGuiCol_Text, ImGuiCol_TextDisabled, ImGuiCol_TextSelectedBg, ImGuiCol_TitleBg, ImGuiCol_TitleBgActive, ImGuiCol_TitleBgCollapsed, and ImGuiCol_WindowBg.

Referenced by ErrorCheckEndFrameRecover(), ShowExampleMenuFile(), and ShowStyleEditor().

+ Here is the caller graph for this function:

◆ GetStyleColorVec4()

◆ GetTextLineHeight()

◆ GetTextLineHeightWithSpacing()

float ImGui::GetTextLineHeightWithSpacing ( )
7646{
7647 ImGuiContext& g = *GImGui;
7648 return g.FontSize + g.Style.ItemSpacing.y;
7649}

References ImGuiContext::FontSize, GImGui, ImGuiStyle::ItemSpacing, ImGuiContext::Style, and ImVec2::y.

Referenced by BeginListBox(), Slic3r::GUI::GLGizmoSimplify::create_gui_cfg(), Slic3r::GUI::GLGizmoEmboss::create_gui_configuration(), ListBoxHeader(), Slic3r::GUI::ImGuiWrapper::search_list(), ShowAboutWindow(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), and ShowExampleAppDocuments().

+ Here is the caller graph for this function:

◆ GetTime()

double ImGui::GetTime ( )
3454{
3455 return GImGui->Time;
3456}

References GImGui, and ImGuiContext::Time.

Referenced by ShowDemoWindow(), ShowDemoWindowWidgets(), ShowExampleAppLog(), and ShowExampleAppWindowTitles().

+ Here is the caller graph for this function:

◆ GetTopMostPopupModal()

ImGuiWindow * ImGui::GetTopMostPopupModal ( )
8112{
8113 ImGuiContext& g = *GImGui;
8114 for (int n = g.OpenPopupStack.Size - 1; n >= 0; n--)
8115 if (ImGuiWindow* popup = g.OpenPopupStack.Data[n].Window)
8116 if (popup->Flags & ImGuiWindowFlags_Modal)
8117 return popup;
8118 return NULL;
8119}

References ImVector< T >::Data, GImGui, ImGuiWindowFlags_Modal, ImGuiContext::OpenPopupStack, ImVector< T >::Size, and ImGuiPopupData::Window.

Referenced by Begin(), BeginPopupContextVoid(), NavUpdateWindowing(), NewFrame(), UpdateHoveredWindowAndCaptureFlags(), and UpdateMouseMovingWindowEndFrame().

+ Here is the caller graph for this function:

◆ GetTreeNodeToLabelSpacing()

float ImGui::GetTreeNodeToLabelSpacing ( )
5942{
5943 ImGuiContext& g = *GImGui;
5944 return g.FontSize + (g.Style.FramePadding.x * 2.0f);
5945}

References ImGuiContext::FontSize, ImGuiStyle::FramePadding, GImGui, ImGuiContext::Style, and ImVec2::x.

Referenced by ShowDemoWindowWidgets(), ShowMetricsWindow(), and TreeAdvanceToLabelPos().

+ Here is the caller graph for this function:

◆ GetVersion()

const char * ImGui::GetVersion ( )
3355{
3356 return IMGUI_VERSION;
3357}

References IMGUI_VERSION.

Referenced by ShowAboutWindow(), and ShowMetricsWindow().

+ Here is the caller graph for this function:

◆ GetWindowAllowedExtentRect()

ImRect ImGui::GetWindowAllowedExtentRect ( ImGuiWindow window)
8526{
8527 ImGuiContext& g = *GImGui;
8528 IM_UNUSED(window);
8529 ImRect r_screen = ((ImGuiViewportP*)(void*)GetMainViewport())->GetMainRect();
8531 r_screen.Expand(ImVec2((r_screen.GetWidth() > padding.x * 2) ? -padding.x : 0.0f, (r_screen.GetHeight() > padding.y * 2) ? -padding.y : 0.0f));
8532 return r_screen;
8533}

References ImGuiStyle::DisplaySafeAreaPadding, ImRect::Expand(), ImRect::GetHeight(), GetMainViewport(), ImRect::GetWidth(), GImGui, IM_UNUSED, ImGuiContext::Style, ImVec2::x, and ImVec2::y.

Referenced by BeginCombo(), and FindBestWindowPosForPopup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetWindowContentRegionMax()

ImVec2 ImGui::GetWindowContentRegionMax ( )
7701{
7702 ImGuiWindow* window = GImGui->CurrentWindow;
7703 return window->ContentRegionRect.Max - window->Pos;
7704}

References ImGuiWindow::ContentRegionRect, ImGuiContext::CurrentWindow, GImGui, ImRect::Max, and ImGuiWindow::Pos.

Referenced by ShowDemoWindowLayout().

+ Here is the caller graph for this function:

◆ GetWindowContentRegionMin()

ImVec2 ImGui::GetWindowContentRegionMin ( )

◆ GetWindowContentRegionWidth()

float ImGui::GetWindowContentRegionWidth ( )
7707{
7708 ImGuiWindow* window = GImGui->CurrentWindow;
7709 return window->ContentRegionRect.GetWidth();
7710}

References ImGuiWindow::ContentRegionRect, ImGuiContext::CurrentWindow, ImRect::GetWidth(), and GImGui.

Referenced by Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GLCanvas3D::Tooltip::render(), and ShowDemoWindowLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetWindowDrawList()

◆ GetWindowHeight()

float ImGui::GetWindowHeight ( )

◆ GetWindowPos()

ImVec2 ImGui::GetWindowPos ( )
6714{
6715 ImGuiContext& g = *GImGui;
6716 ImGuiWindow* window = g.CurrentWindow;
6717 return window->Pos;
6718}

References ImGuiContext::CurrentWindow, GImGui, and ImGuiWindow::Pos.

Referenced by Slic3r::GUI::GLGizmoCut3D::render_debug_input_window(), ShowDemoWindowLayout(), and ShowExampleAppCustomRendering().

+ Here is the caller graph for this function:

◆ GetWindowResizeBorderID()

ImGuiID ImGui::GetWindowResizeBorderID ( ImGuiWindow window,
ImGuiDir  dir 
)
5357{
5358 IM_ASSERT(dir >= 0 && dir < 4);
5359 int n = (int)dir + 4;
5360 ImGuiID id = window->ID;
5361 id = ImHashStr("#RESIZE", 0, id);
5362 id = ImHashData(&n, sizeof(int), id);
5363 return id;
5364}
ImGuiID ImHashData(const void *data_p, size_t data_size, ImU32 seed)
Definition imgui.cpp:1495

References ImGuiWindow::ID, IM_ASSERT, ImHashData(), and ImHashStr().

+ Here is the call graph for this function:

◆ GetWindowResizeCornerID()

ImGuiID ImGui::GetWindowResizeCornerID ( ImGuiWindow window,
int  n 
)
5347{
5348 IM_ASSERT(n >= 0 && n < 4);
5349 ImGuiID id = window->ID;
5350 id = ImHashStr("#RESIZE", 0, id);
5351 id = ImHashData(&n, sizeof(int), id);
5352 return id;
5353}

References ImGuiWindow::ID, IM_ASSERT, ImHashData(), and ImHashStr().

+ Here is the call graph for this function:

◆ GetWindowScrollbarID()

ImGuiID ImGui::GetWindowScrollbarID ( ImGuiWindow window,
ImGuiAxis  axis 
)
856{
857 return window->GetIDNoKeepAlive(axis == ImGuiAxis_X ? "#SCROLLX" : "#SCROLLY");
858}
ImGuiID GetIDNoKeepAlive(const char *str, const char *str_end=NULL)
Definition imgui.cpp:2963

References ImGuiWindow::GetIDNoKeepAlive(), and ImGuiAxis_X.

Referenced by InputTextEx(), and Scrollbar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetWindowScrollbarRect()

ImRect ImGui::GetWindowScrollbarRect ( ImGuiWindow window,
ImGuiAxis  axis 
)
862{
863 const ImRect outer_rect = window->Rect();
864 const ImRect inner_rect = window->InnerRect;
865 const float border_size = window->WindowBorderSize;
866 const float scrollbar_size = window->ScrollbarSizes[axis ^ 1]; // (ScrollbarSizes.x = width of Y scrollbar; ScrollbarSizes.y = height of X scrollbar)
867 IM_ASSERT(scrollbar_size > 0.0f);
868 if (axis == ImGuiAxis_X)
869 return ImRect(inner_rect.Min.x, ImMax(outer_rect.Min.y, outer_rect.Max.y - border_size - scrollbar_size), inner_rect.Max.x, outer_rect.Max.y);
870 else
871 return ImRect(ImMax(outer_rect.Min.x, outer_rect.Max.x - border_size - scrollbar_size), inner_rect.Min.y, outer_rect.Max.x, inner_rect.Max.y);
872}

References IM_ASSERT, ImGuiAxis_X, ImMax(), ImGuiWindow::InnerRect, ImRect::Max, ImRect::Min, ImGuiWindow::Rect(), ImGuiWindow::ScrollbarSizes, ImGuiWindow::WindowBorderSize, ImVec2::x, and ImVec2::y.

Referenced by Scrollbar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetWindowSize()

ImVec2 ImGui::GetWindowSize ( )
6753{
6755 return window->Size;
6756}

References GetCurrentWindowRead(), and ImGuiWindow::Size.

Referenced by Slic3r::GUI::GLCanvas3D::Tooltip::render(), Slic3r::GUI::NotificationManager::PopNotification::render(), Slic3r::GUI::GLCanvas3D::LayersEditing::render_overlay(), Slic3r::GUI::Mouse3DController::render_settings_dialog(), Slic3r::GUI::GLGizmoEmboss::set_minimal_window_size(), and ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetWindowWidth()

float ImGui::GetWindowWidth ( )
6702{
6703 ImGuiWindow* window = GImGui->CurrentWindow;
6704 return window->Size.x;
6705}

References ImGuiContext::CurrentWindow, GImGui, ImGuiWindow::Size, and ImVec2::x.

Referenced by igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_window(), Slic3r::GUI::GCodeViewer::SequentialView::Marker::render(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GCodeViewer::render_legend(), and ShowStyleEditor().

+ Here is the caller graph for this function:

◆ Image()

void ImGui::Image ( ImTextureID  user_texture_id,
const ImVec2 size,
const ImVec2 uv0 = ImVec2(0, 0),
const ImVec2 uv1 = ImVec2(1,1),
const ImVec4 tint_col = ImVec4(1,1,1,1),
const ImVec4 border_col = ImVec4(0,0,0,0) 
)
1001{
1002 ImGuiWindow* window = GetCurrentWindow();
1003 if (window->SkipItems)
1004 return;
1005
1006 ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
1007 if (border_col.w > 0.0f)
1008 bb.Max += ImVec2(2, 2);
1009 ItemSize(bb);
1010 if (!ItemAdd(bb, 0))
1011 return;
1012
1013 if (border_col.w > 0.0f)
1014 {
1015 window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(border_col), 0.0f);
1016 window->DrawList->AddImage(user_texture_id, bb.Min + ImVec2(1, 1), bb.Max - ImVec2(1, 1), uv0, uv1, GetColorU32(tint_col));
1017 }
1018 else
1019 {
1020 window->DrawList->AddImage(user_texture_id, bb.Min, bb.Max, uv0, uv1, GetColorU32(tint_col));
1021 }
1022}
IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2 &p_min, const ImVec2 &p_max, const ImVec2 &uv_min=ImVec2(0, 0), const ImVec2 &uv_max=ImVec2(1, 1), ImU32 col=IM_COL32_WHITE)
Definition imgui_draw.cpp:1598

References ImDrawList::AddImage(), ImDrawList::AddRect(), ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, GetColorU32(), GetCurrentWindow(), ItemAdd(), ItemSize(), ImRect::Max, ImRect::Min, ImGuiWindow::SkipItems, and ImVec4::w.

Referenced by Slic3r::GUI::draw(), Slic3r::GUI::GLGizmoEmboss::draw_font_preview(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), Slic3r::GUI::GLGizmoEmboss::draw_window(), ShowDemoWindowWidgets(), and ShowFontAtlas().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ImageButton()

bool ImGui::ImageButton ( ImTextureID  user_texture_id,
const ImVec2 size,
const ImVec2 uv0 = ImVec2(0, 0),
const ImVec2 uv1 = ImVec2(1,1),
int  frame_padding = -1,
const ImVec4 bg_col = ImVec4(0,0,0,0),
const ImVec4 tint_col = ImVec4(1,1,1,1) 
)
1056{
1057 ImGuiContext& g = *GImGui;
1058 ImGuiWindow* window = g.CurrentWindow;
1059 if (window->SkipItems)
1060 return false;
1061
1062 // Default to using texture ID as ID. User can still push string/integer prefixes.
1063 PushID((void*)(intptr_t)user_texture_id);
1064 const ImGuiID id = window->GetID("#image");
1065 PopID();
1066
1067 const ImVec2 padding = (frame_padding >= 0) ? ImVec2((float)frame_padding, (float)frame_padding) : g.Style.FramePadding;
1068 return ImageButtonEx(id, user_texture_id, size, uv0, uv1, padding, bg_col, tint_col);
1069}
IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2 &size, const ImVec2 &uv0, const ImVec2 &uv1, const ImVec2 &padding, const ImVec4 &bg_col, const ImVec4 &tint_col)
Definition imgui_widgets.cpp:1026

References ImGuiContext::CurrentWindow, ImGuiStyle::FramePadding, ImGuiWindow::GetID(), GImGui, ImageButtonEx(), PopID(), PushID(), ImGuiWindow::SkipItems, and ImGuiContext::Style.

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ImageButtonEx()

bool ImGui::ImageButtonEx ( ImGuiID  id,
ImTextureID  texture_id,
const ImVec2 size,
const ImVec2 uv0,
const ImVec2 uv1,
const ImVec2 padding,
const ImVec4 bg_col,
const ImVec4 tint_col 
)
1027{
1028 ImGuiContext& g = *GImGui;
1029 ImGuiWindow* window = GetCurrentWindow();
1030 if (window->SkipItems)
1031 return false;
1032
1033 const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size + padding * 2);
1034 ItemSize(bb);
1035 if (!ItemAdd(bb, id))
1036 return false;
1037
1038 bool hovered, held;
1039 bool pressed = ButtonBehavior(bb, id, &hovered, &held);
1040
1041 // Render
1042 const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
1043 RenderNavHighlight(bb, id);
1044 RenderFrame(bb.Min, bb.Max, col, true, ImClamp((float)ImMin(padding.x, padding.y), 0.0f, g.Style.FrameRounding));
1045 if (bg_col.w > 0.0f)
1046 window->DrawList->AddRectFilled(bb.Min + padding, bb.Max - padding, GetColorU32(bg_col));
1047 window->DrawList->AddImage(texture_id, bb.Min + padding, bb.Max - padding, uv0, uv1, GetColorU32(tint_col));
1048
1049 return pressed;
1050}

References ImDrawList::AddImage(), ImDrawList::AddRectFilled(), ButtonBehavior(), col(), ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, ImGuiStyle::FrameRounding, GetColorU32(), GetCurrentWindow(), GImGui, ImClamp(), ImGuiCol_Button, ImGuiCol_ButtonActive, ImGuiCol_ButtonHovered, ImMin(), ItemAdd(), ItemSize(), ImRect::Max, ImRect::Min, RenderFrame(), RenderNavHighlight(), ImGuiWindow::SkipItems, ImGuiContext::Style, ImVec4::w, ImVec2::x, and ImVec2::y.

Referenced by ImageButton().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Indent()

void ImGui::Indent ( float  indent_w = 0.0f)
7539{
7540 ImGuiContext& g = *GImGui;
7541 ImGuiWindow* window = GetCurrentWindow();
7542 window->DC.Indent.x += (indent_w != 0.0f) ? indent_w : g.Style.IndentSpacing;
7543 window->DC.CursorPos.x = window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x;
7544}

References ImGuiWindowTempData::ColumnsOffset, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetCurrentWindow(), GImGui, ImGuiWindowTempData::Indent, ImGuiStyle::IndentSpacing, ImGuiWindow::Pos, ImGuiContext::Style, ImVec2::x, and ImVec1::x.

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_window(), ShowDemoWindowLayout(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppFullscreen(), ShowMetricsWindow(), ShowUserGuide(), TreePush(), TreePush(), and TreePushOverrideID().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Initialize()

void ImGui::Initialize ( ImGuiContext context)
4127{
4128 ImGuiContext& g = *context;
4130
4131 // Add .ini handle for ImGuiWindow type
4132 {
4133 ImGuiSettingsHandler ini_handler;
4134 ini_handler.TypeName = "Window";
4135 ini_handler.TypeHash = ImHashStr("Window");
4141 g.SettingsHandlers.push_back(ini_handler);
4142 }
4143
4144 // Add .ini handle for ImGuiTable type
4145 TableSettingsInstallHandler(context);
4146
4147 // Create default viewport
4148 ImGuiViewportP* viewport = IM_NEW(ImGuiViewportP)();
4149 g.Viewports.push_back(viewport);
4150
4151#ifdef IMGUI_HAS_DOCK
4152#endif // #ifdef IMGUI_HAS_DOCK
4153
4154 g.Initialized = true;
4155}
static void WindowSettingsHandler_WriteAll(ImGuiContext *, ImGuiSettingsHandler *, ImGuiTextBuffer *buf)
Definition imgui.cpp:10585
static void WindowSettingsHandler_ApplyAll(ImGuiContext *, ImGuiSettingsHandler *)
Definition imgui.cpp:10573
static void WindowSettingsHandler_ReadLine(ImGuiContext *, ImGuiSettingsHandler *, void *entry, const char *line)
Definition imgui.cpp:10562
static void WindowSettingsHandler_ClearAll(ImGuiContext *, ImGuiSettingsHandler *)
Definition imgui.cpp:10544
static void * WindowSettingsHandler_ReadOpen(ImGuiContext *, ImGuiSettingsHandler *, const char *name)
Definition imgui.cpp:10552
bool SettingsLoaded
Definition imgui_internal.h:1559
Definition imgui_internal.h:1273
void(* ReadLineFn)(ImGuiContext *ctx, ImGuiSettingsHandler *handler, void *entry, const char *line)
Definition imgui_internal.h:1279
const char * TypeName
Definition imgui_internal.h:1274
void(* ClearAllFn)(ImGuiContext *ctx, ImGuiSettingsHandler *handler)
Definition imgui_internal.h:1276
void *(* ReadOpenFn)(ImGuiContext *ctx, ImGuiSettingsHandler *handler, const char *name)
Definition imgui_internal.h:1278
void(* ApplyAllFn)(ImGuiContext *ctx, ImGuiSettingsHandler *handler)
Definition imgui_internal.h:1280
void(* WriteAllFn)(ImGuiContext *ctx, ImGuiSettingsHandler *handler, ImGuiTextBuffer *out_buf)
Definition imgui_internal.h:1281
ImGuiID TypeHash
Definition imgui_internal.h:1275

References ImGuiSettingsHandler::ApplyAllFn, ImGuiSettingsHandler::ClearAllFn, IM_ASSERT, IM_NEW, ImHashStr(), ImGuiContext::Initialized, ImVector< T >::push_back(), ImGuiSettingsHandler::ReadLineFn, ImGuiSettingsHandler::ReadOpenFn, ImGuiContext::SettingsHandlers, ImGuiContext::SettingsLoaded, TableSettingsInstallHandler(), ImGuiSettingsHandler::TypeHash, ImGuiSettingsHandler::TypeName, ImGuiContext::Viewports, WindowSettingsHandler_ApplyAll(), WindowSettingsHandler_ClearAll(), WindowSettingsHandler_ReadLine(), WindowSettingsHandler_ReadOpen(), WindowSettingsHandler_WriteAll(), and ImGuiSettingsHandler::WriteAllFn.

Referenced by CreateContext().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InputDouble()

bool ImGui::InputDouble ( const char *  label,
double *  v,
double  step = 0.0,
double  step_fast = 0.0,
const char *  format = "%.6f",
ImGuiInputTextFlags  flags = 0 
)
3492{
3494 return InputScalar(label, ImGuiDataType_Double, (void*)v, (void*)(step > 0.0 ? &step : NULL), (void*)(step_fast > 0.0 ? &step_fast : NULL), format, flags);
3495}
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
@ ImGuiInputTextFlags_CharsScientific
Definition imgui.h:973
IMGUI_API bool InputScalar(const char *label, ImGuiDataType data_type, void *p_data, const void *p_step=NULL, const void *p_step_fast=NULL, const char *format=NULL, ImGuiInputTextFlags flags=0)
Definition imgui_widgets.cpp:3341

References ImGuiDataType_Double, ImGuiInputTextFlags_CharsScientific, and InputScalar().

Referenced by Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::GLGizmoCut3D::render_double_input(), Slic3r::GUI::GLGizmoCut3D::render_move_center_input(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InputFloat()

bool ImGui::InputFloat ( const char *  label,
float *  v,
float  step = 0.0f,
float  step_fast = 0.0f,
const char *  format = "%.3f",
ImGuiInputTextFlags  flags = 0 
)
3449{
3451 return InputScalar(label, ImGuiDataType_Float, (void*)v, (void*)(step > 0.0f ? &step : NULL), (void*)(step_fast > 0.0f ? &step_fast : NULL), format, flags);
3452}

References ImGuiDataType_Float, ImGuiInputTextFlags_CharsScientific, and InputScalar().

Referenced by Slic3r::GUI::ImGuiWrapper::input_optional_float(), Slic3r::GUI::GLGizmoEmboss::rev_input(), ShowDemoWindowColumns(), ShowDemoWindowWidgets(), ShowExampleMenuFile(), and ShowPlaceholderObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InputFloat2()

bool ImGui::InputFloat2 ( const char *  label,
float  v[2],
const char *  format = "%.3f",
ImGuiInputTextFlags  flags = 0 
)
3455{
3456 return InputScalarN(label, ImGuiDataType_Float, v, 2, NULL, NULL, format, flags);
3457}
IMGUI_API bool InputScalarN(const char *label, ImGuiDataType data_type, void *p_data, int components, const void *p_step=NULL, const void *p_step_fast=NULL, const char *format=NULL, ImGuiInputTextFlags flags=0)
Definition imgui_widgets.cpp:3413

References ImGuiDataType_Float, and InputScalarN().

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InputFloat3()

bool ImGui::InputFloat3 ( const char *  label,
float  v[3],
const char *  format = "%.3f",
ImGuiInputTextFlags  flags = 0 
)
3460{
3461 return InputScalarN(label, ImGuiDataType_Float, v, 3, NULL, NULL, format, flags);
3462}

References ImGuiDataType_Float, and InputScalarN().

Referenced by Slic3r::GUI::Mouse3DController::render_settings_dialog(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InputFloat4()

bool ImGui::InputFloat4 ( const char *  label,
float  v[4],
const char *  format = "%.3f",
ImGuiInputTextFlags  flags = 0 
)
3465{
3466 return InputScalarN(label, ImGuiDataType_Float, v, 4, NULL, NULL, format, flags);
3467}

References ImGuiDataType_Float, and InputScalarN().

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InputInt()

bool ImGui::InputInt ( const char *  label,
int *  v,
int  step = 1,
int  step_fast = 100,
ImGuiInputTextFlags  flags = 0 
)
3470{
3471 // Hexadecimal input provided as a convenience but the flag name is awkward. Typically you'd use InputText() to parse your own data, if you want to handle prefixes.
3472 const char* format = (flags & ImGuiInputTextFlags_CharsHexadecimal) ? "%08X" : "%d";
3473 return InputScalar(label, ImGuiDataType_S32, (void*)v, (void*)(step > 0 ? &step : NULL), (void*)(step_fast > 0 ? &step_fast : NULL), format, flags);
3474}

References ImGuiDataType_S32, ImGuiInputTextFlags_CharsHexadecimal, and InputScalar().

Referenced by Slic3r::GUI::ImGuiWrapper::input_optional_int(), Slic3r::GUI::Mouse3DController::render_settings_dialog(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InputInt2()

bool ImGui::InputInt2 ( const char *  label,
int  v[2],
ImGuiInputTextFlags  flags = 0 
)
3477{
3478 return InputScalarN(label, ImGuiDataType_S32, v, 2, NULL, NULL, "%d", flags);
3479}

References ImGuiDataType_S32, and InputScalarN().

Referenced by Slic3r::GUI::Mouse3DController::render_settings_dialog(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InputInt3()

bool ImGui::InputInt3 ( const char *  label,
int  v[3],
ImGuiInputTextFlags  flags = 0 
)
3482{
3483 return InputScalarN(label, ImGuiDataType_S32, v, 3, NULL, NULL, "%d", flags);
3484}

References ImGuiDataType_S32, and InputScalarN().

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InputInt4()

bool ImGui::InputInt4 ( const char *  label,
int  v[4],
ImGuiInputTextFlags  flags = 0 
)
3487{
3488 return InputScalarN(label, ImGuiDataType_S32, v, 4, NULL, NULL, "%d", flags);
3489}

References ImGuiDataType_S32, and InputScalarN().

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InputScalar()

bool ImGui::InputScalar ( const char *  label,
ImGuiDataType  data_type,
void p_data,
const void p_step = NULL,
const void p_step_fast = NULL,
const char *  format = NULL,
ImGuiInputTextFlags  flags = 0 
)
3342{
3343 ImGuiWindow* window = GetCurrentWindow();
3344 if (window->SkipItems)
3345 return false;
3346
3347 ImGuiContext& g = *GImGui;
3348 ImGuiStyle& style = g.Style;
3349
3350 if (format == NULL)
3351 format = DataTypeGetInfo(data_type)->PrintFmt;
3352
3353 char buf[64];
3354 DataTypeFormatString(buf, IM_ARRAYSIZE(buf), data_type, p_data, format);
3355
3356 bool value_changed = false;
3360 flags |= ImGuiInputTextFlags_NoMarkEdited; // We call MarkItemEdited() ourselves by comparing the actual data rather than the string.
3361
3362 if (p_step != NULL)
3363 {
3364 const float button_size = GetFrameHeight();
3365
3366 BeginGroup(); // The only purpose of the group here is to allow the caller to query item data e.g. IsItemActive()
3367 PushID(label);
3368 SetNextItemWidth(ImMax(1.0f, CalcItemWidth() - (button_size + style.ItemInnerSpacing.x) * 2));
3369 if (InputText("", buf, IM_ARRAYSIZE(buf), flags)) // PushId(label) + "" gives us the expected ID from outside point of view
3370 value_changed = DataTypeApplyOpFromText(buf, g.InputTextState.InitialTextA.Data, data_type, p_data, format);
3371
3372 // Step buttons
3373 const ImVec2 backup_frame_padding = style.FramePadding;
3374 style.FramePadding.x = style.FramePadding.y;
3376 if (flags & ImGuiInputTextFlags_ReadOnly)
3377 button_flags |= ImGuiButtonFlags_Disabled;
3378 SameLine(0, style.ItemInnerSpacing.x);
3379 if (ButtonEx("-", ImVec2(button_size, button_size), button_flags))
3380 {
3381 DataTypeApplyOp(data_type, '-', p_data, p_data, g.IO.KeyCtrl && p_step_fast ? p_step_fast : p_step);
3382 value_changed = true;
3383 }
3384 SameLine(0, style.ItemInnerSpacing.x);
3385 if (ButtonEx("+", ImVec2(button_size, button_size), button_flags))
3386 {
3387 DataTypeApplyOp(data_type, '+', p_data, p_data, g.IO.KeyCtrl && p_step_fast ? p_step_fast : p_step);
3388 value_changed = true;
3389 }
3390
3391 const char* label_end = FindRenderedTextEnd(label);
3392 if (label != label_end)
3393 {
3394 SameLine(0, style.ItemInnerSpacing.x);
3395 TextEx(label, label_end);
3396 }
3397 style.FramePadding = backup_frame_padding;
3398
3399 PopID();
3400 EndGroup();
3401 }
3402 else
3403 {
3404 if (InputText(label, buf, IM_ARRAYSIZE(buf), flags))
3405 value_changed = DataTypeApplyOpFromText(buf, g.InputTextState.InitialTextA.Data, data_type, p_data, format);
3406 }
3407 if (value_changed)
3408 MarkItemEdited(window->DC.LastItemId);
3409
3410 return value_changed;
3411}
@ ImGuiInputTextFlags_AutoSelectAll
Definition imgui.h:960
@ ImGuiInputTextFlags_CharsDecimal
Definition imgui.h:956
@ ImGuiInputTextFlags_ReadOnly
Definition imgui.h:970
int ImGuiButtonFlags
Definition imgui.h:182
@ ImGuiInputTextFlags_NoMarkEdited
Definition imgui_internal.h:771
@ ImGuiButtonFlags_DontClosePopups
Definition imgui_internal.h:787
IMGUI_API bool DataTypeApplyOpFromText(const char *buf, const char *initial_value_buf, ImGuiDataType data_type, void *p_data, const char *format)
Definition imgui_widgets.cpp:1912
IMGUI_API void DataTypeApplyOp(ImGuiDataType data_type, int op, void *output, const void *arg_1, const void *arg_2)
Definition imgui_widgets.cpp:1860
ImVector< char > InitialTextA
Definition imgui_internal.h:1023

References BeginGroup(), ButtonEx(), CalcItemWidth(), ImVector< T >::Data, DataTypeApplyOp(), DataTypeApplyOpFromText(), DataTypeFormatString(), DataTypeGetInfo(), ImGuiWindow::DC, EndGroup(), FindRenderedTextEnd(), GetCurrentWindow(), GetFrameHeight(), GImGui, IM_ARRAYSIZE, ImGuiButtonFlags_Disabled, ImGuiButtonFlags_DontClosePopups, ImGuiButtonFlags_Repeat, ImGuiInputTextFlags_AutoSelectAll, ImGuiInputTextFlags_CharsDecimal, ImGuiInputTextFlags_CharsHexadecimal, ImGuiInputTextFlags_CharsScientific, ImGuiInputTextFlags_NoMarkEdited, ImGuiInputTextFlags_ReadOnly, ImMax(), ImGuiInputTextState::InitialTextA, InputText(), ImGuiContext::InputTextState, ImGuiContext::IO, ImGuiIO::KeyCtrl, ImGuiWindowTempData::LastItemId, MarkItemEdited(), PopID(), ImGuiDataTypeInfo::PrintFmt, PushID(), SameLine(), SetNextItemWidth(), ImGuiWindow::SkipItems, ImGuiContext::Style, style, and TextEx().

Referenced by InputDouble(), InputFloat(), InputInt(), InputScalarN(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InputScalarN()

bool ImGui::InputScalarN ( const char *  label,
ImGuiDataType  data_type,
void p_data,
int  components,
const void p_step = NULL,
const void p_step_fast = NULL,
const char *  format = NULL,
ImGuiInputTextFlags  flags = 0 
)
3414{
3415 ImGuiWindow* window = GetCurrentWindow();
3416 if (window->SkipItems)
3417 return false;
3418
3419 ImGuiContext& g = *GImGui;
3420 bool value_changed = false;
3421 BeginGroup();
3422 PushID(label);
3423 PushMultiItemsWidths(components, CalcItemWidth());
3424 size_t type_size = GDataTypeInfo[data_type].Size;
3425 for (int i = 0; i < components; i++)
3426 {
3427 PushID(i);
3428 if (i > 0)
3430 value_changed |= InputScalar("", data_type, p_data, p_step, p_step_fast, format, flags);
3431 PopID();
3432 PopItemWidth();
3433 p_data = (void*)((char*)p_data + type_size);
3434 }
3435 PopID();
3436
3437 const char* label_end = FindRenderedTextEnd(label);
3438 if (label != label_end)
3439 {
3440 SameLine(0.0f, g.Style.ItemInnerSpacing.x);
3441 TextEx(label, label_end);
3442 }
3443
3444 EndGroup();
3445 return value_changed;
3446}

References BeginGroup(), CalcItemWidth(), EndGroup(), FindRenderedTextEnd(), GDataTypeInfo, GetCurrentWindow(), GImGui, InputScalar(), ImGuiStyle::ItemInnerSpacing, PopID(), PopItemWidth(), PushID(), PushMultiItemsWidths(), SameLine(), ImGuiDataTypeInfo::Size, ImGuiWindow::SkipItems, ImGuiContext::Style, TextEx(), and ImVec2::x.

Referenced by InputFloat2(), InputFloat3(), InputFloat4(), InputInt2(), InputInt3(), and InputInt4().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InputText() [1/3]

bool ImGui::InputText ( const char *  label,
char *  buf,
size_t  buf_size,
ImGuiInputTextFlags  flags = 0,
ImGuiInputTextCallback  callback = NULL,
void user_data = NULL 
)
3507{
3508 IM_ASSERT(!(flags & ImGuiInputTextFlags_Multiline)); // call InputTextMultiline()
3509 return InputTextEx(label, NULL, buf, (int)buf_size, ImVec2(0, 0), flags, callback, user_data);
3510}
@ ImGuiInputTextFlags_Multiline
Definition imgui_internal.h:770
IMGUI_API bool InputTextEx(const char *label, const char *hint, char *buf, int buf_size, const ImVec2 &size_arg, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback=NULL, void *user_data=NULL)
Definition imgui_widgets.cpp:3865

References IM_ASSERT, ImGuiInputTextFlags_Multiline, and InputTextEx().

Referenced by ColorEdit4(), ImGuiTextFilter::Draw(), ExampleAppConsole::Draw(), Slic3r::GUI::GLGizmoEmboss::draw_style_rename_popup(), Slic3r::GUI::GLGizmoEmboss::draw_style_save_as_popup(), InputScalar(), InputText(), InputText(), ShowDemoWindowMisc(), ShowDemoWindowPopups(), ShowDemoWindowTables(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InputText() [2/3]

bool ImGui::InputText ( const char *  label,
std::string &  str,
ImGuiInputTextFlags  flags = 0,
ImGuiTextEditCallback  callback = NULL,
void user_data = NULL 
)
inline
60{
61 char buf[1024];
62 std::fill_n(buf, 1024, 0);
63 std::copy_n(str.begin(), std::min(1024, (int) str.size()), buf);
64 if (ImGui::InputText(label, buf, 1024, flags, callback, user_data))
65 {
66 str = std::string(buf);
67 return true;
68 }
69 return false;
70}

References InputText().

+ Here is the call graph for this function:

◆ InputText() [3/3]

bool ImGui::InputText ( const char *  label,
std::string *  str,
ImGuiInputTextFlags  flags = 0,
ImGuiInputTextCallback  callback = NULL,
void user_data = NULL 
)
43{
46
47 InputTextCallback_UserData cb_user_data;
48 cb_user_data.Str = str;
49 cb_user_data.ChainCallback = callback;
50 cb_user_data.ChainCallbackUserData = user_data;
51 return InputText(label, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data);
52}
@ ImGuiInputTextFlags_CallbackResize
Definition imgui.h:974
void * ChainCallbackUserData
Definition imgui_stdlib.cpp:18
static int InputTextCallback(ImGuiInputTextCallbackData *data)
Definition imgui_stdlib.cpp:21
std::string * Str
Definition imgui_stdlib.cpp:16
ImGuiInputTextCallback ChainCallback
Definition imgui_stdlib.cpp:17
Definition imgui_stdlib.cpp:15

References InputTextCallback_UserData::ChainCallback, InputTextCallback_UserData::ChainCallbackUserData, IM_ASSERT, ImGuiInputTextFlags_CallbackResize, InputText(), InputTextCallback(), and InputTextCallback_UserData::Str.

+ Here is the call graph for this function:

◆ InputTextEx()

bool ImGui::InputTextEx ( const char *  label,
const char *  hint,
char *  buf,
int  buf_size,
const ImVec2 size_arg,
ImGuiInputTextFlags  flags,
ImGuiInputTextCallback  callback = NULL,
void user_data = NULL 
)
3866{
3867 ImGuiWindow* window = GetCurrentWindow();
3868 if (window->SkipItems)
3869 return false;
3870
3871 IM_ASSERT(buf != NULL && buf_size >= 0);
3872 IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackHistory) && (flags & ImGuiInputTextFlags_Multiline))); // Can't use both together (they both use up/down keys)
3873 IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackCompletion) && (flags & ImGuiInputTextFlags_AllowTabInput))); // Can't use both together (they both use tab key)
3874
3875 ImGuiContext& g = *GImGui;
3876 ImGuiIO& io = g.IO;
3877 const ImGuiStyle& style = g.Style;
3878
3879 const bool RENDER_SELECTION_WHEN_INACTIVE = false;
3880 const bool is_multiline = (flags & ImGuiInputTextFlags_Multiline) != 0;
3881 const bool is_readonly = (flags & ImGuiInputTextFlags_ReadOnly) != 0;
3882 const bool is_password = (flags & ImGuiInputTextFlags_Password) != 0;
3883 const bool is_undoable = (flags & ImGuiInputTextFlags_NoUndoRedo) == 0;
3884 const bool is_resizable = (flags & ImGuiInputTextFlags_CallbackResize) != 0;
3885 if (is_resizable)
3886 IM_ASSERT(callback != NULL); // Must provide a callback if you set the ImGuiInputTextFlags_CallbackResize flag!
3887
3888 if (is_multiline) // Open group before calling GetID() because groups tracks id created within their scope,
3889 BeginGroup();
3890 const ImGuiID id = window->GetID(label);
3891 const ImVec2 label_size = CalcTextSize(label, NULL, true);
3892 const ImVec2 frame_size = CalcItemSize(size_arg, CalcItemWidth(), (is_multiline ? g.FontSize * 8.0f : label_size.y) + style.FramePadding.y * 2.0f); // Arbitrary default of 8 lines high for multi-line
3893 const ImVec2 total_size = ImVec2(frame_size.x + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), frame_size.y);
3894
3895 const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size);
3896 const ImRect total_bb(frame_bb.Min, frame_bb.Min + total_size);
3897
3898 ImGuiWindow* draw_window = window;
3899 ImVec2 inner_size = frame_size;
3900 if (is_multiline)
3901 {
3902 if (!ItemAdd(total_bb, id, &frame_bb, ImGuiItemAddFlags_Focusable))
3903 {
3904 ItemSize(total_bb, style.FramePadding.y);
3905 EndGroup();
3906 return false;
3907 }
3908
3909 // We reproduce the contents of BeginChildFrame() in order to provide 'label' so our window internal data are easier to read/debug.
3910 PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]);
3911 PushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding);
3912 PushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize);
3913 bool child_visible = BeginChildEx(label, id, frame_bb.GetSize(), true, ImGuiWindowFlags_NoMove);
3914 PopStyleVar(2);
3915 PopStyleColor();
3916 if (!child_visible)
3917 {
3918 EndChild();
3919 EndGroup();
3920 return false;
3921 }
3922 draw_window = g.CurrentWindow; // Child window
3923 draw_window->DC.NavLayersActiveMaskNext |= (1 << draw_window->DC.NavLayerCurrent); // This is to ensure that EndChild() will display a navigation highlight so we can "enter" into it.
3924 draw_window->DC.CursorPos += style.FramePadding;
3925 inner_size.x -= draw_window->ScrollbarSizes.x;
3926 }
3927 else
3928 {
3929 // Support for internal ImGuiInputTextFlags_MergedItem flag, which could be redesigned as an ItemFlags if needed (with test performed in ItemAdd)
3930 ItemSize(total_bb, style.FramePadding.y);
3931 if (!(flags & ImGuiInputTextFlags_MergedItem))
3932 if (!ItemAdd(total_bb, id, &frame_bb, ImGuiItemAddFlags_Focusable))
3933 return false;
3934 }
3935 const bool hovered = ItemHoverable(frame_bb, id);
3936 if (hovered)
3938
3939 // We are only allowed to access the state if we are already the active widget.
3941
3942 const bool focus_requested_by_code = (window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_FocusedByCode) != 0;
3943 const bool focus_requested_by_tabbing = (window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_FocusedByTabbing) != 0;
3944
3945 const bool user_clicked = hovered && io.MouseClicked[0];
3946 const bool user_nav_input_start = (g.ActiveId != id) && ((g.NavInputId == id) || (g.NavActivateId == id && g.NavInputSource == ImGuiInputSource_Keyboard));
3947 const bool user_scroll_finish = is_multiline && state != NULL && g.ActiveId == 0 && g.ActiveIdPreviousFrame == GetWindowScrollbarID(draw_window, ImGuiAxis_Y);
3948 const bool user_scroll_active = is_multiline && state != NULL && g.ActiveId == GetWindowScrollbarID(draw_window, ImGuiAxis_Y);
3949
3950 bool clear_active_id = false;
3951 bool select_all = (g.ActiveId != id) && ((flags & ImGuiInputTextFlags_AutoSelectAll) != 0 || user_nav_input_start) && (!is_multiline);
3952
3953 float scroll_y = is_multiline ? draw_window->Scroll.y : FLT_MAX;
3954
3955 const bool init_changed_specs = (state != NULL && state->Stb.single_line != !is_multiline);
3956 const bool init_make_active = (user_clicked || user_scroll_finish || user_nav_input_start || focus_requested_by_code || focus_requested_by_tabbing);
3957 const bool init_state = (init_make_active || user_scroll_active);
3958 if ((init_state && g.ActiveId != id) || init_changed_specs)
3959 {
3960 // Access state even if we don't own it yet.
3961 state = &g.InputTextState;
3962 state->CursorAnimReset();
3963
3964 // Take a copy of the initial buffer value (both in original UTF-8 format and converted to wchar)
3965 // From the moment we focused we are ignoring the content of 'buf' (unless we are in read-only mode)
3966 const int buf_len = (int)strlen(buf);
3967 state->InitialTextA.resize(buf_len + 1); // UTF-8. we use +1 to make sure that .Data is always pointing to at least an empty string.
3968 memcpy(state->InitialTextA.Data, buf, buf_len + 1);
3969
3970 // Start edition
3971 const char* buf_end = NULL;
3972 state->TextW.resize(buf_size + 1); // wchar count <= UTF-8 count. we use +1 to make sure that .Data is always pointing to at least an empty string.
3973 state->TextA.resize(0);
3974 state->TextAIsValid = false; // TextA is not valid yet (we will display buf until then)
3975 state->CurLenW = ImTextStrFromUtf8(state->TextW.Data, buf_size, buf, NULL, &buf_end);
3976 state->CurLenA = (int)(buf_end - buf); // We can't get the result from ImStrncpy() above because it is not UTF-8 aware. Here we'll cut off malformed UTF-8.
3977
3978 // Preserve cursor position and undo/redo stack if we come back to same widget
3979 // FIXME: For non-readonly widgets we might be able to require that TextAIsValid && TextA == buf ? (untested) and discard undo stack if user buffer has changed.
3980 const bool recycle_state = (state->ID == id && !init_changed_specs);
3981 if (recycle_state)
3982 {
3983 // Recycle existing cursor/selection/undo stack but clamp position
3984 // Note a single mouse click will override the cursor/position immediately by calling stb_textedit_click handler.
3985 state->CursorClamp();
3986 }
3987 else
3988 {
3989 state->ID = id;
3990 state->ScrollX = 0.0f;
3991 stb_textedit_initialize_state(&state->Stb, !is_multiline);
3992 if (!is_multiline && focus_requested_by_code)
3993 select_all = true;
3994 }
3996 state->Stb.insert_mode = 1; // stb field name is indeed incorrect (see #2863)
3997 if (!is_multiline && (focus_requested_by_tabbing || (user_clicked && io.KeyCtrl)))
3998 select_all = true;
3999 }
4000
4001 if (g.ActiveId != id && init_make_active)
4002 {
4003 IM_ASSERT(state && state->ID == id);
4004 SetActiveID(id, window);
4005 SetFocusID(id, window);
4006 FocusWindow(window);
4007
4008 // Declare our inputs
4011 if (is_multiline || (flags & ImGuiInputTextFlags_CallbackHistory))
4015 if (is_multiline)
4017 if (flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_AllowTabInput)) // Disable keyboard tabbing out as we will use the \t character.
4019 }
4020
4021 // We have an edge case if ActiveId was set through another widget (e.g. widget being swapped), clear id immediately (don't wait until the end of the function)
4022 if (g.ActiveId == id && state == NULL)
4023 ClearActiveID();
4024
4025 // Release focus when we click outside
4026 if (g.ActiveId == id && io.MouseClicked[0] && !init_state && !init_make_active) //-V560
4027 clear_active_id = true;
4028
4029 // Lock the decision of whether we are going to take the path displaying the cursor or selection
4030 const bool render_cursor = (g.ActiveId == id) || (state && user_scroll_active);
4031 bool render_selection = state && state->HasSelection() && (RENDER_SELECTION_WHEN_INACTIVE || render_cursor);
4032 bool value_changed = false;
4033 bool enter_pressed = false;
4034
4035 // When read-only we always use the live data passed to the function
4036 // FIXME-OPT: Because our selection/cursor code currently needs the wide text we need to convert it when active, which is not ideal :(
4037 if (is_readonly && state != NULL && (render_cursor || render_selection))
4038 {
4039 const char* buf_end = NULL;
4040 state->TextW.resize(buf_size + 1);
4041 state->CurLenW = ImTextStrFromUtf8(state->TextW.Data, state->TextW.Size, buf, NULL, &buf_end);
4042 state->CurLenA = (int)(buf_end - buf);
4043 state->CursorClamp();
4044 render_selection &= state->HasSelection();
4045 }
4046
4047 // Select the buffer to render.
4048 const bool buf_display_from_state = (render_cursor || render_selection || g.ActiveId == id) && !is_readonly && state && state->TextAIsValid;
4049 const bool is_displaying_hint = (hint != NULL && (buf_display_from_state ? state->TextA.Data : buf)[0] == 0);
4050
4051 // Password pushes a temporary font with only a fallback glyph
4052 if (is_password && !is_displaying_hint)
4053 {
4054 const ImFontGlyph* glyph = g.Font->FindGlyph('*');
4055 ImFont* password_font = &g.InputTextPasswordFont;
4056 password_font->FontSize = g.Font->FontSize;
4057 password_font->Scale = g.Font->Scale;
4058 password_font->Ascent = g.Font->Ascent;
4059 password_font->Descent = g.Font->Descent;
4060 password_font->ContainerAtlas = g.Font->ContainerAtlas;
4061 password_font->FallbackGlyph = glyph;
4062 password_font->FallbackAdvanceX = glyph->AdvanceX;
4063 IM_ASSERT(password_font->Glyphs.empty() && password_font->IndexAdvanceX.empty() && password_font->IndexLookup.empty());
4064 PushFont(password_font);
4065 }
4066
4067 // Process mouse inputs and character inputs
4068 int backup_current_text_length = 0;
4069 if (g.ActiveId == id)
4070 {
4071 IM_ASSERT(state != NULL);
4072 backup_current_text_length = state->CurLenA;
4073 state->Edited = false;
4074 state->BufCapacityA = buf_size;
4075 state->Flags = flags;
4076 state->UserCallback = callback;
4077 state->UserCallbackData = callback_user_data;
4078
4079 // Although we are active we don't prevent mouse from hovering other elements unless we are interacting right now with the widget.
4080 // Down the line we should have a cleaner library-wide concept of Selected vs Active.
4083
4084 // Edit in progress
4085 const float mouse_x = (io.MousePos.x - frame_bb.Min.x - style.FramePadding.x) + state->ScrollX;
4086 const float mouse_y = (is_multiline ? (io.MousePos.y - draw_window->DC.CursorPos.y) : (g.FontSize * 0.5f));
4087
4088 const bool is_osx = io.ConfigMacOSXBehaviors;
4089 if (select_all || (hovered && !is_osx && io.MouseDoubleClicked[0]))
4090 {
4091 state->SelectAll();
4092 state->SelectedAllMouseLock = true;
4093 }
4094 else if (hovered && is_osx && io.MouseDoubleClicked[0])
4095 {
4096 // Double-click select a word only, OS X style (by simulating keystrokes)
4099 }
4100 else if (io.MouseClicked[0] && !state->SelectedAllMouseLock)
4101 {
4102 if (hovered)
4103 {
4104 stb_textedit_click(state, &state->Stb, mouse_x, mouse_y);
4105 state->CursorAnimReset();
4106 }
4107 }
4108 else if (io.MouseDown[0] && !state->SelectedAllMouseLock && (io.MouseDelta.x != 0.0f || io.MouseDelta.y != 0.0f))
4109 {
4110 stb_textedit_drag(state, &state->Stb, mouse_x, mouse_y);
4111 state->CursorAnimReset();
4112 state->CursorFollow = true;
4113 }
4114 if (state->SelectedAllMouseLock && !io.MouseDown[0])
4115 state->SelectedAllMouseLock = false;
4116
4117 // It is ill-defined whether the backend needs to send a \t character when pressing the TAB keys.
4118 // Win32 and GLFW naturally do it but not SDL.
4119 const bool ignore_char_inputs = (io.KeyCtrl && !io.KeyAlt) || (is_osx && io.KeySuper);
4120 if ((flags & ImGuiInputTextFlags_AllowTabInput) && IsKeyPressedMap(ImGuiKey_Tab) && !ignore_char_inputs && !io.KeyShift && !is_readonly)
4121 if (!io.InputQueueCharacters.contains('\t'))
4122 {
4123 unsigned int c = '\t'; // Insert TAB
4124 if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard))
4125 state->OnKeyPressed((int)c);
4126 }
4127
4128 // Process regular text input (before we check for Return because using some IME will effectively send a Return?)
4129 // We ignore CTRL inputs, but need to allow ALT+CTRL as some keyboards (e.g. German) use AltGR (which _is_ Alt+Ctrl) to input certain characters.
4130 if (io.InputQueueCharacters.Size > 0)
4131 {
4132 if (!ignore_char_inputs && !is_readonly && !user_nav_input_start)
4133 for (int n = 0; n < io.InputQueueCharacters.Size; n++)
4134 {
4135 // Insert character if they pass filtering
4136 unsigned int c = (unsigned int)io.InputQueueCharacters[n];
4137 if (c == '\t' && io.KeyShift)
4138 continue;
4139 if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard))
4140 state->OnKeyPressed((int)c);
4141 }
4142
4143 // Consume characters
4145 }
4146 }
4147
4148 // Process other shortcuts/key-presses
4149 bool cancel_edit = false;
4150 if (g.ActiveId == id && !g.ActiveIdIsJustActivated && !clear_active_id)
4151 {
4152 IM_ASSERT(state != NULL);
4153 IM_ASSERT(io.KeyMods == GetMergedKeyModFlags() && "Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods"); // We rarely do this check, but if anything let's do it here.
4154
4155 const int row_count_per_page = ImMax((int)((inner_size.y - style.FramePadding.y) / g.FontSize), 1);
4156 state->Stb.row_count_per_page = row_count_per_page;
4157
4158 const int k_mask = (io.KeyShift ? STB_TEXTEDIT_K_SHIFT : 0);
4159 const bool is_osx = io.ConfigMacOSXBehaviors;
4160 const bool is_osx_shift_shortcut = is_osx && (io.KeyMods == (ImGuiKeyModFlags_Super | ImGuiKeyModFlags_Shift));
4161 const bool is_wordmove_key_down = is_osx ? io.KeyAlt : io.KeyCtrl; // OS X style: Text editing cursor movement using Alt instead of Ctrl
4162 const bool is_startend_key_down = is_osx && io.KeySuper && !io.KeyCtrl && !io.KeyAlt; // OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End
4163 const bool is_ctrl_key_only = (io.KeyMods == ImGuiKeyModFlags_Ctrl);
4164 const bool is_shift_key_only = (io.KeyMods == ImGuiKeyModFlags_Shift);
4165 const bool is_shortcut_key = g.IO.ConfigMacOSXBehaviors ? (io.KeyMods == ImGuiKeyModFlags_Super) : (io.KeyMods == ImGuiKeyModFlags_Ctrl);
4166
4167 const bool is_cut = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_X)) || (is_shift_key_only && IsKeyPressedMap(ImGuiKey_Delete))) && !is_readonly && !is_password && (!is_multiline || state->HasSelection());
4168 const bool is_copy = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_C)) || (is_ctrl_key_only && IsKeyPressedMap(ImGuiKey_Insert))) && !is_password && (!is_multiline || state->HasSelection());
4169 const bool is_paste = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_V)) || (is_shift_key_only && IsKeyPressedMap(ImGuiKey_Insert))) && !is_readonly;
4170 const bool is_undo = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_Z)) && !is_readonly && is_undoable);
4171 const bool is_redo = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_Y)) || (is_osx_shift_shortcut && IsKeyPressedMap(ImGuiKey_Z))) && !is_readonly && is_undoable;
4172
4173 if (IsKeyPressedMap(ImGuiKey_LeftArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); }
4174 else if (IsKeyPressedMap(ImGuiKey_RightArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINEEND : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT : STB_TEXTEDIT_K_RIGHT) | k_mask); }
4175 else if (IsKeyPressedMap(ImGuiKey_UpArrow) && is_multiline) { if (io.KeyCtrl) SetScrollY(draw_window, ImMax(draw_window->Scroll.y - g.FontSize, 0.0f)); else state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTSTART : STB_TEXTEDIT_K_UP) | k_mask); }
4176 else if (IsKeyPressedMap(ImGuiKey_DownArrow) && is_multiline) { if (io.KeyCtrl) SetScrollY(draw_window, ImMin(draw_window->Scroll.y + g.FontSize, GetScrollMaxY())); else state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTEND : STB_TEXTEDIT_K_DOWN) | k_mask); }
4177 else if (IsKeyPressedMap(ImGuiKey_PageUp) && is_multiline) { state->OnKeyPressed(STB_TEXTEDIT_K_PGUP | k_mask); scroll_y -= row_count_per_page * g.FontSize; }
4178 else if (IsKeyPressedMap(ImGuiKey_PageDown) && is_multiline) { state->OnKeyPressed(STB_TEXTEDIT_K_PGDOWN | k_mask); scroll_y += row_count_per_page * g.FontSize; }
4180 else if (IsKeyPressedMap(ImGuiKey_End)) { state->OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTEND | k_mask : STB_TEXTEDIT_K_LINEEND | k_mask); }
4181 else if (IsKeyPressedMap(ImGuiKey_Delete) && !is_readonly) { state->OnKeyPressed(STB_TEXTEDIT_K_DELETE | k_mask); }
4182 else if (IsKeyPressedMap(ImGuiKey_Backspace) && !is_readonly)
4183 {
4184 if (!state->HasSelection())
4185 {
4186 if (is_wordmove_key_down)
4188 else if (is_osx && io.KeySuper && !io.KeyAlt && !io.KeyCtrl)
4190 }
4191 state->OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask);
4192 }
4194 {
4195 bool ctrl_enter_for_new_line = (flags & ImGuiInputTextFlags_CtrlEnterForNewLine) != 0;
4196 if (!is_multiline || (ctrl_enter_for_new_line && !io.KeyCtrl) || (!ctrl_enter_for_new_line && io.KeyCtrl))
4197 {
4198 enter_pressed = clear_active_id = true;
4199 }
4200 else if (!is_readonly)
4201 {
4202 unsigned int c = '\n'; // Insert new line
4203 if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard))
4204 state->OnKeyPressed((int)c);
4205 }
4206 }
4208 {
4209 clear_active_id = cancel_edit = true;
4210 }
4211 else if (is_undo || is_redo)
4212 {
4214 state->ClearSelection();
4215 }
4216 else if (is_shortcut_key && IsKeyPressedMap(ImGuiKey_A))
4217 {
4218 state->SelectAll();
4219 state->CursorFollow = true;
4220 }
4221 else if (is_cut || is_copy)
4222 {
4223 // Cut, Copy
4224 if (io.SetClipboardTextFn)
4225 {
4226 const int ib = state->HasSelection() ? ImMin(state->Stb.select_start, state->Stb.select_end) : 0;
4227 const int ie = state->HasSelection() ? ImMax(state->Stb.select_start, state->Stb.select_end) : state->CurLenW;
4228 const int clipboard_data_len = ImTextCountUtf8BytesFromStr(state->TextW.Data + ib, state->TextW.Data + ie) + 1;
4229 char* clipboard_data = (char*)IM_ALLOC(clipboard_data_len * sizeof(char));
4230 ImTextStrToUtf8(clipboard_data, clipboard_data_len, state->TextW.Data + ib, state->TextW.Data + ie);
4231 SetClipboardText(clipboard_data);
4232 MemFree(clipboard_data);
4233 }
4234 if (is_cut)
4235 {
4236 if (!state->HasSelection())
4237 state->SelectAll();
4238 state->CursorFollow = true;
4239 stb_textedit_cut(state, &state->Stb);
4240 }
4241 }
4242 else if (is_paste)
4243 {
4244 if (const char* clipboard = GetClipboardText())
4245 {
4246 // Filter pasted buffer
4247 const int clipboard_len = (int)strlen(clipboard);
4248 ImWchar* clipboard_filtered = (ImWchar*)IM_ALLOC((clipboard_len + 1) * sizeof(ImWchar));
4249 int clipboard_filtered_len = 0;
4250 for (const char* s = clipboard; *s; )
4251 {
4252 unsigned int c;
4253 s += ImTextCharFromUtf8(&c, s, NULL);
4254 if (c == 0)
4255 break;
4256 if (!InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Clipboard))
4257 continue;
4258 clipboard_filtered[clipboard_filtered_len++] = (ImWchar)c;
4259 }
4260 clipboard_filtered[clipboard_filtered_len] = 0;
4261 if (clipboard_filtered_len > 0) // If everything was filtered, ignore the pasting operation
4262 {
4263 stb_textedit_paste(state, &state->Stb, clipboard_filtered, clipboard_filtered_len);
4264 state->CursorFollow = true;
4265 }
4266 MemFree(clipboard_filtered);
4267 }
4268 }
4269
4270 // Update render selection flag after events have been handled, so selection highlight can be displayed during the same frame.
4271 render_selection |= state->HasSelection() && (RENDER_SELECTION_WHEN_INACTIVE || render_cursor);
4272 }
4273
4274 // Process callbacks and apply result back to user's buffer.
4275 if (g.ActiveId == id)
4276 {
4277 IM_ASSERT(state != NULL);
4278 const char* apply_new_text = NULL;
4279 int apply_new_text_length = 0;
4280 if (cancel_edit)
4281 {
4282 // Restore initial value. Only return true if restoring to the initial value changes the current buffer contents.
4283 if (!is_readonly && strcmp(buf, state->InitialTextA.Data) != 0)
4284 {
4285 // Push records into the undo stack so we can CTRL+Z the revert operation itself
4286 apply_new_text = state->InitialTextA.Data;
4287 apply_new_text_length = state->InitialTextA.Size - 1;
4288 ImVector<ImWchar> w_text;
4289 if (apply_new_text_length > 0)
4290 {
4291 w_text.resize(ImTextCountCharsFromUtf8(apply_new_text, apply_new_text + apply_new_text_length) + 1);
4292 ImTextStrFromUtf8(w_text.Data, w_text.Size, apply_new_text, apply_new_text + apply_new_text_length);
4293 }
4294 stb_textedit_replace(state, &state->Stb, w_text.Data, (apply_new_text_length > 0) ? (w_text.Size - 1) : 0);
4295 }
4296 }
4297
4298 // When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer before clearing ActiveId, even though strictly speaking it wasn't modified on this frame.
4299 // If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail.
4300 // This also allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage (please note that if you use this property along ImGuiInputTextFlags_CallbackResize you can end up with your temporary string object unnecessarily allocating once a frame, either store your string data, either if you don't then don't use ImGuiInputTextFlags_CallbackResize).
4301 bool apply_edit_back_to_user_buffer = !cancel_edit || (enter_pressed && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0);
4302 if (apply_edit_back_to_user_buffer)
4303 {
4304 // Apply new value immediately - copy modified buffer back
4305 // Note that as soon as the input box is active, the in-widget value gets priority over any underlying modification of the input buffer
4306 // FIXME: We actually always render 'buf' when calling DrawList->AddText, making the comment above incorrect.
4307 // FIXME-OPT: CPU waste to do this every time the widget is active, should mark dirty state from the stb_textedit callbacks.
4308 if (!is_readonly)
4309 {
4310 state->TextAIsValid = true;
4311 state->TextA.resize(state->TextW.Size * 4 + 1);
4312 ImTextStrToUtf8(state->TextA.Data, state->TextA.Size, state->TextW.Data, NULL);
4313 }
4314
4315 // User callback
4317 {
4318 IM_ASSERT(callback != NULL);
4319
4320 // The reason we specify the usage semantic (Completion/History) is that Completion needs to disable keyboard TABBING at the moment.
4321 ImGuiInputTextFlags event_flag = 0;
4322 ImGuiKey event_key = ImGuiKey_COUNT;
4324 {
4326 event_key = ImGuiKey_Tab;
4327 }
4329 {
4331 event_key = ImGuiKey_UpArrow;
4332 }
4334 {
4336 event_key = ImGuiKey_DownArrow;
4337 }
4338 else if ((flags & ImGuiInputTextFlags_CallbackEdit) && state->Edited)
4339 {
4341 }
4342 else if (flags & ImGuiInputTextFlags_CallbackAlways)
4343 {
4345 }
4346
4347 if (event_flag)
4348 {
4349 ImGuiInputTextCallbackData callback_data;
4350 memset(&callback_data, 0, sizeof(ImGuiInputTextCallbackData));
4351 callback_data.EventFlag = event_flag;
4352 callback_data.Flags = flags;
4353 callback_data.UserData = callback_user_data;
4354
4355 callback_data.EventKey = event_key;
4356 callback_data.Buf = state->TextA.Data;
4357 callback_data.BufTextLen = state->CurLenA;
4358 callback_data.BufSize = state->BufCapacityA;
4359 callback_data.BufDirty = false;
4360
4361 // We have to convert from wchar-positions to UTF-8-positions, which can be pretty slow (an incentive to ditch the ImWchar buffer, see https://github.com/nothings/stb/issues/188)
4362 ImWchar* text = state->TextW.Data;
4363 const int utf8_cursor_pos = callback_data.CursorPos = ImTextCountUtf8BytesFromStr(text, text + state->Stb.cursor);
4364 const int utf8_selection_start = callback_data.SelectionStart = ImTextCountUtf8BytesFromStr(text, text + state->Stb.select_start);
4365 const int utf8_selection_end = callback_data.SelectionEnd = ImTextCountUtf8BytesFromStr(text, text + state->Stb.select_end);
4366
4367 // Call user code
4368 callback(&callback_data);
4369
4370 // Read back what user may have modified
4371 IM_ASSERT(callback_data.Buf == state->TextA.Data); // Invalid to modify those fields
4372 IM_ASSERT(callback_data.BufSize == state->BufCapacityA);
4373 IM_ASSERT(callback_data.Flags == flags);
4374 const bool buf_dirty = callback_data.BufDirty;
4375 if (callback_data.CursorPos != utf8_cursor_pos || buf_dirty) { state->Stb.cursor = ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.CursorPos); state->CursorFollow = true; }
4376 if (callback_data.SelectionStart != utf8_selection_start || buf_dirty) { state->Stb.select_start = (callback_data.SelectionStart == callback_data.CursorPos) ? state->Stb.cursor : ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.SelectionStart); }
4377 if (callback_data.SelectionEnd != utf8_selection_end || buf_dirty) { state->Stb.select_end = (callback_data.SelectionEnd == callback_data.SelectionStart) ? state->Stb.select_start : ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.SelectionEnd); }
4378 if (buf_dirty)
4379 {
4380 IM_ASSERT(callback_data.BufTextLen == (int)strlen(callback_data.Buf)); // You need to maintain BufTextLen if you change the text!
4381 if (callback_data.BufTextLen > backup_current_text_length && is_resizable)
4382 state->TextW.resize(state->TextW.Size + (callback_data.BufTextLen - backup_current_text_length));
4383 state->CurLenW = ImTextStrFromUtf8(state->TextW.Data, state->TextW.Size, callback_data.Buf, NULL);
4384 state->CurLenA = callback_data.BufTextLen; // Assume correct length and valid UTF-8 from user, saves us an extra strlen()
4385 state->CursorAnimReset();
4386 }
4387 }
4388 }
4389
4390 // Will copy result string if modified
4391 if (!is_readonly && strcmp(state->TextA.Data, buf) != 0)
4392 {
4393 apply_new_text = state->TextA.Data;
4394 apply_new_text_length = state->CurLenA;
4395 }
4396 }
4397
4398 // Copy result to user buffer
4399 if (apply_new_text)
4400 {
4401 // We cannot test for 'backup_current_text_length != apply_new_text_length' here because we have no guarantee that the size
4402 // of our owned buffer matches the size of the string object held by the user, and by design we allow InputText() to be used
4403 // without any storage on user's side.
4404 IM_ASSERT(apply_new_text_length >= 0);
4405 if (is_resizable)
4406 {
4407 ImGuiInputTextCallbackData callback_data;
4409 callback_data.Flags = flags;
4410 callback_data.Buf = buf;
4411 callback_data.BufTextLen = apply_new_text_length;
4412 callback_data.BufSize = ImMax(buf_size, apply_new_text_length + 1);
4413 callback_data.UserData = callback_user_data;
4414 callback(&callback_data);
4415 buf = callback_data.Buf;
4416 buf_size = callback_data.BufSize;
4417 apply_new_text_length = ImMin(callback_data.BufTextLen, buf_size - 1);
4418 IM_ASSERT(apply_new_text_length <= buf_size);
4419 }
4420 //IMGUI_DEBUG_LOG("InputText(\"%s\"): apply_new_text length %d\n", label, apply_new_text_length);
4421
4422 // If the underlying buffer resize was denied or not carried to the next frame, apply_new_text_length+1 may be >= buf_size.
4423 ImStrncpy(buf, apply_new_text, ImMin(apply_new_text_length + 1, buf_size));
4424 value_changed = true;
4425 }
4426
4427 // Clear temporary user storage
4429 state->UserCallback = NULL;
4430 state->UserCallbackData = NULL;
4431 }
4432
4433 // Release active ID at the end of the function (so e.g. pressing Return still does a final application of the value)
4434 if (clear_active_id && g.ActiveId == id)
4435 ClearActiveID();
4436
4437 // Render frame
4438 if (!is_multiline)
4439 {
4440 RenderNavHighlight(frame_bb, id);
4441 RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
4442 }
4443
4444 const ImVec4 clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + inner_size.x, frame_bb.Min.y + inner_size.y); // Not using frame_bb.Max because we have adjusted size
4445 ImVec2 draw_pos = is_multiline ? draw_window->DC.CursorPos : frame_bb.Min + style.FramePadding;
4446 ImVec2 text_size(0.0f, 0.0f);
4447
4448 // Set upper limit of single-line InputTextEx() at 2 million characters strings. The current pathological worst case is a long line
4449 // without any carriage return, which would makes ImFont::RenderText() reserve too many vertices and probably crash. Avoid it altogether.
4450 // Note that we only use this limit on single-line InputText(), so a pathologically large line on a InputTextMultiline() would still crash.
4451 const int buf_display_max_length = 2 * 1024 * 1024;
4452 const char* buf_display = buf_display_from_state ? state->TextA.Data : buf; //-V595
4453 const char* buf_display_end = NULL; // We have specialized paths below for setting the length
4454 if (is_displaying_hint)
4455 {
4456 buf_display = hint;
4457 buf_display_end = hint + strlen(hint);
4458 }
4459
4460 // Render text. We currently only render selection when the widget is active or while scrolling.
4461 // FIXME: We could remove the '&& render_cursor' to keep rendering selection when inactive.
4462 if (render_cursor || render_selection)
4463 {
4464 IM_ASSERT(state != NULL);
4465 if (!is_displaying_hint)
4466 buf_display_end = buf_display + state->CurLenA;
4467
4468 // Render text (with cursor and selection)
4469 // This is going to be messy. We need to:
4470 // - Display the text (this alone can be more easily clipped)
4471 // - Handle scrolling, highlight selection, display cursor (those all requires some form of 1d->2d cursor position calculation)
4472 // - Measure text height (for scrollbar)
4473 // We are attempting to do most of that in **one main pass** to minimize the computation cost (non-negligible for large amount of text) + 2nd pass for selection rendering (we could merge them by an extra refactoring effort)
4474 // FIXME: This should occur on buf_display but we'd need to maintain cursor/select_start/select_end for UTF-8.
4475 const ImWchar* text_begin = state->TextW.Data;
4476 ImVec2 cursor_offset, select_start_offset;
4477
4478 {
4479 // Find lines numbers straddling 'cursor' (slot 0) and 'select_start' (slot 1) positions.
4480 const ImWchar* searches_input_ptr[2] = { NULL, NULL };
4481 int searches_result_line_no[2] = { -1000, -1000 };
4482 int searches_remaining = 0;
4483 if (render_cursor)
4484 {
4485 searches_input_ptr[0] = text_begin + state->Stb.cursor;
4486 searches_result_line_no[0] = -1;
4487 searches_remaining++;
4488 }
4489 if (render_selection)
4490 {
4491 searches_input_ptr[1] = text_begin + ImMin(state->Stb.select_start, state->Stb.select_end);
4492 searches_result_line_no[1] = -1;
4493 searches_remaining++;
4494 }
4495
4496 // Iterate all lines to find our line numbers
4497 // In multi-line mode, we never exit the loop until all lines are counted, so add one extra to the searches_remaining counter.
4498 searches_remaining += is_multiline ? 1 : 0;
4499 int line_count = 0;
4500 //for (const ImWchar* s = text_begin; (s = (const ImWchar*)wcschr((const wchar_t*)s, (wchar_t)'\n')) != NULL; s++) // FIXME-OPT: Could use this when wchar_t are 16-bit
4501 for (const ImWchar* s = text_begin; *s != 0; s++)
4502 if (*s == '\n')
4503 {
4504 line_count++;
4505 if (searches_result_line_no[0] == -1 && s >= searches_input_ptr[0]) { searches_result_line_no[0] = line_count; if (--searches_remaining <= 0) break; }
4506 if (searches_result_line_no[1] == -1 && s >= searches_input_ptr[1]) { searches_result_line_no[1] = line_count; if (--searches_remaining <= 0) break; }
4507 }
4508 line_count++;
4509 if (searches_result_line_no[0] == -1)
4510 searches_result_line_no[0] = line_count;
4511 if (searches_result_line_no[1] == -1)
4512 searches_result_line_no[1] = line_count;
4513
4514 // Calculate 2d position by finding the beginning of the line and measuring distance
4515 cursor_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[0], text_begin), searches_input_ptr[0]).x;
4516 cursor_offset.y = searches_result_line_no[0] * g.FontSize;
4517 if (searches_result_line_no[1] >= 0)
4518 {
4519 select_start_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[1], text_begin), searches_input_ptr[1]).x;
4520 select_start_offset.y = searches_result_line_no[1] * g.FontSize;
4521 }
4522
4523 // Store text height (note that we haven't calculated text width at all, see GitHub issues #383, #1224)
4524 if (is_multiline)
4525 text_size = ImVec2(inner_size.x, line_count * g.FontSize);
4526 }
4527
4528 // Scroll
4529 if (render_cursor && state->CursorFollow)
4530 {
4531 // Horizontal scroll in chunks of quarter width
4533 {
4534 const float scroll_increment_x = inner_size.x * 0.25f;
4535 const float visible_width = inner_size.x - style.FramePadding.x;
4536 if (cursor_offset.x < state->ScrollX)
4537 state->ScrollX = IM_FLOOR(ImMax(0.0f, cursor_offset.x - scroll_increment_x));
4538 else if (cursor_offset.x - visible_width >= state->ScrollX)
4539 state->ScrollX = IM_FLOOR(cursor_offset.x - visible_width + scroll_increment_x);
4540 }
4541 else
4542 {
4543 state->ScrollX = 0.0f;
4544 }
4545
4546 // Vertical scroll
4547 if (is_multiline)
4548 {
4549 // Test if cursor is vertically visible
4550 if (cursor_offset.y - g.FontSize < scroll_y)
4551 scroll_y = ImMax(0.0f, cursor_offset.y - g.FontSize);
4552 else if (cursor_offset.y - inner_size.y >= scroll_y)
4553 scroll_y = cursor_offset.y - inner_size.y + style.FramePadding.y * 2.0f;
4554 const float scroll_max_y = ImMax((text_size.y + style.FramePadding.y * 2.0f) - inner_size.y, 0.0f);
4555 scroll_y = ImClamp(scroll_y, 0.0f, scroll_max_y);
4556 draw_pos.y += (draw_window->Scroll.y - scroll_y); // Manipulate cursor pos immediately avoid a frame of lag
4557 draw_window->Scroll.y = scroll_y;
4558 }
4559
4560 state->CursorFollow = false;
4561 }
4562
4563 // Draw selection
4564 const ImVec2 draw_scroll = ImVec2(state->ScrollX, 0.0f);
4565 if (render_selection)
4566 {
4567 const ImWchar* text_selected_begin = text_begin + ImMin(state->Stb.select_start, state->Stb.select_end);
4568 const ImWchar* text_selected_end = text_begin + ImMax(state->Stb.select_start, state->Stb.select_end);
4569
4570 ImU32 bg_color = GetColorU32(ImGuiCol_TextSelectedBg, render_cursor ? 1.0f : 0.6f); // FIXME: current code flow mandate that render_cursor is always true here, we are leaving the transparent one for tests.
4571 float bg_offy_up = is_multiline ? 0.0f : -1.0f; // FIXME: those offsets should be part of the style? they don't play so well with multi-line selection.
4572 float bg_offy_dn = is_multiline ? 0.0f : 2.0f;
4573 ImVec2 rect_pos = draw_pos + select_start_offset - draw_scroll;
4574 for (const ImWchar* p = text_selected_begin; p < text_selected_end; )
4575 {
4576 if (rect_pos.y > clip_rect.w + g.FontSize)
4577 break;
4578 if (rect_pos.y < clip_rect.y)
4579 {
4580 //p = (const ImWchar*)wmemchr((const wchar_t*)p, '\n', text_selected_end - p); // FIXME-OPT: Could use this when wchar_t are 16-bit
4581 //p = p ? p + 1 : text_selected_end;
4582 while (p < text_selected_end)
4583 if (*p++ == '\n')
4584 break;
4585 }
4586 else
4587 {
4588 ImVec2 rect_size = InputTextCalcTextSizeW(p, text_selected_end, &p, NULL, true);
4589 if (rect_size.x <= 0.0f) rect_size.x = IM_FLOOR(g.Font->GetCharAdvance((ImWchar)' ') * 0.50f); // So we can see selected empty lines
4590 ImRect rect(rect_pos + ImVec2(0.0f, bg_offy_up - g.FontSize), rect_pos + ImVec2(rect_size.x, bg_offy_dn));
4591 rect.ClipWith(clip_rect);
4592 if (rect.Overlaps(clip_rect))
4593 draw_window->DrawList->AddRectFilled(rect.Min, rect.Max, bg_color);
4594 }
4595 rect_pos.x = draw_pos.x - draw_scroll.x;
4596 rect_pos.y += g.FontSize;
4597 }
4598 }
4599
4600 // We test for 'buf_display_max_length' as a way to avoid some pathological cases (e.g. single-line 1 MB string) which would make ImDrawList crash.
4601 if (is_multiline || (buf_display_end - buf_display) < buf_display_max_length)
4602 {
4603 ImU32 col = GetColorU32(is_displaying_hint ? ImGuiCol_TextDisabled : ImGuiCol_Text);
4604 draw_window->DrawList->AddText(g.Font, g.FontSize, draw_pos - draw_scroll, col, buf_display, buf_display_end, 0.0f, is_multiline ? NULL : &clip_rect);
4605 }
4606
4607 // Draw blinking cursor
4608 if (render_cursor)
4609 {
4610 state->CursorAnim += io.DeltaTime;
4611 bool cursor_is_visible = (!g.IO.ConfigInputTextCursorBlink) || (state->CursorAnim <= 0.0f) || ImFmod(state->CursorAnim, 1.20f) <= 0.80f;
4612 ImVec2 cursor_screen_pos = ImFloor(draw_pos + cursor_offset - draw_scroll);
4613 ImRect cursor_screen_rect(cursor_screen_pos.x, cursor_screen_pos.y - g.FontSize + 0.5f, cursor_screen_pos.x + 1.0f, cursor_screen_pos.y - 1.5f);
4614 if (cursor_is_visible && cursor_screen_rect.Overlaps(clip_rect))
4615 draw_window->DrawList->AddLine(cursor_screen_rect.Min, cursor_screen_rect.GetBL(), GetColorU32(ImGuiCol_Text));
4616
4617 // Notify OS of text input position for advanced IME (-1 x offset so that Windows IME can cover our cursor. Bit of an extra nicety.)
4618 if (!is_readonly)
4619 g.PlatformImePos = ImVec2(cursor_screen_pos.x - 1.0f, cursor_screen_pos.y - g.FontSize);
4620 }
4621 }
4622 else
4623 {
4624 // Render text only (no selection, no cursor)
4625 if (is_multiline)
4626 text_size = ImVec2(inner_size.x, InputTextCalcTextLenAndLineCount(buf_display, &buf_display_end) * g.FontSize); // We don't need width
4627 else if (!is_displaying_hint && g.ActiveId == id)
4628 buf_display_end = buf_display + state->CurLenA;
4629 else if (!is_displaying_hint)
4630 buf_display_end = buf_display + strlen(buf_display);
4631
4632 if (is_multiline || (buf_display_end - buf_display) < buf_display_max_length)
4633 {
4634 ImU32 col = GetColorU32(is_displaying_hint ? ImGuiCol_TextDisabled : ImGuiCol_Text);
4635 draw_window->DrawList->AddText(g.Font, g.FontSize, draw_pos, col, buf_display, buf_display_end, 0.0f, is_multiline ? NULL : &clip_rect);
4636 }
4637 }
4638
4639 if (is_password && !is_displaying_hint)
4640 PopFont();
4641
4642 if (is_multiline)
4643 {
4644 Dummy(ImVec2(text_size.x, text_size.y + style.FramePadding.y));
4645 EndChild();
4646 EndGroup();
4647 }
4648
4649 // Log as text
4650 if (g.LogEnabled && (!is_password || is_displaying_hint))
4651 {
4652 LogSetNextTextDecoration("{", "}");
4653 LogRenderedText(&draw_pos, buf_display, buf_display_end);
4654 }
4655
4656 if (label_size.x > 0)
4657 RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
4658
4659 if (value_changed && !(flags & ImGuiInputTextFlags_NoMarkEdited))
4660 MarkItemEdited(id);
4661
4663 if ((flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0)
4664 return enter_pressed;
4665 else
4666 return value_changed;
4667}
static double scroll_y
Definition Viewer.cpp:51
int ImTextCharFromUtf8(unsigned int *out_char, const char *in_text, const char *in_text_end)
Definition imgui.cpp:1619
const ImWchar * ImStrbolW(const ImWchar *buf_mid_line, const ImWchar *buf_begin)
Definition imgui.cpp:1365
int ImTextStrToUtf8(char *buf, int buf_size, const ImWchar *in_text, const ImWchar *in_text_end)
Definition imgui.cpp:1755
int ImTextCountUtf8BytesFromStr(const ImWchar *in_text, const ImWchar *in_text_end)
Definition imgui.cpp:1771
int ImTextCountCharsFromUtf8(const char *in_text, const char *in_text_end)
Definition imgui.cpp:1689
int ImTextStrFromUtf8(ImWchar *buf, int buf_size, const char *in_text, const char *in_text_end, const char **in_text_remaining)
Definition imgui.cpp:1671
void ImStrncpy(char *dst, const char *src, size_t count)
Definition imgui.cpp:1314
float AdvanceX
Definition imgui.h:2528
int ImGuiKey
Definition imgui.h:171
@ ImGuiNavInput_COUNT
Definition imgui.h:1380
@ ImGuiNavInput_Cancel
Definition imgui.h:1357
ImWchar16 ImWchar
Definition imgui.h:220
@ ImGuiMouseCursor_TextInput
Definition imgui.h:1598
#define IM_ALLOC(_SIZE)
Definition imgui.h:1634
@ ImGuiKey_PageUp
Definition imgui.h:1319
@ ImGuiKey_RightArrow
Definition imgui.h:1316
@ ImGuiKey_Delete
Definition imgui.h:1324
@ ImGuiKey_Escape
Definition imgui.h:1328
@ ImGuiKey_DownArrow
Definition imgui.h:1318
@ ImGuiKey_Home
Definition imgui.h:1321
@ ImGuiKey_Z
Definition imgui.h:1335
@ ImGuiKey_Insert
Definition imgui.h:1323
@ ImGuiKey_Y
Definition imgui.h:1334
@ ImGuiKey_Tab
Definition imgui.h:1314
@ ImGuiKey_A
Definition imgui.h:1330
@ ImGuiKey_C
Definition imgui.h:1331
@ ImGuiKey_PageDown
Definition imgui.h:1320
@ ImGuiKey_X
Definition imgui.h:1333
@ ImGuiKey_UpArrow
Definition imgui.h:1317
@ ImGuiKey_KeyPadEnter
Definition imgui.h:1329
@ ImGuiKey_LeftArrow
Definition imgui.h:1315
@ ImGuiKey_End
Definition imgui.h:1322
@ ImGuiKey_V
Definition imgui.h:1332
@ ImGuiKey_Enter
Definition imgui.h:1327
@ ImGuiKey_Backspace
Definition imgui.h:1325
@ ImGuiInputTextFlags_None
Definition imgui.h:955
@ ImGuiInputTextFlags_CallbackHistory
Definition imgui.h:963
@ ImGuiInputTextFlags_NoUndoRedo
Definition imgui.h:972
@ ImGuiInputTextFlags_NoHorizontalScroll
Definition imgui.h:968
@ ImGuiInputTextFlags_AllowTabInput
Definition imgui.h:966
@ ImGuiInputTextFlags_CallbackCompletion
Definition imgui.h:962
@ ImGuiInputTextFlags_Password
Definition imgui.h:971
@ ImGuiInputTextFlags_CtrlEnterForNewLine
Definition imgui.h:967
@ ImGuiInputTextFlags_EnterReturnsTrue
Definition imgui.h:961
@ ImGuiInputTextFlags_AlwaysOverwrite
Definition imgui.h:969
@ ImGuiInputTextFlags_CallbackEdit
Definition imgui.h:975
@ ImGuiInputTextFlags_CallbackAlways
Definition imgui.h:964
int ImGuiInputTextFlags
Definition imgui.h:189
Definition imgui.h:2524
@ ImGuiInputTextFlags_MergedItem
Definition imgui_internal.h:772
@ ImGuiItemStatusFlags_FocusedByCode
Definition imgui_internal.h:753
@ ImGuiItemStatusFlags_FocusedByTabbing
Definition imgui_internal.h:754
@ ImGuiInputSource_Clipboard
Definition imgui_internal.h:882
@ ImGuiInputSource_Keyboard
Definition imgui_internal.h:879
#define STB_TEXTEDIT_K_DOWN
Definition imgui_widgets.cpp:3669
#define STB_TEXTEDIT_K_DELETE
Definition imgui_widgets.cpp:3674
#define STB_TEXTEDIT_K_RIGHT
Definition imgui_widgets.cpp:3667
#define STB_TEXTEDIT_K_SHIFT
Definition imgui_widgets.cpp:3682
#define STB_TEXTEDIT_K_REDO
Definition imgui_widgets.cpp:3677
#define STB_TEXTEDIT_K_BACKSPACE
Definition imgui_widgets.cpp:3675
#define STB_TEXTEDIT_K_WORDRIGHT
Definition imgui_widgets.cpp:3679
#define STB_TEXTEDIT_K_UP
Definition imgui_widgets.cpp:3668
static int InputTextCalcTextLenAndLineCount(const char *text_begin, const char **out_text_end)
Definition imgui_widgets.cpp:3523
#define STB_TEXTEDIT_K_TEXTEND
Definition imgui_widgets.cpp:3673
#define STB_TEXTEDIT_K_LINEEND
Definition imgui_widgets.cpp:3671
#define STB_TEXTEDIT_K_UNDO
Definition imgui_widgets.cpp:3676
#define STB_TEXTEDIT_K_LEFT
Definition imgui_widgets.cpp:3666
#define STB_TEXTEDIT_K_PGUP
Definition imgui_widgets.cpp:3680
#define STB_TEXTEDIT_K_WORDLEFT
Definition imgui_widgets.cpp:3678
static ImVec2 InputTextCalcTextSizeW(const ImWchar *text_begin, const ImWchar *text_end, const ImWchar **remaining=NULL, ImVec2 *out_offset=NULL, bool stop_on_new_line=false)
Definition imgui_widgets.cpp:3537
#define STB_TEXTEDIT_K_TEXTSTART
Definition imgui_widgets.cpp:3672
#define STB_TEXTEDIT_K_LINESTART
Definition imgui_widgets.cpp:3670
static bool InputTextFilterCharacter(unsigned int *p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void *user_data, ImGuiInputSource input_source)
Definition imgui_widgets.cpp:3772
#define STB_TEXTEDIT_K_PGDOWN
Definition imgui_widgets.cpp:3681
IMGUI_API const char * GetClipboardText()
Definition imgui.cpp:3341
IMGUI_API void MemFree(void *ptr)
Definition imgui.cpp:3333
IMGUI_API void SetScrollY(float scroll_y)
Definition imgui.cpp:7932
IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow *window, ImGuiAxis axis)
Definition imgui_widgets.cpp:855
IMGUI_API void Dummy(const ImVec2 &size)
Definition imgui_widgets.cpp:1320
ImGuiInputTextState * GetInputTextState(ImGuiID id)
Definition imgui_internal.h:2592
bool IsKeyPressedMap(ImGuiKey key, bool repeat=true)
Definition imgui_internal.h:2428
IMGUI_API float GetScrollMaxY()
Definition imgui.cpp:7906
IMGUI_API void PushFont(ImFont *font)
Definition imgui.cpp:6532
IMGUI_API void PopFont()
Definition imgui.cpp:6542
static void stb_textedit_replace(ImGuiInputTextState *str, STB_TexteditState *state, const STB_TEXTEDIT_CHARTYPE *text, int text_len)
Definition imgui_widgets.cpp:3689
ImVector< ImWchar > IndexLookup
Definition imgui.h:2697
const ImFontGlyph * FallbackGlyph
Definition imgui.h:2699
ImVector< ImFontGlyph > Glyphs
Definition imgui.h:2698
float FontSize
Definition imgui.h:2694
float Ascent
Definition imgui.h:2709
float Descent
Definition imgui.h:2709
IMGUI_API const ImFontGlyph * FindGlyph(ImWchar c) const
Definition imgui_draw.cpp:3283
float FallbackAdvanceX
Definition imgui.h:2693
float GetCharAdvance(ImWchar c) const
Definition imgui.h:2718
float Scale
Definition imgui.h:2708
ImVector< float > IndexAdvanceX
Definition imgui.h:2692
ImGuiInputSource NavInputSource
Definition imgui_internal.h:1452
ImFont InputTextPasswordFont
Definition imgui_internal.h:1535
int WantTextInputNextFrame
Definition imgui_internal.h:1593
void(* SetClipboardTextFn)(void *user_data, const char *text)
Definition imgui.h:1825
bool ConfigMacOSXBehaviors
Definition imgui.h:1803
bool ConfigInputTextCursorBlink
Definition imgui.h:1804
Definition imgui.h:1917
int BufSize
Definition imgui.h:1929
ImGuiKey EventKey
Definition imgui.h:1926
int CursorPos
Definition imgui.h:1931
int SelectionEnd
Definition imgui.h:1933
ImGuiInputTextFlags EventFlag
Definition imgui.h:1918
int SelectionStart
Definition imgui.h:1932
bool BufDirty
Definition imgui.h:1930
int BufTextLen
Definition imgui.h:1928
ImGuiInputTextFlags Flags
Definition imgui.h:1919
char * Buf
Definition imgui.h:1927
void * UserData
Definition imgui.h:1920
Definition imgui_internal.h:1018
void CursorClamp()
Definition imgui_internal.h:1045
int BufCapacityA
Definition imgui_internal.h:1025
void OnKeyPressed(int key)
Definition imgui_widgets.cpp:3706
ImGuiInputTextFlags Flags
Definition imgui_internal.h:1032
bool SelectedAllMouseLock
Definition imgui_internal.h:1030
ImGuiInputTextCallback UserCallback
Definition imgui_internal.h:1033
void * UserCallbackData
Definition imgui_internal.h:1034
int CurLenW
Definition imgui_internal.h:1020
ImStb::STB_TexteditState Stb
Definition imgui_internal.h:1027
float ScrollX
Definition imgui_internal.h:1026
void CursorAnimReset()
Definition imgui_internal.h:1044
bool CursorFollow
Definition imgui_internal.h:1029
float CursorAnim
Definition imgui_internal.h:1028
void ClearSelection()
Definition imgui_internal.h:1047
bool HasSelection() const
Definition imgui_internal.h:1046
int CurLenA
Definition imgui_internal.h:1020
ImVector< char > TextA
Definition imgui_internal.h:1022
void SelectAll()
Definition imgui_internal.h:1048
bool TextAIsValid
Definition imgui_internal.h:1024
ImVector< ImWchar > TextW
Definition imgui_internal.h:1021
bool Edited
Definition imgui_internal.h:1031
Definition imgui.h:1654

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdAllowOverlap, ImGuiContext::ActiveIdIsJustActivated, ImGuiContext::ActiveIdPreviousFrame, ImGuiContext::ActiveIdUsingKeyInputMask, ImGuiContext::ActiveIdUsingNavDirMask, ImGuiContext::ActiveIdUsingNavInputMask, ImDrawList::AddLine(), ImDrawList::AddRectFilled(), ImDrawList::AddText(), ImFontGlyph::AdvanceX, ImFont::Ascent, BeginChildEx(), BeginGroup(), ImGuiInputTextCallbackData::Buf, ImGuiInputTextState::BufCapacityA, ImGuiInputTextCallbackData::BufDirty, ImGuiInputTextCallbackData::BufSize, ImGuiInputTextCallbackData::BufTextLen, CalcItemSize(), CalcItemWidth(), CalcTextSize(), ClearActiveID(), ImGuiInputTextState::ClearSelection(), ImRect::ClipWith(), col(), ImGuiIO::ConfigInputTextCursorBlink, ImGuiIO::ConfigMacOSXBehaviors, ImFont::ContainerAtlas, ImVector< T >::contains(), ImGuiInputTextState::CurLenA, ImGuiInputTextState::CurLenW, ImGuiContext::CurrentWindow, ImGuiInputTextState::CursorAnim, ImGuiInputTextState::CursorAnimReset(), ImGuiInputTextState::CursorClamp(), ImGuiInputTextState::CursorFollow, ImGuiInputTextCallbackData::CursorPos, ImGuiWindowTempData::CursorPos, ImVector< T >::Data, ImGuiWindow::DC, ImGuiIO::DeltaTime, ImFont::Descent, ImGuiWindow::DrawList, Dummy(), ImGuiInputTextState::Edited, ImVector< T >::empty(), EndChild(), EndGroup(), ImGuiInputTextCallbackData::EventFlag, ImGuiInputTextCallbackData::EventKey, ImFont::FallbackAdvanceX, ImFont::FallbackGlyph, ImFont::FindGlyph(), ImGuiInputTextCallbackData::Flags, ImGuiInputTextState::Flags, FocusWindow(), ImGuiContext::Font, ImFont::FontSize, ImGuiContext::FontSize, ImRect::GetBL(), ImFont::GetCharAdvance(), GetClipboardText(), GetColorU32(), GetCurrentWindow(), ImGuiWindow::GetID(), GetInputTextState(), GetMergedKeyModFlags(), GetScrollMaxY(), ImRect::GetSize(), GetWindowScrollbarID(), GImGui, ImFont::Glyphs, ImGuiInputTextState::HasSelection(), ImGuiInputTextState::ID, IM_ALLOC, IM_ASSERT, IM_FLOOR, ImClamp(), ImFloor(), ImFmod, IMGUI_TEST_ENGINE_ITEM_INFO, ImGuiAxis_Y, ImGuiCol_ChildBg, ImGuiCol_FrameBg, ImGuiCol_Text, ImGuiCol_TextDisabled, ImGuiCol_TextSelectedBg, ImGuiDir_Down, ImGuiDir_Left, ImGuiDir_Right, ImGuiDir_Up, ImGuiInputSource_Clipboard, ImGuiInputSource_Keyboard, ImGuiInputTextFlags_AllowTabInput, ImGuiInputTextFlags_AlwaysOverwrite, ImGuiInputTextFlags_AutoSelectAll, ImGuiInputTextFlags_CallbackAlways, ImGuiInputTextFlags_CallbackCompletion, ImGuiInputTextFlags_CallbackEdit, ImGuiInputTextFlags_CallbackHistory, ImGuiInputTextFlags_CallbackResize, ImGuiInputTextFlags_CtrlEnterForNewLine, ImGuiInputTextFlags_EnterReturnsTrue, ImGuiInputTextFlags_MergedItem, ImGuiInputTextFlags_Multiline, ImGuiInputTextFlags_NoHorizontalScroll, ImGuiInputTextFlags_NoMarkEdited, ImGuiInputTextFlags_None, ImGuiInputTextFlags_NoUndoRedo, ImGuiInputTextFlags_Password, ImGuiInputTextFlags_ReadOnly, ImGuiItemAddFlags_Focusable, ImGuiItemStatusFlags_FocusedByCode, ImGuiItemStatusFlags_FocusedByTabbing, ImGuiKey_A, ImGuiKey_Backspace, ImGuiKey_C, ImGuiKey_COUNT, ImGuiKey_Delete, ImGuiKey_DownArrow, ImGuiKey_End, ImGuiKey_Enter, ImGuiKey_Escape, ImGuiKey_Home, ImGuiKey_Insert, ImGuiKey_KeyPadEnter, ImGuiKey_LeftArrow, ImGuiKey_PageDown, ImGuiKey_PageUp, ImGuiKey_RightArrow, ImGuiKey_Tab, ImGuiKey_UpArrow, ImGuiKey_V, ImGuiKey_X, ImGuiKey_Y, ImGuiKey_Z, ImGuiKeyModFlags_Ctrl, ImGuiKeyModFlags_Shift, ImGuiKeyModFlags_Super, ImGuiMouseCursor_TextInput, ImGuiNavInput_Cancel, ImGuiNavInput_COUNT, ImGuiStyleVar_ChildBorderSize, ImGuiStyleVar_ChildRounding, ImGuiWindowFlags_NoMove, ImMax(), ImMin(), ImStrbolW(), ImStrncpy(), ImTextCharFromUtf8(), ImTextCountCharsFromUtf8(), ImTextCountUtf8BytesFromStr(), ImTextStrFromUtf8(), ImTextStrToUtf8(), ImFont::IndexAdvanceX, ImFont::IndexLookup, ImGuiInputTextState::InitialTextA, ImGuiIO::InputQueueCharacters, InputTextCalcTextLenAndLineCount(), InputTextCalcTextSizeW(), InputTextFilterCharacter(), ImGuiContext::InputTextPasswordFont, ImGuiContext::InputTextState, ImGuiContext::IO, IsKeyPressedMap(), ItemAdd(), ItemHoverable(), ItemSize(), ImGuiIO::KeyAlt, ImGuiIO::KeyCtrl, ImGuiIO::KeyMods, ImGuiIO::KeyShift, ImGuiIO::KeySuper, ImGuiWindowTempData::LastItemStatusFlags, ImGuiContext::LogEnabled, LogRenderedText(), LogSetNextTextDecoration(), MarkItemEdited(), ImRect::Max, MemFree(), ImRect::Min, ImGuiIO::MouseClicked, ImGuiContext::MouseCursor, ImGuiIO::MouseDelta, ImGuiIO::MouseDoubleClicked, ImGuiIO::MouseDown, ImGuiIO::MousePos, ImGuiContext::NavActivateId, ImGuiContext::NavInputId, ImGuiContext::NavInputSource, ImGuiWindowTempData::NavLayerCurrent, ImGuiWindowTempData::NavLayersActiveMaskNext, ImGuiInputTextState::OnKeyPressed(), ImRect::Overlaps(), ImGuiContext::PlatformImePos, PopFont(), PopStyleColor(), PopStyleVar(), PushFont(), PushStyleColor(), PushStyleVar(), RenderFrame(), RenderNavHighlight(), RenderText(), ImVector< T >::resize(), ImFont::Scale, ImGuiWindow::Scroll, scroll_y, ImGuiWindow::ScrollbarSizes, ImGuiInputTextState::ScrollX, ImGuiInputTextState::SelectAll(), ImGuiInputTextState::SelectedAllMouseLock, ImGuiInputTextCallbackData::SelectionEnd, ImGuiInputTextCallbackData::SelectionStart, SetActiveID(), SetClipboardText(), ImGuiIO::SetClipboardTextFn, SetFocusID(), SetScrollY(), ImVector< T >::Size, ImGuiWindow::SkipItems, ImGuiInputTextState::Stb, STB_TEXTEDIT_K_BACKSPACE, STB_TEXTEDIT_K_DELETE, STB_TEXTEDIT_K_DOWN, STB_TEXTEDIT_K_LEFT, STB_TEXTEDIT_K_LINEEND, STB_TEXTEDIT_K_LINESTART, STB_TEXTEDIT_K_PGDOWN, STB_TEXTEDIT_K_PGUP, STB_TEXTEDIT_K_REDO, STB_TEXTEDIT_K_RIGHT, STB_TEXTEDIT_K_SHIFT, STB_TEXTEDIT_K_TEXTEND, STB_TEXTEDIT_K_TEXTSTART, STB_TEXTEDIT_K_UNDO, STB_TEXTEDIT_K_UP, STB_TEXTEDIT_K_WORDLEFT, STB_TEXTEDIT_K_WORDRIGHT, ImGuiContext::Style, style, ImGuiInputTextState::TextA, ImGuiInputTextState::TextAIsValid, ImGuiInputTextState::TextW, ImGuiInputTextState::UserCallback, ImGuiInputTextState::UserCallbackData, ImGuiInputTextCallbackData::UserData, ImVec4::w, ImGuiContext::WantTextInputNextFrame, ImVec2::x, ImVec2::y, and ImVec4::y.

Referenced by InputText(), InputTextMultiline(), InputTextWithHint(), Slic3r::GUI::ImGuiWrapper::search_list(), and TempInputText().

+ Here is the caller graph for this function:

◆ InputTextMultiline() [1/2]

bool ImGui::InputTextMultiline ( const char *  label,
char *  buf,
size_t  buf_size,
const ImVec2 size = ImVec2(0, 0),
ImGuiInputTextFlags  flags = 0,
ImGuiInputTextCallback  callback = NULL,
void user_data = NULL 
)
3513{
3514 return InputTextEx(label, NULL, buf, (int)buf_size, size, flags | ImGuiInputTextFlags_Multiline, callback, user_data);
3515}

References ImGuiInputTextFlags_Multiline, and InputTextEx().

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_text_input(), InputTextMultiline(), ShowDemoWindowWidgets(), and ShowMetricsWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InputTextMultiline() [2/2]

bool ImGui::InputTextMultiline ( const char *  label,
std::string *  str,
const ImVec2 size = ImVec2(0, 0),
ImGuiInputTextFlags  flags = 0,
ImGuiInputTextCallback  callback = NULL,
void user_data = NULL 
)
55{
58
59 InputTextCallback_UserData cb_user_data;
60 cb_user_data.Str = str;
61 cb_user_data.ChainCallback = callback;
62 cb_user_data.ChainCallbackUserData = user_data;
63 return InputTextMultiline(label, (char*)str->c_str(), str->capacity() + 1, size, flags, InputTextCallback, &cb_user_data);
64}
IMGUI_API bool InputTextMultiline(const char *label, char *buf, size_t buf_size, const ImVec2 &size=ImVec2(0, 0), ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=NULL, void *user_data=NULL)
Definition imgui_widgets.cpp:3512

References InputTextCallback_UserData::ChainCallback, InputTextCallback_UserData::ChainCallbackUserData, IM_ASSERT, ImGuiInputTextFlags_CallbackResize, InputTextCallback(), InputTextMultiline(), and InputTextCallback_UserData::Str.

+ Here is the call graph for this function:

◆ InputTextWithHint() [1/2]

bool ImGui::InputTextWithHint ( const char *  label,
const char *  hint,
char *  buf,
size_t  buf_size,
ImGuiInputTextFlags  flags = 0,
ImGuiInputTextCallback  callback = NULL,
void user_data = NULL 
)
3518{
3519 IM_ASSERT(!(flags & ImGuiInputTextFlags_Multiline)); // call InputTextMultiline()
3520 return InputTextEx(label, hint, buf, (int)buf_size, ImVec2(0, 0), flags, callback, user_data);
3521}

References IM_ASSERT, ImGuiInputTextFlags_Multiline, and InputTextEx().

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_font_list(), InputTextWithHint(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InputTextWithHint() [2/2]

bool ImGui::InputTextWithHint ( const char *  label,
const char *  hint,
std::string *  str,
ImGuiInputTextFlags  flags = 0,
ImGuiInputTextCallback  callback = NULL,
void user_data = NULL 
)
67{
70
71 InputTextCallback_UserData cb_user_data;
72 cb_user_data.Str = str;
73 cb_user_data.ChainCallback = callback;
74 cb_user_data.ChainCallbackUserData = user_data;
75 return InputTextWithHint(label, hint, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data);
76}
IMGUI_API bool InputTextWithHint(const char *label, const char *hint, char *buf, size_t buf_size, ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=NULL, void *user_data=NULL)
Definition imgui_widgets.cpp:3517

References InputTextCallback_UserData::ChainCallback, InputTextCallback_UserData::ChainCallbackUserData, IM_ASSERT, ImGuiInputTextFlags_CallbackResize, InputTextCallback(), InputTextWithHint(), and InputTextCallback_UserData::Str.

+ Here is the call graph for this function:

◆ InvisibleButton()

bool ImGui::InvisibleButton ( const char *  str_id,
const ImVec2 size,
ImGuiButtonFlags  flags = 0 
)
734{
735 ImGuiWindow* window = GetCurrentWindow();
736 if (window->SkipItems)
737 return false;
738
739 // Cannot use zero-size for InvisibleButton(). Unlike Button() there is not way to fallback using the label size.
740 IM_ASSERT(size_arg.x != 0.0f && size_arg.y != 0.0f);
741
742 const ImGuiID id = window->GetID(str_id);
743 ImVec2 size = CalcItemSize(size_arg, 0.0f, 0.0f);
744 const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
745 ItemSize(size);
746 if (!ItemAdd(bb, id))
747 return false;
748
749 bool hovered, held;
750 bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
751
752 return pressed;
753}

References ButtonBehavior(), CalcItemSize(), ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetCurrentWindow(), ImGuiWindow::GetID(), IM_ASSERT, ItemAdd(), ItemSize(), ImGuiWindow::SkipItems, ImVec2::x, and ImVec2::y.

Referenced by ColorPicker4(), ShowDemoWindowLayout(), and ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsActiveIdUsingKey()

bool ImGui::IsActiveIdUsingKey ( ImGuiKey  key)
inline
2426{ ImGuiContext& g = *GImGui; IM_ASSERT(key < 64); return (g.ActiveIdUsingKeyInputMask & ((ImU64)1 << key)) != 0; }

References ImGuiContext::ActiveIdUsingKeyInputMask, GImGui, and IM_ASSERT.

Referenced by ItemFocusable(), and NavUpdatePageUpPageDown().

+ Here is the caller graph for this function:

◆ IsActiveIdUsingNavDir()

bool ImGui::IsActiveIdUsingNavDir ( ImGuiDir  dir)
inline
2424{ ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; }

References ImGuiContext::ActiveIdUsingNavDirMask, and GImGui.

Referenced by NavUpdate().

+ Here is the caller graph for this function:

◆ IsActiveIdUsingNavInput()

bool ImGui::IsActiveIdUsingNavInput ( ImGuiNavInput  input)
inline
2425{ ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavInputMask & (1 << input)) != 0; }
static int input(void)

References ImGuiContext::ActiveIdUsingNavInputMask, GImGui, and input().

Referenced by NavUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsAnyItemActive()

bool ImGui::IsAnyItemActive ( )
4906{
4907 ImGuiContext& g = *GImGui;
4908 return g.ActiveId != 0;
4909}

References ImGuiContext::ActiveId, and GImGui.

Referenced by Slic3r::GUI::ImGuiWrapper::search_list().

+ Here is the caller graph for this function:

◆ IsAnyItemFocused()

bool ImGui::IsAnyItemFocused ( )
4912{
4913 ImGuiContext& g = *GImGui;
4914 return g.NavId != 0 && !g.NavDisableHighlight;
4915}

References GImGui, ImGuiContext::NavDisableHighlight, and ImGuiContext::NavId.

Referenced by Slic3r::GUI::ImGuiWrapper::search_list().

+ Here is the caller graph for this function:

◆ IsAnyItemHovered()

bool ImGui::IsAnyItemHovered ( )
4900{
4901 ImGuiContext& g = *GImGui;
4902 return g.HoveredId != 0 || g.HoveredIdPreviousFrame != 0;
4903}

References GImGui, ImGuiContext::HoveredId, and ImGuiContext::HoveredIdPreviousFrame.

Referenced by BeginPopupContextWindow(), EndTable(), and ShowDemoWindowTables().

+ Here is the caller graph for this function:

◆ IsAnyMouseDown()

bool ImGui::IsAnyMouseDown ( )
4779{
4780 ImGuiContext& g = *GImGui;
4781 for (int n = 0; n < IM_ARRAYSIZE(g.IO.MouseDown); n++)
4782 if (g.IO.MouseDown[n])
4783 return true;
4784 return false;
4785}

References GImGui, IM_ARRAYSIZE, ImGuiContext::IO, and ImGuiIO::MouseDown.

◆ IsClippedEx()

bool ImGui::IsClippedEx ( const ImRect bb,
ImGuiID  id,
bool  clip_even_when_logged 
)
3235{
3236 ImGuiContext& g = *GImGui;
3237 ImGuiWindow* window = g.CurrentWindow;
3238 if (!bb.Overlaps(window->ClipRect))
3239 if (id == 0 || (id != g.ActiveId && id != g.NavId))
3240 if (clip_even_when_logged || !g.LogEnabled)
3241 return true;
3242 return false;
3243}
bool Overlaps(const ImRect &r) const
Definition imgui_internal.h:491

References ImGuiContext::ActiveId, ImGuiWindow::ClipRect, ImGuiContext::CurrentWindow, GImGui, ImGuiContext::LogEnabled, ImGuiContext::NavId, and ImRect::Overlaps().

Referenced by BeginTableEx(), EndColumns(), ItemAdd(), and TextEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsDragDropPayloadBeingAccepted()

bool ImGui::IsDragDropPayloadBeingAccepted ( )

◆ IsItemActivated()

bool ImGui::IsItemActivated ( )
4843{
4844 ImGuiContext& g = *GImGui;
4845 if (g.ActiveId)
4846 {
4847 ImGuiWindow* window = g.CurrentWindow;
4848 if (g.ActiveId == window->DC.LastItemId && g.ActiveIdPreviousFrame != window->DC.LastItemId)
4849 return true;
4850 }
4851 return false;
4852}

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdPreviousFrame, ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, and ImGuiWindowTempData::LastItemId.

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_font_list(), and ShowDemoWindowWidgets().

+ Here is the caller graph for this function:

◆ IsItemActive()

bool ImGui::IsItemActive ( )
4832{
4833 ImGuiContext& g = *GImGui;
4834 if (g.ActiveId)
4835 {
4836 ImGuiWindow* window = g.CurrentWindow;
4837 return g.ActiveId == window->DC.LastItemId;
4838 }
4839 return false;
4840}

References ImGuiContext::ActiveId, ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, and ImGuiWindowTempData::LastItemId.

Referenced by CollapseButton(), ColorPicker4(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), ShowDemoWindowLayout(), ShowDemoWindowMisc(), ShowDemoWindowWidgets(), ShowExampleAppCustomRendering(), and ShowStyleEditor().

+ Here is the caller graph for this function:

◆ IsItemClicked()

bool ImGui::IsItemClicked ( ImGuiMouseButton  mouse_button = 0)
4883{
4884 return IsMouseClicked(mouse_button) && IsItemHovered(ImGuiHoveredFlags_None);
4885}
@ ImGuiHoveredFlags_None
Definition imgui.h:1241

References ImGuiHoveredFlags_None, IsItemHovered(), and IsMouseClicked().

Referenced by Slic3r::GUI::clickable(), Slic3r::GUI::ImGuiWrapper::search_list(), ShowDemoWindowWidgets(), Slic3r::GUI::ImGuiWrapper::slider_float(), and Slic3r::GUI::ImGuiWrapper::undo_redo_list().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsItemDeactivated()

bool ImGui::IsItemDeactivated ( )
4855{
4856 ImGuiContext& g = *GImGui;
4857 ImGuiWindow* window = g.CurrentWindow;
4860 return (g.ActiveIdPreviousFrame == window->DC.LastItemId && g.ActiveIdPreviousFrame != 0 && g.ActiveId != window->DC.LastItemId);
4861}

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdPreviousFrame, ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, ImGuiItemStatusFlags_Deactivated, ImGuiItemStatusFlags_HasDeactivated, ImGuiWindowTempData::LastItemId, and ImGuiWindowTempData::LastItemStatusFlags.

Referenced by IsItemDeactivatedAfterEdit(), ShowDemoWindowTables(), and ShowDemoWindowWidgets().

+ Here is the caller graph for this function:

◆ IsItemDeactivatedAfterEdit()

bool ImGui::IsItemDeactivatedAfterEdit ( )
4864{
4865 ImGuiContext& g = *GImGui;
4867}
IMGUI_API bool IsItemDeactivated()
Definition imgui.cpp:4854
bool ActiveIdPreviousFrameHasBeenEditedBefore
Definition imgui_internal.h:1417
bool ActiveIdHasBeenEditedBefore
Definition imgui_internal.h:1405

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdHasBeenEditedBefore, ImGuiContext::ActiveIdPreviousFrameHasBeenEditedBefore, GImGui, and IsItemDeactivated().

Referenced by ShowDemoWindowWidgets(), and Slic3r::GUI::ImGuiWrapper::slider_float().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsItemEdited()

bool ImGui::IsItemEdited ( )
4924{
4926 return (window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_Edited) != 0;
4927}

References ImGuiWindow::DC, GetCurrentWindowRead(), ImGuiItemStatusFlags_Edited, and ImGuiWindowTempData::LastItemStatusFlags.

Referenced by Slic3r::GUI::ImGuiWrapper::search_list(), ShowDemoWindowWidgets(), and Slic3r::GUI::ImGuiWrapper::slider_float().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsItemFocused()

bool ImGui::IsItemFocused ( )
4871{
4872 ImGuiContext& g = *GImGui;
4873 ImGuiWindow* window = g.CurrentWindow;
4874
4875 if (g.NavId != window->DC.LastItemId || g.NavId == 0)
4876 return false;
4877 return true;
4878}

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, ImGuiWindowTempData::LastItemId, and ImGuiContext::NavId.

Referenced by IsItemHovered(), and ShowDemoWindowWidgets().

+ Here is the caller graph for this function:

◆ IsItemHovered()

bool ImGui::IsItemHovered ( ImGuiHoveredFlags  flags = 0)
3150{
3151 ImGuiContext& g = *GImGui;
3152 ImGuiWindow* window = g.CurrentWindow;
3154 return IsItemFocused();
3155
3156 // Test for bounding box overlap, as updated as ItemAdd()
3157 ImGuiItemStatusFlags status_flags = window->DC.LastItemStatusFlags;
3158 if (!(status_flags & ImGuiItemStatusFlags_HoveredRect))
3159 return false;
3160 IM_ASSERT((flags & (ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows)) == 0); // Flags not supported by this function
3161
3162 // Test if we are hovering the right window (our window could be behind another window)
3163 // [2021/03/02] Reworked / reverted the revert, finally. Note we want e.g. BeginGroup/ItemAdd/EndGroup to work as well. (#3851)
3164 // [2017/10/16] Reverted commit 344d48be3 and testing RootWindow instead. I believe it is correct to NOT test for RootWindow but this leaves us unable
3165 // to use IsItemHovered() after EndChild() itself. Until a solution is found I believe reverting to the test from 2017/09/27 is safe since this was
3166 // the test that has been running for a long while.
3167 if (g.HoveredWindow != window && (status_flags & ImGuiItemStatusFlags_HoveredWindow) == 0)
3168 if ((flags & ImGuiHoveredFlags_AllowWhenOverlapped) == 0)
3169 return false;
3170
3171 // Test if another item is active (e.g. being dragged)
3173 if (g.ActiveId != 0 && g.ActiveId != window->DC.LastItemId && !g.ActiveIdAllowOverlap && g.ActiveId != window->MoveId)
3174 return false;
3175
3176 // Test if interactions on this window are blocked by an active popup or modal.
3177 // The ImGuiHoveredFlags_AllowWhenBlockedByPopup flag will be tested here.
3178 if (!IsWindowContentHoverable(window, flags))
3179 return false;
3180
3181 // Test if the item is disabled
3183 return false;
3184
3185 // Special handling for calling after Begin() which represent the title bar or tab.
3186 // When the window is collapsed (SkipItems==true) that last item will never be overwritten so we need to detect the case.
3187 if (window->DC.LastItemId == window->MoveId && window->WriteAccessed)
3188 return false;
3189 return true;
3190}
static bool IsWindowContentHoverable(ImGuiWindow *window, ImGuiHoveredFlags flags)
Definition imgui.cpp:3127
@ ImGuiHoveredFlags_ChildWindows
Definition imgui.h:1242
@ ImGuiHoveredFlags_RootWindow
Definition imgui.h:1243
@ ImGuiHoveredFlags_AllowWhenOverlapped
Definition imgui.h:1248
@ ImGuiHoveredFlags_AllowWhenDisabled
Definition imgui.h:1249
@ ImGuiItemFlags_Disabled
Definition imgui_internal.h:725
int ImGuiItemStatusFlags
Definition imgui_internal.h:144
IMGUI_API bool IsItemFocused()
Definition imgui.cpp:4870

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdAllowOverlap, ImGuiContext::CurrentItemFlags, ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, ImGuiContext::HoveredWindow, IM_ASSERT, ImGuiHoveredFlags_AllowWhenBlockedByActiveItem, ImGuiHoveredFlags_AllowWhenDisabled, ImGuiHoveredFlags_AllowWhenOverlapped, ImGuiHoveredFlags_ChildWindows, ImGuiHoveredFlags_RootWindow, ImGuiItemFlags_Disabled, ImGuiItemStatusFlags_HoveredRect, ImGuiItemStatusFlags_HoveredWindow, IsItemFocused(), IsWindowContentHoverable(), ImGuiWindowTempData::LastItemId, ImGuiWindowTempData::LastItemStatusFlags, ImGuiWindow::MoveId, ImGuiContext::NavDisableHighlight, ImGuiContext::NavDisableMouseHover, and ImGuiWindow::WriteAccessed.

Referenced by Slic3r::GUI::GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(), BeginPopupContextItem(), Slic3r::GUI::ImGuiWrapper::button(), ButtonBehavior(), Slic3r::GUI::clickable(), DebugNodeDrawList(), DebugNodeTabBar(), DebugNodeTable(), DebugNodeWindow(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoEmboss::draw_bold_button(), Slic3r::GUI::GLGizmoEmboss::draw_delete_style_button(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), Slic3r::GUI::GLGizmoEmboss::draw_font_list_line(), Slic3r::GUI::GLGizmoEmboss::draw_italic_button(), Slic3r::GUI::GLGizmoEmboss::draw_model_type(), Slic3r::GUI::GLGizmoEmboss::draw_style_add_button(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), Slic3r::GUI::GLGizmoEmboss::draw_style_rename_button(), Slic3r::GUI::GLGizmoEmboss::draw_style_save_button(), Slic3r::GUI::GLGizmoEmboss::draw_text_input(), Slic3r::GUI::GLGizmoEmboss::draw_window(), EditTableSizingFlags(), HelpMarker(), Slic3r::GUI::ImGuiWrapper::image_button(), IsItemClicked(), MetricsHelpMarker(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), Slic3r::GUI::GLGizmoSeam::on_render_input_window(), Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), OpenPopupOnItemClick(), Slic3r::GUI::NotificationManager::PopNotification::render_hypertext(), Slic3r::GUI::GCodeViewer::render_legend(), Slic3r::GUI::GLCanvas3D::LayersEditing::render_overlay(), Slic3r::GUI::GLGizmoCut3D::render_reset_button(), Slic3r::GUI::GLCanvas3D::SLAView::render_switch_button(), Slic3r::GUI::GLGizmoEmboss::revertible(), Slic3r::GUI::ImGuiWrapper::search_list(), ShowDemoWindowColumns(), ShowDemoWindowLayout(), ShowDemoWindowMisc(), ShowDemoWindowPopups(), ShowDemoWindowWidgets(), ShowExampleAppCustomRendering(), ShowMetricsWindow(), Slic3r::GUI::ImGuiWrapper::slider_float(), TabItemEx(), TableHeader(), and Slic3r::GUI::ImGuiWrapper::undo_redo_list().

+ Here is the call graph for this function:

◆ IsItemToggledOpen()

bool ImGui::IsItemToggledOpen ( )
4888{
4889 ImGuiContext& g = *GImGui;
4891}
@ ImGuiItemStatusFlags_ToggledOpen
Definition imgui_internal.h:749

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, ImGuiItemStatusFlags_ToggledOpen, and ImGuiWindowTempData::LastItemStatusFlags.

Referenced by ShowDemoWindowWidgets().

+ Here is the caller graph for this function:

◆ IsItemToggledSelection()

bool ImGui::IsItemToggledSelection ( )

◆ IsItemVisible()

bool ImGui::IsItemVisible ( )
4918{
4920 return window->ClipRect.Overlaps(window->DC.LastItemRect);
4921}

References ImGuiWindow::ClipRect, ImGuiWindow::DC, GetCurrentWindowRead(), ImGuiWindowTempData::LastItemRect, and ImRect::Overlaps().

Referenced by DebugNodeTable(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), SetItemDefaultFocus(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsKeyDown()

bool ImGui::IsKeyDown ( int  user_key_index)
4635{
4636 if (user_key_index < 0)
4637 return false;
4638 ImGuiContext& g = *GImGui;
4639 IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown));
4640 return g.IO.KeysDown[user_key_index];
4641}

References GImGui, IM_ARRAYSIZE, IM_ASSERT, ImGuiContext::IO, and ImGuiIO::KeysDown.

Referenced by NavUpdatePageUpPageDown(), Slic3r::GUI::process_key_down(), and ShowDemoWindowMisc().

+ Here is the caller graph for this function:

◆ IsKeyPressed()

bool ImGui::IsKeyPressed ( int  user_key_index,
bool  repeat = true 
)
4672{
4673 ImGuiContext& g = *GImGui;
4674 if (user_key_index < 0)
4675 return false;
4676 IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown));
4677 const float t = g.IO.KeysDownDuration[user_key_index];
4678 if (t == 0.0f)
4679 return true;
4680 if (repeat && t > g.IO.KeyRepeatDelay)
4681 return GetKeyPressedAmount(user_key_index, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0;
4682 return false;
4683}
IMGUI_API int GetKeyPressedAmount(int key_index, float repeat_delay, float rate)
Definition imgui.cpp:4661

References GetKeyPressedAmount(), GImGui, IM_ARRAYSIZE, IM_ASSERT, ImGuiContext::IO, ImGuiIO::KeyRepeatDelay, ImGuiIO::KeyRepeatRate, ImGuiIO::KeysDown, and ImGuiIO::KeysDownDuration.

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_font_list(), IsKeyPressedMap(), NavUpdatePageUpPageDown(), ShowDemoWindow(), and ShowDemoWindowMisc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsKeyPressedMap()

bool ImGui::IsKeyPressedMap ( ImGuiKey  key,
bool  repeat = true 
)
inline
2428{ ImGuiContext& g = *GImGui; const int key_index = g.IO.KeyMap[key]; return (key_index >= 0) ? IsKeyPressed(key_index, repeat) : false; }
IMGUI_API bool IsKeyPressed(int user_key_index, bool repeat=true)
Definition imgui.cpp:4671

References GImGui, ImGuiContext::IO, IsKeyPressed(), and ImGuiIO::KeyMap.

Referenced by InputTextEx(), NavScoreItem(), NavUpdateWindowing(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), UpdateDebugToolItemPicker(), and UpdateTabFocus().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsKeyReleased()

bool ImGui::IsKeyReleased ( int  user_key_index)
4686{
4687 ImGuiContext& g = *GImGui;
4688 if (user_key_index < 0) return false;
4689 IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown));
4690 return g.IO.KeysDownDurationPrev[user_key_index] >= 0.0f && !g.IO.KeysDown[user_key_index];
4691}
float KeysDownDurationPrev[512]
Definition imgui.h:1893

References GImGui, IM_ARRAYSIZE, IM_ASSERT, ImGuiContext::IO, ImGuiIO::KeysDown, and ImGuiIO::KeysDownDurationPrev.

Referenced by ShowDemoWindowMisc().

+ Here is the caller graph for this function:

◆ IsMouseClicked()

bool ImGui::IsMouseClicked ( ImGuiMouseButton  button,
bool  repeat = false 
)
4701{
4702 ImGuiContext& g = *GImGui;
4703 IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
4704 const float t = g.IO.MouseDownDuration[button];
4705 if (t == 0.0f)
4706 return true;
4707
4708 if (repeat && t > g.IO.KeyRepeatDelay)
4709 {
4710 // FIXME: 2019/05/03: Our old repeat code was wrong here and led to doubling the repeat rate, which made it an ok rate for repeat on mouse hold.
4711 int amount = CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate * 0.50f);
4712 if (amount > 0)
4713 return true;
4714 }
4715 return false;
4716}

References CalcTypematicRepeatAmount(), ImGuiIO::DeltaTime, GImGui, IM_ARRAYSIZE, IM_ASSERT, ImGuiContext::IO, ImGuiIO::KeyRepeatDelay, ImGuiIO::KeyRepeatRate, ImGuiIO::MouseDown, and ImGuiIO::MouseDownDuration.

Referenced by ButtonBehavior(), IsItemClicked(), Slic3r::GUI::ImGuiWrapper::search_list(), ShowDemoWindowMisc(), ShowExampleAppCustomRendering(), TabItemEx(), TabItemLabelAndCloseButton(), and UpdateDebugToolItemPicker().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsMouseDoubleClicked()

bool ImGui::IsMouseDoubleClicked ( ImGuiMouseButton  button)
4726{
4727 ImGuiContext& g = *GImGui;
4728 IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
4729 return g.IO.MouseDoubleClicked[button];
4730}

References GImGui, IM_ARRAYSIZE, IM_ASSERT, ImGuiContext::IO, ImGuiIO::MouseDoubleClicked, and ImGuiIO::MouseDown.

Referenced by ShowDemoWindowMisc(), ShowDemoWindowWidgets(), and TableUpdateBorders().

+ Here is the caller graph for this function:

◆ IsMouseDown()

bool ImGui::IsMouseDown ( ImGuiMouseButton  button)
4694{
4695 ImGuiContext& g = *GImGui;
4696 IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
4697 return g.IO.MouseDown[button];
4698}

References GImGui, IM_ARRAYSIZE, IM_ASSERT, ImGuiContext::IO, and ImGuiIO::MouseDown.

Referenced by AcceptDragDropPayload(), EndFrame(), ShowDemoWindowMisc(), and ShowExampleAppCustomRendering().

+ Here is the caller graph for this function:

◆ IsMouseDragging()

bool ImGui::IsMouseDragging ( ImGuiMouseButton  button,
float  lock_threshold = -1.0f 
)
4744{
4745 ImGuiContext& g = *GImGui;
4746 IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
4747 if (!g.IO.MouseDown[button])
4748 return false;
4749 return IsMouseDragPastThreshold(button, lock_threshold);
4750}
IMGUI_API bool IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold=-1.0f)
Definition imgui.cpp:4734

References GImGui, IM_ARRAYSIZE, IM_ASSERT, ImGuiContext::IO, IsMouseDragPastThreshold(), and ImGuiIO::MouseDown.

Referenced by BeginDragDropSource(), CollapseButton(), ShowDemoWindowLayout(), ShowDemoWindowMisc(), ShowExampleAppCustomRendering(), TabItemEx(), and TableHeader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsMouseDragPastThreshold()

bool ImGui::IsMouseDragPastThreshold ( ImGuiMouseButton  button,
float  lock_threshold = -1.0f 
)
4735{
4736 ImGuiContext& g = *GImGui;
4737 IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
4738 if (lock_threshold < 0.0f)
4739 lock_threshold = g.IO.MouseDragThreshold;
4740 return g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold;
4741}

References GImGui, IM_ARRAYSIZE, IM_ASSERT, ImGuiContext::IO, ImGuiIO::MouseDown, ImGuiIO::MouseDragMaxDistanceSqr, and ImGuiIO::MouseDragThreshold.

Referenced by DragScalar(), and IsMouseDragging().

+ Here is the caller graph for this function:

◆ IsMouseHoveringRect()

bool ImGui::IsMouseHoveringRect ( const ImVec2 r_min,
const ImVec2 r_max,
bool  clip = true 
)
4610{
4611 ImGuiContext& g = *GImGui;
4612
4613 // Clip
4614 ImRect rect_clipped(r_min, r_max);
4615 if (clip)
4616 rect_clipped.ClipWith(g.CurrentWindow->ClipRect);
4617
4618 // Expand for touch input
4619 const ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding);
4620 if (!rect_for_touch.Contains(g.IO.MousePos))
4621 return false;
4622 return true;
4623}
ImVec2 TouchExtraPadding
Definition imgui.h:1739

References ImGuiWindow::ClipRect, ImRect::ClipWith(), ImRect::Contains(), ImGuiContext::CurrentWindow, GImGui, ImGuiContext::IO, ImRect::Max, ImRect::Min, ImGuiIO::MousePos, ImGuiContext::Style, and ImGuiStyle::TouchExtraPadding.

Referenced by Begin(), BeginDragDropTargetCustom(), ItemAdd(), ItemHoverable(), NavScoreItem(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressBarWithCancelNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::PopNotification::render_close_button(), Slic3r::GUI::NotificationManager::HintNotification::render_close_button(), Slic3r::GUI::NotificationManager::ProgressBarWithCancelNotification::render_close_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_close_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_documentation_button(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_eject_button(), Slic3r::GUI::NotificationManager::PopNotification::render_minimize_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_open_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_pause_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_preferences_button(), and ShowFont().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsMousePosValid()

bool ImGui::IsMousePosValid ( const ImVec2 mouse_pos = NULL)
4769{
4770 // The assert is only to silence a false-positive in XCode Static Analysis.
4771 // Because GImGui is not dereferenced in every code path, the static analyzer assume that it may be NULL (which it doesn't for other functions).
4772 IM_ASSERT(GImGui != NULL);
4773 const float MOUSE_INVALID = -256000.0f;
4774 ImVec2 p = mouse_pos ? *mouse_pos : GImGui->IO.MousePos;
4775 return p.x >= MOUSE_INVALID && p.y >= MOUSE_INVALID;
4776}

References GImGui, IM_ASSERT, ImGuiContext::IO, ImGuiIO::MousePos, ImVec2::x, and ImVec2::y.

Referenced by GetMouseDragDelta(), NavCalcPreferredRefPos(), NavUpdateWindowing(), OpenPopupEx(), ShowDemoWindowMisc(), ShowExampleAppSimpleOverlay(), UpdateMouseInputs(), UpdateMouseMovingWindowNewFrame(), and UpdateMouseWheel().

+ Here is the caller graph for this function:

◆ IsMouseReleased()

bool ImGui::IsMouseReleased ( ImGuiMouseButton  button)
4719{
4720 ImGuiContext& g = *GImGui;
4721 IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
4722 return g.IO.MouseReleased[button];
4723}

References GImGui, IM_ARRAYSIZE, IM_ASSERT, ImGuiContext::IO, ImGuiIO::MouseDown, and ImGuiIO::MouseReleased.

Referenced by BeginPopupContextItem(), BeginPopupContextVoid(), BeginPopupContextWindow(), EndTable(), OpenPopupOnItemClick(), ShowDemoWindowMisc(), ShowDemoWindowTables(), ShowExampleAppCustomRendering(), TabItemEx(), TableHeader(), and TableHeadersRow().

+ Here is the caller graph for this function:

◆ IsNavInputDown()

bool ImGui::IsNavInputDown ( ImGuiNavInput  n)
inline
2429{ ImGuiContext& g = *GImGui; return g.IO.NavInputs[n] > 0.0f; }

References GImGui, ImGuiContext::IO, and ImGuiIO::NavInputs.

Referenced by GetNavInputAmount2d(), NavUpdate(), and NavUpdateWindowing().

+ Here is the caller graph for this function:

◆ IsNavInputTest()

bool ImGui::IsNavInputTest ( ImGuiNavInput  n,
ImGuiInputReadMode  rm 
)
inline
2430{ return (GetNavInputAmount(n, rm) > 0.0f); }

References GetNavInputAmount().

Referenced by ButtonBehavior(), NavUpdate(), and NavUpdateWindowing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsPopupOpen() [1/2]

bool ImGui::IsPopupOpen ( const char *  str_id,
ImGuiPopupFlags  flags = 0 
)
8103{
8104 ImGuiContext& g = *GImGui;
8105 ImGuiID id = (popup_flags & ImGuiPopupFlags_AnyPopupId) ? 0 : g.CurrentWindow->GetID(str_id);
8106 if ((popup_flags & ImGuiPopupFlags_AnyPopupLevel) && id != 0)
8107 IM_ASSERT(0 && "Cannot use IsPopupOpen() with a string id and ImGuiPopupFlags_AnyPopupLevel."); // But non-string version is legal and used internally
8108 return IsPopupOpen(id, popup_flags);
8109}
@ ImGuiPopupFlags_AnyPopupLevel
Definition imgui.h:1024
@ ImGuiPopupFlags_AnyPopupId
Definition imgui.h:1023

References ImGuiContext::CurrentWindow, ImGuiWindow::GetID(), GImGui, IM_ASSERT, ImGuiPopupFlags_AnyPopupId, ImGuiPopupFlags_AnyPopupLevel, and IsPopupOpen().

Referenced by BeginCombo(), BeginMenu(), BeginPopupEx(), BeginPopupModal(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), IsPopupOpen(), OpenPopupEx(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), ShowExampleAppDocuments(), and UpdateMouseMovingWindowEndFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsPopupOpen() [2/2]

bool ImGui::IsPopupOpen ( ImGuiID  id,
ImGuiPopupFlags  popup_flags 
)
8072{
8073 ImGuiContext& g = *GImGui;
8074 if (popup_flags & ImGuiPopupFlags_AnyPopupId)
8075 {
8076 // Return true if any popup is open at the current BeginPopup() level of the popup stack
8077 // This may be used to e.g. test for another popups already opened to handle popups priorities at the same level.
8078 IM_ASSERT(id == 0);
8079 if (popup_flags & ImGuiPopupFlags_AnyPopupLevel)
8080 return g.OpenPopupStack.Size > 0;
8081 else
8083 }
8084 else
8085 {
8086 if (popup_flags & ImGuiPopupFlags_AnyPopupLevel)
8087 {
8088 // Return true if the popup is open anywhere in the popup stack
8089 for (int n = 0; n < g.OpenPopupStack.Size; n++)
8090 if (g.OpenPopupStack[n].PopupId == id)
8091 return true;
8092 return false;
8093 }
8094 else
8095 {
8096 // Return true if the popup is open at the current BeginPopup() level of the popup stack (this is the most-common query)
8097 return g.OpenPopupStack.Size > g.BeginPopupStack.Size && g.OpenPopupStack[g.BeginPopupStack.Size].PopupId == id;
8098 }
8099 }
8100}

References ImGuiContext::BeginPopupStack, GImGui, IM_ASSERT, ImGuiPopupFlags_AnyPopupId, ImGuiPopupFlags_AnyPopupLevel, ImGuiContext::OpenPopupStack, and ImVector< T >::Size.

◆ IsRectVisible() [1/2]

bool ImGui::IsRectVisible ( const ImVec2 rect_min,
const ImVec2 rect_max 
)
7104{
7105 ImGuiWindow* window = GImGui->CurrentWindow;
7106 return window->ClipRect.Overlaps(ImRect(rect_min, rect_max));
7107}

References ImGuiWindow::ClipRect, ImGuiContext::CurrentWindow, GImGui, and ImRect::Overlaps().

+ Here is the call graph for this function:

◆ IsRectVisible() [2/2]

bool ImGui::IsRectVisible ( const ImVec2 size)
7098{
7099 ImGuiWindow* window = GImGui->CurrentWindow;
7100 return window->ClipRect.Overlaps(ImRect(window->DC.CursorPos, window->DC.CursorPos + size));
7101}

References ImGuiWindow::ClipRect, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GImGui, and ImRect::Overlaps().

Referenced by BeginListBox(), and Slic3r::GUI::ImGuiWrapper::search_list().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsWindowAbove()

bool ImGui::IsWindowAbove ( ImGuiWindow potential_above,
ImGuiWindow potential_below 
)
6620{
6621 ImGuiContext& g = *GImGui;
6622 for (int i = g.Windows.Size - 1; i >= 0; i--)
6623 {
6624 ImGuiWindow* candidate_window = g.Windows[i];
6625 if (candidate_window == potential_above)
6626 return true;
6627 if (candidate_window == potential_below)
6628 return false;
6629 }
6630 return false;
6631}

References GImGui, ImVector< T >::Size, and ImGuiContext::Windows.

Referenced by UpdateMouseMovingWindowEndFrame().

+ Here is the caller graph for this function:

◆ IsWindowAppearing()

bool ImGui::IsWindowAppearing ( )
6831{
6833 return window->Appearing;
6834}

References ImGuiWindow::Appearing, and GetCurrentWindowRead().

+ Here is the call graph for this function:

◆ IsWindowChildOf()

bool ImGui::IsWindowChildOf ( ImGuiWindow window,
ImGuiWindow potential_parent 
)
6607{
6608 if (window->RootWindow == potential_parent)
6609 return true;
6610 while (window != NULL)
6611 {
6612 if (window == potential_parent)
6613 return true;
6614 window = window->ParentWindow;
6615 }
6616 return false;
6617}

References ImGuiWindow::ParentWindow, and ImGuiWindow::RootWindow.

Referenced by IsWindowFocused(), IsWindowHovered(), and UpdateHoveredWindowAndCaptureFlags().

+ Here is the caller graph for this function:

◆ IsWindowCollapsed()

bool ImGui::IsWindowCollapsed ( )
6825{
6827 return window->Collapsed;
6828}

References ImGuiWindow::Collapsed, and GetCurrentWindowRead().

+ Here is the call graph for this function:

◆ IsWindowFocused()

bool ImGui::IsWindowFocused ( ImGuiFocusedFlags  flags = 0)
6673{
6674 ImGuiContext& g = *GImGui;
6675
6676 if (flags & ImGuiFocusedFlags_AnyWindow)
6677 return g.NavWindow != NULL;
6678
6679 IM_ASSERT(g.CurrentWindow); // Not inside a Begin()/End()
6681 {
6685 return g.NavWindow == g.CurrentWindow->RootWindow;
6688 default:
6689 return g.NavWindow == g.CurrentWindow;
6690 }
6691}
@ ImGuiFocusedFlags_RootWindow
Definition imgui.h:1231
@ ImGuiFocusedFlags_AnyWindow
Definition imgui.h:1232
@ ImGuiFocusedFlags_ChildWindows
Definition imgui.h:1230
IMGUI_API bool IsWindowChildOf(ImGuiWindow *window, ImGuiWindow *potential_parent)
Definition imgui.cpp:6606

References ImGuiContext::CurrentWindow, GImGui, IM_ASSERT, ImGuiFocusedFlags_AnyWindow, ImGuiFocusedFlags_ChildWindows, ImGuiFocusedFlags_RootWindow, IsWindowChildOf(), ImGuiContext::NavWindow, and ImGuiWindow::RootWindow.

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_font_list(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsWindowHovered()

bool ImGui::IsWindowHovered ( ImGuiHoveredFlags  flags = 0)
6634{
6635 IM_ASSERT((flags & ImGuiHoveredFlags_AllowWhenOverlapped) == 0); // Flags not supported by this function
6636 ImGuiContext& g = *GImGui;
6637 if (g.HoveredWindow == NULL)
6638 return false;
6639
6640 if ((flags & ImGuiHoveredFlags_AnyWindow) == 0)
6641 {
6642 ImGuiWindow* window = g.CurrentWindow;
6644 {
6646 if (g.HoveredWindow->RootWindow != window->RootWindow)
6647 return false;
6648 break;
6650 if (g.HoveredWindow != window->RootWindow)
6651 return false;
6652 break;
6654 if (!IsWindowChildOf(g.HoveredWindow, window))
6655 return false;
6656 break;
6657 default:
6658 if (g.HoveredWindow != window)
6659 return false;
6660 break;
6661 }
6662 }
6663
6665 return false;
6667 if (g.ActiveId != 0 && !g.ActiveIdAllowOverlap && g.ActiveId != g.HoveredWindow->MoveId)
6668 return false;
6669 return true;
6670}

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdAllowOverlap, ImGuiContext::CurrentWindow, GImGui, ImGuiContext::HoveredWindow, IM_ASSERT, ImGuiHoveredFlags_AllowWhenBlockedByActiveItem, ImGuiHoveredFlags_AllowWhenOverlapped, ImGuiHoveredFlags_AnyWindow, ImGuiHoveredFlags_ChildWindows, ImGuiHoveredFlags_RootWindow, IsWindowChildOf(), IsWindowContentHoverable(), ImGuiWindow::MoveId, and ImGuiWindow::RootWindow.

Referenced by BeginPopupContextVoid(), BeginPopupContextWindow(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsWindowNavFocusable()

bool ImGui::IsWindowNavFocusable ( ImGuiWindow window)
6697{
6698 return window->WasActive && window == window->RootWindow && !(window->Flags & ImGuiWindowFlags_NoNavFocus);
6699}

References ImGuiWindow::Flags, ImGuiWindowFlags_NoNavFocus, ImGuiWindow::RootWindow, and ImGuiWindow::WasActive.

Referenced by FindWindowNavFocusable(), and NavUpdateWindowingOverlay().

+ Here is the caller graph for this function:

◆ ItemAdd()

bool ImGui::ItemAdd ( const ImRect bb,
ImGuiID  id,
const ImRect nav_bb = NULL,
ImGuiItemAddFlags  flags = 0 
)
7391{
7392 ImGuiContext& g = *GImGui;
7393 ImGuiWindow* window = g.CurrentWindow;
7394
7395 if (id != 0)
7396 {
7397 // Navigation processing runs prior to clipping early-out
7398 // (a) So that NavInitRequest can be honored, for newly opened windows to select a default widget
7399 // (b) So that we can scroll up/down past clipped items. This adds a small O(N) cost to regular navigation requests
7400 // unfortunately, but it is still limited to one window. It may not scale very well for windows with ten of
7401 // thousands of item, but at least NavMoveRequest is only set on user interaction, aka maximum once a frame.
7402 // We could early out with "if (is_clipped && !g.NavInitRequest) return false;" but when we wouldn't be able
7403 // to reach unclipped widgets. This would work if user had explicit scrolling control (e.g. mapped on a stick).
7404 // We intentionally don't check if g.NavWindow != NULL because g.NavAnyRequest should only be set when it is non null.
7405 // If we crash on a NULL g.NavWindow we need to fix the bug elsewhere.
7406 window->DC.NavLayersActiveMaskNext |= (1 << window->DC.NavLayerCurrent);
7407 if (g.NavId == id || g.NavAnyRequest)
7409 if (window == g.NavWindow || ((window->Flags | g.NavWindow->Flags) & ImGuiWindowFlags_NavFlattened))
7410 NavProcessItem(window, nav_bb_arg ? *nav_bb_arg : bb, id);
7411
7412 // [DEBUG] Item Picker tool, when enabling the "extended" version we perform the check in ItemAdd()
7413#ifdef IMGUI_DEBUG_TOOL_ITEM_PICKER_EX
7414 if (id == g.DebugItemPickerBreakId)
7415 {
7418 }
7419#endif
7420 }
7421
7422 // Equivalent to calling SetLastItemData()
7423 window->DC.LastItemId = id;
7424 window->DC.LastItemRect = bb;
7427
7428#ifdef IMGUI_ENABLE_TEST_ENGINE
7429 if (id != 0)
7430 IMGUI_TEST_ENGINE_ITEM_ADD(nav_bb_arg ? *nav_bb_arg : bb, id);
7431#endif
7432
7433 // Clipping test
7434 const bool is_clipped = IsClippedEx(bb, id, false);
7435 if (is_clipped)
7436 return false;
7437 //if (g.IO.KeyAlt) window->DrawList->AddRect(bb.Min, bb.Max, IM_COL32(255,255,0,120)); // [DEBUG]
7438
7439 // Tab stop handling (previously was using internal ItemFocusable() api)
7440 // FIXME-NAV: We would now want to move this above the clipping test, but this would require being able to scroll and currently this would mean an extra frame. (#4079, #343)
7441 if (flags & ImGuiItemAddFlags_Focusable)
7442 ItemFocusable(window, id);
7443
7444 // We need to calculate this now to take account of the current clipping rectangle (as items like Selectable may change them)
7445 if (IsMouseHoveringRect(bb.Min, bb.Max))
7447 return true;
7448}
#define IM_DEBUG_BREAK()
Definition imgui_internal.h:257
@ ImGuiItemStatusFlags_None
Definition imgui_internal.h:744
@ ImGuiNextItemDataFlags_None
Definition imgui_internal.h:1117
static void NavProcessItem(ImGuiWindow *window, const ImRect &nav_bb, ImGuiID id)
Definition imgui.cpp:8789
IMGUI_API void ItemFocusable(ImGuiWindow *window, ImGuiID id)
Definition imgui.cpp:3255
ImGuiID DebugItemPickerBreakId
Definition imgui_internal.h:1583
ImGuiWindow * RootWindowForNav
Definition imgui_internal.h:1888

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiContext::DebugItemPickerBreakId, ImGuiNextItemData::Flags, ImGuiWindow::Flags, GImGui, IM_DEBUG_BREAK, IMGUI_TEST_ENGINE_ITEM_ADD, ImGuiItemAddFlags_Focusable, ImGuiItemStatusFlags_HoveredRect, ImGuiItemStatusFlags_None, ImGuiNextItemDataFlags_None, ImGuiWindowFlags_NavFlattened, IsClippedEx(), IsMouseHoveringRect(), ItemFocusable(), ImGuiWindowTempData::LastItemId, ImGuiWindowTempData::LastItemRect, ImGuiWindowTempData::LastItemStatusFlags, ImRect::Max, ImRect::Min, ImGuiContext::NavAnyRequest, ImGuiContext::NavId, ImGuiWindowTempData::NavLayerCurrent, ImGuiWindowTempData::NavLayersActiveMaskNext, NavProcessItem(), ImGuiContext::NavWindow, ImGuiContext::NextItemData, and ImGuiWindow::RootWindowForNav.

Referenced by ArrowButtonEx(), BeginCombo(), BeginListBox(), Bullet(), BulletTextV(), ButtonEx(), Checkbox(), CloseButton(), CollapseButton(), ColorButton(), DragScalar(), Slic3r::GUI::ImGuiWrapper::draw_radio_button(), Dummy(), EndChild(), EndGroup(), EndTable(), Image(), Slic3r::GUI::image_button_ex(), ImageButtonEx(), InputTextEx(), InvisibleButton(), LabelTextV(), PlotEx(), ProgressBar(), RadioButton(), Slic3r::GUI::ImGuiWrapper::search_list(), Slic3r::GUI::selectable(), Selectable(), SeparatorEx(), SliderScalar(), SplitterBehavior(), TabItemEx(), TableHeader(), TextEx(), TreeNodeBehavior(), and VSliderScalar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ItemFocusable()

void ImGui::ItemFocusable ( ImGuiWindow window,
ImGuiID  id 
)
3256{
3257 ImGuiContext& g = *GImGui;
3258 IM_ASSERT(id != 0 && id == window->DC.LastItemId);
3259
3260 // Increment counters
3261 // FIXME: ImGuiItemFlags_Disabled should disable more.
3262 const bool is_tab_stop = (g.CurrentItemFlags & (ImGuiItemFlags_NoTabStop | ImGuiItemFlags_Disabled)) == 0;
3263 window->DC.FocusCounterRegular++;
3264 if (is_tab_stop)
3265 {
3266 window->DC.FocusCounterTabStop++;
3267 if (g.NavId == id)
3269 }
3270
3271 // Process TAB/Shift-TAB to tab *OUT* of the currently focused item.
3272 // (Note that we can always TAB out of a widget that doesn't allow tabbing in)
3273 if (g.ActiveId == id && g.TabFocusPressed && !IsActiveIdUsingKey(ImGuiKey_Tab) && g.TabFocusRequestNextWindow == NULL)
3274 {
3275 g.TabFocusRequestNextWindow = window;
3276 g.TabFocusRequestNextCounterTabStop = window->DC.FocusCounterTabStop + (g.IO.KeyShift ? (is_tab_stop ? -1 : 0) : +1); // Modulo on index will be applied at the end of frame once we've got the total counter of items.
3277 }
3278
3279 // Handle focus requests
3280 if (g.TabFocusRequestCurrWindow == window)
3281 {
3283 {
3285 return;
3286 }
3287 if (is_tab_stop && window->DC.FocusCounterTabStop == g.TabFocusRequestCurrCounterTabStop)
3288 {
3289 g.NavJustTabbedId = id;
3291 return;
3292 }
3293
3294 // If another item is about to be focused, we clear our own active id
3295 if (g.ActiveId == id)
3296 ClearActiveID();
3297 }
3298}
@ ImGuiItemFlags_NoTabStop
Definition imgui_internal.h:723
int TabFocusRequestCurrCounterRegular
Definition imgui_internal.h:1489
int NavIdTabCounter
Definition imgui_internal.h:1456
int TabFocusRequestCurrCounterTabStop
Definition imgui_internal.h:1490
bool TabFocusPressed
Definition imgui_internal.h:1493
int TabFocusRequestNextCounterTabStop
Definition imgui_internal.h:1492
ImGuiWindow * TabFocusRequestCurrWindow
Definition imgui_internal.h:1487
ImGuiWindow * TabFocusRequestNextWindow
Definition imgui_internal.h:1488
ImGuiID NavJustTabbedId
Definition imgui_internal.h:1447

References ImGuiContext::ActiveId, ClearActiveID(), ImGuiContext::CurrentItemFlags, ImGuiWindow::DC, ImGuiWindowTempData::FocusCounterRegular, ImGuiWindowTempData::FocusCounterTabStop, GImGui, IM_ASSERT, ImGuiItemFlags_Disabled, ImGuiItemFlags_NoTabStop, ImGuiItemStatusFlags_FocusedByCode, ImGuiItemStatusFlags_FocusedByTabbing, ImGuiKey_Tab, ImGuiContext::IO, IsActiveIdUsingKey(), ImGuiIO::KeyShift, ImGuiWindowTempData::LastItemId, ImGuiWindowTempData::LastItemStatusFlags, ImGuiContext::NavId, ImGuiContext::NavIdTabCounter, ImGuiContext::NavJustTabbedId, ImGuiContext::TabFocusPressed, ImGuiContext::TabFocusRequestCurrCounterRegular, ImGuiContext::TabFocusRequestCurrCounterTabStop, ImGuiContext::TabFocusRequestCurrWindow, ImGuiContext::TabFocusRequestNextCounterTabStop, and ImGuiContext::TabFocusRequestNextWindow.

Referenced by ItemAdd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ItemHoverable()

bool ImGui::ItemHoverable ( const ImRect bb,
ImGuiID  id 
)
3194{
3195 ImGuiContext& g = *GImGui;
3196 if (g.HoveredId != 0 && g.HoveredId != id && !g.HoveredIdAllowOverlap)
3197 return false;
3198
3199 ImGuiWindow* window = g.CurrentWindow;
3200 if (g.HoveredWindow != window)
3201 return false;
3202 if (g.ActiveId != 0 && g.ActiveId != id && !g.ActiveIdAllowOverlap)
3203 return false;
3204 if (!IsMouseHoveringRect(bb.Min, bb.Max))
3205 return false;
3207 return false;
3209 {
3210 g.HoveredIdDisabled = true;
3211 return false;
3212 }
3213
3214 // We exceptionally allow this function to be called with id==0 to allow using it for easy high-level
3215 // hover test in widgets code. We could also decide to split this function is two.
3216 if (id != 0)
3217 {
3218 SetHoveredID(id);
3219
3220 // [DEBUG] Item Picker tool!
3221 // We perform the check here because SetHoveredID() is not frequently called (1~ time a frame), making
3222 // the cost of this tool near-zero. We can get slightly better call-stack and support picking non-hovered
3223 // items if we perform the test in ItemAdd(), but that would incur a small runtime cost.
3224 // #define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX in imconfig.h if you want this check to also be performed in ItemAdd().
3226 GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(255, 255, 0, 255));
3227 if (g.DebugItemPickerBreakId == id)
3229 }
3230
3231 return true;
3232}
bool HoveredIdAllowOverlap
Definition imgui_internal.h:1392
bool HoveredIdDisabled
Definition imgui_internal.h:1395

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdAllowOverlap, ImDrawList::AddRect(), ImGuiContext::CurrentItemFlags, ImGuiContext::CurrentWindow, ImGuiContext::DebugItemPickerActive, ImGuiContext::DebugItemPickerBreakId, GetForegroundDrawList(), GImGui, ImGuiContext::HoveredId, ImGuiContext::HoveredIdAllowOverlap, ImGuiContext::HoveredIdDisabled, ImGuiContext::HoveredIdPreviousFrame, ImGuiContext::HoveredWindow, IM_COL32, IM_DEBUG_BREAK, ImGuiHoveredFlags_None, ImGuiItemFlags_Disabled, IsMouseHoveringRect(), IsWindowContentHoverable(), ImRect::Max, ImRect::Min, ImGuiContext::NavDisableMouseHover, and SetHoveredID().

Referenced by BeginDragDropSource(), BeginMenu(), ButtonBehavior(), DragScalar(), InputTextEx(), PlotEx(), SliderScalar(), TableUpdateLayout(), and VSliderScalar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ItemSize() [1/2]

void ImGui::ItemSize ( const ImRect bb,
float  text_baseline_y = -1.0f 
)
7383{
7384 ItemSize(bb.GetSize(), text_baseline_y);
7385}

References ImRect::GetSize(), and ItemSize().

+ Here is the call graph for this function:

◆ ItemSize() [2/2]

void ImGui::ItemSize ( const ImVec2 size,
float  text_baseline_y = -1.0f 
)
7350{
7351 ImGuiContext& g = *GImGui;
7352 ImGuiWindow* window = g.CurrentWindow;
7353 if (window->SkipItems)
7354 return;
7355
7356 // We increase the height in this function to accommodate for baseline offset.
7357 // In theory we should be offsetting the starting position (window->DC.CursorPos), that will be the topic of a larger refactor,
7358 // but since ItemSize() is not yet an API that moves the cursor (to handle e.g. wrapping) enlarging the height has the same effect.
7359 const float offset_to_match_baseline_y = (text_baseline_y >= 0) ? ImMax(0.0f, window->DC.CurrLineTextBaseOffset - text_baseline_y) : 0.0f;
7360 const float line_height = ImMax(window->DC.CurrLineSize.y, size.y + offset_to_match_baseline_y);
7361
7362 // Always align ourselves on pixel boundaries
7363 //if (g.IO.KeyAlt) window->DrawList->AddRect(window->DC.CursorPos, window->DC.CursorPos + ImVec2(size.x, line_height), IM_COL32(255,0,0,200)); // [DEBUG]
7364 window->DC.CursorPosPrevLine.x = window->DC.CursorPos.x + size.x;
7365 window->DC.CursorPosPrevLine.y = window->DC.CursorPos.y;
7366 window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x); // Next line
7367 window->DC.CursorPos.y = IM_FLOOR(window->DC.CursorPos.y + line_height + g.Style.ItemSpacing.y); // Next line
7368 window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPosPrevLine.x);
7369 window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y - g.Style.ItemSpacing.y);
7370 //if (g.IO.KeyAlt) window->DrawList->AddCircle(window->DC.CursorMaxPos, 3.0f, IM_COL32(255,0,0,255), 4); // [DEBUG]
7371
7372 window->DC.PrevLineSize.y = line_height;
7373 window->DC.CurrLineSize.y = 0.0f;
7374 window->DC.PrevLineTextBaseOffset = ImMax(window->DC.CurrLineTextBaseOffset, text_baseline_y);
7375 window->DC.CurrLineTextBaseOffset = 0.0f;
7376
7377 // Horizontal layout mode
7379 SameLine();
7380}

References ImGuiWindowTempData::ColumnsOffset, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CurrLineSize, ImGuiWindowTempData::CurrLineTextBaseOffset, ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindowTempData::CursorPosPrevLine, ImGuiWindow::DC, GImGui, IM_FLOOR, ImGuiLayoutType_Horizontal, ImMax(), ImGuiWindowTempData::Indent, ImGuiStyle::ItemSpacing, ImGuiWindowTempData::LayoutType, ImGuiWindow::Pos, ImGuiWindowTempData::PrevLineSize, ImGuiWindowTempData::PrevLineTextBaseOffset, SameLine(), ImGuiWindow::SkipItems, ImGuiContext::Style, ImVec2::x, ImVec1::x, and ImVec2::y.

Referenced by ArrowButtonEx(), BeginCombo(), BeginListBox(), BeginTableEx(), Bullet(), BulletTextV(), ButtonEx(), Checkbox(), ColorButton(), DragScalar(), Slic3r::GUI::ImGuiWrapper::draw_radio_button(), Dummy(), EndChild(), EndGroup(), EndTable(), Image(), Slic3r::GUI::image_button_ex(), ImageButtonEx(), InputTextEx(), InvisibleButton(), ItemSize(), LabelTextV(), NewLine(), PlotEx(), ProgressBar(), RadioButton(), Slic3r::GUI::ImGuiWrapper::search_list(), Slic3r::GUI::selectable(), Selectable(), SeparatorEx(), SliderScalar(), Spacing(), TabBarLayout(), TabItemEx(), TableHeader(), TextEx(), TreeNodeBehavior(), and VSliderScalar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ KeepAliveID()

void ImGui::KeepAliveID ( ImGuiID  id)
3106{
3107 ImGuiContext& g = *GImGui;
3108 if (g.ActiveId == id)
3109 g.ActiveIdIsAlive = id;
3110 if (g.ActiveIdPreviousFrame == id)
3112}

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdIsAlive, ImGuiContext::ActiveIdPreviousFrame, ImGuiContext::ActiveIdPreviousFrameIsAlive, and GImGui.

Referenced by EndColumns(), ImGuiWindow::GetID(), ImGuiWindow::GetID(), ImGuiWindow::GetID(), ImGuiWindow::GetIDFromRectangle(), GetIDWithSeed(), NewFrame(), Scrollbar(), TabBarCalcTabID(), TableUpdateBorders(), and UpdateMouseMovingWindowNewFrame().

+ Here is the caller graph for this function:

◆ LabelText()

void ImGui::LabelText ( const char *  label,
const char *  fmt,
  ... 
)
339{
340 va_list args;
341 va_start(args, fmt);
342 LabelTextV(label, fmt, args);
343 va_end(args);
344}
IMGUI_API void LabelTextV(const char *label, const char *fmt, va_list args) IM_FMTLIST(2)
Definition imgui_widgets.cpp:347

References LabelTextV().

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LabelTextV()

void ImGui::LabelTextV ( const char *  label,
const char *  fmt,
va_list  args 
)
348{
349 ImGuiWindow* window = GetCurrentWindow();
350 if (window->SkipItems)
351 return;
352
353 ImGuiContext& g = *GImGui;
354 const ImGuiStyle& style = g.Style;
355 const float w = CalcItemWidth();
356
357 const char* value_text_begin = &g.TempBuffer[0];
358 const char* value_text_end = value_text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
359 const ImVec2 value_size = CalcTextSize(value_text_begin, value_text_end, false);
360 const ImVec2 label_size = CalcTextSize(label, NULL, true);
361
362 const ImVec2 pos = window->DC.CursorPos;
363 const ImRect value_bb(pos, pos + ImVec2(w, value_size.y + style.FramePadding.y * 2));
364 const ImRect total_bb(pos, pos + ImVec2(w + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), ImMax(value_size.y, label_size.y) + style.FramePadding.y * 2));
365 ItemSize(total_bb, style.FramePadding.y);
366 if (!ItemAdd(total_bb, 0))
367 return;
368
369 // Render
370 RenderTextClipped(value_bb.Min + style.FramePadding, value_bb.Max, value_text_begin, value_text_end, &value_size, ImVec2(0.0f, 0.0f));
371 if (label_size.x > 0.0f)
372 RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label);
373}

References CalcItemWidth(), CalcTextSize(), ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetCurrentWindow(), GImGui, IM_ARRAYSIZE, ImFormatStringV(), ImMax(), ItemAdd(), ItemSize(), ImRect::Max, ImRect::Min, RenderText(), RenderTextClipped(), ImGuiWindow::SkipItems, ImGuiContext::Style, style, ImGuiContext::TempBuffer, ImVec2::x, and ImVec2::y.

Referenced by LabelText().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ListBox() [1/3]

IMGUI_API bool ImGui::ListBox ( const char *  label,
int *  current_item,
bool(*)(void *data, int idx, const char **out_text)  items_getter,
void data,
int  items_count,
int  height_in_items = -1 
)

◆ ListBox() [2/3]

bool ImGui::ListBox ( const char *  label,
int *  current_item,
const char *const  items[],
int  items_count,
int  height_in_items = -1 
)
6245{
6246 const bool value_changed = ListBox(label, current_item, Items_ArrayGetter, (void*)items, items_count, height_items);
6247 return value_changed;
6248}
IMGUI_API bool ListBox(const char *label, int *current_item, const char *const items[], int items_count, int height_in_items=-1)
Definition imgui_widgets.cpp:6244

References Items_ArrayGetter(), and ListBox().

Referenced by ListBox(), ListBox(), ShowDemoWindowLayout(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ListBox() [3/3]

bool ImGui::ListBox ( const char *  label,
int *  idx,
std::vector< std::string > &  values 
)
inline
53{
54 if (values.empty()) { return false; }
55 return ListBox(label, idx, vector_getter,
56 static_cast<void*>(&values), values.size());
57}

References ListBox(), and vector_getter.

+ Here is the call graph for this function:

◆ ListBoxFooter()

static void ImGui::ListBoxFooter ( )
inlinestatic
2787{ EndListBox(); }
IMGUI_API void EndListBox()
Definition imgui_widgets.cpp:6233

References EndListBox(), and ListBoxFooter().

Referenced by ListBoxFooter(), Slic3r::GUI::ImGuiWrapper::search_list(), and Slic3r::GUI::ImGuiWrapper::undo_redo_list().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ListBoxHeader() [1/2]

static bool ImGui::ListBoxHeader ( const char *  label,
const ImVec2 size = ImVec2(0, 0) 
)
inlinestatic
2786{ return BeginListBox(label, size); }
IMGUI_API bool BeginListBox(const char *label, const ImVec2 &size=ImVec2(0, 0))
Definition imgui_widgets.cpp:6180

References BeginListBox(), and ListBoxHeader().

+ Here is the call graph for this function:

◆ ListBoxHeader() [2/2]

bool ImGui::ListBoxHeader ( const char *  label,
int  items_count,
int  height_in_items = -1 
)
6222{
6223 // If height_in_items == -1, default height is maximum 7.
6224 ImGuiContext& g = *GImGui;
6225 float height_in_items_f = (height_in_items < 0 ? ImMin(items_count, 7) : height_in_items) + 0.25f;
6226 ImVec2 size;
6227 size.x = 0.0f;
6228 size.y = GetTextLineHeightWithSpacing() * height_in_items_f + g.Style.FramePadding.y * 2.0f;
6229 return BeginListBox(label, size);
6230}

References BeginListBox(), ImGuiStyle::FramePadding, GetTextLineHeightWithSpacing(), GImGui, ImMin(), ImGuiContext::Style, and ImVec2::y.

Referenced by ListBoxHeader(), and Slic3r::GUI::ImGuiWrapper::undo_redo_list().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LoadIniSettingsFromDisk()

void ImGui::LoadIniSettingsFromDisk ( const char *  ini_filename)
10431{
10432 size_t file_data_size = 0;
10433 char* file_data = (char*)ImFileLoadToMemory(ini_filename, "rb", &file_data_size);
10434 if (!file_data)
10435 return;
10436 LoadIniSettingsFromMemory(file_data, (size_t)file_data_size);
10437 IM_FREE(file_data);
10438}
void * ImFileLoadToMemory(const char *filename, const char *mode, size_t *out_file_size, int padding_bytes)
Definition imgui.cpp:1573
IMGUI_API void LoadIniSettingsFromMemory(const char *ini_data, size_t ini_size=0)
Definition imgui.cpp:10441

References IM_FREE, ImFileLoadToMemory(), and LoadIniSettingsFromMemory().

Referenced by UpdateSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LoadIniSettingsFromMemory()

void ImGui::LoadIniSettingsFromMemory ( const char *  ini_data,
size_t  ini_size = 0 
)
10442{
10443 ImGuiContext& g = *GImGui;
10445 //IM_ASSERT(!g.WithinFrameScope && "Cannot be called between NewFrame() and EndFrame()");
10446 //IM_ASSERT(g.SettingsLoaded == false && g.FrameCount == 0);
10447
10448 // For user convenience, we allow passing a non zero-terminated string (hence the ini_size parameter).
10449 // For our convenience and to make the code simpler, we'll also write zero-terminators within the buffer. So let's create a writable copy..
10450 if (ini_size == 0)
10451 ini_size = strlen(ini_data);
10452 g.SettingsIniData.Buf.resize((int)ini_size + 1);
10453 char* const buf = g.SettingsIniData.Buf.Data;
10454 char* const buf_end = buf + ini_size;
10455 memcpy(buf, ini_data, ini_size);
10456 buf_end[0] = 0;
10457
10458 // Call pre-read handlers
10459 // Some types will clear their data (e.g. dock information) some types will allow merge/override (window)
10460 for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++)
10461 if (g.SettingsHandlers[handler_n].ReadInitFn)
10462 g.SettingsHandlers[handler_n].ReadInitFn(&g, &g.SettingsHandlers[handler_n]);
10463
10464 void* entry_data = NULL;
10465 ImGuiSettingsHandler* entry_handler = NULL;
10466
10467 char* line_end = NULL;
10468 for (char* line = buf; line < buf_end; line = line_end + 1)
10469 {
10470 // Skip new lines markers, then find end of the line
10471 while (*line == '\n' || *line == '\r')
10472 line++;
10473 line_end = line;
10474 while (line_end < buf_end && *line_end != '\n' && *line_end != '\r')
10475 line_end++;
10476 line_end[0] = 0;
10477 if (line[0] == ';')
10478 continue;
10479 if (line[0] == '[' && line_end > line && line_end[-1] == ']')
10480 {
10481 // Parse "[Type][Name]". Note that 'Name' can itself contains [] characters, which is acceptable with the current format and parsing code.
10482 line_end[-1] = 0;
10483 const char* name_end = line_end - 1;
10484 const char* type_start = line + 1;
10485 char* type_end = (char*)(void*)ImStrchrRange(type_start, name_end, ']');
10486 const char* name_start = type_end ? ImStrchrRange(type_end + 1, name_end, '[') : NULL;
10487 if (!type_end || !name_start)
10488 continue;
10489 *type_end = 0; // Overwrite first ']'
10490 name_start++; // Skip second '['
10491 entry_handler = FindSettingsHandler(type_start);
10492 entry_data = entry_handler ? entry_handler->ReadOpenFn(&g, entry_handler, name_start) : NULL;
10493 }
10494 else if (entry_handler != NULL && entry_data != NULL)
10495 {
10496 // Let type handler parse the line
10497 entry_handler->ReadLineFn(&g, entry_handler, entry_data, line);
10498 }
10499 }
10500 g.SettingsLoaded = true;
10501
10502 // [DEBUG] Restore untouched copy so it can be browsed in Metrics (not strictly necessary)
10503 memcpy(buf, ini_data, ini_size);
10504
10505 // Call post-read handlers
10506 for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++)
10507 if (g.SettingsHandlers[handler_n].ApplyAllFn)
10508 g.SettingsHandlers[handler_n].ApplyAllFn(&g, &g.SettingsHandlers[handler_n]);
10509}
const char * ImStrchrRange(const char *str, const char *str_end, char c)
Definition imgui.cpp:1344
IMGUI_API ImGuiSettingsHandler * FindSettingsHandler(const char *type_name)
Definition imgui.cpp:10411

References ImGuiTextBuffer::Buf, ImVector< T >::Data, FindSettingsHandler(), GImGui, IM_ASSERT, ImStrchrRange(), ImGuiContext::Initialized, ImGuiSettingsHandler::ReadLineFn, ImGuiSettingsHandler::ReadOpenFn, ImVector< T >::resize(), ImGuiContext::SettingsHandlers, ImGuiContext::SettingsIniData, ImGuiContext::SettingsLoaded, and ImVector< T >::Size.

Referenced by LoadIniSettingsFromDisk().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LogBegin()

void ImGui::LogBegin ( ImGuiLogType  type,
int  auto_open_depth 
)
10172{
10173 ImGuiContext& g = *GImGui;
10174 ImGuiWindow* window = g.CurrentWindow;
10175 IM_ASSERT(g.LogEnabled == false);
10176 IM_ASSERT(g.LogFile == NULL);
10178 g.LogEnabled = true;
10179 g.LogType = type;
10180 g.LogNextPrefix = g.LogNextSuffix = NULL;
10181 g.LogDepthRef = window->DC.TreeDepth;
10182 g.LogDepthToExpand = ((auto_open_depth >= 0) ? auto_open_depth : g.LogDepthToExpandDefault);
10183 g.LogLinePosY = FLT_MAX;
10184 g.LogLineFirstItem = true;
10185}
int LogDepthToExpand
Definition imgui_internal.h:1578
const char * LogNextPrefix
Definition imgui_internal.h:1573
int LogDepthRef
Definition imgui_internal.h:1577
ImGuiTextBuffer LogBuffer
Definition imgui_internal.h:1572
ImGuiLogType LogType
Definition imgui_internal.h:1570
const char * LogNextSuffix
Definition imgui_internal.h:1574
bool LogLineFirstItem
Definition imgui_internal.h:1576
ImFileHandle LogFile
Definition imgui_internal.h:1571
bool empty() const
Definition imgui.h:2060

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiTextBuffer::empty(), GImGui, IM_ASSERT, ImGuiContext::LogBuffer, ImGuiContext::LogDepthRef, ImGuiContext::LogDepthToExpand, ImGuiContext::LogDepthToExpandDefault, ImGuiContext::LogEnabled, ImGuiContext::LogFile, ImGuiContext::LogLineFirstItem, ImGuiContext::LogLinePosY, ImGuiContext::LogNextPrefix, ImGuiContext::LogNextSuffix, ImGuiContext::LogType, and ImGuiWindowTempData::TreeDepth.

Referenced by LogToBuffer(), LogToClipboard(), LogToFile(), and LogToTTY().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LogButtons()

void ImGui::LogButtons ( )
10286{
10287 ImGuiContext& g = *GImGui;
10288
10289 PushID("LogButtons");
10290#ifndef IMGUI_DISABLE_TTY_FUNCTIONS
10291 const bool log_to_tty = Button("Log To TTY"); SameLine();
10292#else
10293 const bool log_to_tty = false;
10294#endif
10295 const bool log_to_file = Button("Log To File"); SameLine();
10296 const bool log_to_clipboard = Button("Log To Clipboard"); SameLine();
10298 SetNextItemWidth(80.0f);
10299 SliderInt("Default Depth", &g.LogDepthToExpandDefault, 0, 9, NULL);
10301 PopID();
10302
10303 // Start logging at the end of the function so that the buttons don't appear in the log
10304 if (log_to_tty)
10305 LogToTTY();
10306 if (log_to_file)
10307 LogToFile();
10308 if (log_to_clipboard)
10310}
IMGUI_API void PopAllowKeyboardFocus()
Definition imgui.cpp:6577
IMGUI_API bool SliderInt(const char *label, int *v, int v_min, int v_max, const char *format="%d", ImGuiSliderFlags flags=0)
Definition imgui_widgets.cpp:3068
IMGUI_API void LogToClipboard(int auto_open_depth=-1)
Definition imgui.cpp:10233
IMGUI_API void LogToFile(int auto_open_depth=-1, const char *filename=NULL)
Definition imgui.cpp:10208
IMGUI_API void LogToTTY(int auto_open_depth=-1)
Definition imgui.cpp:10195
IMGUI_API void PushAllowKeyboardFocus(bool allow_keyboard_focus)
Definition imgui.cpp:6572
int LogDepthToExpandDefault
Definition imgui_internal.h:1579

References Button(), GImGui, ImGuiContext::LogDepthToExpandDefault, LogToClipboard(), LogToFile(), LogToTTY(), PopAllowKeyboardFocus(), PopID(), PushAllowKeyboardFocus(), PushID(), SameLine(), SetNextItemWidth(), and SliderInt().

Referenced by ShowDemoWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LogFinish()

void ImGui::LogFinish ( )
10250{
10251 ImGuiContext& g = *GImGui;
10252 if (!g.LogEnabled)
10253 return;
10254
10256 switch (g.LogType)
10257 {
10258 case ImGuiLogType_TTY:
10259#ifndef IMGUI_DISABLE_TTY_FUNCTIONS
10260 fflush(g.LogFile);
10261#endif
10262 break;
10263 case ImGuiLogType_File:
10265 break;
10267 break;
10269 if (!g.LogBuffer.empty())
10271 break;
10272 case ImGuiLogType_None:
10273 IM_ASSERT(0);
10274 break;
10275 }
10276
10277 g.LogEnabled = false;
10279 g.LogFile = NULL;
10280 g.LogBuffer.clear();
10281}
bool ImFileClose(ImFileHandle f)
Definition imgui.cpp:1564
#define IM_NEWLINE
Definition imgui_demo.cpp:129
@ ImGuiLogType_TTY
Definition imgui_internal.h:855
@ ImGuiLogType_None
Definition imgui_internal.h:854
@ ImGuiLogType_Clipboard
Definition imgui_internal.h:858
@ ImGuiLogType_File
Definition imgui_internal.h:856
@ ImGuiLogType_Buffer
Definition imgui_internal.h:857
IMGUI_API void LogText(const char *fmt,...) IM_FMTARGS(1)
Definition imgui.cpp:10088
const char * begin() const
Definition imgui.h:2057

References ImGuiTextBuffer::begin(), ImGuiTextBuffer::clear(), ImGuiTextBuffer::empty(), GImGui, IM_ASSERT, IM_NEWLINE, ImFileClose(), ImGuiLogType_Buffer, ImGuiLogType_Clipboard, ImGuiLogType_File, ImGuiLogType_None, ImGuiLogType_TTY, ImGuiContext::LogBuffer, ImGuiContext::LogEnabled, ImGuiContext::LogFile, LogText(), ImGuiContext::LogType, and SetClipboardText().

Referenced by ExampleAppConsole::Draw(), End(), ShowAboutWindow(), ShowDemoWindow(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LogRenderedText()

void ImGui::LogRenderedText ( const ImVec2 ref_pos,
const char *  text,
const char *  text_end = NULL 
)
10113{
10114 ImGuiContext& g = *GImGui;
10115 ImGuiWindow* window = g.CurrentWindow;
10116
10117 const char* prefix = g.LogNextPrefix;
10118 const char* suffix = g.LogNextSuffix;
10119 g.LogNextPrefix = g.LogNextSuffix = NULL;
10120
10121 if (!text_end)
10122 text_end = FindRenderedTextEnd(text, text_end);
10123
10124 const bool log_new_line = ref_pos && (ref_pos->y > g.LogLinePosY + g.Style.FramePadding.y + 1);
10125 if (ref_pos)
10126 g.LogLinePosY = ref_pos->y;
10127 if (log_new_line)
10128 {
10130 g.LogLineFirstItem = true;
10131 }
10132
10133 if (prefix)
10134 LogRenderedText(ref_pos, prefix, prefix + strlen(prefix)); // Calculate end ourself to ensure "##" are included here.
10135
10136 // Re-adjust padding if we have popped out of our starting depth
10137 if (g.LogDepthRef > window->DC.TreeDepth)
10138 g.LogDepthRef = window->DC.TreeDepth;
10139 const int tree_depth = (window->DC.TreeDepth - g.LogDepthRef);
10140
10141 const char* text_remaining = text;
10142 for (;;)
10143 {
10144 // Split the string. Each new line (after a '\n') is followed by indentation corresponding to the current depth of our log entry.
10145 // We don't add a trailing \n yet to allow a subsequent item on the same line to be captured.
10146 const char* line_start = text_remaining;
10147 const char* line_end = ImStreolRange(line_start, text_end);
10148 const bool is_last_line = (line_end == text_end);
10149 if (line_start != line_end || !is_last_line)
10150 {
10151 const int line_length = (int)(line_end - line_start);
10152 const int indentation = g.LogLineFirstItem ? tree_depth * 4 : 1;
10153 LogText("%*s%.*s", indentation, "", line_length, line_start);
10154 g.LogLineFirstItem = false;
10155 if (*line_end == '\n')
10156 {
10157 LogText(IM_NEWLINE);
10158 g.LogLineFirstItem = true;
10159 }
10160 }
10161 if (is_last_line)
10162 break;
10163 text_remaining = line_end + 1;
10164 }
10165
10166 if (suffix)
10167 LogRenderedText(ref_pos, suffix, suffix + strlen(suffix));
10168}
const char * ImStreolRange(const char *str, const char *str_end)
Definition imgui.cpp:1359

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, FindRenderedTextEnd(), ImGuiStyle::FramePadding, GImGui, IM_NEWLINE, ImStreolRange(), ImGuiContext::LogDepthRef, ImGuiContext::LogLineFirstItem, ImGuiContext::LogLinePosY, ImGuiContext::LogNextPrefix, ImGuiContext::LogNextSuffix, LogRenderedText(), LogText(), ImGuiContext::Style, ImGuiWindowTempData::TreeDepth, and ImVec2::y.

Referenced by Checkbox(), InputTextEx(), LogRenderedText(), RadioButton(), RenderText(), RenderTextClipped(), RenderTextEllipsis(), RenderTextWrapped(), SeparatorEx(), TableBeginCell(), and TableEndRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LogSetNextTextDecoration()

void ImGui::LogSetNextTextDecoration ( const char *  prefix,
const char *  suffix 
)
10189{
10190 ImGuiContext& g = *GImGui;
10191 g.LogNextPrefix = prefix;
10192 g.LogNextSuffix = suffix;
10193}

References GImGui, ImGuiContext::LogNextPrefix, and ImGuiContext::LogNextSuffix.

Referenced by BeginCombo(), ButtonEx(), DragScalar(), InputTextEx(), SliderScalar(), and TreeNodeBehavior().

+ Here is the caller graph for this function:

◆ LogText()

void ImGui::LogText ( const char *  fmt,
  ... 
)
10089{
10090 ImGuiContext& g = *GImGui;
10091 if (!g.LogEnabled)
10092 return;
10093
10094 va_list args;
10095 va_start(args, fmt);
10096 LogTextV(g, fmt, args);
10097 va_end(args);
10098}
static void LogTextV(ImGuiContext &g, const char *fmt, va_list args)
Definition imgui.cpp:10074

References GImGui, ImGuiContext::LogEnabled, and LogTextV().

Referenced by LogFinish(), LogRenderedText(), SeparatorEx(), ShowAboutWindow(), ShowDemoWindow(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LogTextV()

void ImGui::LogTextV ( const char *  fmt,
va_list  args 
)
10101{
10102 ImGuiContext& g = *GImGui;
10103 if (!g.LogEnabled)
10104 return;
10105
10106 LogTextV(g, fmt, args);
10107}

References GImGui, ImGuiContext::LogEnabled, and LogTextV().

+ Here is the call graph for this function:

◆ LogToBuffer()

void ImGui::LogToBuffer ( int  auto_open_depth = -1)
10242{
10243 ImGuiContext& g = *GImGui;
10244 if (g.LogEnabled)
10245 return;
10246 LogBegin(ImGuiLogType_Buffer, auto_open_depth);
10247}
IMGUI_API void LogBegin(ImGuiLogType type, int auto_open_depth)
Definition imgui.cpp:10171

References GImGui, ImGuiLogType_Buffer, LogBegin(), and ImGuiContext::LogEnabled.

+ Here is the call graph for this function:

◆ LogToClipboard()

void ImGui::LogToClipboard ( int  auto_open_depth = -1)
10234{
10235 ImGuiContext& g = *GImGui;
10236 if (g.LogEnabled)
10237 return;
10238 LogBegin(ImGuiLogType_Clipboard, auto_open_depth);
10239}

References GImGui, ImGuiLogType_Clipboard, LogBegin(), and ImGuiContext::LogEnabled.

Referenced by ExampleAppConsole::Draw(), ExampleAppLog::Draw(), LogButtons(), ShowAboutWindow(), ShowDemoWindow(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LogToFile()

void ImGui::LogToFile ( int  auto_open_depth = -1,
const char *  filename = NULL 
)
10209{
10210 ImGuiContext& g = *GImGui;
10211 if (g.LogEnabled)
10212 return;
10213
10214 // FIXME: We could probably open the file in text mode "at", however note that clipboard/buffer logging will still
10215 // be subject to outputting OS-incompatible carriage return if within strings the user doesn't use IM_NEWLINE.
10216 // By opening the file in binary mode "ab" we have consistent output everywhere.
10217 if (!filename)
10218 filename = g.IO.LogFilename;
10219 if (!filename || !filename[0])
10220 return;
10221 ImFileHandle f = ImFileOpen(filename, "ab");
10222 if (!f)
10223 {
10224 IM_ASSERT(0);
10225 return;
10226 }
10227
10228 LogBegin(ImGuiLogType_File, auto_open_depth);
10229 g.LogFile = f;
10230}
ImFileHandle ImFileOpen(const char *filename, const char *mode)
Definition imgui.cpp:1546
FILE * ImFileHandle
Definition imgui_internal.h:366
const char * LogFilename
Definition imgui.h:1786

References GImGui, IM_ASSERT, ImFileOpen(), ImGuiLogType_File, ImGuiContext::IO, LogBegin(), ImGuiContext::LogEnabled, ImGuiContext::LogFile, and ImGuiIO::LogFilename.

Referenced by LogButtons().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LogToTTY()

void ImGui::LogToTTY ( int  auto_open_depth = -1)
10196{
10197 ImGuiContext& g = *GImGui;
10198 if (g.LogEnabled)
10199 return;
10200 IM_UNUSED(auto_open_depth);
10201#ifndef IMGUI_DISABLE_TTY_FUNCTIONS
10202 LogBegin(ImGuiLogType_TTY, auto_open_depth);
10203 g.LogFile = stdout;
10204#endif
10205}

References GImGui, IM_UNUSED, ImGuiLogType_TTY, LogBegin(), ImGuiContext::LogEnabled, and ImGuiContext::LogFile.

Referenced by LogButtons(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MarkIniSettingsDirty() [1/2]

void ImGui::MarkIniSettingsDirty ( )
10359{
10360 ImGuiContext& g = *GImGui;
10361 if (g.SettingsDirtyTimer <= 0.0f)
10363}
float SettingsDirtyTimer
Definition imgui_internal.h:1560
float IniSavingRate
Definition imgui.h:1784

References GImGui, ImGuiIO::IniSavingRate, ImGuiContext::IO, and ImGuiContext::SettingsDirtyTimer.

Referenced by Begin(), NavUpdateWindowing(), TabBarProcessReorder(), TableSaveSettings(), UpdateMouseMovingWindowNewFrame(), and UpdateWindowManualResize().

+ Here is the caller graph for this function:

◆ MarkIniSettingsDirty() [2/2]

void ImGui::MarkIniSettingsDirty ( ImGuiWindow window)

◆ MarkItemEdited()

void ImGui::MarkItemEdited ( ImGuiID  id)
3115{
3116 // This marking is solely to be able to provide info for IsItemDeactivatedAfterEdit().
3117 // ActiveId might have been released by the time we call this (as in the typical press/release button behavior) but still need need to fill the data.
3118 ImGuiContext& g = *GImGui;
3119 IM_ASSERT(g.ActiveId == id || g.ActiveId == 0 || g.DragDropActive);
3120 IM_UNUSED(id); // Avoid unused variable warnings when asserts are compiled out.
3121 //IM_ASSERT(g.CurrentWindow->DC.LastItemId == id);
3125}

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdHasBeenEditedBefore, ImGuiContext::ActiveIdHasBeenEditedThisFrame, ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiContext::DragDropActive, GImGui, IM_ASSERT, IM_UNUSED, ImGuiItemStatusFlags_Edited, and ImGuiWindowTempData::LastItemStatusFlags.

Referenced by Checkbox(), ColorEdit4(), ColorPicker4(), DragScalar(), Slic3r::GUI::ImGuiWrapper::draw_radio_button(), InputScalar(), InputTextEx(), RadioButton(), Slic3r::GUI::selectable(), Selectable(), SliderScalar(), SplitterBehavior(), TempInputScalar(), and VSliderScalar().

+ Here is the caller graph for this function:

◆ MemAlloc()

void * ImGui::MemAlloc ( size_t  size)
3326{
3327 if (ImGuiContext* ctx = GImGui)
3328 ctx->IO.MetricsActiveAllocations++;
3330}

References GImAllocatorAllocFunc, GImAllocatorUserData, and GImGui.

◆ MemFree()

void ImGui::MemFree ( void ptr)
3334{
3335 if (ptr)
3336 if (ImGuiContext* ctx = GImGui)
3337 ctx->IO.MetricsActiveAllocations--;
3339}

References GImAllocatorFreeFunc, GImAllocatorUserData, and GImGui.

Referenced by IM_DELETE(), and InputTextEx().

+ Here is the caller graph for this function:

◆ MenuItem() [1/2]

bool ImGui::MenuItem ( const char *  label,
const char *  shortcut,
bool *  p_selected,
bool  enabled = true 
)
6922{
6923 if (MenuItem(label, shortcut, p_selected ? *p_selected : false, enabled))
6924 {
6925 if (p_selected)
6926 *p_selected = !*p_selected;
6927 return true;
6928 }
6929 return false;
6930}
IMGUI_API bool MenuItem(const char *label, const char *shortcut=NULL, bool selected=false, bool enabled=true)
Definition imgui_widgets.cpp:6872

References MenuItem().

+ Here is the call graph for this function:

◆ MenuItem() [2/2]

bool ImGui::MenuItem ( const char *  label,
const char *  shortcut = NULL,
bool  selected = false,
bool  enabled = true 
)
6873{
6874 ImGuiWindow* window = GetCurrentWindow();
6875 if (window->SkipItems)
6876 return false;
6877
6878 ImGuiContext& g = *GImGui;
6879 ImGuiStyle& style = g.Style;
6880 ImVec2 pos = window->DC.CursorPos;
6881 ImVec2 label_size = CalcTextSize(label, NULL, true);
6882
6883 // We've been using the equivalent of ImGuiSelectableFlags_SetNavIdOnHover on all Selectable() since early Nav system days (commit 43ee5d73),
6884 // but I am unsure whether this should be kept at all. For now moved it to be an opt-in feature used by menus only.
6886 bool pressed;
6888 {
6889 // Mimic the exact layout spacing of BeginMenu() to allow MenuItem() inside a menu bar, which is a little misleading but may be useful
6890 // Note that in this situation: we don't render the shortcut, we render a highlight instead of the selected tick mark.
6891 float w = label_size.x;
6892 window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * 0.5f);
6893 PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y));
6894 pressed = Selectable(label, selected, flags, ImVec2(w, 0.0f));
6895 PopStyleVar();
6896 window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar().
6897 }
6898 else
6899 {
6900 // Menu item inside a vertical menu
6901 // (In a typical menu window where all items are BeginMenu() or MenuItem() calls, extra_w will always be 0.0f.
6902 // Only when they are other items sticking out we're going to add spacing, yet only register minimum width into the layout system.
6903 float shortcut_w = shortcut ? CalcTextSize(shortcut, NULL).x : 0.0f;
6904 float min_w = window->DC.MenuColumns.DeclColumns(label_size.x, shortcut_w, IM_FLOOR(g.FontSize * 1.20f)); // Feedback for next frame
6905 float extra_w = ImMax(0.0f, GetContentRegionAvail().x - min_w);
6906 pressed = Selectable(label, false, flags | ImGuiSelectableFlags_SpanAvailWidth, ImVec2(min_w, 0.0f));
6907 if (shortcut_w > 0.0f)
6908 {
6909 PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]);
6910 RenderText(pos + ImVec2(window->DC.MenuColumns.Pos[1] + extra_w, 0.0f), shortcut, NULL, false);
6911 PopStyleColor();
6912 }
6913 if (selected)
6914 RenderCheckMark(window->DrawList, pos + ImVec2(window->DC.MenuColumns.Pos[2] + extra_w + g.FontSize * 0.40f, g.FontSize * 0.134f * 0.5f), GetColorU32(enabled ? ImGuiCol_Text : ImGuiCol_TextDisabled), g.FontSize * 0.866f);
6915 }
6916
6917 IMGUI_TEST_ENGINE_ITEM_INFO(window->DC.LastItemId, label, window->DC.LastItemStatusFlags | ImGuiItemStatusFlags_Checkable | (selected ? ImGuiItemStatusFlags_Checked : 0));
6918 return pressed;
6919}
int ImGuiSelectableFlags
Definition imgui.h:192
@ ImGuiSelectableFlags_SetNavIdOnHover
Definition imgui_internal.h:814
@ ImGuiSelectableFlags_SelectOnRelease
Definition imgui_internal.h:811

References CalcTextSize(), ImGuiStyle::Colors, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiMenuColumns::DeclColumns(), ImGuiWindow::DrawList, ImGuiContext::FontSize, GetColorU32(), GetContentRegionAvail(), GetCurrentWindow(), GImGui, IM_FLOOR, IMGUI_TEST_ENGINE_ITEM_INFO, ImGuiCol_Text, ImGuiCol_TextDisabled, ImGuiLayoutType_Horizontal, ImGuiSelectableFlags_Disabled, ImGuiSelectableFlags_SelectOnRelease, ImGuiSelectableFlags_SetNavIdOnHover, ImGuiSelectableFlags_SpanAvailWidth, ImGuiStyleVar_ItemSpacing, ImMax(), ImGuiWindowTempData::LastItemId, ImGuiWindowTempData::LastItemStatusFlags, ImGuiWindowTempData::LayoutType, ImGuiWindowTempData::MenuColumns, PopStyleColor(), PopStyleVar(), ImGuiMenuColumns::Pos, PushStyleColor(), PushStyleVar(), RenderCheckMark(), RenderText(), Selectable(), ImGuiWindow::SkipItems, ImGuiContext::Style, style, and ImVec2::x.

Referenced by MyDocument::DisplayContextMenu(), ExampleAppConsole::Draw(), MenuItem(), Slic3r::GUI::GCodeViewer::render_legend(), ShowDemoWindow(), ShowDemoWindowPopups(), ShowDemoWindowWidgets(), ShowExampleAppCustomRendering(), ShowExampleAppDocuments(), ShowExampleAppLayout(), ShowExampleAppMainMenuBar(), ShowExampleAppSimpleOverlay(), ShowExampleMenuFile(), and TableDrawContextMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NavApplyItemToResult()

static void ImGui::NavApplyItemToResult ( ImGuiNavItemData result,
ImGuiWindow window,
ImGuiID  id,
const ImRect nav_bb_rel 
)
static
8781{
8782 result->Window = window;
8783 result->ID = id;
8784 result->FocusScopeId = window->DC.NavFocusScopeIdCurrent;
8785 result->RectRel = nav_bb_rel;
8786}
ImGuiID ID
Definition imgui_internal.h:1068
ImRect RectRel
Definition imgui_internal.h:1070
ImGuiID FocusScopeId
Definition imgui_internal.h:1069
ImGuiWindow * Window
Definition imgui_internal.h:1067

References ImGuiWindow::DC, ImGuiNavItemData::FocusScopeId, ImGuiNavItemData::ID, ImGuiWindowTempData::NavFocusScopeIdCurrent, ImGuiNavItemData::RectRel, and ImGuiNavItemData::Window.

Referenced by NavProcessItem().

+ Here is the caller graph for this function:

◆ NavCalcPreferredRefPos()

static ImVec2 ImGui::NavCalcPreferredRefPos ( )
static
8964{
8965 ImGuiContext& g = *GImGui;
8967 {
8968 // Mouse (we need a fallback in case the mouse becomes invalid after being used)
8969 if (IsMousePosValid(&g.IO.MousePos))
8970 return g.IO.MousePos;
8971 return g.LastValidMousePos;
8972 }
8973 else
8974 {
8975 // When navigation is active and mouse is disabled, decide on an arbitrary position around the bottom left of the currently navigated item.
8976 const ImRect& rect_rel = g.NavWindow->NavRectRel[g.NavLayer];
8977 ImVec2 pos = g.NavWindow->Pos + ImVec2(rect_rel.Min.x + ImMin(g.Style.FramePadding.x * 4, rect_rel.GetWidth()), rect_rel.Max.y - ImMin(g.Style.FramePadding.y, rect_rel.GetHeight()));
8978 ImGuiViewport* viewport = GetMainViewport();
8979 return ImFloor(ImClamp(pos, viewport->Pos, viewport->Pos + viewport->Size)); // ImFloor() is important because non-integer mouse position application in backend might be lossy and result in undesirable non-zero delta.
8980 }
8981}
ImVec2 LastValidMousePos
Definition imgui_internal.h:1533

References ImGuiStyle::FramePadding, ImRect::GetHeight(), GetMainViewport(), ImRect::GetWidth(), GImGui, ImClamp(), ImFloor(), ImMin(), ImGuiContext::IO, IsMousePosValid(), ImGuiContext::LastValidMousePos, ImRect::Max, ImRect::Min, ImGuiIO::MousePos, ImGuiContext::NavDisableHighlight, ImGuiContext::NavDisableMouseHover, ImGuiContext::NavLayer, ImGuiWindow::NavRectRel, ImGuiContext::NavWindow, ImGuiViewport::Pos, ImGuiWindow::Pos, ImGuiViewport::Size, ImGuiContext::Style, ImVec2::x, and ImVec2::y.

Referenced by FindBestWindowPosForPopup(), NavUpdate(), and OpenPopupEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NavEndFrame()

static void ImGui::NavEndFrame ( )
static
9460{
9461 ImGuiContext& g = *GImGui;
9462
9463 // Show CTRL+TAB list window
9464 if (g.NavWindowingTarget != NULL)
9466
9467 // Perform wrap-around in menus
9471 {
9472 IM_ASSERT(move_flags != 0); // No points calling this with no wrapping
9473 ImRect bb_rel = window->NavRectRel[0];
9474
9475 ImGuiDir clip_dir = g.NavMoveDir;
9477 {
9478 bb_rel.Min.x = bb_rel.Max.x =
9479 ImMax(window->SizeFull.x, window->ContentSize.x + window->WindowPadding.x * 2.0f) - window->Scroll.x;
9480 if (move_flags & ImGuiNavMoveFlags_WrapX)
9481 {
9482 bb_rel.TranslateY(-bb_rel.GetHeight());
9483 clip_dir = ImGuiDir_Up;
9484 }
9485 NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags);
9486 }
9488 {
9489 bb_rel.Min.x = bb_rel.Max.x = -window->Scroll.x;
9490 if (move_flags & ImGuiNavMoveFlags_WrapX)
9491 {
9492 bb_rel.TranslateY(+bb_rel.GetHeight());
9493 clip_dir = ImGuiDir_Down;
9494 }
9495 NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags);
9496 }
9498 {
9499 bb_rel.Min.y = bb_rel.Max.y =
9500 ImMax(window->SizeFull.y, window->ContentSize.y + window->WindowPadding.y * 2.0f) - window->Scroll.y;
9501 if (move_flags & ImGuiNavMoveFlags_WrapY)
9502 {
9503 bb_rel.TranslateX(-bb_rel.GetWidth());
9504 clip_dir = ImGuiDir_Left;
9505 }
9506 NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags);
9507 }
9509 {
9510 bb_rel.Min.y = bb_rel.Max.y = -window->Scroll.y;
9511 if (move_flags & ImGuiNavMoveFlags_WrapY)
9512 {
9513 bb_rel.TranslateX(+bb_rel.GetWidth());
9514 clip_dir = ImGuiDir_Right;
9515 }
9516 NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags);
9517 }
9518 }
9519}
@ ImGuiNavMoveFlags_WrapY
Definition imgui_internal.h:920
@ ImGuiNavMoveFlags_WrapX
Definition imgui_internal.h:919
@ ImGuiNavMoveFlags_LoopX
Definition imgui_internal.h:917
int ImGuiNavMoveFlags
Definition imgui_internal.h:148
static void NavUpdateWindowingOverlay()
Definition imgui.cpp:9719
IMGUI_API void NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, const ImRect &bb_rel, ImGuiNavMoveFlags move_flags)
Definition imgui.cpp:8862
ImGuiNavMoveFlags NavWrapRequestFlags
Definition imgui_internal.h:1476
ImGuiWindow * NavWrapRequestWindow
Definition imgui_internal.h:1475
void TranslateX(float dx)
Definition imgui_internal.h:497
void TranslateY(float dy)
Definition imgui_internal.h:498

References ImGuiWindow::ContentSize, ImRect::GetHeight(), ImRect::GetWidth(), GImGui, IM_ASSERT, ImGuiDir_Down, ImGuiDir_Left, ImGuiDir_Right, ImGuiDir_Up, ImGuiNavForward_None, ImGuiNavLayer_Main, ImGuiNavMoveFlags_LoopX, ImGuiNavMoveFlags_LoopY, ImGuiNavMoveFlags_WrapX, ImGuiNavMoveFlags_WrapY, ImMax(), ImRect::Max, ImRect::Min, ImGuiContext::NavLayer, ImGuiContext::NavMoveDir, NavMoveRequestButNoResultYet(), ImGuiContext::NavMoveRequestForward, NavMoveRequestForward(), ImGuiWindow::NavRectRel, NavUpdateWindowingOverlay(), ImGuiContext::NavWindow, ImGuiContext::NavWindowingTarget, ImGuiContext::NavWrapRequestFlags, ImGuiContext::NavWrapRequestWindow, ImGuiWindow::Scroll, ImGuiWindow::SizeFull, ImRect::TranslateX(), ImRect::TranslateY(), ImGuiWindow::WindowPadding, ImVec2::x, and ImVec2::y.

Referenced by EndFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NavInitWindow()

void ImGui::NavInitWindow ( ImGuiWindow window,
bool  force_reinit 
)
8933{
8934 ImGuiContext& g = *GImGui;
8935 IM_ASSERT(window == g.NavWindow);
8936
8937 if (window->Flags & ImGuiWindowFlags_NoNavInputs)
8938 {
8939 g.NavId = g.NavFocusScopeId = 0;
8940 return;
8941 }
8942
8943 bool init_for_nav = false;
8944 if (window == window->RootWindow || (window->Flags & ImGuiWindowFlags_Popup) || (window->NavLastIds[0] == 0) || force_reinit)
8945 init_for_nav = true;
8946 IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from NavInitWindow(), init_for_nav=%d, window=\"%s\", layer=%d\n", init_for_nav, window->Name, g.NavLayer);
8947 if (init_for_nav)
8948 {
8949 SetNavID(0, g.NavLayer, 0, ImRect());
8950 g.NavInitRequest = true;
8951 g.NavInitRequestFromMove = false;
8952 g.NavInitResultId = 0;
8954 NavUpdateAnyRequestFlag();
8955 }
8956 else
8957 {
8958 g.NavId = window->NavLastIds[0];
8959 g.NavFocusScopeId = 0;
8960 }
8961}
#define IMGUI_DEBUG_LOG_NAV(...)
Definition imgui_internal.h:197
ImGuiID NavInitResultId
Definition imgui_internal.h:1464
ImRect NavInitResultRectRel
Definition imgui_internal.h:1465
bool NavInitRequestFromMove
Definition imgui_internal.h:1463

References ImGuiWindow::Flags, GImGui, IM_ASSERT, IMGUI_DEBUG_LOG_NAV, ImGuiWindowFlags_NoNavInputs, ImGuiWindowFlags_Popup, ImGuiWindow::Name, ImGuiContext::NavFocusScopeId, ImGuiContext::NavId, ImGuiContext::NavInitRequest, ImGuiContext::NavInitRequestFromMove, ImGuiContext::NavInitResultId, ImGuiContext::NavInitResultRectRel, ImGuiWindow::NavLastIds, ImGuiContext::NavLayer, NavUpdateAnyRequestFlag(), ImGuiContext::NavWindow, ImGuiWindow::RootWindow, and SetNavID().

Referenced by Begin(), BeginChildEx(), NavRestoreLayer(), and NavUpdateWindowing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NavMoveRequestButNoResultYet()

bool ImGui::NavMoveRequestButNoResultYet ( )
8850{
8851 ImGuiContext& g = *GImGui;
8852 return g.NavMoveRequest && g.NavMoveResultLocal.ID == 0 && g.NavMoveResultOther.ID == 0;
8853}
ImGuiNavItemData NavMoveResultLocal
Definition imgui_internal.h:1472
ImGuiNavItemData NavMoveResultOther
Definition imgui_internal.h:1474

References GImGui, ImGuiNavItemData::ID, ImGuiContext::NavMoveRequest, ImGuiContext::NavMoveResultLocal, and ImGuiContext::NavMoveResultOther.

Referenced by EndMenu(), EndMenuBar(), NavEndFrame(), and TreePop().

+ Here is the caller graph for this function:

◆ NavMoveRequestCancel()

void ImGui::NavMoveRequestCancel ( )
8856{
8857 ImGuiContext& g = *GImGui;
8858 g.NavMoveRequest = false;
8860}

References GImGui, ImGuiContext::NavMoveRequest, and NavUpdateAnyRequestFlag().

Referenced by BeginMenu(), EndMenu(), EndMenuBar(), NavMoveRequestForward(), TreeNodeBehavior(), and TreePop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NavMoveRequestForward()

void ImGui::NavMoveRequestForward ( ImGuiDir  move_dir,
ImGuiDir  clip_dir,
const ImRect bb_rel,
ImGuiNavMoveFlags  move_flags 
)
8863{
8864 ImGuiContext& g = *GImGui;
8867 g.NavMoveDir = move_dir;
8868 g.NavMoveClipDir = clip_dir;
8870 g.NavMoveRequestFlags = move_flags;
8871 g.NavWindow->NavRectRel[g.NavLayer] = bb_rel;
8872}
ImGuiNavMoveFlags NavMoveRequestFlags
Definition imgui_internal.h:1467

References GImGui, IM_ASSERT, ImGuiNavForward_ForwardQueued, ImGuiNavForward_None, ImGuiContext::NavLayer, ImGuiContext::NavMoveClipDir, ImGuiContext::NavMoveDir, NavMoveRequestCancel(), ImGuiContext::NavMoveRequestFlags, ImGuiContext::NavMoveRequestForward, ImGuiWindow::NavRectRel, and ImGuiContext::NavWindow.

Referenced by NavEndFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NavMoveRequestTryWrapping()

void ImGui::NavMoveRequestTryWrapping ( ImGuiWindow window,
ImGuiNavMoveFlags  move_flags 
)
8875{
8876 ImGuiContext& g = *GImGui;
8877
8878 // Navigation wrap-around logic is delayed to the end of the frame because this operation is only valid after entire
8879 // popup is assembled and in case of appended popups it is not clear which EndPopup() call is final.
8880 g.NavWrapRequestWindow = window;
8881 g.NavWrapRequestFlags = move_flags;
8882}

References GImGui, ImGuiContext::NavWrapRequestFlags, and ImGuiContext::NavWrapRequestWindow.

Referenced by EndPopup().

+ Here is the caller graph for this function:

◆ NavProcessItem()

static void ImGui::NavProcessItem ( ImGuiWindow window,
const ImRect nav_bb,
ImGuiID  id 
)
static
8790{
8791 ImGuiContext& g = *GImGui;
8792 //if (!g.IO.NavActive) // [2017/10/06] Removed this possibly redundant test but I am not sure of all the side-effects yet. Some of the feature here will need to work regardless of using a _NoNavInputs flag.
8793 // return;
8794
8795 const ImGuiItemFlags item_flags = g.CurrentItemFlags;
8796 const ImRect nav_bb_rel(nav_bb.Min - window->Pos, nav_bb.Max - window->Pos);
8797
8798 // Process Init Request
8799 if (g.NavInitRequest && g.NavLayer == window->DC.NavLayerCurrent)
8800 {
8801 // Even if 'ImGuiItemFlags_NoNavDefaultFocus' is on (typically collapse/close button) we record the first ResultId so they can be used as a fallback
8802 if (!(item_flags & ImGuiItemFlags_NoNavDefaultFocus) || g.NavInitResultId == 0)
8803 {
8804 g.NavInitResultId = id;
8805 g.NavInitResultRectRel = nav_bb_rel;
8806 }
8807 if (!(item_flags & ImGuiItemFlags_NoNavDefaultFocus))
8808 {
8809 g.NavInitRequest = false; // Found a match, clear request
8810 NavUpdateAnyRequestFlag();
8811 }
8812 }
8813
8814 // Process Move Request (scoring for navigation)
8815 // FIXME-NAV: Consider policy for double scoring (scoring from NavScoringRectScreen + scoring from a rect wrapped according to current wrapping policy)
8817 {
8818 ImGuiNavItemData* result = (window == g.NavWindow) ? &g.NavMoveResultLocal : &g.NavMoveResultOther;
8819#if IMGUI_DEBUG_NAV_SCORING
8820 // [DEBUG] Score all items in NavWindow at all times
8821 if (!g.NavMoveRequest)
8823 bool new_best = NavScoreItem(result, nav_bb) && g.NavMoveRequest;
8824#else
8825 bool new_best = g.NavMoveRequest && NavScoreItem(result, nav_bb);
8826#endif
8827 if (new_best)
8828 NavApplyItemToResult(result, window, id, nav_bb_rel);
8829
8830 // Features like PageUp/PageDown need to maintain a separate score for the visible set of items.
8831 const float VISIBLE_RATIO = 0.70f;
8833 if (ImClamp(nav_bb.Max.y, window->ClipRect.Min.y, window->ClipRect.Max.y) - ImClamp(nav_bb.Min.y, window->ClipRect.Min.y, window->ClipRect.Max.y) >= (nav_bb.Max.y - nav_bb.Min.y) * VISIBLE_RATIO)
8835 NavApplyItemToResult(&g.NavMoveResultLocalVisibleSet, window, id, nav_bb_rel);
8836 }
8837
8838 // Update window-relative bounding box of navigated item
8839 if (g.NavId == id)
8840 {
8841 g.NavWindow = window; // Always refresh g.NavWindow, because some operations such as FocusItem() don't have a window.
8842 g.NavLayer = window->DC.NavLayerCurrent;
8844 g.NavIdIsAlive = true;
8845 window->NavRectRel[window->DC.NavLayerCurrent] = nav_bb_rel; // Store item bounding box (relative to window position)
8846 }
8847}
int ImGuiItemFlags
Definition imgui_internal.h:142
@ ImGuiNavMoveFlags_AlsoScoreVisibleSet
Definition imgui_internal.h:922
@ ImGuiNavMoveFlags_AllowCurrentNavId
Definition imgui_internal.h:921
static bool NavScoreItem(ImGuiNavItemData *result, ImRect cand)
Definition imgui.cpp:8649
static void NavApplyItemToResult(ImGuiNavItemData *result, ImGuiWindow *window, ImGuiID id, const ImRect &nav_bb_rel)
Definition imgui.cpp:8780
ImGuiNavItemData NavMoveResultLocalVisibleSet
Definition imgui_internal.h:1473
ImGuiDir NavMoveDirLast
Definition imgui_internal.h:1470
Definition imgui_internal.h:1066

References ImGuiWindow::ClipRect, ImGuiContext::CurrentItemFlags, ImGuiWindow::DC, GImGui, ImClamp(), ImGuiItemFlags_Disabled, ImGuiItemFlags_NoNav, ImGuiItemFlags_NoNavDefaultFocus, ImGuiNavMoveFlags_AllowCurrentNavId, ImGuiNavMoveFlags_AlsoScoreVisibleSet, ImRect::Max, ImRect::Min, NavApplyItemToResult(), ImGuiContext::NavFocusScopeId, ImGuiWindowTempData::NavFocusScopeIdCurrent, ImGuiContext::NavId, ImGuiContext::NavIdIsAlive, ImGuiContext::NavInitRequest, ImGuiContext::NavInitResultId, ImGuiContext::NavInitResultRectRel, ImGuiContext::NavLayer, ImGuiWindowTempData::NavLayerCurrent, ImGuiContext::NavMoveDir, ImGuiContext::NavMoveDirLast, ImGuiContext::NavMoveRequest, ImGuiContext::NavMoveRequestFlags, ImGuiContext::NavMoveResultLocal, ImGuiContext::NavMoveResultLocalVisibleSet, ImGuiContext::NavMoveResultOther, ImGuiWindow::NavRectRel, NavScoreItem(), NavUpdateAnyRequestFlag(), ImGuiContext::NavWindow, ImRect::Overlaps(), ImGuiWindow::Pos, and ImVec2::y.

Referenced by ItemAdd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NavRestoreLastChildNavWindow()

static ImGuiWindow * ImGui::NavRestoreLastChildNavWindow ( ImGuiWindow window)
static
8898{
8900 return window->NavLastChildNavWindow;
8901 return window;
8902}

References ImGuiWindow::NavLastChildNavWindow, and ImGuiWindow::WasActive.

Referenced by ClosePopupToLevel(), FocusTopMostWindowUnderOne(), NavRestoreLayer(), and NavUpdateWindowing().

+ Here is the caller graph for this function:

◆ NavRestoreLayer()

void ImGui::NavRestoreLayer ( ImGuiNavLayer  layer)
static
8905{
8906 ImGuiContext& g = *GImGui;
8907 if (layer == ImGuiNavLayer_Main)
8909 ImGuiWindow* window = g.NavWindow;
8910 if (window->NavLastIds[layer] != 0)
8911 {
8912 SetNavID(window->NavLastIds[layer], layer, 0, window->NavRectRel[layer]);
8913 g.NavDisableHighlight = false;
8915 }
8916 else
8917 {
8918 g.NavLayer = layer;
8919 NavInitWindow(window, true);
8920 }
8921}

References GImGui, ImGuiNavLayer_Main, ImGuiContext::NavDisableHighlight, ImGuiContext::NavDisableMouseHover, NavInitWindow(), ImGuiWindow::NavLastIds, ImGuiContext::NavLayer, ImGuiContext::NavMousePosDirty, ImGuiWindow::NavRectRel, NavRestoreLastChildNavWindow(), ImGuiContext::NavWindow, and SetNavID().

Referenced by NavUpdate(), and NavUpdateWindowing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NavSaveLastChildNavWindowIntoParent()

static void ImGui::NavSaveLastChildNavWindowIntoParent ( ImGuiWindow nav_window)
static
8887{
8888 ImGuiWindow* parent = nav_window;
8889 while (parent && parent->RootWindow != parent && (parent->Flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu)) == 0)
8890 parent = parent->ParentWindow;
8891 if (parent && parent != nav_window)
8892 parent->NavLastChildNavWindow = nav_window;
8893}

References ImGuiWindow::Flags, ImGuiWindowFlags_ChildMenu, ImGuiWindowFlags_Popup, ImGuiWindow::NavLastChildNavWindow, ImGuiWindow::ParentWindow, and ImGuiWindow::RootWindow.

Referenced by NavUpdate().

+ Here is the caller graph for this function:

◆ NavScoreItem()

static bool ImGui::NavScoreItem ( ImGuiNavItemData result,
ImRect  cand 
)
static
8650{
8651 ImGuiContext& g = *GImGui;
8652 ImGuiWindow* window = g.CurrentWindow;
8653 if (g.NavLayer != window->DC.NavLayerCurrent)
8654 return false;
8655
8656 const ImRect& curr = g.NavScoringRect; // Current modified source rect (NB: we've applied Max.x = Min.x in NavUpdate() to inhibit the effect of having varied item width)
8657 g.NavScoringCount++;
8658
8659 // When entering through a NavFlattened border, we consider child window items as fully clipped for scoring
8660 if (window->ParentWindow == g.NavWindow)
8661 {
8663 if (!window->ClipRect.Overlaps(cand))
8664 return false;
8665 cand.ClipWithFull(window->ClipRect); // This allows the scored item to not overlap other candidates in the parent window
8666 }
8667
8668 // We perform scoring on items bounding box clipped by the current clipping rectangle on the other axis (clipping on our movement axis would give us equal scores for all clipped items)
8669 // For example, this ensure that items in one column are not reached when moving vertically from items in another column.
8671
8672 // Compute distance between boxes
8673 // FIXME-NAV: Introducing biases for vertical navigation, needs to be removed.
8674 float dbx = NavScoreItemDistInterval(cand.Min.x, cand.Max.x, curr.Min.x, curr.Max.x);
8675 float dby = NavScoreItemDistInterval(ImLerp(cand.Min.y, cand.Max.y, 0.2f), ImLerp(cand.Min.y, cand.Max.y, 0.8f), ImLerp(curr.Min.y, curr.Max.y, 0.2f), ImLerp(curr.Min.y, curr.Max.y, 0.8f)); // Scale down on Y to keep using box-distance for vertically touching items
8676 if (dby != 0.0f && dbx != 0.0f)
8677 dbx = (dbx / 1000.0f) + ((dbx > 0.0f) ? +1.0f : -1.0f);
8678 float dist_box = ImFabs(dbx) + ImFabs(dby);
8679
8680 // Compute distance between centers (this is off by a factor of 2, but we only compare center distances with each other so it doesn't matter)
8681 float dcx = (cand.Min.x + cand.Max.x) - (curr.Min.x + curr.Max.x);
8682 float dcy = (cand.Min.y + cand.Max.y) - (curr.Min.y + curr.Max.y);
8683 float dist_center = ImFabs(dcx) + ImFabs(dcy); // L1 metric (need this for our connectedness guarantee)
8684
8685 // Determine which quadrant of 'curr' our candidate item 'cand' lies in based on distance
8686 ImGuiDir quadrant;
8687 float dax = 0.0f, day = 0.0f, dist_axial = 0.0f;
8688 if (dbx != 0.0f || dby != 0.0f)
8689 {
8690 // For non-overlapping boxes, use distance between boxes
8691 dax = dbx;
8692 day = dby;
8693 dist_axial = dist_box;
8694 quadrant = ImGetDirQuadrantFromDelta(dbx, dby);
8695 }
8696 else if (dcx != 0.0f || dcy != 0.0f)
8697 {
8698 // For overlapping boxes with different centers, use distance between centers
8699 dax = dcx;
8700 day = dcy;
8701 dist_axial = dist_center;
8702 quadrant = ImGetDirQuadrantFromDelta(dcx, dcy);
8703 }
8704 else
8705 {
8706 // Degenerate case: two overlapping buttons with same center, break ties arbitrarily (note that LastItemId here is really the _previous_ item order, but it doesn't matter)
8707 quadrant = (window->DC.LastItemId < g.NavId) ? ImGuiDir_Left : ImGuiDir_Right;
8708 }
8709
8710#if IMGUI_DEBUG_NAV_SCORING
8711 char buf[128];
8712 if (IsMouseHoveringRect(cand.Min, cand.Max))
8713 {
8714 ImFormatString(buf, IM_ARRAYSIZE(buf), "dbox (%.2f,%.2f->%.4f)\ndcen (%.2f,%.2f->%.4f)\nd (%.2f,%.2f->%.4f)\nnav %c, quadrant %c", dbx, dby, dist_box, dcx, dcy, dist_center, dax, day, dist_axial, "WENS"[g.NavMoveDir], "WENS"[quadrant]);
8715 ImDrawList* draw_list = GetForegroundDrawList(window);
8716 draw_list->AddRect(curr.Min, curr.Max, IM_COL32(255,200,0,100));
8717 draw_list->AddRect(cand.Min, cand.Max, IM_COL32(255,255,0,200));
8718 draw_list->AddRectFilled(cand.Max - ImVec2(4, 4), cand.Max + CalcTextSize(buf) + ImVec2(4, 4), IM_COL32(40,0,0,150));
8719 draw_list->AddText(g.IO.FontDefault, 13.0f, cand.Max, ~0U, buf);
8720 }
8721 else if (g.IO.KeyCtrl) // Hold to preview score in matching quadrant. Press C to rotate.
8722 {
8724 if (quadrant == g.NavMoveDir)
8725 {
8726 ImFormatString(buf, IM_ARRAYSIZE(buf), "%.0f/%.0f", dist_box, dist_center);
8727 ImDrawList* draw_list = GetForegroundDrawList(window);
8728 draw_list->AddRectFilled(cand.Min, cand.Max, IM_COL32(255, 0, 0, 200));
8729 draw_list->AddText(g.IO.FontDefault, 13.0f, cand.Min, IM_COL32(255, 255, 255, 255), buf);
8730 }
8731 }
8732#endif
8733
8734 // Is it in the quadrant we're interesting in moving to?
8735 bool new_best = false;
8736 if (quadrant == g.NavMoveDir)
8737 {
8738 // Does it beat the current best candidate?
8739 if (dist_box < result->DistBox)
8740 {
8741 result->DistBox = dist_box;
8742 result->DistCenter = dist_center;
8743 return true;
8744 }
8745 if (dist_box == result->DistBox)
8746 {
8747 // Try using distance between center points to break ties
8748 if (dist_center < result->DistCenter)
8749 {
8750 result->DistCenter = dist_center;
8751 new_best = true;
8752 }
8753 else if (dist_center == result->DistCenter)
8754 {
8755 // Still tied! we need to be extra-careful to make sure everything gets linked properly. We consistently break ties by symbolically moving "later" items
8756 // (with higher index) to the right/downwards by an infinitesimal amount since we the current "best" button already (so it must have a lower index),
8757 // this is fairly easy. This rule ensures that all buttons with dx==dy==0 will end up being linked in order of appearance along the x axis.
8758 if (((g.NavMoveDir == ImGuiDir_Up || g.NavMoveDir == ImGuiDir_Down) ? dby : dbx) < 0.0f) // moving bj to the right/down decreases distance
8759 new_best = true;
8760 }
8761 }
8762 }
8763
8764 // Axial check: if 'curr' has no link at all in some direction and 'cand' lies roughly in that direction, add a tentative link. This will only be kept if no "real" matches
8765 // are found, so it only augments the graph produced by the above method using extra links. (important, since it doesn't guarantee strong connectedness)
8766 // This is just to avoid buttons having no links in a particular direction when there's a suitable neighbor. you get good graphs without this too.
8767 // 2017/09/29: FIXME: This now currently only enabled inside menu bars, ideally we'd disable it everywhere. Menus in particular need to catch failure. For general navigation it feels awkward.
8768 // Disabling it may lead to disconnected graphs when nodes are very spaced out on different axis. Perhaps consider offering this as an option?
8769 if (result->DistBox == FLT_MAX && dist_axial < result->DistAxial) // Check axial match
8771 if ((g.NavMoveDir == ImGuiDir_Left && dax < 0.0f) || (g.NavMoveDir == ImGuiDir_Right && dax > 0.0f) || (g.NavMoveDir == ImGuiDir_Up && day < 0.0f) || (g.NavMoveDir == ImGuiDir_Down && day > 0.0f))
8772 {
8773 result->DistAxial = dist_axial;
8774 new_best = true;
8775 }
8776
8777 return new_best;
8778}
ImGuiDir ImGetDirQuadrantFromDelta(float dx, float dy)
Definition imgui.cpp:8618
static float NavScoreItemDistInterval(float a0, float a1, float b0, float b1)
Definition imgui.cpp:8625
static void NavClampRectToVisibleAreaForMoveDir(ImGuiDir move_dir, ImRect &r, const ImRect &clip_rect)
Definition imgui.cpp:8634
int NavScoringCount
Definition imgui_internal.h:1454
float DistBox
Definition imgui_internal.h:1071
float DistCenter
Definition imgui_internal.h:1072
float DistAxial
Definition imgui_internal.h:1073

References ImDrawList::AddRect(), ImDrawList::AddRectFilled(), ImDrawList::AddText(), CalcTextSize(), ImGuiWindow::ClipRect, ImRect::ClipWithFull(), ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiNavItemData::DistAxial, ImGuiNavItemData::DistBox, ImGuiNavItemData::DistCenter, ImGuiWindow::Flags, ImGuiIO::FontDefault, GetForegroundDrawList(), GImGui, IM_ARRAYSIZE, IM_ASSERT, IM_COL32, ImFabs, ImFormatString(), ImGetDirQuadrantFromDelta(), ImGuiDir_Down, ImGuiDir_Left, ImGuiDir_Right, ImGuiDir_Up, ImGuiKey_C, ImGuiNavLayer_Menu, ImGuiWindowFlags_ChildMenu, ImGuiWindowFlags_NavFlattened, ImLerp(), ImGuiContext::IO, IsKeyPressedMap(), IsMouseHoveringRect(), ImGuiIO::KeyCtrl, ImGuiIO::KeyMap, ImGuiIO::KeysDownDuration, ImGuiWindowTempData::LastItemId, ImRect::Max, ImRect::Min, NavClampRectToVisibleAreaForMoveDir(), ImGuiContext::NavId, ImGuiContext::NavLayer, ImGuiWindowTempData::NavLayerCurrent, ImGuiContext::NavMoveClipDir, ImGuiContext::NavMoveDir, ImGuiContext::NavMoveDirLast, NavScoreItemDistInterval(), ImGuiContext::NavScoringCount, ImGuiContext::NavScoringRect, ImGuiContext::NavWindow, ImRect::Overlaps(), ImGuiWindow::ParentWindow, ImVec2::x, and ImVec2::y.

Referenced by NavProcessItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NavUpdate()

static void ImGui::NavUpdate ( )
static
9022{
9023 ImGuiContext& g = *GImGui;
9024 ImGuiIO& io = g.IO;
9025
9026 io.WantSetMousePos = false;
9027 g.NavWrapRequestWindow = NULL;
9029#if 0
9030 if (g.NavScoringCount > 0) IMGUI_DEBUG_LOG("NavScoringCount %d for '%s' layer %d (Init:%d, Move:%d)\n", g.FrameCount, g.NavScoringCount, g.NavWindow ? g.NavWindow->Name : "NULL", g.NavLayer, g.NavInitRequest || g.NavInitResultId != 0, g.NavMoveRequest);
9031#endif
9032
9033 // Set input source as Gamepad when buttons are pressed (as some features differs when used with Gamepad vs Keyboard)
9034 // (do it before we map Keyboard input!)
9035 bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
9036 bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0;
9037 if (nav_gamepad_active && g.NavInputSource != ImGuiInputSource_Gamepad)
9038 {
9042 }
9043
9044 // Update Keyboard->Nav inputs mapping
9045 if (nav_keyboard_active)
9046 {
9047 #define NAV_MAP_KEY(_KEY, _NAV_INPUT) do { if (IsKeyDown(io.KeyMap[_KEY])) { io.NavInputs[_NAV_INPUT] = 1.0f; g.NavInputSource = ImGuiInputSource_Keyboard; } } while (0)
9055 if (io.KeyCtrl)
9057 if (io.KeyShift)
9059
9060 // AltGR is normally Alt+Ctrl but we can't reliably detect it (not all backends/systems/layout emit it as Alt+Ctrl)
9061 // But also even on keyboards without AltGR we don't want Alt+Ctrl to open menu anyway.
9062 if (io.KeyAlt && !io.KeyCtrl)
9064
9065 // We automatically cancel toggling nav layer when any text has been typed while holding Alt. (See #370)
9066 if (io.KeyAlt && !io.KeyCtrl && g.NavWindowingToggleLayer && io.InputQueueCharacters.Size > 0)
9067 g.NavWindowingToggleLayer = false;
9068
9069 #undef NAV_MAP_KEY
9070 }
9072 for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++)
9073 io.NavInputsDownDuration[i] = (io.NavInputs[i] > 0.0f) ? (io.NavInputsDownDuration[i] < 0.0f ? 0.0f : io.NavInputsDownDuration[i] + io.DeltaTime) : -1.0f;
9074
9075 // Process navigation init request (select first/default focus)
9076 if (g.NavInitResultId != 0)
9078 g.NavInitRequest = false;
9079 g.NavInitRequestFromMove = false;
9080 g.NavInitResultId = 0;
9081 g.NavJustMovedToId = 0;
9082
9083 // Process navigation move request
9084 if (g.NavMoveRequest)
9086
9087 // When a forwarded move request failed, we restore the highlight that we disabled during the forward frame
9089 {
9091 if (g.NavMoveResultLocal.ID == 0 && g.NavMoveResultOther.ID == 0)
9092 g.NavDisableHighlight = false;
9094 }
9095
9096 // Apply application mouse position movement, after we had a chance to process move request result.
9097 if (g.NavMousePosDirty && g.NavIdIsAlive)
9098 {
9099 // Set mouse position given our knowledge of the navigated item position from last frame
9102 {
9104 io.WantSetMousePos = true;
9105 }
9106 g.NavMousePosDirty = false;
9107 }
9108 g.NavIdIsAlive = false;
9109 g.NavJustTabbedId = 0;
9110 IM_ASSERT(g.NavLayer == 0 || g.NavLayer == 1);
9111
9112 // Store our return window (for returning from Layer 1 to Layer 0) and clear it as soon as we step back in our own Layer 0
9113 if (g.NavWindow)
9117
9118 // Update CTRL+TAB and Windowing features (hold Square to move/resize/etc.)
9120
9121 // Set output flags for user application
9122 io.NavActive = (nav_keyboard_active || nav_gamepad_active) && g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs);
9123 io.NavVisible = (io.NavActive && g.NavId != 0 && !g.NavDisableHighlight) || (g.NavWindowingTarget != NULL);
9124
9125 // Process NavCancel input (to close a popup, get back to parent, clear focus)
9127 {
9128 IMGUI_DEBUG_LOG_NAV("[nav] ImGuiNavInput_Cancel\n");
9129 if (g.ActiveId != 0)
9130 {
9132 ClearActiveID();
9133 }
9134 else if (g.NavLayer != ImGuiNavLayer_Main)
9135 {
9136 // Leave the "menu" layer
9138 }
9140 {
9141 // Exit child window
9142 ImGuiWindow* child_window = g.NavWindow;
9143 ImGuiWindow* parent_window = g.NavWindow->ParentWindow;
9144 IM_ASSERT(child_window->ChildId != 0);
9145 ImRect child_rect = child_window->Rect();
9146 FocusWindow(parent_window);
9147 SetNavID(child_window->ChildId, ImGuiNavLayer_Main, 0, ImRect(child_rect.Min - parent_window->Pos, child_rect.Max - parent_window->Pos));
9148 }
9149 else if (g.OpenPopupStack.Size > 0)
9150 {
9151 // Close open popup/menu
9154 }
9155 else
9156 {
9157 // Clear NavLastId for popups but keep it for regular child window so we can leave one and come back where we were
9159 g.NavWindow->NavLastIds[0] = 0;
9160 g.NavId = g.NavFocusScopeId = 0;
9161 }
9162 }
9163
9164 // Process manual activation request
9167 {
9168 bool activate_down = IsNavInputDown(ImGuiNavInput_Activate);
9169 bool activate_pressed = activate_down && IsNavInputTest(ImGuiNavInput_Activate, ImGuiInputReadMode_Pressed);
9170 if (g.ActiveId == 0 && activate_pressed)
9171 g.NavActivateId = g.NavId;
9172 if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && activate_down)
9174 if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && activate_pressed)
9177 g.NavInputId = g.NavId;
9178 }
9180 g.NavDisableHighlight = true;
9181 if (g.NavActivateId != 0)
9183 g.NavMoveRequest = false;
9184
9185 // Process programmatic activation request
9186 if (g.NavNextActivateId != 0)
9188 g.NavNextActivateId = 0;
9189
9190 // Initiate directional inputs request
9192 {
9196 {
9202 }
9204 }
9205 else
9206 {
9207 // Forwarding previous request (which has been modified, e.g. wrap around menus rewrite the requests with a starting rectangle at the other side of the window)
9208 // (Preserve g.NavMoveRequestFlags, g.NavMoveClipDir which were set by the NavMoveRequestForward() function)
9211 IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequestForward %d\n", g.NavMoveDir);
9213 }
9214
9215 // Update PageUp/PageDown/Home/End scroll
9216 // FIXME-NAV: Consider enabling those keys even without the master ImGuiConfigFlags_NavEnableKeyboard flag?
9217 float nav_scoring_rect_offset_y = 0.0f;
9218 if (nav_keyboard_active)
9219 nav_scoring_rect_offset_y = NavUpdatePageUpPageDown();
9220
9221 // If we initiate a movement request and have no current NavId, we initiate a InitDefautRequest that will be used as a fallback if the direction fails to find a match
9222 if (g.NavMoveDir != ImGuiDir_None)
9223 {
9224 g.NavMoveRequest = true;
9227 }
9228 if (g.NavMoveRequest && g.NavId == 0)
9229 {
9230 IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from move, window \"%s\", layer=%d\n", g.NavWindow->Name, g.NavLayer);
9232 // Reassigning with same value, we're being explicit here.
9233 g.NavInitResultId = 0; // -V1048
9234 g.NavDisableHighlight = false;
9235 }
9237
9238 // Scrolling
9240 {
9241 // *Fallback* manual-scroll with Nav directional keys when window has no navigable item
9242 ImGuiWindow* window = g.NavWindow;
9243 const float scroll_speed = IM_ROUND(window->CalcFontSize() * 100 * io.DeltaTime); // We need round the scrolling speed because sub-pixel scroll isn't reliably supported.
9244 if (window->DC.NavLayersActiveMask == 0x00 && window->DC.NavHasScroll && g.NavMoveRequest)
9245 {
9247 SetScrollX(window, ImFloor(window->Scroll.x + ((g.NavMoveDir == ImGuiDir_Left) ? -1.0f : +1.0f) * scroll_speed));
9249 SetScrollY(window, ImFloor(window->Scroll.y + ((g.NavMoveDir == ImGuiDir_Up) ? -1.0f : +1.0f) * scroll_speed));
9250 }
9251
9252 // *Normal* Manual scroll with NavScrollXXX keys
9253 // Next movement request will clamp the NavId reference rectangle to the visible area, so navigation will resume within those bounds.
9255 if (scroll_dir.x != 0.0f && window->ScrollbarX)
9256 SetScrollX(window, ImFloor(window->Scroll.x + scroll_dir.x * scroll_speed));
9257 if (scroll_dir.y != 0.0f)
9258 SetScrollY(window, ImFloor(window->Scroll.y + scroll_dir.y * scroll_speed));
9259 }
9260
9261 // Reset search results
9265
9266 // When using gamepad, we project the reference nav bounding box into window visible area.
9267 // This is to allow resuming navigation inside the visible area after doing a large amount of scrolling, since with gamepad every movements are relative
9268 // (can't focus a visible object like we can with the mouse).
9270 {
9271 ImGuiWindow* window = g.NavWindow;
9272 ImRect window_rect_rel(window->InnerRect.Min - window->Pos - ImVec2(1, 1), window->InnerRect.Max - window->Pos + ImVec2(1, 1));
9273 if (!window_rect_rel.Contains(window->NavRectRel[g.NavLayer]))
9274 {
9275 IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequest: clamp NavRectRel\n");
9276 float pad = window->CalcFontSize() * 0.5f;
9277 window_rect_rel.Expand(ImVec2(-ImMin(window_rect_rel.GetWidth(), pad), -ImMin(window_rect_rel.GetHeight(), pad))); // Terrible approximation for the intent of starting navigation from first fully visible item
9278 window->NavRectRel[g.NavLayer].ClipWithFull(window_rect_rel);
9279 g.NavId = g.NavFocusScopeId = 0;
9280 }
9281 }
9282
9283 // For scoring we use a single segment on the left side our current item bounding box (not touching the edge to avoid box overlap with zero-spaced items)
9284 ImRect nav_rect_rel = g.NavWindow && !g.NavWindow->NavRectRel[g.NavLayer].IsInverted() ? g.NavWindow->NavRectRel[g.NavLayer] : ImRect(0, 0, 0, 0);
9285 g.NavScoringRect = g.NavWindow ? ImRect(g.NavWindow->Pos + nav_rect_rel.Min, g.NavWindow->Pos + nav_rect_rel.Max) : ImRect(0, 0, 0, 0);
9286 g.NavScoringRect.TranslateY(nav_scoring_rect_offset_y);
9289 IM_ASSERT(!g.NavScoringRect.IsInverted()); // Ensure if we have a finite, non-inverted bounding box here will allows us to remove extraneous ImFabs() calls in NavScoreItem().
9290 //GetForegroundDrawList()->AddRect(g.NavScoringRectScreen.Min, g.NavScoringRectScreen.Max, IM_COL32(255,200,0,255)); // [DEBUG]
9291 g.NavScoringCount = 0;
9292#if IMGUI_DEBUG_NAV_RECTS
9293 if (g.NavWindow)
9294 {
9296 if (1) { for (int layer = 0; layer < 2; layer++) draw_list->AddRect(g.NavWindow->Pos + g.NavWindow->NavRectRel[layer].Min, g.NavWindow->Pos + g.NavWindow->NavRectRel[layer].Max, IM_COL32(255,200,0,255)); } // [DEBUG]
9297 if (1) { ImU32 col = (!g.NavWindow->Hidden) ? IM_COL32(255,0,255,255) : IM_COL32(255,0,0,255); ImVec2 p = NavCalcPreferredRefPos(); char buf[32]; ImFormatString(buf, 32, "%d", g.NavLayer); draw_list->AddCircleFilled(p, 3.0f, col); draw_list->AddText(NULL, 13.0f, p + ImVec2(8,-4), col, buf); }
9298 }
9299#endif
9300}
#define NAV_MAP_KEY(_KEY, _NAV_INPUT)
@ ImGuiConfigFlags_NavEnableGamepad
Definition imgui.h:1389
@ ImGuiNavInput_Menu
Definition imgui.h:1359
@ ImGuiNavInput_KeyMenu_
Definition imgui.h:1375
@ ImGuiNavInput_Input
Definition imgui.h:1358
@ ImGuiBackendFlags_HasGamepad
Definition imgui.h:1404
@ ImGuiBackendFlags_HasSetMousePos
Definition imgui.h:1406
@ ImGuiNavForward_ForwardActive
Definition imgui_internal.h:930
ImGuiInputReadMode
Definition imgui_internal.h:888
@ ImGuiInputSource_Gamepad
Definition imgui_internal.h:880
@ ImGuiNavMoveFlags_None
Definition imgui_internal.h:916
#define IMGUI_DEBUG_LOG(_FMT,...)
Definition imgui_internal.h:190
IMGUI_API void SetScrollX(float scroll_x)
Definition imgui.cpp:7926
static void NavSaveLastChildNavWindowIntoParent(ImGuiWindow *nav_window)
Definition imgui.cpp:8886
static void NavRestoreLayer(ImGuiNavLayer layer)
Definition imgui.cpp:8904
IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor=0.0f, float fast_factor=0.0f)
Definition imgui.cpp:9005
bool IsActiveIdUsingNavDir(ImGuiDir dir)
Definition imgui_internal.h:2424
static void NavUpdateInitResult()
Definition imgui.cpp:9302
static float NavUpdatePageUpPageDown()
Definition imgui.cpp:9386
bool IsActiveIdUsingNavInput(ImGuiNavInput input)
Definition imgui_internal.h:2425
static void NavUpdateWindowing()
Definition imgui.cpp:9558
static void NavUpdateMoveResult()
Definition imgui.cpp:9321
ImGuiKeyModFlags NavMoveRequestKeyMods
Definition imgui_internal.h:1469
bool NavWindowingToggleLayer
Definition imgui_internal.h:1484
ImVec2 MousePosPrev
Definition imgui.h:1880
bool WantSetMousePos
Definition imgui.h:1863
bool NavVisible
Definition imgui.h:1866
bool NavActive
Definition imgui.h:1865
void Clear()
Definition imgui_internal.h:1076
float CalcFontSize() const
Definition imgui_internal.h:1912
bool IsInverted() const
Definition imgui_internal.h:502

References ImGuiContext::ActiveId, ImDrawList::AddCircleFilled(), ImDrawList::AddRect(), ImDrawList::AddText(), ImVector< T >::back(), ImGuiIO::BackendFlags, ImGuiWindow::CalcFontSize(), ImGuiWindow::ChildId, ImGuiNavItemData::Clear(), ClearActiveID(), ImRect::ClipWithFull(), ClosePopupToLevel(), col(), ImGuiIO::ConfigFlags, ImRect::Contains(), ImGuiWindow::DC, ImGuiIO::DeltaTime, ImRect::Expand(), ImGuiWindow::Flags, FocusWindow(), ImGuiContext::FrameCount, GetForegroundDrawList(), ImRect::GetHeight(), GetNavInputAmount2d(), ImRect::GetWidth(), GImGui, ImGuiWindow::Hidden, ImGuiNavItemData::ID, IM_ARRAYSIZE, IM_ASSERT, IM_COL32, IM_ROUND, ImFloor(), ImFormatString(), IMGUI_DEBUG_LOG, IMGUI_DEBUG_LOG_NAV, ImGuiBackendFlags_HasGamepad, ImGuiBackendFlags_HasSetMousePos, ImGuiConfigFlags_NavEnableGamepad, ImGuiConfigFlags_NavEnableKeyboard, ImGuiConfigFlags_NavEnableSetMousePos, ImGuiDir_Down, ImGuiDir_Left, ImGuiDir_None, ImGuiDir_Right, ImGuiDir_Up, ImGuiInputReadMode_Down, ImGuiInputReadMode_Pressed, ImGuiInputReadMode_Repeat, ImGuiInputSource_Gamepad, ImGuiKey_DownArrow, ImGuiKey_Enter, ImGuiKey_Escape, ImGuiKey_LeftArrow, ImGuiKey_RightArrow, ImGuiKey_Space, ImGuiKey_UpArrow, ImGuiNavDirSourceFlags_PadLStick, ImGuiNavForward_ForwardActive, ImGuiNavForward_ForwardQueued, ImGuiNavForward_None, ImGuiNavInput_Activate, ImGuiNavInput_Cancel, ImGuiNavInput_DpadDown, ImGuiNavInput_DpadLeft, ImGuiNavInput_DpadRight, ImGuiNavInput_DpadUp, ImGuiNavInput_Input, ImGuiNavInput_KeyDown_, ImGuiNavInput_KeyLeft_, ImGuiNavInput_KeyMenu_, ImGuiNavInput_KeyRight_, ImGuiNavInput_KeyUp_, ImGuiNavInput_Menu, ImGuiNavInput_TweakFast, ImGuiNavInput_TweakSlow, ImGuiNavLayer_Main, ImGuiNavMoveFlags_None, ImGuiWindowFlags_ChildWindow, ImGuiWindowFlags_Modal, ImGuiWindowFlags_NoNavInputs, ImGuiWindowFlags_Popup, ImMin(), ImGuiWindow::InnerRect, ImGuiIO::InputQueueCharacters, ImGuiContext::IO, IsActiveIdUsingNavDir(), IsActiveIdUsingNavInput(), ImRect::IsInverted(), IsNavInputDown(), IsNavInputTest(), ImGuiIO::KeyAlt, ImGuiIO::KeyCtrl, ImGuiIO::KeyMods, ImGuiIO::KeyShift, ImRect::Max, ImRect::Min, ImGuiIO::MousePos, ImGuiIO::MousePosPrev, ImGuiWindow::Name, NAV_MAP_KEY, ImGuiContext::NavActivateDownId, ImGuiContext::NavActivateId, ImGuiContext::NavActivatePressedId, ImGuiIO::NavActive, NavCalcPreferredRefPos(), ImGuiContext::NavDisableHighlight, ImGuiContext::NavDisableMouseHover, ImGuiContext::NavFocusScopeId, ImGuiWindowTempData::NavHasScroll, ImGuiContext::NavId, ImGuiContext::NavIdIsAlive, ImGuiContext::NavInitRequest, ImGuiContext::NavInitRequestFromMove, ImGuiContext::NavInitResultId, ImGuiContext::NavInputId, ImGuiIO::NavInputs, ImGuiIO::NavInputsDownDuration, ImGuiIO::NavInputsDownDurationPrev, ImGuiContext::NavInputSource, ImGuiContext::NavJustMovedToId, ImGuiContext::NavJustTabbedId, ImGuiWindow::NavLastChildNavWindow, ImGuiWindow::NavLastIds, ImGuiContext::NavLayer, ImGuiWindowTempData::NavLayersActiveMask, ImGuiContext::NavMousePosDirty, ImGuiContext::NavMoveClipDir, ImGuiContext::NavMoveDir, ImGuiContext::NavMoveDirLast, ImGuiContext::NavMoveRequest, ImGuiContext::NavMoveRequestFlags, ImGuiContext::NavMoveRequestForward, ImGuiContext::NavMoveRequestKeyMods, ImGuiContext::NavMoveResultLocal, ImGuiContext::NavMoveResultLocalVisibleSet, ImGuiContext::NavMoveResultOther, ImGuiContext::NavNextActivateId, ImGuiWindow::NavRectRel, NavRestoreLayer(), NavSaveLastChildNavWindowIntoParent(), ImGuiContext::NavScoringCount, ImGuiContext::NavScoringRect, NavUpdateAnyRequestFlag(), NavUpdateInitResult(), NavUpdateMoveResult(), NavUpdatePageUpPageDown(), NavUpdateWindowing(), ImGuiIO::NavVisible, ImGuiContext::NavWindow, ImGuiContext::NavWindowingTarget, ImGuiContext::NavWindowingToggleLayer, ImGuiContext::NavWrapRequestFlags, ImGuiContext::NavWrapRequestWindow, ImGuiContext::OpenPopupStack, ImGuiWindow::ParentWindow, ImGuiWindow::Pos, ImGuiWindow::Rect(), ImGuiWindow::RootWindow, ImGuiWindow::Scroll, ImGuiWindow::ScrollbarX, SetNavID(), SetScrollX(), SetScrollY(), ImVector< T >::Size, ImRect::TranslateY(), ImGuiIO::WantSetMousePos, ImGuiPopupData::Window, ImVec2::x, and ImVec2::y.

Referenced by NewFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NavUpdateAnyRequestFlag()

static void ImGui::NavUpdateAnyRequestFlag ( )
inlinestatic
8924{
8925 ImGuiContext& g = *GImGui;
8927 if (g.NavAnyRequest)
8928 IM_ASSERT(g.NavWindow != NULL);
8929}
#define IMGUI_DEBUG_NAV_SCORING
Definition imgui.cpp:858

References GImGui, IM_ASSERT, IMGUI_DEBUG_NAV_SCORING, ImGuiContext::NavAnyRequest, ImGuiContext::NavInitRequest, ImGuiContext::NavMoveRequest, and ImGuiContext::NavWindow.

Referenced by FocusWindow(), NavInitWindow(), NavMoveRequestCancel(), NavProcessItem(), NavUpdate(), and SetItemDefaultFocus().

+ Here is the caller graph for this function:

◆ NavUpdateInitResult()

static void ImGui::NavUpdateInitResult ( )
static
9303{
9304 // In very rare cases g.NavWindow may be null (e.g. clearing focus after requesting an init request, which does happen when releasing Alt while clicking on void)
9305 ImGuiContext& g = *GImGui;
9306 if (!g.NavWindow)
9307 return;
9308
9309 // Apply result from previous navigation init request (will typically select the first item, unless SetItemDefaultFocus() has been called)
9310 // FIXME-NAV: On _NavFlattened windows, g.NavWindow will only be updated during subsequent frame. Not a problem currently.
9311 IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: result NavID 0x%08X in Layer %d Window \"%s\"\n", g.NavInitResultId, g.NavLayer, g.NavWindow->Name);
9314 {
9315 g.NavDisableHighlight = false;
9317 }
9318}

References GImGui, IMGUI_DEBUG_LOG_NAV, ImGuiWindow::Name, ImGuiContext::NavDisableHighlight, ImGuiContext::NavDisableMouseHover, ImGuiContext::NavInitRequestFromMove, ImGuiContext::NavInitResultId, ImGuiContext::NavInitResultRectRel, ImGuiContext::NavLayer, ImGuiContext::NavMousePosDirty, ImGuiContext::NavWindow, and SetNavID().

Referenced by NavUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NavUpdateMoveResult()

static void ImGui::NavUpdateMoveResult ( )
static
9322{
9323 ImGuiContext& g = *GImGui;
9324 if (g.NavMoveResultLocal.ID == 0 && g.NavMoveResultOther.ID == 0)
9325 {
9326 // In a situation when there is no results but NavId != 0, re-enable the Navigation highlight (because g.NavId is not considered as a possible result)
9327 if (g.NavId != 0)
9328 {
9329 g.NavDisableHighlight = false;
9330 g.NavDisableMouseHover = true;
9331 }
9332 return;
9333 }
9334
9335 // Select which result to use
9336 ImGuiNavItemData* result = (g.NavMoveResultLocal.ID != 0) ? &g.NavMoveResultLocal : &g.NavMoveResultOther;
9337
9338 // PageUp/PageDown behavior first jumps to the bottom/top mostly visible item, _otherwise_ use the result from the previous/next page.
9341 result = &g.NavMoveResultLocalVisibleSet;
9342
9343 // Maybe entering a flattened child from the outside? In this case solve the tie using the regular scoring rules.
9346 result = &g.NavMoveResultOther;
9347 IM_ASSERT(g.NavWindow && result->Window);
9348
9349 // Scroll to keep newly navigated item fully into view.
9351 {
9352 ImVec2 delta_scroll;
9354 {
9355 float scroll_target = (g.NavMoveDir == ImGuiDir_Up) ? result->Window->ScrollMax.y : 0.0f;
9356 delta_scroll.y = result->Window->Scroll.y - scroll_target;
9357 SetScrollY(result->Window, scroll_target);
9358 }
9359 else
9360 {
9361 ImRect rect_abs = ImRect(result->RectRel.Min + result->Window->Pos, result->RectRel.Max + result->Window->Pos);
9362 delta_scroll = ScrollToBringRectIntoView(result->Window, rect_abs);
9363 }
9364
9365 // Offset our result position so mouse position can be applied immediately after in NavUpdate()
9366 result->RectRel.TranslateX(-delta_scroll.x);
9367 result->RectRel.TranslateY(-delta_scroll.y);
9368 }
9369
9370 ClearActiveID();
9371 g.NavWindow = result->Window;
9372 if (g.NavId != result->ID)
9373 {
9374 // Don't set NavJustMovedToId if just landed on the same spot (which may happen with ImGuiNavMoveFlags_AllowCurrentNavId)
9375 g.NavJustMovedToId = result->ID;
9378 }
9379 IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequest: result NavID 0x%08X in Layer %d Window \"%s\"\n", result->ID, g.NavLayer, g.NavWindow->Name);
9380 SetNavID(result->ID, g.NavLayer, result->FocusScopeId, result->RectRel);
9381 g.NavDisableHighlight = false;
9383}
@ ImGuiNavMoveFlags_ScrollToEdge
Definition imgui_internal.h:923
IMGUI_API ImVec2 ScrollToBringRectIntoView(ImGuiWindow *window, const ImRect &item_rect)
Definition imgui.cpp:7859
ImGuiKeyModFlags NavJustMovedToKeyMods
Definition imgui_internal.h:1450
ImGuiID NavJustMovedToFocusScopeId
Definition imgui_internal.h:1449

References ClearActiveID(), ImGuiNavItemData::DistBox, ImGuiNavItemData::DistCenter, ImGuiNavItemData::FocusScopeId, GImGui, ImGuiNavItemData::ID, IM_ASSERT, IMGUI_DEBUG_LOG_NAV, ImGuiDir_Up, ImGuiNavLayer_Main, ImGuiNavMoveFlags_AlsoScoreVisibleSet, ImGuiNavMoveFlags_ScrollToEdge, ImRect::Max, ImRect::Min, ImGuiWindow::Name, ImGuiContext::NavDisableHighlight, ImGuiContext::NavDisableMouseHover, ImGuiContext::NavId, ImGuiContext::NavJustMovedToFocusScopeId, ImGuiContext::NavJustMovedToId, ImGuiContext::NavJustMovedToKeyMods, ImGuiContext::NavLayer, ImGuiContext::NavMousePosDirty, ImGuiContext::NavMoveDir, ImGuiContext::NavMoveRequestFlags, ImGuiContext::NavMoveRequestKeyMods, ImGuiContext::NavMoveResultLocal, ImGuiContext::NavMoveResultLocalVisibleSet, ImGuiContext::NavMoveResultOther, ImGuiContext::NavWindow, ImGuiWindow::ParentWindow, ImGuiWindow::Pos, ImGuiNavItemData::RectRel, ImGuiWindow::Scroll, ImGuiWindow::ScrollMax, ScrollToBringRectIntoView(), SetNavID(), SetScrollY(), ImRect::TranslateX(), ImRect::TranslateY(), ImGuiNavItemData::Window, ImVec2::x, and ImVec2::y.

Referenced by NavUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NavUpdatePageUpPageDown()

static float ImGui::NavUpdatePageUpPageDown ( )
static
9387{
9388 ImGuiContext& g = *GImGui;
9389 ImGuiIO& io = g.IO;
9390
9391 if (g.NavMoveDir != ImGuiDir_None || g.NavWindow == NULL)
9392 return 0.0f;
9394 return 0.0f;
9395
9396 ImGuiWindow* window = g.NavWindow;
9397 const bool page_up_held = IsKeyDown(io.KeyMap[ImGuiKey_PageUp]) && !IsActiveIdUsingKey(ImGuiKey_PageUp);
9398 const bool page_down_held = IsKeyDown(io.KeyMap[ImGuiKey_PageDown]) && !IsActiveIdUsingKey(ImGuiKey_PageDown);
9399 const bool home_pressed = IsKeyPressed(io.KeyMap[ImGuiKey_Home]) && !IsActiveIdUsingKey(ImGuiKey_Home);
9400 const bool end_pressed = IsKeyPressed(io.KeyMap[ImGuiKey_End]) && !IsActiveIdUsingKey(ImGuiKey_End);
9401 if (page_up_held != page_down_held || home_pressed != end_pressed) // If either (not both) are pressed
9402 {
9403 if (window->DC.NavLayersActiveMask == 0x00 && window->DC.NavHasScroll)
9404 {
9405 // Fallback manual-scroll when window has no navigable item
9406 if (IsKeyPressed(io.KeyMap[ImGuiKey_PageUp], true))
9407 SetScrollY(window, window->Scroll.y - window->InnerRect.GetHeight());
9408 else if (IsKeyPressed(io.KeyMap[ImGuiKey_PageDown], true))
9409 SetScrollY(window, window->Scroll.y + window->InnerRect.GetHeight());
9410 else if (home_pressed)
9411 SetScrollY(window, 0.0f);
9412 else if (end_pressed)
9413 SetScrollY(window, window->ScrollMax.y);
9414 }
9415 else
9416 {
9417 ImRect& nav_rect_rel = window->NavRectRel[g.NavLayer];
9418 const float page_offset_y = ImMax(0.0f, window->InnerRect.GetHeight() - window->CalcFontSize() * 1.0f + nav_rect_rel.GetHeight());
9419 float nav_scoring_rect_offset_y = 0.0f;
9420 if (IsKeyPressed(io.KeyMap[ImGuiKey_PageUp], true))
9421 {
9422 nav_scoring_rect_offset_y = -page_offset_y;
9423 g.NavMoveDir = ImGuiDir_Down; // Because our scoring rect is offset up, we request the down direction (so we can always land on the last item)
9426 }
9427 else if (IsKeyPressed(io.KeyMap[ImGuiKey_PageDown], true))
9428 {
9429 nav_scoring_rect_offset_y = +page_offset_y;
9430 g.NavMoveDir = ImGuiDir_Up; // Because our scoring rect is offset down, we request the up direction (so we can always land on the last item)
9433 }
9434 else if (home_pressed)
9435 {
9436 // FIXME-NAV: handling of Home/End is assuming that the top/bottom most item will be visible with Scroll.y == 0/ScrollMax.y
9437 // Scrolling will be handled via the ImGuiNavMoveFlags_ScrollToEdge flag, we don't scroll immediately to avoid scrolling happening before nav result.
9438 // Preserve current horizontal position if we have any.
9439 nav_rect_rel.Min.y = nav_rect_rel.Max.y = -window->Scroll.y;
9440 if (nav_rect_rel.IsInverted())
9441 nav_rect_rel.Min.x = nav_rect_rel.Max.x = 0.0f;
9444 }
9445 else if (end_pressed)
9446 {
9447 nav_rect_rel.Min.y = nav_rect_rel.Max.y = window->ScrollMax.y + window->SizeFull.y - window->Scroll.y;
9448 if (nav_rect_rel.IsInverted())
9449 nav_rect_rel.Min.x = nav_rect_rel.Max.x = 0.0f;
9452 }
9453 return nav_scoring_rect_offset_y;
9454 }
9455 }
9456 return 0.0f;
9457}
IMGUI_API bool IsKeyDown(int user_key_index)
Definition imgui.cpp:4634
bool IsActiveIdUsingKey(ImGuiKey key)
Definition imgui_internal.h:2426

References ImGuiWindow::CalcFontSize(), ImGuiWindow::DC, ImGuiWindow::Flags, ImRect::GetHeight(), GImGui, ImGuiDir_Down, ImGuiDir_None, ImGuiDir_Up, ImGuiKey_End, ImGuiKey_Home, ImGuiKey_PageDown, ImGuiKey_PageUp, ImGuiNavLayer_Main, ImGuiNavMoveFlags_AllowCurrentNavId, ImGuiNavMoveFlags_AlsoScoreVisibleSet, ImGuiNavMoveFlags_ScrollToEdge, ImGuiWindowFlags_NoNavInputs, ImMax(), ImGuiWindow::InnerRect, ImGuiContext::IO, IsActiveIdUsingKey(), ImRect::IsInverted(), IsKeyDown(), IsKeyPressed(), ImGuiIO::KeyMap, ImRect::Max, ImRect::Min, ImGuiWindowTempData::NavHasScroll, ImGuiContext::NavLayer, ImGuiWindowTempData::NavLayersActiveMask, ImGuiContext::NavMoveClipDir, ImGuiContext::NavMoveDir, ImGuiContext::NavMoveRequestFlags, ImGuiWindow::NavRectRel, ImGuiContext::NavWindow, ImGuiContext::NavWindowingTarget, ImGuiWindow::Scroll, ImGuiWindow::ScrollMax, SetScrollY(), ImGuiWindow::SizeFull, ImVec2::x, and ImVec2::y.

Referenced by NavUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NavUpdateWindowing()

static void ImGui::NavUpdateWindowing ( )
static
9559{
9560 ImGuiContext& g = *GImGui;
9561 ImGuiWindow* apply_focus_window = NULL;
9562 bool apply_toggle_layer = false;
9563
9564 ImGuiWindow* modal_window = GetTopMostPopupModal();
9565 bool allow_windowing = (modal_window == NULL);
9566 if (!allow_windowing)
9567 g.NavWindowingTarget = NULL;
9568
9569 // Fade out
9570 if (g.NavWindowingTargetAnim && g.NavWindowingTarget == NULL)
9571 {
9573 if (g.DimBgRatio <= 0.0f && g.NavWindowingHighlightAlpha <= 0.0f)
9574 g.NavWindowingTargetAnim = NULL;
9575 }
9576
9577 // Start CTRL-TAB or Square+L/R window selection
9578 bool start_windowing_with_gamepad = allow_windowing && !g.NavWindowingTarget && IsNavInputTest(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed);
9579 bool start_windowing_with_keyboard = allow_windowing && !g.NavWindowingTarget && g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab) && (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard);
9580 if (start_windowing_with_gamepad || start_windowing_with_keyboard)
9581 if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1))
9582 {
9583 g.NavWindowingTarget = g.NavWindowingTargetAnim = window->RootWindow; // FIXME-DOCK: Will need to use RootWindowDockStop
9585 g.NavWindowingToggleLayer = start_windowing_with_keyboard ? false : true;
9586 g.NavInputSource = start_windowing_with_keyboard ? ImGuiInputSource_Keyboard : ImGuiInputSource_Gamepad;
9587 }
9588
9589 // Gamepad update
9592 {
9593 // Highlight only appears after a brief time holding the button, so that a fast tap on PadMenu (to toggle NavLayer) doesn't add visual noise
9595
9596 // Select window to focus
9598 if (focus_change_dir != 0)
9599 {
9600 NavUpdateWindowingHighlightWindow(focus_change_dir);
9602 }
9603
9604 // Single press toggles NavLayer, long press with L/R apply actual focus on release (until then the window was merely rendered top-most)
9606 {
9607 g.NavWindowingToggleLayer &= (g.NavWindowingHighlightAlpha < 1.0f); // Once button was held long enough we don't consider it a tap-to-toggle-layer press anymore.
9609 apply_toggle_layer = true;
9610 else if (!g.NavWindowingToggleLayer)
9611 apply_focus_window = g.NavWindowingTarget;
9612 g.NavWindowingTarget = NULL;
9613 }
9614 }
9615
9616 // Keyboard: Focus
9618 {
9619 // Visuals only appears after a brief time after pressing TAB the first time, so that a fast CTRL+TAB doesn't add visual noise
9621 if (IsKeyPressedMap(ImGuiKey_Tab, true))
9623 if (!g.IO.KeyCtrl)
9624 apply_focus_window = g.NavWindowingTarget;
9625 }
9626
9627 // Keyboard: Press and Release ALT to toggle menu layer
9628 // FIXME: We lack an explicit IO variable for "is the imgui window focused", so compare mouse validity to detect the common case of backend clearing releases all keys on ALT-TAB
9630 g.NavWindowingToggleLayer = true;
9633 apply_toggle_layer = true;
9634
9635 // Move window
9637 {
9638 ImVec2 move_delta;
9643 if (move_delta.x != 0.0f || move_delta.y != 0.0f)
9644 {
9645 const float NAV_MOVE_SPEED = 800.0f;
9646 const float move_speed = ImFloor(NAV_MOVE_SPEED * g.IO.DeltaTime * ImMin(g.IO.DisplayFramebufferScale.x, g.IO.DisplayFramebufferScale.y)); // FIXME: Doesn't handle variable framerate very well
9647 ImGuiWindow* moving_window = g.NavWindowingTarget->RootWindow;
9648 SetWindowPos(moving_window, moving_window->Pos + move_delta * move_speed, ImGuiCond_Always);
9649 MarkIniSettingsDirty(moving_window);
9650 g.NavDisableMouseHover = true;
9651 }
9652 }
9653
9654 // Apply final focus
9655 if (apply_focus_window && (g.NavWindow == NULL || apply_focus_window != g.NavWindow->RootWindow))
9656 {
9657 ClearActiveID();
9658 g.NavDisableHighlight = false;
9659 g.NavDisableMouseHover = true;
9660 apply_focus_window = NavRestoreLastChildNavWindow(apply_focus_window);
9661 ClosePopupsOverWindow(apply_focus_window, false);
9662 FocusWindow(apply_focus_window);
9663 if (apply_focus_window->NavLastIds[0] == 0)
9664 NavInitWindow(apply_focus_window, false);
9665
9666 // If the window has ONLY a menu layer (no main layer), select it directly
9667 // Use NavLayersActiveMaskNext since windows didn't have a chance to be Begin()-ed on this frame,
9668 // so CTRL+Tab where the keys are only held for 1 frame will be able to use correct layers mask since
9669 // the target window as already been previewed once.
9670 // FIXME-NAV: This should be done in NavInit.. or in FocusWindow... However in both of those cases,
9671 // we won't have a guarantee that windows has been visible before and therefore NavLayersActiveMask*
9672 // won't be valid.
9673 if (apply_focus_window->DC.NavLayersActiveMaskNext == (1 << ImGuiNavLayer_Menu))
9675 }
9676 if (apply_focus_window)
9677 g.NavWindowingTarget = NULL;
9678
9679 // Apply menu/layer toggle
9680 if (apply_toggle_layer && g.NavWindow)
9681 {
9682 ClearActiveID();
9683
9684 // Move to parent menu if necessary
9685 ImGuiWindow* new_nav_window = g.NavWindow;
9686 while (new_nav_window->ParentWindow
9687 && (new_nav_window->DC.NavLayersActiveMask & (1 << ImGuiNavLayer_Menu)) == 0
9688 && (new_nav_window->Flags & ImGuiWindowFlags_ChildWindow) != 0
9689 && (new_nav_window->Flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu)) == 0)
9690 new_nav_window = new_nav_window->ParentWindow;
9691 if (new_nav_window != g.NavWindow)
9692 {
9693 ImGuiWindow* old_nav_window = g.NavWindow;
9694 FocusWindow(new_nav_window);
9695 new_nav_window->NavLastChildNavWindow = old_nav_window;
9696 }
9697 g.NavDisableHighlight = false;
9698 g.NavDisableMouseHover = true;
9699
9700 // Reinitialize navigation when entering menu bar with the Alt key.
9701 const ImGuiNavLayer new_nav_layer = (g.NavWindow->DC.NavLayersActiveMask & (1 << ImGuiNavLayer_Menu)) ? (ImGuiNavLayer)((int)g.NavLayer ^ 1) : ImGuiNavLayer_Main;
9702 if (new_nav_layer == ImGuiNavLayer_Menu)
9703 g.NavWindow->NavLastIds[new_nav_layer] = 0;
9704 NavRestoreLayer(new_nav_layer);
9705 }
9706}
static ImGuiWindow * FindWindowNavFocusable(int i_start, int i_stop, int dir)
Definition imgui.cpp:9530
static const float NAV_WINDOWING_HIGHLIGHT_DELAY
Definition imgui.cpp:863
static void NavUpdateWindowingHighlightWindow(int focus_change_dir)
Definition imgui.cpp:9539
@ ImGuiNavInput_FocusPrev
Definition imgui.h:1368
@ ImGuiNavInput_FocusNext
Definition imgui.h:1369
IMGUI_API void ClosePopupsOverWindow(ImGuiWindow *ref_window, bool restore_focus_to_window_under_popup)
Definition imgui.cpp:8185
float NavWindowingTimer
Definition imgui_internal.h:1482
float DimBgRatio
Definition imgui_internal.h:1496
ImVec2 DisplayFramebufferScale
Definition imgui.h:1799

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdAllowOverlap, ClearActiveID(), ClosePopupsOverWindow(), ImGuiIO::ConfigFlags, ImGuiWindow::DC, ImGuiIO::DeltaTime, ImGuiContext::DimBgRatio, ImGuiIO::DisplayFramebufferScale, FindWindowNavFocusable(), ImGuiWindow::Flags, FocusWindow(), GetNavInputAmount2d(), GetTopMostPopupModal(), GImGui, ImFloor(), ImGuiCond_Always, ImGuiConfigFlags_NavEnableKeyboard, ImGuiInputReadMode_Down, ImGuiInputReadMode_Pressed, ImGuiInputReadMode_Released, ImGuiInputReadMode_RepeatSlow, ImGuiInputSource_Gamepad, ImGuiInputSource_Keyboard, ImGuiKey_Tab, ImGuiNavDirSourceFlags_Keyboard, ImGuiNavDirSourceFlags_PadLStick, ImGuiNavInput_FocusNext, ImGuiNavInput_FocusPrev, ImGuiNavInput_KeyMenu_, ImGuiNavInput_Menu, ImGuiNavLayer_Main, ImGuiNavLayer_Menu, ImGuiWindowFlags_ChildMenu, ImGuiWindowFlags_ChildWindow, ImGuiWindowFlags_NoMove, ImGuiWindowFlags_Popup, ImMax(), ImMin(), ImSaturate(), ImGuiContext::IO, IsKeyPressedMap(), IsMousePosValid(), IsNavInputDown(), IsNavInputTest(), ImGuiIO::KeyCtrl, ImGuiIO::KeyShift, MarkIniSettingsDirty(), ImGuiIO::MousePos, ImGuiIO::MousePosPrev, NAV_WINDOWING_HIGHLIGHT_DELAY, ImGuiContext::NavDisableHighlight, ImGuiContext::NavDisableMouseHover, NavInitWindow(), ImGuiContext::NavInputSource, ImGuiWindow::NavLastChildNavWindow, ImGuiWindow::NavLastIds, ImGuiContext::NavLayer, ImGuiWindowTempData::NavLayersActiveMask, ImGuiWindowTempData::NavLayersActiveMaskNext, NavRestoreLastChildNavWindow(), NavRestoreLayer(), NavUpdateWindowingHighlightWindow(), ImGuiContext::NavWindow, ImGuiContext::NavWindowingHighlightAlpha, ImGuiContext::NavWindowingTarget, ImGuiContext::NavWindowingTargetAnim, ImGuiContext::NavWindowingTimer, ImGuiContext::NavWindowingToggleLayer, ImGuiWindow::ParentWindow, ImGuiWindow::Pos, ImGuiWindow::RootWindow, SetWindowPos(), ImVector< T >::Size, ImGuiContext::WindowsFocusOrder, ImVec2::x, and ImVec2::y.

Referenced by NavUpdate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NavUpdateWindowingOverlay()

void ImGui::NavUpdateWindowingOverlay ( )
static
9720{
9721 ImGuiContext& g = *GImGui;
9722 IM_ASSERT(g.NavWindowingTarget != NULL);
9723
9725 return;
9726
9727 if (g.NavWindowingListWindow == NULL)
9728 g.NavWindowingListWindow = FindWindowByName("###NavWindowingList");
9729 const ImGuiViewport* viewport = GetMainViewport();
9730 SetNextWindowSizeConstraints(ImVec2(viewport->Size.x * 0.20f, viewport->Size.y * 0.20f), ImVec2(FLT_MAX, FLT_MAX));
9731 SetNextWindowPos(viewport->GetCenter(), ImGuiCond_Always, ImVec2(0.5f, 0.5f));
9734 for (int n = g.WindowsFocusOrder.Size - 1; n >= 0; n--)
9735 {
9736 ImGuiWindow* window = g.WindowsFocusOrder[n];
9737 IM_ASSERT(window != NULL); // Fix static analyzers
9738 if (!IsWindowNavFocusable(window))
9739 continue;
9740 const char* label = window->Name;
9741 if (label == FindRenderedTextEnd(label))
9743 Selectable(label, g.NavWindowingTarget == window);
9744 }
9745 End();
9746 PopStyleVar();
9747}
static const float NAV_WINDOWING_LIST_APPEAR_DELAY
Definition imgui.cpp:864
static const char * GetFallbackWindowNameForWindowingList(ImGuiWindow *window)
Definition imgui.cpp:9709
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow *window)
Definition imgui.cpp:6696
ImVec2 WindowPadding
Definition imgui.h:1723

References Begin(), End(), FindRenderedTextEnd(), FindWindowByName(), ImGuiViewport::GetCenter(), GetFallbackWindowNameForWindowingList(), GetMainViewport(), GImGui, IM_ASSERT, ImGuiCond_Always, ImGuiStyleVar_WindowPadding, ImGuiWindowFlags_AlwaysAutoResize, ImGuiWindowFlags_NoFocusOnAppearing, ImGuiWindowFlags_NoInputs, ImGuiWindowFlags_NoMove, ImGuiWindowFlags_NoResize, ImGuiWindowFlags_NoSavedSettings, ImGuiWindowFlags_NoTitleBar, IsWindowNavFocusable(), ImGuiWindow::Name, NAV_WINDOWING_LIST_APPEAR_DELAY, ImGuiContext::NavWindowingListWindow, ImGuiContext::NavWindowingTarget, ImGuiContext::NavWindowingTimer, PopStyleVar(), PushStyleVar(), Selectable(), SetNextWindowPos(), SetNextWindowSizeConstraints(), ImVector< T >::Size, ImGuiViewport::Size, ImGuiContext::Style, ImGuiStyle::WindowPadding, ImGuiContext::WindowsFocusOrder, ImVec2::x, and ImVec2::y.

Referenced by NavEndFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NewFrame()

void ImGui::NewFrame ( )
3900{
3901 IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?");
3902 ImGuiContext& g = *GImGui;
3903
3904 // Remove pending delete hooks before frame start.
3905 // This deferred removal avoid issues of removal while iterating the hook vector
3906 for (int n = g.Hooks.Size - 1; n >= 0; n--)
3908 g.Hooks.erase(&g.Hooks[n]);
3909
3911
3912 // Check and assert for various common IO and Configuration mistakes
3914
3915 // Load settings on first frame, save settings when modified (after a delay)
3917
3918 g.Time += g.IO.DeltaTime;
3919 g.WithinFrameScope = true;
3920 g.FrameCount += 1;
3922 g.WindowsActiveCount = 0;
3924
3925 // Calculate frame-rate for the user, as a purely luxurious feature
3930 g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)g.FramerateSecPerFrameCount)) : FLT_MAX;
3931
3933
3934 // Setup current font and draw list shared data
3935 g.IO.Fonts->Locked = true;
3937 IM_ASSERT(g.Font->IsLoaded());
3938 ImRect virtual_space(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX);
3939 for (int n = 0; n < g.Viewports.Size; n++)
3940 virtual_space.Add(g.Viewports[n]->GetMainRect());
3941 g.DrawListSharedData.ClipRectFullscreen = virtual_space.ToVec4();
3945 if (g.Style.AntiAliasedLines)
3949 if (g.Style.AntiAliasedFill)
3953
3954 // Mark rendering data as invalid to prevent user who may have a handle on it to use it.
3955 for (int n = 0; n < g.Viewports.Size; n++)
3956 {
3957 ImGuiViewportP* viewport = g.Viewports[n];
3958 viewport->DrawDataP.Clear();
3959 }
3960
3961 // Drag and drop keep the source ID alive so even if the source disappear our state is consistent
3963 KeepAliveID(g.DragDropPayload.SourceId);
3964
3965 // Update HoveredId data
3967 g.HoveredIdTimer = 0.0f;
3968 if (!g.HoveredIdPreviousFrame || (g.HoveredId && g.ActiveId == g.HoveredId))
3969 g.HoveredIdNotActiveTimer = 0.0f;
3970 if (g.HoveredId)
3972 if (g.HoveredId && g.ActiveId != g.HoveredId)
3976 g.HoveredId = 0;
3977 g.HoveredIdAllowOverlap = false;
3978 g.HoveredIdUsingMouseWheel = false;
3979 g.HoveredIdDisabled = false;
3980
3981 // Update ActiveId data (clear reference to active widget if the widget isn't alive anymore)
3982 if (g.ActiveIdIsAlive != g.ActiveId && g.ActiveIdPreviousFrame == g.ActiveId && g.ActiveId != 0)
3983 ClearActiveID();
3984 if (g.ActiveId)
3985 g.ActiveIdTimer += g.IO.DeltaTime;
3990 g.ActiveIdIsAlive = 0;
3993 g.ActiveIdIsJustActivated = false;
3994 if (g.TempInputId != 0 && g.ActiveId != g.TempInputId)
3995 g.TempInputId = 0;
3996 if (g.ActiveId == 0)
3997 {
3998 g.ActiveIdUsingNavDirMask = 0x00;
4001 }
4002
4003 // Drag and drop
4007 g.DragDropWithinSource = false;
4008 g.DragDropWithinTarget = false;
4010
4011 // Update keyboard input state
4012 // Synchronize io.KeyMods with individual modifiers io.KeyXXX bools
4015 for (int i = 0; i < IM_ARRAYSIZE(g.IO.KeysDown); i++)
4016 g.IO.KeysDownDuration[i] = g.IO.KeysDown[i] ? (g.IO.KeysDownDuration[i] < 0.0f ? 0.0f : g.IO.KeysDownDuration[i] + g.IO.DeltaTime) : -1.0f;
4017
4018 // Update gamepad/keyboard navigation
4019 NavUpdate();
4020
4021 // Update mouse input state
4023
4024 // Find hovered window
4025 // (needs to be before UpdateMouseMovingWindowNewFrame so we fill g.HoveredWindowUnderMovingWindow on the mouse release frame)
4027
4028 // Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering)
4030
4031 // Background darkening/whitening
4032 if (GetTopMostPopupModal() != NULL || (g.NavWindowingTarget != NULL && g.NavWindowingHighlightAlpha > 0.0f))
4033 g.DimBgRatio = ImMin(g.DimBgRatio + g.IO.DeltaTime * 6.0f, 1.0f);
4034 else
4035 g.DimBgRatio = ImMax(g.DimBgRatio - g.IO.DeltaTime * 10.0f, 0.0f);
4036
4039 g.PlatformImePos = ImVec2(1.0f, 1.0f); // OS Input Method Editor showing on top-left of our window by default
4040
4041 // Mouse wheel scrolling, scale
4043
4044 // Update legacy TAB focus
4046
4047 // Mark all windows as not visible and compact unused memory.
4049 const float memory_compact_start_time = (g.GcCompactAll || g.IO.ConfigMemoryCompactTimer < 0.0f) ? FLT_MAX : (float)g.Time - g.IO.ConfigMemoryCompactTimer;
4050 for (int i = 0; i != g.Windows.Size; i++)
4051 {
4052 ImGuiWindow* window = g.Windows[i];
4053 window->WasActive = window->Active;
4054 window->BeginCount = 0;
4055 window->Active = false;
4056 window->WriteAccessed = false;
4057
4058 // Garbage collect transient buffers of recently unused windows
4059 if (!window->WasActive && !window->MemoryCompacted && window->LastTimeActive < memory_compact_start_time)
4061 }
4062
4063 // Garbage collect transient buffers of recently unused tables
4064 for (int i = 0; i < g.TablesLastTimeActive.Size; i++)
4065 if (g.TablesLastTimeActive[i] >= 0.0f && g.TablesLastTimeActive[i] < memory_compact_start_time)
4067 for (int i = 0; i < g.TablesTempDataStack.Size; i++)
4068 if (g.TablesTempDataStack[i].LastTimeActive >= 0.0f && g.TablesTempDataStack[i].LastTimeActive < memory_compact_start_time)
4070 if (g.GcCompactAll)
4072 g.GcCompactAll = false;
4073
4074 // Closing the focused window restore focus to the first active root window in descending z-order
4075 if (g.NavWindow && !g.NavWindow->WasActive)
4076 FocusTopMostWindowUnderOne(NULL, NULL);
4077
4078 // No window should be open at the beginning of the frame.
4079 // But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear.
4084 g.GroupStack.resize(0);
4086
4087 // [DEBUG] Item picker tool - start with DebugStartItemPicker() - useful to visually select an item and break into its call-stack.
4089
4090 // Create implicit/fallback window - which we will only render it if the user has added something to it.
4091 // We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags.
4092 // This fallback is particularly important as it avoid ImGui:: calls from crashing.
4095 Begin("Debug##Default");
4097
4099}
@ ImDrawListFlags_None
Definition imgui.h:2331
@ ImDrawListFlags_AntiAliasedLinesUseTex
Definition imgui.h:2333
@ ImDrawListFlags_AntiAliasedFill
Definition imgui.h:2334
@ ImDrawListFlags_AntiAliasedLines
Definition imgui.h:2332
@ ImDrawListFlags_AllowVtxOffset
Definition imgui.h:2335
@ ImGuiBackendFlags_RendererHasVtxOffset
Definition imgui.h:1407
@ ImGuiMouseCursor_Arrow
Definition imgui.h:1597
@ ImFontAtlasFlags_NoBakedLines
Definition imgui.h:2568
@ ImGuiContextHookType_NewFramePost
Definition imgui_internal.h:1333
@ ImGuiContextHookType_NewFramePre
Definition imgui_internal.h:1333
@ ImGuiItemFlags_None
Definition imgui_internal.h:722
static void UpdateTabFocus()
Definition imgui.cpp:3787
IMGUI_API void UpdateMouseMovingWindowNewFrame()
Definition imgui.cpp:3538
static void UpdateMouseWheel()
Definition imgui.cpp:3702
IMGUI_API void SetCurrentFont(ImFont *font)
Definition imgui.cpp:6516
IMGUI_API void UpdateHoveredWindowAndCaptureFlags()
Definition imgui.cpp:3826
ImFont * GetDefaultFont()
Definition imgui_internal.h:2303
IMGUI_API void GcCompactTransientWindowBuffers(ImGuiWindow *window)
Definition imgui.cpp:3027
static void UpdateSettings()
Definition imgui.cpp:10331
IMGUI_API void GcCompactTransientMiscBuffers()
Definition imgui.cpp:3015
static void NavUpdate()
Definition imgui.cpp:9021
static void UpdateDebugToolItemPicker()
Definition imgui.cpp:4102
static void ErrorCheckNewFrameSanityChecks()
Definition imgui.cpp:7132
static void UpdateMouseInputs()
Definition imgui.cpp:3635
static void UpdateViewportsNewFrame()
Definition imgui.cpp:10637
IMGUI_API void TableGcCompactTransientBuffers(ImGuiTable *table)
Definition imgui_tables.cpp:3439
void Clear()
Definition imgui.h:2485
float CurveTessellationTol
Definition imgui_internal.h:689
ImDrawListFlags InitialFlags
Definition imgui_internal.h:692
ImVec4 ClipRectFullscreen
Definition imgui_internal.h:691
void SetCircleTessellationMaxError(float max_error)
Definition imgui_draw.cpp:388
ImFontAtlasFlags Flags
Definition imgui.h:2653
bool IsLoaded() const
Definition imgui.h:2719
int FramerateSecPerFrameIdx
Definition imgui_internal.h:1588
int FramerateSecPerFrameCount
Definition imgui_internal.h:1589
bool HoveredIdUsingMouseWheel
Definition imgui_internal.h:1393
float LastActiveIdTimer
Definition imgui_internal.h:1420
bool GcCompactAll
Definition imgui_internal.h:1367
bool HoveredIdPreviousFrameUsingMouseWheel
Definition imgui_internal.h:1394
float ActiveIdTimer
Definition imgui_internal.h:1400
float FramerateSecPerFrameAccum
Definition imgui_internal.h:1590
ImGuiWindow * ActiveIdPreviousFrameWindow
Definition imgui_internal.h:1418
float HoveredIdNotActiveTimer
Definition imgui_internal.h:1397
float FramerateSecPerFrame[120]
Definition imgui_internal.h:1587
ImGuiID TempInputId
Definition imgui_internal.h:1536
float Framerate
Definition imgui.h:1867
float ConfigMemoryCompactTimer
Definition imgui.h:1808
bool AntiAliasedLines
Definition imgui.h:1756
bool AntiAliasedFill
Definition imgui.h:1758
bool AntiAliasedLinesUseTex
Definition imgui.h:1757
T * erase(const T *it)
Definition imgui.h:1699

References ImGuiWindow::Active, ImGuiContext::ActiveId, ImGuiContext::ActiveIdHasBeenEditedBefore, ImGuiContext::ActiveIdHasBeenEditedThisFrame, ImGuiContext::ActiveIdIsAlive, ImGuiContext::ActiveIdIsJustActivated, ImGuiContext::ActiveIdPreviousFrame, ImGuiContext::ActiveIdPreviousFrameHasBeenEditedBefore, ImGuiContext::ActiveIdPreviousFrameIsAlive, ImGuiContext::ActiveIdPreviousFrameWindow, ImGuiContext::ActiveIdTimer, ImGuiContext::ActiveIdUsingKeyInputMask, ImGuiContext::ActiveIdUsingNavDirMask, ImGuiContext::ActiveIdUsingNavInputMask, ImGuiContext::ActiveIdWindow, ImRect::Add(), ImGuiStyle::AntiAliasedFill, ImGuiStyle::AntiAliasedLines, ImGuiStyle::AntiAliasedLinesUseTex, ImGuiIO::BackendFlags, Begin(), ImGuiWindow::BeginCount, ImGuiContext::BeginPopupStack, CallContextHooks(), ImGuiStyle::CircleTessellationMaxError, ImDrawData::Clear(), ClearActiveID(), ImDrawListSharedData::ClipRectFullscreen, ClosePopupsOverWindow(), ImGuiIO::ConfigMemoryCompactTimer, ImFont::ContainerAtlas, ImGuiContext::CurrentWindow, ImGuiContext::CurrentWindowStack, ImGuiStyle::CurveTessellationTol, ImDrawListSharedData::CurveTessellationTol, ImGuiIO::DeltaTime, ImGuiContext::DimBgRatio, ImGuiContext::DragDropAcceptIdCurr, ImGuiContext::DragDropAcceptIdCurrRectSurface, ImGuiContext::DragDropAcceptIdPrev, ImGuiContext::DragDropActive, ImGuiContext::DragDropHoldJustPressedId, ImGuiContext::DragDropPayload, ImGuiContext::DragDropWithinSource, ImGuiContext::DragDropWithinTarget, ImGuiViewportP::DrawDataP, ImGuiContext::DrawListSharedData, ImVector< T >::erase(), ErrorCheckNewFrameSanityChecks(), ImFontAtlas::Flags, FocusTopMostWindowUnderOne(), ImGuiContext::Font, ImGuiIO::Fonts, ImGuiContext::FrameCount, ImGuiIO::Framerate, ImGuiContext::FramerateSecPerFrame, ImGuiContext::FramerateSecPerFrameAccum, ImGuiContext::FramerateSecPerFrameCount, ImGuiContext::FramerateSecPerFrameIdx, ImGuiContext::GcCompactAll, GcCompactTransientMiscBuffers(), GcCompactTransientWindowBuffers(), ImPool< T >::GetByIndex(), GetDefaultFont(), GetMergedKeyModFlags(), GetTopMostPopupModal(), GImGui, ImGuiContext::GroupStack, ImGuiContext::Hooks, ImGuiContext::HoveredId, ImGuiContext::HoveredIdAllowOverlap, ImGuiContext::HoveredIdDisabled, ImGuiContext::HoveredIdNotActiveTimer, ImGuiContext::HoveredIdPreviousFrame, ImGuiContext::HoveredIdPreviousFrameUsingMouseWheel, ImGuiContext::HoveredIdTimer, ImGuiContext::HoveredIdUsingMouseWheel, IM_ARRAYSIZE, IM_ASSERT, ImDrawListFlags_AllowVtxOffset, ImDrawListFlags_AntiAliasedFill, ImDrawListFlags_AntiAliasedLines, ImDrawListFlags_AntiAliasedLinesUseTex, ImDrawListFlags_None, ImFontAtlasFlags_NoBakedLines, ImGuiBackendFlags_RendererHasVtxOffset, ImGuiCond_FirstUseEver, ImGuiContextHookType_NewFramePost, ImGuiContextHookType_NewFramePre, ImGuiContextHookType_PendingRemoval_, ImGuiItemFlags_None, ImGuiMouseCursor_Arrow, ImMax(), ImMin(), ImDrawListSharedData::InitialFlags, ImGuiContext::IO, ImGuiWindow::IsFallbackWindow, ImFont::IsLoaded(), ImGuiContext::ItemFlagsStack, KeepAliveID(), ImGuiIO::KeyMods, ImGuiIO::KeysDown, ImGuiIO::KeysDownDuration, ImGuiIO::KeysDownDurationPrev, ImGuiContext::LastActiveIdTimer, ImGuiWindow::LastTimeActive, ImFontAtlas::Locked, ImGuiWindow::MemoryCompacted, ImGuiContext::MenusIdSubmittedThisFrame, ImGuiContext::MouseCursor, NavUpdate(), ImGuiContext::NavWindow, ImGuiContext::NavWindowingHighlightAlpha, ImGuiContext::NavWindowingTarget, ImGuiContext::PlatformImePos, ImVector< T >::push_back(), ImVector< T >::resize(), ImDrawListSharedData::SetCircleTessellationMaxError(), SetCurrentFont(), SetNextWindowSize(), ImVector< T >::Size, ImGuiPayload::SourceId, ImGuiContext::Style, TableGcCompactTransientBuffers(), ImGuiContext::Tables, ImGuiContext::TablesLastTimeActive, ImGuiContext::TablesTempDataStack, ImGuiContext::TempInputId, ImGuiContext::Time, ImGuiContext::TooltipOverrideCount, ImRect::ToVec4(), UpdateDebugToolItemPicker(), UpdateHoveredWindowAndCaptureFlags(), UpdateMouseInputs(), UpdateMouseMovingWindowNewFrame(), UpdateMouseWheel(), UpdateSettings(), UpdateTabFocus(), UpdateViewportsNewFrame(), ImGuiContext::Viewports, ImGuiContext::WantCaptureKeyboardNextFrame, ImGuiContext::WantCaptureMouseNextFrame, ImGuiContext::WantTextInputNextFrame, ImGuiWindow::WasActive, ImGuiContext::Windows, ImGuiContext::WindowsActiveCount, ImGuiContext::WindowsFocusOrder, ImGuiContext::WithinFrameScope, ImGuiContext::WithinFrameScopeWithImplicitWindow, and ImGuiWindow::WriteAccessed.

Referenced by Slic3r::GUI::ImGuiWrapper::new_frame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NewLine()

void ImGui::NewLine ( )
1332{
1333 ImGuiWindow* window = GetCurrentWindow();
1334 if (window->SkipItems)
1335 return;
1336
1337 ImGuiContext& g = *GImGui;
1338 const ImGuiLayoutType backup_layout_type = window->DC.LayoutType;
1340 if (window->DC.CurrLineSize.y > 0.0f) // In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height.
1341 ItemSize(ImVec2(0, 0));
1342 else
1343 ItemSize(ImVec2(0.0f, g.FontSize));
1344 window->DC.LayoutType = backup_layout_type;
1345}
int ImGuiLayoutType
Definition imgui_internal.h:141

References ImGuiWindowTempData::CurrLineSize, ImGuiWindow::DC, ImGuiContext::FontSize, GetCurrentWindow(), GImGui, ImGuiLayoutType_Vertical, ItemSize(), ImGuiWindowTempData::LayoutType, ImGuiWindow::SkipItems, and ImVec2::y.

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_style_rename_popup(), Slic3r::GUI::GLGizmoEmboss::draw_style_save_as_popup(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NextColumn()

void ImGui::NextColumn ( )
3878{
3879 ImGuiWindow* window = GetCurrentWindow();
3880 if (window->SkipItems || window->DC.CurrentColumns == NULL)
3881 return;
3882
3883 ImGuiContext& g = *GImGui;
3884 ImGuiOldColumns* columns = window->DC.CurrentColumns;
3885
3886 if (columns->Count == 1)
3887 {
3888 window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
3889 IM_ASSERT(columns->Current == 0);
3890 return;
3891 }
3892
3893 // Next column
3894 if (++columns->Current == columns->Count)
3895 columns->Current = 0;
3896
3897 PopItemWidth();
3898
3899 // Optimization: avoid PopClipRect() + SetCurrentChannel() + PushClipRect()
3900 // (which would needlessly attempt to update commands in the wrong channel, then pop or overwrite them),
3901 ImGuiOldColumnData* column = &columns->Columns[columns->Current];
3902 SetWindowClipRectBeforeSetChannel(window, column->ClipRect);
3903 columns->Splitter.SetCurrentChannel(window->DrawList, columns->Current + 1);
3904
3905 const float column_padding = g.Style.ItemSpacing.x;
3906 columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y);
3907 if (columns->Current > 0)
3908 {
3909 // Columns 1+ ignore IndentX (by canceling it out)
3910 // FIXME-COLUMNS: Unnecessary, could be locked?
3911 window->DC.ColumnsOffset.x = GetColumnOffset(columns->Current) - window->DC.Indent.x + column_padding;
3912 }
3913 else
3914 {
3915 // New row/line: column 0 honor IndentX.
3916 window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f);
3917 columns->LineMinY = columns->LineMaxY;
3918 }
3919 window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
3920 window->DC.CursorPos.y = columns->LineMinY;
3921 window->DC.CurrLineSize = ImVec2(0.0f, 0.0f);
3922 window->DC.CurrLineTextBaseOffset = 0.0f;
3923
3924 // FIXME-COLUMNS: Share code with BeginColumns() - move code on columns setup.
3925 float offset_0 = GetColumnOffset(columns->Current);
3926 float offset_1 = GetColumnOffset(columns->Current + 1);
3927 float width = offset_1 - offset_0;
3928 PushItemWidth(width * 0.65f);
3929 window->WorkRect.Max.x = window->Pos.x + offset_1 - column_padding;
3930}

References ImGuiOldColumnData::ClipRect, ImGuiOldColumns::Columns, ImGuiWindowTempData::ColumnsOffset, ImGuiOldColumns::Count, ImGuiOldColumns::Current, ImGuiWindowTempData::CurrentColumns, ImGuiWindowTempData::CurrLineSize, ImGuiWindowTempData::CurrLineTextBaseOffset, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, GetColumnOffset(), GetCurrentWindow(), GImGui, IM_ASSERT, IM_FLOOR, ImMax(), ImGuiWindowTempData::Indent, ImGuiStyle::ItemSpacing, ImGuiOldColumns::LineMaxY, ImGuiOldColumns::LineMinY, ImRect::Max, PopItemWidth(), ImGuiWindow::Pos, PushItemWidth(), ImDrawListSplitter::SetCurrentChannel(), SetWindowClipRectBeforeSetChannel(), ImGuiWindow::SkipItems, ImGuiOldColumns::Splitter, ImGuiContext::Style, ImGuiWindow::WindowPadding, ImGuiWindow::WorkRect, ImVec2::x, ImVec1::x, and ImVec2::y.

Referenced by ShowDemoWindowColumns(), ShowDemoWindowLayout(), and ShowPlaceholderObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OpenPopup() [1/2]

void ImGui::OpenPopup ( const char *  str_id,
ImGuiPopupFlags  popup_flags = 0 
)
8122{
8123 ImGuiContext& g = *GImGui;
8124 OpenPopupEx(g.CurrentWindow->GetID(str_id), popup_flags);
8125}

References ImGuiContext::CurrentWindow, ImGuiWindow::GetID(), GImGui, and OpenPopupEx().

Referenced by BeginMenu(), ColorEdit4(), ColorEditOptionsPopup(), ExampleAppConsole::Draw(), ExampleAppLog::Draw(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), Slic3r::GUI::GLGizmoEmboss::draw_style_add_button(), Slic3r::GUI::GLGizmoEmboss::draw_style_rename_button(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), and ShowExampleAppDocuments().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OpenPopup() [2/2]

void ImGui::OpenPopup ( ImGuiID  id,
ImGuiPopupFlags  popup_flags = 0 
)
8128{
8129 OpenPopupEx(id, popup_flags);
8130}

References OpenPopupEx().

+ Here is the call graph for this function:

◆ OpenPopupContextItem()

static void ImGui::OpenPopupContextItem ( const char *  str_id = NULL,
ImGuiMouseButton  mb = 1 
)
inlinestatic
2789{ OpenPopupOnItemClick(str_id, mb); } // Bool return value removed. Use IsWindowAppearing() in BeginPopup() instead. Renamed in 1.77, renamed back in 1.79. Sorry!

References OpenPopupContextItem(), and OpenPopupOnItemClick().

Referenced by OpenPopupContextItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OpenPopupEx()

void ImGui::OpenPopupEx ( ImGuiID  id,
ImGuiPopupFlags  popup_flags = ImGuiPopupFlags_None 
)
8137{
8138 ImGuiContext& g = *GImGui;
8139 ImGuiWindow* parent_window = g.CurrentWindow;
8140 const int current_stack_size = g.BeginPopupStack.Size;
8141
8144 return;
8145
8146 ImGuiPopupData popup_ref; // Tagged as new ref as Window will be set back to NULL if we write this into OpenPopupStack.
8147 popup_ref.PopupId = id;
8148 popup_ref.Window = NULL;
8149 popup_ref.SourceWindow = g.NavWindow;
8150 popup_ref.OpenFrameCount = g.FrameCount;
8151 popup_ref.OpenParentId = parent_window->IDStack.back();
8153 popup_ref.OpenMousePos = IsMousePosValid(&g.IO.MousePos) ? g.IO.MousePos : popup_ref.OpenPopupPos;
8154
8155 IMGUI_DEBUG_LOG_POPUP("OpenPopupEx(0x%08X)\n", id);
8156 if (g.OpenPopupStack.Size < current_stack_size + 1)
8157 {
8158 g.OpenPopupStack.push_back(popup_ref);
8159 }
8160 else
8161 {
8162 // Gently handle the user mistakenly calling OpenPopup() every frame. It is a programming mistake! However, if we were to run the regular code path, the ui
8163 // would become completely unusable because the popup will always be in hidden-while-calculating-size state _while_ claiming focus. Which would be a very confusing
8164 // situation for the programmer. Instead, we silently allow the popup to proceed, it will keep reappearing and the programming error will be more obvious to understand.
8165 if (g.OpenPopupStack[current_stack_size].PopupId == id && g.OpenPopupStack[current_stack_size].OpenFrameCount == g.FrameCount - 1)
8166 {
8167 g.OpenPopupStack[current_stack_size].OpenFrameCount = popup_ref.OpenFrameCount;
8168 }
8169 else
8170 {
8171 // Close child popups if any, then flag popup for open/reopen
8172 ClosePopupToLevel(current_stack_size, false);
8173 g.OpenPopupStack.push_back(popup_ref);
8174 }
8175
8176 // When reopening a popup we first refocus its parent, otherwise if its parent is itself a popup it would get closed by ClosePopupsOverWindow().
8177 // This is equivalent to what ClosePopupToLevel() does.
8178 //if (g.OpenPopupStack[current_stack_size].PopupId == id)
8179 // FocusWindow(parent_window);
8180 }
8181}
@ ImGuiPopupFlags_NoOpenOverExistingPopup
Definition imgui.h:1021
ImGuiWindow * SourceWindow
Definition imgui_internal.h:1056
int OpenFrameCount
Definition imgui_internal.h:1057
ImVec2 OpenMousePos
Definition imgui_internal.h:1060
ImGuiID OpenParentId
Definition imgui_internal.h:1058

References ImVector< T >::back(), ImGuiContext::BeginPopupStack, ClosePopupToLevel(), ImGuiContext::CurrentWindow, ImGuiContext::FrameCount, GImGui, ImGuiWindow::IDStack, IMGUI_DEBUG_LOG_POPUP, ImGuiPopupFlags_AnyPopupId, ImGuiPopupFlags_NoOpenOverExistingPopup, ImGuiContext::IO, IsMousePosValid(), IsPopupOpen(), ImGuiIO::MousePos, NavCalcPreferredRefPos(), ImGuiContext::NavWindow, ImGuiPopupData::OpenFrameCount, ImGuiPopupData::OpenMousePos, ImGuiPopupData::OpenParentId, ImGuiPopupData::OpenPopupPos, ImGuiContext::OpenPopupStack, ImGuiPopupData::PopupId, ImVector< T >::push_back(), ImVector< T >::Size, ImGuiPopupData::SourceWindow, and ImGuiPopupData::Window.

Referenced by BeginCombo(), BeginPopupContextItem(), BeginPopupContextVoid(), BeginPopupContextWindow(), OpenPopup(), OpenPopup(), OpenPopupOnItemClick(), and TableOpenContextMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OpenPopupOnItemClick()

void ImGui::OpenPopupOnItemClick ( const char *  str_id = NULL,
ImGuiPopupFlags  popup_flags = 1 
)
8379{
8380 ImGuiWindow* window = GImGui->CurrentWindow;
8381 int mouse_button = (popup_flags & ImGuiPopupFlags_MouseButtonMask_);
8383 {
8384 ImGuiID id = str_id ? window->GetID(str_id) : window->DC.LastItemId; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict!
8385 IM_ASSERT(id != 0); // You cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
8386 OpenPopupEx(id, popup_flags);
8387 }
8388}

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiWindow::GetID(), GImGui, IM_ASSERT, ImGuiHoveredFlags_AllowWhenBlockedByPopup, ImGuiPopupFlags_MouseButtonMask_, IsItemHovered(), IsMouseReleased(), ImGuiWindowTempData::LastItemId, and OpenPopupEx().

Referenced by ColorEdit4(), ColorPicker4(), OpenPopupContextItem(), ShowDemoWindowPopups(), and ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PlotEx()

int ImGui::PlotEx ( ImGuiPlotType  plot_type,
const char *  label,
float(*)(void *data, int idx)  values_getter,
void data,
int  values_count,
int  values_offset,
const char *  overlay_text,
float  scale_min,
float  scale_max,
ImVec2  frame_size 
)
6309{
6310 ImGuiContext& g = *GImGui;
6311 ImGuiWindow* window = GetCurrentWindow();
6312 if (window->SkipItems)
6313 return -1;
6314
6315 const ImGuiStyle& style = g.Style;
6316 const ImGuiID id = window->GetID(label);
6317
6318 const ImVec2 label_size = CalcTextSize(label, NULL, true);
6319 if (frame_size.x == 0.0f)
6320 frame_size.x = CalcItemWidth();
6321 if (frame_size.y == 0.0f)
6322 frame_size.y = label_size.y + (style.FramePadding.y * 2);
6323
6324 const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size);
6325 const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding);
6326 const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0));
6327 ItemSize(total_bb, style.FramePadding.y);
6328 if (!ItemAdd(total_bb, 0, &frame_bb))
6329 return -1;
6330 const bool hovered = ItemHoverable(frame_bb, id);
6331
6332 // Determine scale from values if not specified
6333 if (scale_min == FLT_MAX || scale_max == FLT_MAX)
6334 {
6335 float v_min = FLT_MAX;
6336 float v_max = -FLT_MAX;
6337 for (int i = 0; i < values_count; i++)
6338 {
6339 const float v = values_getter(data, i);
6340 if (v != v) // Ignore NaN values
6341 continue;
6342 v_min = ImMin(v_min, v);
6343 v_max = ImMax(v_max, v);
6344 }
6345 if (scale_min == FLT_MAX)
6346 scale_min = v_min;
6347 if (scale_max == FLT_MAX)
6348 scale_max = v_max;
6349 }
6350
6351 RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
6352
6353 const int values_count_min = (plot_type == ImGuiPlotType_Lines) ? 2 : 1;
6354 int idx_hovered = -1;
6355 if (values_count >= values_count_min)
6356 {
6357 int res_w = ImMin((int)frame_size.x, values_count) + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0);
6358 int item_count = values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0);
6359
6360 // Tooltip on hover
6361 if (hovered && inner_bb.Contains(g.IO.MousePos))
6362 {
6363 const float t = ImClamp((g.IO.MousePos.x - inner_bb.Min.x) / (inner_bb.Max.x - inner_bb.Min.x), 0.0f, 0.9999f);
6364 const int v_idx = (int)(t * item_count);
6365 IM_ASSERT(v_idx >= 0 && v_idx < values_count);
6366
6367 const float v0 = values_getter(data, (v_idx + values_offset) % values_count);
6368 const float v1 = values_getter(data, (v_idx + 1 + values_offset) % values_count);
6369 if (plot_type == ImGuiPlotType_Lines)
6370 SetTooltip("%d: %8.4g\n%d: %8.4g", v_idx, v0, v_idx + 1, v1);
6371 else if (plot_type == ImGuiPlotType_Histogram)
6372 SetTooltip("%d: %8.4g", v_idx, v0);
6373 idx_hovered = v_idx;
6374 }
6375
6376 const float t_step = 1.0f / (float)res_w;
6377 const float inv_scale = (scale_min == scale_max) ? 0.0f : (1.0f / (scale_max - scale_min));
6378
6379 float v0 = values_getter(data, (0 + values_offset) % values_count);
6380 float t0 = 0.0f;
6381 ImVec2 tp0 = ImVec2( t0, 1.0f - ImSaturate((v0 - scale_min) * inv_scale) ); // Point in the normalized space of our target rectangle
6382 float histogram_zero_line_t = (scale_min * scale_max < 0.0f) ? (-scale_min * inv_scale) : (scale_min < 0.0f ? 0.0f : 1.0f); // Where does the zero line stands
6383
6386
6387 for (int n = 0; n < res_w; n++)
6388 {
6389 const float t1 = t0 + t_step;
6390 const int v1_idx = (int)(t0 * item_count + 0.5f);
6391 IM_ASSERT(v1_idx >= 0 && v1_idx < values_count);
6392 const float v1 = values_getter(data, (v1_idx + values_offset + 1) % values_count);
6393 const ImVec2 tp1 = ImVec2( t1, 1.0f - ImSaturate((v1 - scale_min) * inv_scale) );
6394
6395 // NB: Draw calls are merged together by the DrawList system. Still, we should render our batch are lower level to save a bit of CPU.
6396 ImVec2 pos0 = ImLerp(inner_bb.Min, inner_bb.Max, tp0);
6397 ImVec2 pos1 = ImLerp(inner_bb.Min, inner_bb.Max, (plot_type == ImGuiPlotType_Lines) ? tp1 : ImVec2(tp1.x, histogram_zero_line_t));
6398 if (plot_type == ImGuiPlotType_Lines)
6399 {
6400 window->DrawList->AddLine(pos0, pos1, idx_hovered == v1_idx ? col_hovered : col_base);
6401 }
6402 else if (plot_type == ImGuiPlotType_Histogram)
6403 {
6404 if (pos1.x >= pos0.x + 2.0f)
6405 pos1.x -= 1.0f;
6406 window->DrawList->AddRectFilled(pos0, pos1, idx_hovered == v1_idx ? col_hovered : col_base);
6407 }
6408
6409 t0 = t1;
6410 tp0 = tp1;
6411 }
6412 }
6413
6414 // Text overlay
6415 if (overlay_text)
6416 RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, overlay_text, NULL, NULL, ImVec2(0.5f, 0.0f));
6417
6418 if (label_size.x > 0.0f)
6419 RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label);
6420
6421 // Return hovered index or -1 if none are hovered.
6422 // This is currently not exposed in the public API because we need a larger redesign of the whole thing, but in the short-term we are making it available in PlotEx().
6423 return idx_hovered;
6424}
@ ImGuiPlotType_Histogram
Definition imgui_internal.h:872
@ ImGuiPlotType_Lines
Definition imgui_internal.h:871

References ImDrawList::AddLine(), ImDrawList::AddRectFilled(), CalcItemWidth(), CalcTextSize(), ImRect::Contains(), ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, GetColorU32(), GetCurrentWindow(), ImGuiWindow::GetID(), GImGui, IM_ASSERT, ImClamp(), ImGuiCol_FrameBg, ImGuiCol_PlotHistogram, ImGuiCol_PlotHistogramHovered, ImGuiCol_PlotLines, ImGuiCol_PlotLinesHovered, ImGuiPlotType_Histogram, ImGuiPlotType_Lines, ImLerp(), ImMax(), ImMin(), ImSaturate(), ImGuiContext::IO, ItemAdd(), ItemHoverable(), ItemSize(), ImRect::Max, ImRect::Min, ImGuiIO::MousePos, RenderFrame(), RenderText(), RenderTextClipped(), SetTooltip(), ImGuiWindow::SkipItems, ImGuiContext::Style, style, ImVec2::x, and ImVec2::y.

Referenced by PlotHistogram(), PlotHistogram(), PlotLines(), and PlotLines().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PlotHistogram() [1/2]

void ImGui::PlotHistogram ( const char *  label,
const float *  values,
int  values_count,
int  values_offset = 0,
const char *  overlay_text = NULL,
float  scale_min = FLT_MAX,
float  scale_max = FLT_MAX,
ImVec2  graph_size = ImVec2(0, 0),
int  stride = sizeof(float) 
)
6453{
6454 ImGuiPlotArrayGetterData data(values, stride);
6455 PlotEx(ImGuiPlotType_Histogram, label, &Plot_ArrayGetter, (void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);
6456}
static float Plot_ArrayGetter(void *data, int idx)
Definition imgui_widgets.cpp:6434
IMGUI_API int PlotEx(ImGuiPlotType plot_type, const char *label, float(*values_getter)(void *data, int idx), void *data, int values_count, int values_offset, const char *overlay_text, float scale_min, float scale_max, ImVec2 frame_size)
Definition imgui_widgets.cpp:6308
Definition imgui_widgets.cpp:6427

References ImGuiPlotType_Histogram, Plot_ArrayGetter(), and PlotEx().

Referenced by ShowDemoWindowLayout(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PlotHistogram() [2/2]

void ImGui::PlotHistogram ( const char *  label,
float(*)(void *data, int idx)  values_getter,
void data,
int  values_count,
int  values_offset = 0,
const char *  overlay_text = NULL,
float  scale_min = FLT_MAX,
float  scale_max = FLT_MAX,
ImVec2  graph_size = ImVec2(0, 0) 
)
6459{
6460 PlotEx(ImGuiPlotType_Histogram, label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);
6461}

References ImGuiPlotType_Histogram, and PlotEx().

+ Here is the call graph for this function:

◆ PlotLines() [1/2]

void ImGui::PlotLines ( const char *  label,
const float *  values,
int  values_count,
int  values_offset = 0,
const char *  overlay_text = NULL,
float  scale_min = FLT_MAX,
float  scale_max = FLT_MAX,
ImVec2  graph_size = ImVec2(0, 0),
int  stride = sizeof(float) 
)
6442{
6443 ImGuiPlotArrayGetterData data(values, stride);
6444 PlotEx(ImGuiPlotType_Lines, label, &Plot_ArrayGetter, (void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);
6445}

References ImGuiPlotType_Lines, Plot_ArrayGetter(), and PlotEx().

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PlotLines() [2/2]

void ImGui::PlotLines ( const char *  label,
float(*)(void *data, int idx)  values_getter,
void data,
int  values_count,
int  values_offset = 0,
const char *  overlay_text = NULL,
float  scale_min = FLT_MAX,
float  scale_max = FLT_MAX,
ImVec2  graph_size = ImVec2(0, 0) 
)
6448{
6449 PlotEx(ImGuiPlotType_Lines, label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);
6450}

References ImGuiPlotType_Lines, and PlotEx().

+ Here is the call graph for this function:

◆ PopAllowKeyboardFocus()

void ImGui::PopAllowKeyboardFocus ( )
6578{
6579 PopItemFlag();
6580}

References PopItemFlag().

Referenced by LogButtons(), and ShowDemoWindowMisc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PopButtonRepeat()

void ImGui::PopButtonRepeat ( )
6588{
6589 PopItemFlag();
6590}

References PopItemFlag().

Referenced by ShowDemoWindowTables(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PopClipRect()

void ImGui::PopClipRect ( )
4373{
4374 ImGuiWindow* window = GetCurrentWindow();
4375 window->DrawList->PopClipRect();
4376 window->ClipRect = window->DrawList->_ClipRectStack.back();
4377}

References ImDrawList::_ClipRectStack, ImVector< T >::back(), ImGuiWindow::ClipRect, ImGuiWindow::DrawList, GetCurrentWindow(), and ImDrawList::PopClipRect().

Referenced by End(), EndColumns(), EndMenuBar(), ShowDemoWindowLayout(), and TabItemEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PopColumnsBackground()

void ImGui::PopColumnsBackground ( )
3763{
3765 ImGuiOldColumns* columns = window->DC.CurrentColumns;
3766 if (columns->Count == 1)
3767 return;
3768
3769 // Optimization: avoid PopClipRect() + SetCurrentChannel()
3771 columns->Splitter.SetCurrentChannel(window->DrawList, columns->Current + 1);
3772}
IMGUI_API void SetWindowClipRectBeforeSetChannel(ImGuiWindow *window, const ImRect &clip_rect)
Definition imgui_tables.cpp:3613
ImRect HostBackupClipRect
Definition imgui_internal.h:1197

References ImGuiOldColumns::Count, ImGuiOldColumns::Current, ImGuiWindowTempData::CurrentColumns, ImGuiWindow::DC, ImGuiWindow::DrawList, GetCurrentWindowRead(), ImGuiOldColumns::HostBackupClipRect, ImDrawListSplitter::SetCurrentChannel(), SetWindowClipRectBeforeSetChannel(), and ImGuiOldColumns::Splitter.

Referenced by Slic3r::GUI::selectable(), Selectable(), and SeparatorEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PopFocusScope()

void ImGui::PopFocusScope ( )
6971{
6972 ImGuiContext& g = *GImGui;
6973 ImGuiWindow* window = g.CurrentWindow;
6974 IM_ASSERT(g.FocusScopeStack.Size > 0); // Too many PopFocusScope() ?
6977}

References ImVector< T >::back(), ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiContext::FocusScopeStack, GImGui, IM_ASSERT, ImGuiWindowTempData::NavFocusScopeIdCurrent, ImVector< T >::pop_back(), and ImVector< T >::Size.

Referenced by ErrorCheckEndFrameRecover().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PopFont()

void ImGui::PopFont ( )
6543{
6544 ImGuiContext& g = *GImGui;
6546 g.FontStack.pop_back();
6547 SetCurrentFont(g.FontStack.empty() ? GetDefaultFont() : g.FontStack.back());
6548}
IMGUI_API void PopTextureID()
Definition imgui_draw.cpp:606
ImVector< ImFont * > FontStack
Definition imgui_internal.h:1429

References ImVector< T >::back(), ImGuiContext::CurrentWindow, ImGuiWindow::DrawList, ImVector< T >::empty(), ImGuiContext::FontStack, GetDefaultFont(), GImGui, ImVector< T >::pop_back(), ImDrawList::PopTextureID(), and SetCurrentFont().

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_text_input(), InputTextEx(), and ShowFont().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PopID()

void ImGui::PopID ( )
7073{
7074 ImGuiWindow* window = GImGui->CurrentWindow;
7075 IM_ASSERT(window->IDStack.Size > 1); // Too many PopID(), or could be popping in a wrong/different window?
7076 window->IDStack.pop_back();
7077}

References ImGuiContext::CurrentWindow, GImGui, ImGuiWindow::IDStack, IM_ASSERT, ImVector< T >::pop_back(), and ImVector< T >::Size.

Referenced by ColorEdit4(), ColorPicker4(), ColorPickerOptionsPopup(), DebugNodeTabBar(), DebugNodeWindowsList(), MyDocument::DisplayContents(), DragFloatRange2(), DragIntRange2(), DragScalarN(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), EndMenuBar(), EndTabBar(), EndTabItem(), EndTable(), ErrorCheckEndFrameRecover(), GetColumnsID(), Slic3r::GUI::ImGuiWrapper::image_button(), ImageButton(), InputScalar(), InputScalarN(), LogButtons(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::render_extruders_combo(), ShowDemoWindowLayout(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppDocuments(), ShowFontAtlas(), ShowFontSelector(), ShowPlaceholderObject(), ShowStyleEditor(), SliderScalarN(), TableHeadersRow(), TreePop(), and UpdateWindowManualResize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PopItemFlag()

void ImGui::PopItemFlag ( )
6564{
6565 ImGuiContext& g = *GImGui;
6566 IM_ASSERT(g.ItemFlagsStack.Size > 1); // Too many calls to PopItemFlag() - we always leave a 0 at the bottom of the stack.
6569}

References ImVector< T >::back(), ImGuiContext::CurrentItemFlags, GImGui, IM_ASSERT, ImGuiContext::ItemFlagsStack, ImVector< T >::pop_back(), and ImVector< T >::Size.

Referenced by ColorPicker4(), Slic3r::GUI::ImGuiWrapper::disabled_end(), PopAllowKeyboardFocus(), PopButtonRepeat(), TabItemEx(), and TableDrawContextMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PopItemWidth()

void ImGui::PopItemWidth ( )
7588{
7589 ImGuiWindow* window = GetCurrentWindow();
7590 window->DC.ItemWidth = window->DC.ItemWidthStack.back();
7591 window->DC.ItemWidthStack.pop_back();
7592}

References ImVector< T >::back(), ImGuiWindow::DC, GetCurrentWindow(), ImGuiWindowTempData::ItemWidth, ImGuiWindowTempData::ItemWidthStack, and ImVector< T >::pop_back().

Referenced by ColorPicker4(), ColorPickerOptionsPopup(), DragFloatRange2(), DragIntRange2(), DragScalarN(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_window(), EndColumns(), InputScalarN(), NextColumn(), ShowDemoWindow(), ShowDemoWindowLayout(), ShowDemoWindowTables(), ShowExampleAppCustomRendering(), ShowStyleEditor(), and SliderScalarN().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PopStyleColor()

void ImGui::PopStyleColor ( int  count = 1)
2483{
2484 ImGuiContext& g = *GImGui;
2485 while (count > 0)
2486 {
2487 ImGuiColorMod& backup = g.ColorStack.back();
2488 g.Style.Colors[backup.Col] = backup.BackupValue;
2489 g.ColorStack.pop_back();
2490 count--;
2491 }
2492}
ImVec4 BackupValue
Definition imgui_internal.h:973
Definition imgui_internal.h:971

References ImVector< T >::back(), ImGuiColorMod::BackupValue, ImGuiColorMod::Col, ImGuiStyle::Colors, ImGuiContext::ColorStack, GImGui, ImVector< T >::pop_back(), and ImGuiContext::Style.

Referenced by BeginChildFrame(), DebugNodeTabBar(), DebugNodeTable(), DebugNodeWindow(), MyDocument::DisplayContents(), ExampleAppConsole::Draw(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), igl::opengl::glfw::imgui::ImGuiMenu::draw_labels_window(), ErrorCheckEndFrameRecover(), Slic3r::GUI::ImGuiWrapper::image_button(), InputTextEx(), MenuItem(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::NotificationManager::PopNotification::render(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressBarWithCancelNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::PopNotification::render_close_button(), Slic3r::GUI::NotificationManager::HintNotification::render_close_button(), Slic3r::GUI::NotificationManager::ProgressBarWithCancelNotification::render_close_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_close_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_documentation_button(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_eject_button(), Slic3r::GUI::GLGizmoCut3D::render_flip_plane_button(), Slic3r::GUI::NotificationManager::PopNotification::render_hypertext(), Slic3r::GUI::GCodeViewer::render_legend(), Slic3r::GUI::NotificationManager::PopNotification::render_minimize_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_open_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_pause_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_preferences_button(), Slic3r::GUI::GLGizmoCut3D::render_reset_button(), Slic3r::GUI::NotificationManager::HintNotification::render_right_arrow_button(), Slic3r::GUI::GLCanvas3D::SLAView::render_switch_button(), Slic3r::GUI::selectable(), Selectable(), ShowDemoWindowLayout(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), Slic3r::GUI::ImGuiWrapper::slider_float(), TabBarScrollingButtons(), TabBarTabListPopupButton(), TableHeader(), TextColoredV(), and TextDisabledV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PopStyleVar()

void ImGui::PopStyleVar ( int  count = 1)
2566{
2567 ImGuiContext& g = *GImGui;
2568 while (count > 0)
2569 {
2570 // We avoid a generic memcpy(data, &backup.Backup.., GDataTypeSize[info->Type] * info->Count), the overhead in Debug is not worth it.
2571 ImGuiStyleMod& backup = g.StyleVarStack.back();
2572 const ImGuiStyleVarInfo* info = GetStyleVarInfo(backup.VarIdx);
2573 void* data = info->GetVarPtr(&g.Style);
2574 if (info->Type == ImGuiDataType_Float && info->Count == 1) { ((float*)data)[0] = backup.BackupFloat[0]; }
2575 else if (info->Type == ImGuiDataType_Float && info->Count == 2) { ((float*)data)[0] = backup.BackupFloat[0]; ((float*)data)[1] = backup.BackupFloat[1]; }
2577 count--;
2578 }
2579}
static const ImGuiStyleVarInfo * GetStyleVarInfo(ImGuiStyleVar idx)
Definition imgui.cpp:2530
IGL_INLINE void count(const Eigen::SparseMatrix< XType > &X, const int dim, Eigen::SparseVector< SType > &S)
Definition count.cpp:12
Definition imgui_internal.h:978
ImGuiStyleVar VarIdx
Definition imgui_internal.h:979
Definition imgui.cpp:2495
ImGuiDataType Type
Definition imgui.cpp:2496
void * GetVarPtr(ImGuiStyle *style) const
Definition imgui.cpp:2499
ImU32 Count
Definition imgui.cpp:2497

References ImVector< T >::back(), ImGuiStyleVarInfo::Count, GetStyleVarInfo(), ImGuiStyleVarInfo::GetVarPtr(), GImGui, ImGuiDataType_Float, ImVector< T >::pop_back(), ImGuiContext::Style, ImGuiContext::StyleVarStack, ImGuiStyleVarInfo::Type, and ImGuiStyleMod::VarIdx.

Referenced by BeginChildFrame(), BeginCombo(), BeginMenu(), BeginViewportSideBar(), Slic3r::GUI::ImGuiWrapper::disabled_end(), ExampleAppConsole::Draw(), ExampleAppLog::Draw(), igl::opengl::glfw::imgui::ImGuiMenu::draw_labels_window(), Slic3r::GUI::GLGizmoEmboss::draw_window(), ErrorCheckEndFrameRecover(), InputTextEx(), MenuItem(), NavUpdateWindowingOverlay(), Slic3r::GUI::GLGizmoEmboss::on_render_input_window(), PopStyleCompact(), Slic3r::GUI::GCodeViewer::SequentialView::Marker::render(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GLCanvas3D::Tooltip::render(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::GCodeViewer::render_legend(), Slic3r::GUI::GLGizmoCut3D::render_reset_button(), ShowDemoWindowLayout(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppLongText(), ShowExampleAppPropertyEditor(), Slic3r::GUI::ImGuiWrapper::slider_float(), TabItemLabelAndCloseButton(), and Slic3r::GUI::ImGuiWrapper::tooltip().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PopTextWrapPos()

void ImGui::PopTextWrapPos ( )
6600{
6601 ImGuiWindow* window = GetCurrentWindow();
6602 window->DC.TextWrapPos = window->DC.TextWrapPosStack.back();
6603 window->DC.TextWrapPosStack.pop_back();
6604}

References ImVector< T >::back(), ImGuiWindow::DC, GetCurrentWindow(), ImVector< T >::pop_back(), ImGuiWindowTempData::TextWrapPos, and ImGuiWindowTempData::TextWrapPosStack.

Referenced by EditTableSizingFlags(), HelpMarker(), MetricsHelpMarker(), ShowDemoWindowWidgets(), Slic3r::GUI::ImGuiWrapper::text_wrapped(), TextWrappedV(), and Slic3r::GUI::ImGuiWrapper::tooltip().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProgressBar()

void ImGui::ProgressBar ( float  fraction,
const ImVec2 size_arg = ImVec2(-FLT_MIN, 0),
const char *  overlay = NULL 
)
1241{
1242 ImGuiWindow* window = GetCurrentWindow();
1243 if (window->SkipItems)
1244 return;
1245
1246 ImGuiContext& g = *GImGui;
1247 const ImGuiStyle& style = g.Style;
1248
1249 ImVec2 pos = window->DC.CursorPos;
1250 ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), g.FontSize + style.FramePadding.y * 2.0f);
1251 ImRect bb(pos, pos + size);
1252 ItemSize(size, style.FramePadding.y);
1253 if (!ItemAdd(bb, 0))
1254 return;
1255
1256 // Render
1257 fraction = ImSaturate(fraction);
1258 RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
1259 bb.Expand(ImVec2(-style.FrameBorderSize, -style.FrameBorderSize));
1260 const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y);
1261 RenderRectFilledRangeH(window->DrawList, bb, GetColorU32(ImGuiCol_PlotHistogram), 0.0f, fraction, style.FrameRounding);
1262
1263 // Default displaying the fraction as percentage string, but user can override it
1264 char overlay_buf[32];
1265 if (!overlay)
1266 {
1267 ImFormatString(overlay_buf, IM_ARRAYSIZE(overlay_buf), "%.0f%%", fraction * 100 + 0.01f);
1268 overlay = overlay_buf;
1269 }
1270
1271 ImVec2 overlay_size = CalcTextSize(overlay, NULL);
1272 if (overlay_size.x > 0.0f)
1273 RenderTextClipped(ImVec2(ImClamp(fill_br.x + style.ItemSpacing.x, bb.Min.x, bb.Max.x - overlay_size.x - style.ItemInnerSpacing.x), bb.Min.y), bb.Max, overlay, NULL, &overlay_size, ImVec2(0.0f, 0.5f), &bb);
1274}
IMGUI_API void RenderRectFilledRangeH(ImDrawList *draw_list, const ImRect &rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding)
Definition imgui_draw.cpp:3832

References CalcItemSize(), CalcItemWidth(), CalcTextSize(), ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, ImRect::Expand(), ImGuiContext::FontSize, GetColorU32(), GetCurrentWindow(), GImGui, IM_ARRAYSIZE, ImClamp(), ImFormatString(), ImGuiCol_FrameBg, ImGuiCol_PlotHistogram, ImLerp(), ImSaturate(), ItemAdd(), ItemSize(), ImRect::Max, ImRect::Min, RenderFrame(), RenderRectFilledRangeH(), RenderTextClipped(), ImGuiWindow::SkipItems, ImGuiContext::Style, style, ImVec2::x, and ImVec2::y.

Referenced by Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushAllowKeyboardFocus()

void ImGui::PushAllowKeyboardFocus ( bool  allow_keyboard_focus)
6573{
6574 PushItemFlag(ImGuiItemFlags_NoTabStop, !allow_keyboard_focus);
6575}

References ImGuiItemFlags_NoTabStop, and PushItemFlag().

Referenced by LogButtons(), and ShowDemoWindowMisc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushButtonRepeat()

void ImGui::PushButtonRepeat ( bool  repeat)
6583{
6585}

References ImGuiItemFlags_ButtonRepeat, and PushItemFlag().

Referenced by ShowDemoWindowTables(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushClipRect()

void ImGui::PushClipRect ( const ImVec2 clip_rect_min,
const ImVec2 clip_rect_max,
bool  intersect_with_current_clip_rect 
)
4366{
4367 ImGuiWindow* window = GetCurrentWindow();
4368 window->DrawList->PushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect);
4369 window->ClipRect = window->DrawList->_ClipRectStack.back();
4370}

References ImDrawList::_ClipRectStack, ImVector< T >::back(), ImGuiWindow::ClipRect, ImGuiWindow::DrawList, GetCurrentWindow(), and ImDrawList::PushClipRect().

Referenced by Begin(), BeginMenuBar(), PushColumnClipRect(), ShowDemoWindowLayout(), and TabItemEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushColumnClipRect()

void ImGui::PushColumnClipRect ( int  column_index)
3738{
3740 ImGuiOldColumns* columns = window->DC.CurrentColumns;
3741 if (column_index < 0)
3742 column_index = columns->Current;
3743
3744 ImGuiOldColumnData* column = &columns->Columns[column_index];
3745 PushClipRect(column->ClipRect.Min, column->ClipRect.Max, false);
3746}

References ImGuiOldColumnData::ClipRect, ImGuiOldColumns::Columns, ImGuiOldColumns::Current, ImGuiWindowTempData::CurrentColumns, ImGuiWindow::DC, GetCurrentWindowRead(), ImRect::Max, ImRect::Min, and PushClipRect().

Referenced by BeginColumns().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushColumnsBackground()

void ImGui::PushColumnsBackground ( )
3750{
3752 ImGuiOldColumns* columns = window->DC.CurrentColumns;
3753 if (columns->Count == 1)
3754 return;
3755
3756 // Optimization: avoid SetCurrentChannel() + PushClipRect()
3757 columns->HostBackupClipRect = window->ClipRect;
3759 columns->Splitter.SetCurrentChannel(window->DrawList, 0);
3760}

References ImGuiWindow::ClipRect, ImGuiOldColumns::Count, ImGuiWindowTempData::CurrentColumns, ImGuiWindow::DC, ImGuiWindow::DrawList, GetCurrentWindowRead(), ImGuiOldColumns::HostBackupClipRect, ImGuiOldColumns::HostInitialClipRect, ImDrawListSplitter::SetCurrentChannel(), SetWindowClipRectBeforeSetChannel(), and ImGuiOldColumns::Splitter.

Referenced by Slic3r::GUI::selectable(), Selectable(), and SeparatorEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushFocusScope()

void ImGui::PushFocusScope ( ImGuiID  id)
6963{
6964 ImGuiContext& g = *GImGui;
6965 ImGuiWindow* window = g.CurrentWindow;
6967 window->DC.NavFocusScopeIdCurrent = id;
6968}

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiContext::FocusScopeStack, GImGui, ImGuiWindowTempData::NavFocusScopeIdCurrent, and ImVector< T >::push_back().

+ Here is the call graph for this function:

◆ PushFont()

void ImGui::PushFont ( ImFont font)
6533{
6534 ImGuiContext& g = *GImGui;
6535 if (!font)
6536 font = GetDefaultFont();
6537 SetCurrentFont(font);
6538 g.FontStack.push_back(font);
6540}

References ImFont::ContainerAtlas, ImGuiContext::CurrentWindow, ImGuiWindow::DrawList, ImGuiContext::FontStack, GetDefaultFont(), GImGui, ImVector< T >::push_back(), ImDrawList::PushTextureID(), SetCurrentFont(), and ImFontAtlas::TexID.

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_text_input(), InputTextEx(), and ShowFont().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushID() [1/4]

◆ PushID() [2/4]

void ImGui::PushID ( const char *  str_id_begin,
const char *  str_id_end 
)
7027{
7028 ImGuiContext& g = *GImGui;
7029 ImGuiWindow* window = g.CurrentWindow;
7030 ImGuiID id = window->GetIDNoKeepAlive(str_id_begin, str_id_end);
7031 window->IDStack.push_back(id);
7032}

References ImGuiContext::CurrentWindow, ImGuiWindow::GetIDNoKeepAlive(), GImGui, ImGuiWindow::IDStack, and ImVector< T >::push_back().

+ Here is the call graph for this function:

◆ PushID() [3/4]

void ImGui::PushID ( const void ptr_id)
7035{
7036 ImGuiContext& g = *GImGui;
7037 ImGuiWindow* window = g.CurrentWindow;
7038 ImGuiID id = window->GetIDNoKeepAlive(ptr_id);
7039 window->IDStack.push_back(id);
7040}

References ImGuiContext::CurrentWindow, ImGuiWindow::GetIDNoKeepAlive(), GImGui, ImGuiWindow::IDStack, and ImVector< T >::push_back().

+ Here is the call graph for this function:

◆ PushID() [4/4]

void ImGui::PushID ( int  int_id)
7043{
7044 ImGuiContext& g = *GImGui;
7045 ImGuiWindow* window = g.CurrentWindow;
7046 ImGuiID id = window->GetIDNoKeepAlive(int_id);
7047 window->IDStack.push_back(id);
7048}

References ImGuiContext::CurrentWindow, ImGuiWindow::GetIDNoKeepAlive(), GImGui, ImGuiWindow::IDStack, and ImVector< T >::push_back().

+ Here is the call graph for this function:

◆ PushItemFlag()

void ImGui::PushItemFlag ( ImGuiItemFlags  option,
bool  enabled 
)
6551{
6552 ImGuiContext& g = *GImGui;
6553 ImGuiItemFlags item_flags = g.CurrentItemFlags;
6554 IM_ASSERT(item_flags == g.ItemFlagsStack.back());
6555 if (enabled)
6556 item_flags |= option;
6557 else
6558 item_flags &= ~option;
6559 g.CurrentItemFlags = item_flags;
6560 g.ItemFlagsStack.push_back(item_flags);
6561}
Definition getopt.h:102

References ImVector< T >::back(), ImGuiContext::CurrentItemFlags, GImGui, IM_ASSERT, ImGuiContext::ItemFlagsStack, and ImVector< T >::push_back().

Referenced by ColorPicker4(), Slic3r::GUI::ImGuiWrapper::disabled_begin(), PushAllowKeyboardFocus(), PushButtonRepeat(), TabItemEx(), and TableDrawContextMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushItemWidth()

void ImGui::PushItemWidth ( float  item_width)
7564{
7565 ImGuiContext& g = *GImGui;
7566 ImGuiWindow* window = g.CurrentWindow;
7567 window->DC.ItemWidthStack.push_back(window->DC.ItemWidth); // Backup current width
7568 window->DC.ItemWidth = (item_width == 0.0f ? window->ItemWidthDefault : item_width);
7569 g.NextItemData.Flags &= ~ImGuiNextItemDataFlags_HasWidth;
7570}

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiNextItemData::Flags, GImGui, ImGuiWindowTempData::ItemWidth, ImGuiWindow::ItemWidthDefault, ImGuiWindowTempData::ItemWidthStack, ImGuiContext::NextItemData, and ImVector< T >::push_back().

Referenced by Slic3r::GUI::GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(), BeginColumns(), ColorPicker4(), ColorPickerOptionsPopup(), Slic3r::GUI::ImGuiWrapper::combo(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_window(), NextColumn(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GLGizmoHollow::on_render_input_window(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), Slic3r::GUI::GLGizmoSeam::on_render_input_window(), Slic3r::GUI::GLGizmoSlaSupports::on_render_input_window(), Slic3r::GUI::GLGizmoCut3D::render_connect_mode_radio_button(), Slic3r::GUI::GLGizmoCut3D::render_connect_type_radio_button(), Slic3r::GUI::GLGizmoCut3D::render_debug_input_window(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::GLGizmoCut3D::render_double_input(), Slic3r::GUI::GLGizmoCut3D::render_move_center_input(), Slic3r::GUI::GLCanvas3D::LayersEditing::render_overlay(), Slic3r::GUI::GLGizmoCut3D::render_slider_double_input(), ShowDemoWindow(), ShowDemoWindowLayout(), ShowDemoWindowTables(), ShowExampleAppCustomRendering(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushMultiItemsWidths()

void ImGui::PushMultiItemsWidths ( int  components,
float  width_full 
)
7573{
7574 ImGuiContext& g = *GImGui;
7575 ImGuiWindow* window = g.CurrentWindow;
7576 const ImGuiStyle& style = g.Style;
7577 const float w_item_one = ImMax(1.0f, IM_FLOOR((w_full - (style.ItemInnerSpacing.x) * (components - 1)) / (float)components));
7578 const float w_item_last = ImMax(1.0f, IM_FLOOR(w_full - (w_item_one + style.ItemInnerSpacing.x) * (components - 1)));
7579 window->DC.ItemWidthStack.push_back(window->DC.ItemWidth); // Backup current width
7580 window->DC.ItemWidthStack.push_back(w_item_last);
7581 for (int i = 0; i < components - 2; i++)
7582 window->DC.ItemWidthStack.push_back(w_item_one);
7583 window->DC.ItemWidth = (components == 1) ? w_item_last : w_item_one;
7584 g.NextItemData.Flags &= ~ImGuiNextItemDataFlags_HasWidth;
7585}

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiNextItemData::Flags, GImGui, IM_FLOOR, ImMax(), ImGuiWindowTempData::ItemWidth, ImGuiWindowTempData::ItemWidthStack, ImGuiContext::NextItemData, ImVector< T >::push_back(), ImGuiContext::Style, and style.

Referenced by DragFloatRange2(), DragIntRange2(), DragScalarN(), InputScalarN(), and SliderScalarN().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushOverrideID()

void ImGui::PushOverrideID ( ImGuiID  id)
7052{
7053 ImGuiContext& g = *GImGui;
7054 ImGuiWindow* window = g.CurrentWindow;
7055 window->IDStack.push_back(id);
7056}

References ImGuiContext::CurrentWindow, GImGui, ImGuiWindow::IDStack, and ImVector< T >::push_back().

Referenced by BeginTabBarEx(), BeginTabItem(), and BeginTableEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushStyleColor() [1/2]

void ImGui::PushStyleColor ( ImGuiCol  idx,
const ImVec4 col 
)
2473{
2474 ImGuiContext& g = *GImGui;
2475 ImGuiColorMod backup;
2476 backup.Col = idx;
2477 backup.BackupValue = g.Style.Colors[idx];
2478 g.ColorStack.push_back(backup);
2479 g.Style.Colors[idx] = col;
2480}

References ImGuiColorMod::BackupValue, col(), ImGuiColorMod::Col, ImGuiStyle::Colors, ImGuiContext::ColorStack, GImGui, ImVector< T >::push_back(), and ImGuiContext::Style.

+ Here is the call graph for this function:

◆ PushStyleColor() [2/2]

void ImGui::PushStyleColor ( ImGuiCol  idx,
ImU32  col 
)
2463{
2464 ImGuiContext& g = *GImGui;
2465 ImGuiColorMod backup;
2466 backup.Col = idx;
2467 backup.BackupValue = g.Style.Colors[idx];
2468 g.ColorStack.push_back(backup);
2470}
IMGUI_API ImVec4 ColorConvertU32ToFloat4(ImU32 in)
Definition imgui.cpp:1799

References ImGuiColorMod::BackupValue, col(), ImGuiColorMod::Col, ColorConvertU32ToFloat4(), ImGuiStyle::Colors, ImGuiContext::ColorStack, GImGui, ImVector< T >::push_back(), and ImGuiContext::Style.

Referenced by BeginChildFrame(), DebugNodeTabBar(), DebugNodeTable(), DebugNodeWindow(), MyDocument::DisplayContents(), ExampleAppConsole::Draw(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), igl::opengl::glfw::imgui::ImGuiMenu::draw_labels_window(), Slic3r::GUI::ImGuiWrapper::image_button(), InputTextEx(), MenuItem(), Slic3r::GUI::anonymous_namespace{HintNotification.cpp}::push_style_color(), Slic3r::GUI::anonymous_namespace{NotificationManager.cpp}::push_style_color(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressBarWithCancelNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::PopNotification::render_close_button(), Slic3r::GUI::NotificationManager::HintNotification::render_close_button(), Slic3r::GUI::NotificationManager::ProgressBarWithCancelNotification::render_close_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_close_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_documentation_button(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_eject_button(), Slic3r::GUI::GLGizmoCut3D::render_flip_plane_button(), Slic3r::GUI::NotificationManager::PopNotification::render_hypertext(), Slic3r::GUI::GCodeViewer::render_legend(), Slic3r::GUI::NotificationManager::PopNotification::render_minimize_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_open_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_pause_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_preferences_button(), Slic3r::GUI::GLGizmoCut3D::render_reset_button(), Slic3r::GUI::NotificationManager::HintNotification::render_right_arrow_button(), Slic3r::GUI::GLCanvas3D::SLAView::render_switch_button(), Slic3r::GUI::selectable(), Selectable(), ShowDemoWindowLayout(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), Slic3r::GUI::ImGuiWrapper::slider_float(), TabBarScrollingButtons(), TabBarTabListPopupButton(), TableHeader(), TextColoredV(), and TextDisabledV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushStyleVar() [1/2]

void ImGui::PushStyleVar ( ImGuiStyleVar  idx,
const ImVec2 val 
)
2552{
2553 const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx);
2554 if (var_info->Type == ImGuiDataType_Float && var_info->Count == 2)
2555 {
2556 ImGuiContext& g = *GImGui;
2557 ImVec2* pvar = (ImVec2*)var_info->GetVarPtr(&g.Style);
2558 g.StyleVarStack.push_back(ImGuiStyleMod(idx, *pvar));
2559 *pvar = val;
2560 return;
2561 }
2562 IM_ASSERT(0 && "Called PushStyleVar() ImVec2 variant but variable is not a ImVec2!");
2563}

References ImGuiStyleVarInfo::Count, GetStyleVarInfo(), ImGuiStyleVarInfo::GetVarPtr(), GImGui, IM_ASSERT, ImGuiDataType_Float, ImVector< T >::push_back(), ImGuiContext::Style, ImGuiContext::StyleVarStack, and ImGuiStyleVarInfo::Type.

+ Here is the call graph for this function:

◆ PushStyleVar() [2/2]

void ImGui::PushStyleVar ( ImGuiStyleVar  idx,
float  val 
)
2538{
2539 const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx);
2540 if (var_info->Type == ImGuiDataType_Float && var_info->Count == 1)
2541 {
2542 ImGuiContext& g = *GImGui;
2543 float* pvar = (float*)var_info->GetVarPtr(&g.Style);
2544 g.StyleVarStack.push_back(ImGuiStyleMod(idx, *pvar));
2545 *pvar = val;
2546 return;
2547 }
2548 IM_ASSERT(0 && "Called PushStyleVar() float variant but variable is not a float!");
2549}

References ImGuiStyleVarInfo::Count, GetStyleVarInfo(), ImGuiStyleVarInfo::GetVarPtr(), GImGui, IM_ASSERT, ImGuiDataType_Float, ImVector< T >::push_back(), ImGuiContext::Style, ImGuiContext::StyleVarStack, and ImGuiStyleVarInfo::Type.

Referenced by BeginChildFrame(), BeginCombo(), BeginMenu(), BeginViewportSideBar(), Slic3r::GUI::ImGuiWrapper::disabled_begin(), ExampleAppConsole::Draw(), ExampleAppLog::Draw(), igl::opengl::glfw::imgui::ImGuiMenu::draw_labels_window(), Slic3r::GUI::GLGizmoEmboss::draw_window(), InputTextEx(), MenuItem(), NavUpdateWindowingOverlay(), Slic3r::GUI::GLGizmoEmboss::on_render_input_window(), PushStyleCompact(), Slic3r::GUI::GCodeViewer::SequentialView::Marker::render(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GLCanvas3D::Tooltip::render(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::GCodeViewer::render_legend(), Slic3r::GUI::GLGizmoCut3D::render_reset_button(), ShowDemoWindowLayout(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppLongText(), ShowExampleAppPropertyEditor(), Slic3r::GUI::ImGuiWrapper::slider_float(), TabItemLabelAndCloseButton(), and Slic3r::GUI::ImGuiWrapper::tooltip().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushTextWrapPos()

void ImGui::PushTextWrapPos ( float  wrap_local_pos_x = 0.0f)
6593{
6594 ImGuiWindow* window = GetCurrentWindow();
6595 window->DC.TextWrapPosStack.push_back(window->DC.TextWrapPos);
6596 window->DC.TextWrapPos = wrap_pos_x;
6597}

References ImGuiWindow::DC, GetCurrentWindow(), ImVector< T >::push_back(), ImGuiWindowTempData::TextWrapPos, and ImGuiWindowTempData::TextWrapPosStack.

Referenced by EditTableSizingFlags(), HelpMarker(), MetricsHelpMarker(), ShowDemoWindowWidgets(), Slic3r::GUI::ImGuiWrapper::text_wrapped(), TextWrappedV(), and Slic3r::GUI::ImGuiWrapper::tooltip().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RadioButton() [1/2]

bool ImGui::RadioButton ( const char *  label,
bool  active 
)
1178{
1179 ImGuiWindow* window = GetCurrentWindow();
1180 if (window->SkipItems)
1181 return false;
1182
1183 ImGuiContext& g = *GImGui;
1184 const ImGuiStyle& style = g.Style;
1185 const ImGuiID id = window->GetID(label);
1186 const ImVec2 label_size = CalcTextSize(label, NULL, true);
1187
1188 const float square_sz = GetFrameHeight();
1189 const ImVec2 pos = window->DC.CursorPos;
1190 const ImRect check_bb(pos, pos + ImVec2(square_sz, square_sz));
1191 const ImRect total_bb(pos, pos + ImVec2(square_sz + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), label_size.y + style.FramePadding.y * 2.0f));
1192 ItemSize(total_bb, style.FramePadding.y);
1193 if (!ItemAdd(total_bb, id))
1194 return false;
1195
1196 ImVec2 center = check_bb.GetCenter();
1197 center.x = IM_ROUND(center.x);
1198 center.y = IM_ROUND(center.y);
1199 const float radius = (square_sz - 1.0f) * 0.5f;
1200
1201 bool hovered, held;
1202 bool pressed = ButtonBehavior(total_bb, id, &hovered, &held);
1203 if (pressed)
1204 MarkItemEdited(id);
1205
1206 RenderNavHighlight(total_bb, id);
1207 window->DrawList->AddCircleFilled(center, radius, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), 16);
1208 if (active)
1209 {
1210 const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f));
1211 window->DrawList->AddCircleFilled(center, radius - pad, GetColorU32(ImGuiCol_CheckMark), 16);
1212 }
1213
1214 if (style.FrameBorderSize > 0.0f)
1215 {
1216 window->DrawList->AddCircle(center + ImVec2(1, 1), radius, GetColorU32(ImGuiCol_BorderShadow), 16, style.FrameBorderSize);
1217 window->DrawList->AddCircle(center, radius, GetColorU32(ImGuiCol_Border), 16, style.FrameBorderSize);
1218 }
1219
1220 ImVec2 label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y);
1221 if (g.LogEnabled)
1222 LogRenderedText(&label_pos, active ? "(x)" : "( )");
1223 if (label_size.x > 0.0f)
1224 RenderText(label_pos, label);
1225
1227 return pressed;
1228}

References ImDrawList::AddCircle(), ImDrawList::AddCircleFilled(), ButtonBehavior(), CalcTextSize(), ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, ImRect::GetCenter(), GetColorU32(), GetCurrentWindow(), GetFrameHeight(), ImGuiWindow::GetID(), GImGui, IM_FLOOR, IM_ROUND, IMGUI_TEST_ENGINE_ITEM_INFO, ImGuiCol_Border, ImGuiCol_BorderShadow, ImGuiCol_CheckMark, ImGuiCol_FrameBg, ImGuiCol_FrameBgActive, ImGuiCol_FrameBgHovered, ImMax(), ItemAdd(), ItemSize(), ImGuiWindowTempData::LastItemStatusFlags, ImGuiContext::LogEnabled, LogRenderedText(), MarkItemEdited(), ImRect::Max, ImRect::Min, RenderNavHighlight(), RenderText(), ImGuiWindow::SkipItems, ImGuiContext::Style, style, ImVec2::x, and ImVec2::y.

Referenced by ColorEditOptionsPopup(), Slic3r::GUI::GLGizmoEmboss::draw_model_type(), Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), Slic3r::GUI::ImGuiWrapper::radio_button(), RadioButton(), Slic3r::GUI::GLGizmoCut3D::render_connect_mode_radio_button(), Slic3r::GUI::GLGizmoCut3D::render_connect_type_radio_button(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RadioButton() [2/2]

bool ImGui::RadioButton ( const char *  label,
int *  v,
int  v_button 
)
1232{
1233 const bool pressed = RadioButton(label, *v == v_button);
1234 if (pressed)
1235 *v = v_button;
1236 return pressed;
1237}

References RadioButton().

+ Here is the call graph for this function:

◆ RemoveContextHook()

void ImGui::RemoveContextHook ( ImGuiContext context,
ImGuiID  hook_to_remove 
)
3421{
3422 ImGuiContext& g = *ctx;
3423 IM_ASSERT(hook_id != 0);
3424 for (int n = 0; n < g.Hooks.Size; n++)
3425 if (g.Hooks[n].HookId == hook_id)
3427}

References ImGuiContext::Hooks, IM_ASSERT, ImGuiContextHookType_PendingRemoval_, and ImVector< T >::Size.

◆ Render()

void ImGui::Render ( )
4463{
4464 ImGuiContext& g = *GImGui;
4466
4467 if (g.FrameCountEnded != g.FrameCount)
4468 EndFrame();
4471
4473
4474 // Add background ImDrawList (for each active viewport)
4475 for (int n = 0; n != g.Viewports.Size; n++)
4476 {
4477 ImGuiViewportP* viewport = g.Viewports[n];
4478 viewport->DrawDataBuilder.Clear();
4479 if (viewport->DrawLists[0] != NULL)
4481 }
4482
4483 // Add ImDrawList to render
4484 ImGuiWindow* windows_to_render_top_most[2];
4486 windows_to_render_top_most[1] = (g.NavWindowingTarget ? g.NavWindowingListWindow : NULL);
4487 for (int n = 0; n != g.Windows.Size; n++)
4488 {
4489 ImGuiWindow* window = g.Windows[n];
4490 IM_MSVC_WARNING_SUPPRESS(6011); // Static Analysis false positive "warning C6011: Dereferencing NULL pointer 'window'"
4491 if (IsWindowActiveAndVisible(window) && (window->Flags & ImGuiWindowFlags_ChildWindow) == 0 && window != windows_to_render_top_most[0] && window != windows_to_render_top_most[1])
4493 }
4494 for (int n = 0; n < IM_ARRAYSIZE(windows_to_render_top_most); n++)
4495 if (windows_to_render_top_most[n] && IsWindowActiveAndVisible(windows_to_render_top_most[n])) // NavWindowingTarget is always temporarily displayed as the top-most window
4496 AddRootWindowToDrawData(windows_to_render_top_most[n]);
4497
4498 // Setup ImDrawData structures for end-user
4500 for (int n = 0; n < g.Viewports.Size; n++)
4501 {
4502 ImGuiViewportP* viewport = g.Viewports[n];
4504
4505 // Draw software mouse cursor if requested by io.MouseDrawCursor flag
4506 if (g.IO.MouseDrawCursor)
4508
4509 // Add foreground ImDrawList (for each active viewport)
4510 if (viewport->DrawLists[1] != NULL)
4512
4513 SetupViewportDrawData(viewport, &viewport->DrawDataBuilder.Layers[0]);
4514 ImDrawData* draw_data = &viewport->DrawDataP;
4515 g.IO.MetricsRenderVertices += draw_data->TotalVtxCount;
4516 g.IO.MetricsRenderIndices += draw_data->TotalIdxCount;
4517 }
4518
4520}
static bool IsWindowActiveAndVisible(ImGuiWindow *window)
Definition imgui.cpp:3630
static void AddDrawListToDrawData(ImVector< ImDrawList * > *out_list, ImDrawList *draw_list)
Definition imgui.cpp:4266
static void SetupViewportDrawData(ImGuiViewportP *viewport, ImVector< ImDrawList * > *draw_lists)
Definition imgui.cpp:4341
static void AddRootWindowToDrawData(ImGuiWindow *window)
Definition imgui.cpp:4317
#define IM_COL32_WHITE
Definition imgui.h:2178
#define IM_COL32_BLACK
Definition imgui.h:2179
@ ImGuiContextHookType_RenderPost
Definition imgui_internal.h:1333
@ ImGuiContextHookType_RenderPre
Definition imgui_internal.h:1333
IMGUI_API void EndFrame()
Definition imgui.cpp:4380
IMGUI_API void RenderMouseCursor(ImDrawList *draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow)
Definition imgui_draw.cpp:3789
IMGUI_API void FlattenIntoSingleLayer()
Definition imgui.cpp:4323
void Clear()
Definition imgui_internal.h:708
Definition imgui.h:2473
int TotalIdxCount
Definition imgui.h:2476
int TotalVtxCount
Definition imgui.h:2477
int FrameCountRendered
Definition imgui_internal.h:1363
int MetricsRenderIndices
Definition imgui.h:1869
int MetricsRenderVertices
Definition imgui.h:1868
bool MouseDrawCursor
Definition imgui.h:1802
int MetricsRenderWindows
Definition imgui.h:1870
ImDrawList * DrawLists[2]
Definition imgui_internal.h:1230

References AddDrawListToDrawData(), AddRootWindowToDrawData(), CallContextHooks(), ImDrawDataBuilder::Clear(), ImGuiViewportP::DrawDataBuilder, ImGuiViewportP::DrawDataP, ImGuiViewportP::DrawLists, EndFrame(), ImGuiWindow::Flags, ImDrawDataBuilder::FlattenIntoSingleLayer(), ImGuiContext::FrameCount, ImGuiContext::FrameCountEnded, ImGuiContext::FrameCountRendered, GetBackgroundDrawList(), GetForegroundDrawList(), GImGui, IM_ARRAYSIZE, IM_ASSERT, IM_COL32, IM_COL32_BLACK, IM_COL32_WHITE, IM_MSVC_WARNING_SUPPRESS, ImGuiContextHookType_RenderPost, ImGuiContextHookType_RenderPre, ImGuiWindowFlags_ChildWindow, ImGuiWindowFlags_NoBringToFrontOnFocus, ImGuiContext::Initialized, ImGuiContext::IO, IsWindowActiveAndVisible(), ImDrawDataBuilder::Layers, ImGuiIO::MetricsRenderIndices, ImGuiIO::MetricsRenderVertices, ImGuiIO::MetricsRenderWindows, ImGuiContext::MouseCursor, ImGuiStyle::MouseCursorScale, ImGuiIO::MouseDrawCursor, ImGuiIO::MousePos, ImGuiContext::NavWindowingListWindow, ImGuiContext::NavWindowingTarget, RenderMouseCursor(), ImGuiWindow::RootWindow, SetupViewportDrawData(), ImVector< T >::Size, ImGuiContext::Style, ImDrawData::TotalIdxCount, ImDrawData::TotalVtxCount, ImGuiContext::Viewports, and ImGuiContext::Windows.

Referenced by igl::opengl::glfw::imgui::ImGuiMenu::post_draw(), and Slic3r::GUI::ImGuiWrapper::render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderArrow() [1/2]

void ImGui::RenderArrow ( ImDrawList draw_list,
ImVec2  pos,
ImU32  col,
ImGuiDir  dir,
float  scale = 1.0f 
)
3739{
3740 const float h = draw_list->_Data->FontSize * 1.00f;
3741 float r = h * 0.40f * scale;
3742 ImVec2 center = pos + ImVec2(h * 0.50f, h * 0.50f * scale);
3743
3744 ImVec2 a, b, c;
3745 switch (dir)
3746 {
3747 case ImGuiDir_Up:
3748 case ImGuiDir_Down:
3749 if (dir == ImGuiDir_Up) r = -r;
3750 a = ImVec2(+0.000f, +0.750f) * r;
3751 b = ImVec2(-0.866f, -0.750f) * r;
3752 c = ImVec2(+0.866f, -0.750f) * r;
3753 break;
3754 case ImGuiDir_Left:
3755 case ImGuiDir_Right:
3756 if (dir == ImGuiDir_Left) r = -r;
3757 a = ImVec2(+0.750f, +0.000f) * r;
3758 b = ImVec2(-0.750f, +0.866f) * r;
3759 c = ImVec2(-0.750f, -0.866f) * r;
3760 break;
3761 case ImGuiDir_None:
3762 case ImGuiDir_COUNT:
3763 IM_ASSERT(0);
3764 break;
3765 }
3766 draw_list->AddTriangleFilled(center + a, center + b, center + c, col);
3767}
const ImDrawListSharedData * _Data
Definition imgui.h:2357
IMGUI_API void AddTriangleFilled(const ImVec2 &p1, const ImVec2 &p2, const ImVec2 &p3, ImU32 col)
Definition imgui_draw.cpp:1455
float FontSize
Definition imgui_internal.h:688

References ImDrawList::_Data, ImDrawList::AddTriangleFilled(), col(), ImDrawListSharedData::FontSize, IM_ASSERT, ImGuiDir_COUNT, ImGuiDir_Down, ImGuiDir_Left, ImGuiDir_None, ImGuiDir_Right, ImGuiDir_Up, and scale().

Referenced by ArrowButtonEx(), BeginCombo(), BeginMenu(), CollapseButton(), RenderArrow(), TableHeader(), and TreeNodeBehavior().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderArrow() [2/2]

void ImGui::RenderArrow ( ImVec2  pos,
ImGuiDir  dir,
float  scale = 1.0f 
)
inline
2539{ ImGuiWindow* window = GetCurrentWindow(); RenderArrow(window->DrawList, pos, GetColorU32(ImGuiCol_Text), dir, scale); }

References ImGuiWindow::DrawList, GetColorU32(), GetCurrentWindow(), ImGuiCol_Text, RenderArrow(), and scale().

+ Here is the call graph for this function:

◆ RenderArrowPointingAt()

void ImGui::RenderArrowPointingAt ( ImDrawList draw_list,
ImVec2  pos,
ImVec2  half_sz,
ImGuiDir  direction,
ImU32  col 
)
3812{
3813 switch (direction)
3814 {
3815 case ImGuiDir_Left: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), pos, col); return;
3816 case ImGuiDir_Right: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), pos, col); return;
3817 case ImGuiDir_Up: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), pos, col); return;
3818 case ImGuiDir_Down: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), pos, col); return;
3819 case ImGuiDir_None: case ImGuiDir_COUNT: break; // Fix warnings
3820 }
3821}

References ImDrawList::AddTriangleFilled(), col(), ImGuiDir_COUNT, ImGuiDir_Down, ImGuiDir_Left, ImGuiDir_None, ImGuiDir_Right, ImGuiDir_Up, ImVec2::x, and ImVec2::y.

Referenced by RenderArrowsForVerticalBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderBullet() [1/2]

void ImGui::RenderBullet ( ImDrawList draw_list,
ImVec2  pos,
ImU32  col 
)
3770{
3771 draw_list->AddCircleFilled(pos, draw_list->_Data->FontSize * 0.20f, col, 8);
3772}

References ImDrawList::_Data, ImDrawList::AddCircleFilled(), col(), and ImDrawListSharedData::FontSize.

Referenced by Bullet(), BulletTextV(), RenderBullet(), and TreeNodeBehavior().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderBullet() [2/2]

void ImGui::RenderBullet ( ImVec2  pos)
inline

References ImGuiWindow::DrawList, GetColorU32(), GetCurrentWindow(), ImGuiCol_Text, and RenderBullet().

+ Here is the call graph for this function:

◆ RenderCheckMark()

void ImGui::RenderCheckMark ( ImDrawList draw_list,
ImVec2  pos,
ImU32  col,
float  sz 
)
3775{
3776 float thickness = ImMax(sz / 5.0f, 1.0f);
3777 sz -= thickness * 0.5f;
3778 pos += ImVec2(thickness * 0.25f, thickness * 0.25f);
3779
3780 float third = sz / 3.0f;
3781 float bx = pos.x + third;
3782 float by = pos.y + sz - third * 0.5f;
3783 draw_list->PathLineTo(ImVec2(bx - third, by - third));
3784 draw_list->PathLineTo(ImVec2(bx, by));
3785 draw_list->PathLineTo(ImVec2(bx + third * 2.0f, by - third * 2.0f));
3786 draw_list->PathStroke(col, 0, thickness);
3787}
void PathLineTo(const ImVec2 &pos)
Definition imgui.h:2415

References col(), ImMax(), ImDrawList::PathLineTo(), and ImDrawList::PathStroke().

Referenced by Checkbox(), and MenuItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderColorRectWithAlphaCheckerboard()

void ImGui::RenderColorRectWithAlphaCheckerboard ( ImDrawList draw_list,
ImVec2  p_min,
ImVec2  p_max,
ImU32  fill_col,
float  grid_step,
ImVec2  grid_off,
float  rounding = 0.0f,
ImDrawFlags  flags = 0 
)
3913{
3914 if ((flags & ImDrawFlags_RoundCornersMask_) == 0)
3916 if (((col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT) < 0xFF)
3917 {
3918 ImU32 col_bg1 = GetColorU32(ImAlphaBlendColors(IM_COL32(204, 204, 204, 255), col));
3919 ImU32 col_bg2 = GetColorU32(ImAlphaBlendColors(IM_COL32(128, 128, 128, 255), col));
3920 draw_list->AddRectFilled(p_min, p_max, col_bg1, rounding, flags);
3921
3922 int yi = 0;
3923 for (float y = p_min.y + grid_off.y; y < p_max.y; y += grid_step, yi++)
3924 {
3925 float y1 = ImClamp(y, p_min.y, p_max.y), y2 = ImMin(y + grid_step, p_max.y);
3926 if (y2 <= y1)
3927 continue;
3928 for (float x = p_min.x + grid_off.x + (yi & 1) * grid_step; x < p_max.x; x += grid_step * 2.0f)
3929 {
3930 float x1 = ImClamp(x, p_min.x, p_max.x), x2 = ImMin(x + grid_step, p_max.x);
3931 if (x2 <= x1)
3932 continue;
3934 if (y1 <= p_min.y) { if (x1 <= p_min.x) cell_flags |= ImDrawFlags_RoundCornersTopLeft; if (x2 >= p_max.x) cell_flags |= ImDrawFlags_RoundCornersTopRight; }
3935 if (y2 >= p_max.y) { if (x1 <= p_min.x) cell_flags |= ImDrawFlags_RoundCornersBottomLeft; if (x2 >= p_max.x) cell_flags |= ImDrawFlags_RoundCornersBottomRight; }
3936
3937 // Combine flags
3938 cell_flags = (flags == ImDrawFlags_RoundCornersNone || cell_flags == ImDrawFlags_RoundCornersNone) ? ImDrawFlags_RoundCornersNone : (cell_flags & flags);
3939 draw_list->AddRectFilled(ImVec2(x1, y1), ImVec2(x2, y2), col_bg2, rounding, cell_flags);
3940 }
3941 }
3942 }
3943 else
3944 {
3945 draw_list->AddRectFilled(p_min, p_max, col, rounding, flags);
3946 }
3947}
IMGUI_API ImU32 ImAlphaBlendColors(ImU32 col_a, ImU32 col_b)
Definition imgui.cpp:1790
int ImDrawFlags
Definition imgui.h:178
@ ImDrawFlags_RoundCornersTopLeft
Definition imgui.h:2313
@ ImDrawFlags_RoundCornersBottomLeft
Definition imgui.h:2315
@ ImDrawFlags_RoundCornersTopRight
Definition imgui.h:2314
@ ImDrawFlags_RoundCornersNone
Definition imgui.h:2317
@ ImDrawFlags_RoundCornersBottomRight
Definition imgui.h:2316
@ ImDrawFlags_RoundCornersMask_
Definition imgui.h:2324
@ ImDrawFlags_RoundCornersDefault_
Definition imgui.h:2323

References ImDrawList::AddRectFilled(), col(), GetColorU32(), IM_COL32, IM_COL32_A_MASK, IM_COL32_A_SHIFT, ImAlphaBlendColors(), ImClamp(), ImDrawFlags_RoundCornersBottomLeft, ImDrawFlags_RoundCornersBottomRight, ImDrawFlags_RoundCornersDefault_, ImDrawFlags_RoundCornersMask_, ImDrawFlags_RoundCornersNone, ImDrawFlags_RoundCornersTopLeft, ImDrawFlags_RoundCornersTopRight, ImMin(), ImVec2::x, and ImVec2::y.

Referenced by ColorButton(), and ColorPicker4().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderFrame()

void ImGui::RenderFrame ( ImVec2  p_min,
ImVec2  p_max,
ImU32  fill_col,
bool  border = true,
float  rounding = 0.0f 
)
2835{
2836 ImGuiContext& g = *GImGui;
2837 ImGuiWindow* window = g.CurrentWindow;
2838 window->DrawList->AddRectFilled(p_min, p_max, fill_col, rounding);
2839 const float border_size = g.Style.FrameBorderSize;
2840 if (border && border_size > 0.0f)
2841 {
2842 window->DrawList->AddRect(p_min + ImVec2(1, 1), p_max + ImVec2(1, 1), GetColorU32(ImGuiCol_BorderShadow), rounding, 0, border_size);
2843 window->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding, 0, border_size);
2844 }
2845}

References ImDrawList::AddRect(), ImDrawList::AddRectFilled(), ImGuiContext::CurrentWindow, ImGuiWindow::DrawList, ImGuiStyle::FrameBorderSize, GetColorU32(), GImGui, ImGuiCol_Border, ImGuiCol_BorderShadow, and ImGuiContext::Style.

Referenced by ArrowButtonEx(), ButtonEx(), Checkbox(), DragScalar(), Slic3r::GUI::image_button_ex(), ImageButtonEx(), InputTextEx(), PlotEx(), ProgressBar(), RenderWindowDecorations(), Slic3r::GUI::selectable(), Selectable(), SliderScalar(), TreeNodeBehavior(), and VSliderScalar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderFrameBorder()

void ImGui::RenderFrameBorder ( ImVec2  p_min,
ImVec2  p_max,
float  rounding = 0.0f 
)
2848{
2849 ImGuiContext& g = *GImGui;
2850 ImGuiWindow* window = g.CurrentWindow;
2851 const float border_size = g.Style.FrameBorderSize;
2852 if (border_size > 0.0f)
2853 {
2854 window->DrawList->AddRect(p_min + ImVec2(1, 1), p_max + ImVec2(1, 1), GetColorU32(ImGuiCol_BorderShadow), rounding, 0, border_size);
2855 window->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding, 0, border_size);
2856 }
2857}

References ImDrawList::AddRect(), ImGuiContext::CurrentWindow, ImGuiWindow::DrawList, ImGuiStyle::FrameBorderSize, GetColorU32(), GImGui, ImGuiCol_Border, ImGuiCol_BorderShadow, and ImGuiContext::Style.

Referenced by BeginCombo(), ColorButton(), and ColorPicker4().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderMouseCursor()

void ImGui::RenderMouseCursor ( ImDrawList draw_list,
ImVec2  pos,
float  scale,
ImGuiMouseCursor  mouse_cursor,
ImU32  col_fill,
ImU32  col_border,
ImU32  col_shadow 
)
3790{
3791 if (mouse_cursor == ImGuiMouseCursor_None)
3792 return;
3793 IM_ASSERT(mouse_cursor > ImGuiMouseCursor_None && mouse_cursor < ImGuiMouseCursor_COUNT);
3794
3795 ImFontAtlas* font_atlas = draw_list->_Data->Font->ContainerAtlas;
3796 ImVec2 offset, size, uv[4];
3797 if (font_atlas->GetMouseCursorTexData(mouse_cursor, &offset, &size, &uv[0], &uv[2]))
3798 {
3799 pos -= offset;
3800 ImTextureID tex_id = font_atlas->TexID;
3801 draw_list->PushTextureID(tex_id);
3802 draw_list->AddImage(tex_id, pos + ImVec2(1, 0) * scale, pos + (ImVec2(1, 0) + size) * scale, uv[2], uv[3], col_shadow);
3803 draw_list->AddImage(tex_id, pos + ImVec2(2, 0) * scale, pos + (ImVec2(2, 0) + size) * scale, uv[2], uv[3], col_shadow);
3804 draw_list->AddImage(tex_id, pos, pos + size * scale, uv[2], uv[3], col_border);
3805 draw_list->AddImage(tex_id, pos, pos + size * scale, uv[0], uv[1], col_fill);
3806 draw_list->PopTextureID();
3807 }
3808}
@ ImGuiMouseCursor_None
Definition imgui.h:1596
@ ImGuiMouseCursor_COUNT
Definition imgui.h:1606
void * ImTextureID
Definition imgui.h:205
ImFont * Font
Definition imgui_internal.h:687
Definition imgui.h:2589
IMGUI_API bool GetMouseCursorTexData(ImGuiMouseCursor cursor, ImVec2 *out_offset, ImVec2 *out_size, ImVec2 out_uv_border[2], ImVec2 out_uv_fill[2])
Definition imgui_draw.cpp:2227

References ImDrawList::_Data, ImDrawList::AddImage(), ImFont::ContainerAtlas, ImDrawListSharedData::Font, ImFontAtlas::GetMouseCursorTexData(), IM_ASSERT, ImGuiMouseCursor_COUNT, ImGuiMouseCursor_None, ImDrawList::PopTextureID(), ImDrawList::PushTextureID(), scale(), and ImFontAtlas::TexID.

Referenced by Render().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderNavHighlight()

void ImGui::RenderNavHighlight ( const ImRect bb,
ImGuiID  id,
ImGuiNavHighlightFlags  flags = ImGuiNavHighlightFlags_TypeDefault 
)
2860{
2861 ImGuiContext& g = *GImGui;
2862 if (id != g.NavId)
2863 return;
2865 return;
2866 ImGuiWindow* window = g.CurrentWindow;
2867 if (window->DC.NavHideHighlightOneFrame)
2868 return;
2869
2870 float rounding = (flags & ImGuiNavHighlightFlags_NoRounding) ? 0.0f : g.Style.FrameRounding;
2871 ImRect display_rect = bb;
2872 display_rect.ClipWith(window->ClipRect);
2874 {
2875 const float THICKNESS = 2.0f;
2876 const float DISTANCE = 3.0f + THICKNESS * 0.5f;
2877 display_rect.Expand(ImVec2(DISTANCE, DISTANCE));
2878 bool fully_visible = window->ClipRect.Contains(display_rect);
2879 if (!fully_visible)
2880 window->DrawList->PushClipRect(display_rect.Min, display_rect.Max);
2881 window->DrawList->AddRect(display_rect.Min + ImVec2(THICKNESS * 0.5f, THICKNESS * 0.5f), display_rect.Max - ImVec2(THICKNESS * 0.5f, THICKNESS * 0.5f), GetColorU32(ImGuiCol_NavHighlight), rounding, 0, THICKNESS);
2882 if (!fully_visible)
2883 window->DrawList->PopClipRect();
2884 }
2886 {
2887 window->DrawList->AddRect(display_rect.Min, display_rect.Max, GetColorU32(ImGuiCol_NavHighlight), rounding, 0, 1.0f);
2888 }
2889}
@ ImGuiNavHighlightFlags_NoRounding
Definition imgui_internal.h:903
@ ImGuiNavHighlightFlags_AlwaysDraw
Definition imgui_internal.h:902
@ ImGuiNavHighlightFlags_TypeDefault
Definition imgui_internal.h:900

References ImDrawList::AddRect(), ImGuiWindow::ClipRect, ImRect::ClipWith(), ImRect::Contains(), ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiWindow::DrawList, ImRect::Expand(), ImGuiStyle::FrameRounding, GetColorU32(), GImGui, ImGuiCol_NavHighlight, ImGuiNavHighlightFlags_AlwaysDraw, ImGuiNavHighlightFlags_NoRounding, ImGuiNavHighlightFlags_TypeDefault, ImGuiNavHighlightFlags_TypeThin, ImRect::Max, ImRect::Min, ImGuiContext::NavDisableHighlight, ImGuiWindowTempData::NavHideHighlightOneFrame, ImGuiContext::NavId, ImDrawList::PopClipRect(), ImDrawList::PushClipRect(), and ImGuiContext::Style.

Referenced by ArrowButtonEx(), BeginCombo(), ButtonEx(), Checkbox(), ColorButton(), DragScalar(), EndChild(), Slic3r::GUI::image_button_ex(), ImageButtonEx(), InputTextEx(), RadioButton(), Slic3r::GUI::selectable(), Selectable(), SliderScalar(), TabItemEx(), TableHeader(), TreeNodeBehavior(), and VSliderScalar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderRectFilledRangeH()

void ImGui::RenderRectFilledRangeH ( ImDrawList draw_list,
const ImRect rect,
ImU32  col,
float  x_start_norm,
float  x_end_norm,
float  rounding 
)
3833{
3834 if (x_end_norm == x_start_norm)
3835 return;
3836 if (x_start_norm > x_end_norm)
3837 ImSwap(x_start_norm, x_end_norm);
3838
3839 ImVec2 p0 = ImVec2(ImLerp(rect.Min.x, rect.Max.x, x_start_norm), rect.Min.y);
3840 ImVec2 p1 = ImVec2(ImLerp(rect.Min.x, rect.Max.x, x_end_norm), rect.Max.y);
3841 if (rounding == 0.0f)
3842 {
3843 draw_list->AddRectFilled(p0, p1, col, 0.0f);
3844 return;
3845 }
3846
3847 rounding = ImClamp(ImMin((rect.Max.x - rect.Min.x) * 0.5f, (rect.Max.y - rect.Min.y) * 0.5f) - 1.0f, 0.0f, rounding);
3848 const float inv_rounding = 1.0f / rounding;
3849 const float arc0_b = ImAcos01(1.0f - (p0.x - rect.Min.x) * inv_rounding);
3850 const float arc0_e = ImAcos01(1.0f - (p1.x - rect.Min.x) * inv_rounding);
3851 const float half_pi = IM_PI * 0.5f; // We will == compare to this because we know this is the exact value ImAcos01 can return.
3852 const float x0 = ImMax(p0.x, rect.Min.x + rounding);
3853 if (arc0_b == arc0_e)
3854 {
3855 draw_list->PathLineTo(ImVec2(x0, p1.y));
3856 draw_list->PathLineTo(ImVec2(x0, p0.y));
3857 }
3858 else if (arc0_b == 0.0f && arc0_e == half_pi)
3859 {
3860 draw_list->PathArcToFast(ImVec2(x0, p1.y - rounding), rounding, 3, 6); // BL
3861 draw_list->PathArcToFast(ImVec2(x0, p0.y + rounding), rounding, 6, 9); // TR
3862 }
3863 else
3864 {
3865 draw_list->PathArcTo(ImVec2(x0, p1.y - rounding), rounding, IM_PI - arc0_e, IM_PI - arc0_b, 3); // BL
3866 draw_list->PathArcTo(ImVec2(x0, p0.y + rounding), rounding, IM_PI + arc0_b, IM_PI + arc0_e, 3); // TR
3867 }
3868 if (p1.x > rect.Min.x + rounding)
3869 {
3870 const float arc1_b = ImAcos01(1.0f - (rect.Max.x - p1.x) * inv_rounding);
3871 const float arc1_e = ImAcos01(1.0f - (rect.Max.x - p0.x) * inv_rounding);
3872 const float x1 = ImMin(p1.x, rect.Max.x - rounding);
3873 if (arc1_b == arc1_e)
3874 {
3875 draw_list->PathLineTo(ImVec2(x1, p0.y));
3876 draw_list->PathLineTo(ImVec2(x1, p1.y));
3877 }
3878 else if (arc1_b == 0.0f && arc1_e == half_pi)
3879 {
3880 draw_list->PathArcToFast(ImVec2(x1, p0.y + rounding), rounding, 9, 12); // TR
3881 draw_list->PathArcToFast(ImVec2(x1, p1.y - rounding), rounding, 0, 3); // BR
3882 }
3883 else
3884 {
3885 draw_list->PathArcTo(ImVec2(x1, p0.y + rounding), rounding, -arc1_e, -arc1_b, 3); // TR
3886 draw_list->PathArcTo(ImVec2(x1, p1.y - rounding), rounding, +arc1_b, +arc1_e, 3); // BR
3887 }
3888 }
3889 draw_list->PathFillConvex(col);
3890}
static float ImAcos01(float x)
Definition imgui_draw.cpp:3823
IMGUI_API void PathArcToFast(const ImVec2 &center, float radius, int a_min_of_12, int a_max_of_12)
Definition imgui_draw.cpp:1153
void PathFillConvex(ImU32 col)
Definition imgui.h:2417

References ImDrawList::AddRectFilled(), col(), IM_PI, ImAcos01(), ImClamp(), ImLerp(), ImMax(), ImMin(), ImSwap(), ImRect::Max, ImRect::Min, ImDrawList::PathArcTo(), ImDrawList::PathArcToFast(), ImDrawList::PathFillConvex(), ImDrawList::PathLineTo(), ImVec2::x, and ImVec2::y.

Referenced by ProgressBar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderRectFilledWithHole()

void ImGui::RenderRectFilledWithHole ( ImDrawList draw_list,
ImRect  outer,
ImRect  inner,
ImU32  col,
float  rounding 
)
3893{
3894 const bool fill_L = (inner.Min.x > outer.Min.x);
3895 const bool fill_R = (inner.Max.x < outer.Max.x);
3896 const bool fill_U = (inner.Min.y > outer.Min.y);
3897 const bool fill_D = (inner.Max.y < outer.Max.y);
3898 if (fill_L) draw_list->AddRectFilled(ImVec2(outer.Min.x, inner.Min.y), ImVec2(inner.Min.x, inner.Max.y), col, rounding, (fill_U ? 0 : ImDrawFlags_RoundCornersTopLeft) | (fill_D ? 0 : ImDrawFlags_RoundCornersBottomLeft));
3899 if (fill_R) draw_list->AddRectFilled(ImVec2(inner.Max.x, inner.Min.y), ImVec2(outer.Max.x, inner.Max.y), col, rounding, (fill_U ? 0 : ImDrawFlags_RoundCornersTopRight) | (fill_D ? 0 : ImDrawFlags_RoundCornersBottomRight));
3900 if (fill_U) draw_list->AddRectFilled(ImVec2(inner.Min.x, outer.Min.y), ImVec2(inner.Max.x, inner.Min.y), col, rounding, (fill_L ? 0 : ImDrawFlags_RoundCornersTopLeft) | (fill_R ? 0 : ImDrawFlags_RoundCornersTopRight));
3901 if (fill_D) draw_list->AddRectFilled(ImVec2(inner.Min.x, inner.Max.y), ImVec2(inner.Max.x, outer.Max.y), col, rounding, (fill_L ? 0 : ImDrawFlags_RoundCornersBottomLeft) | (fill_R ? 0 : ImDrawFlags_RoundCornersBottomRight));
3902 if (fill_L && fill_U) draw_list->AddRectFilled(ImVec2(outer.Min.x, outer.Min.y), ImVec2(inner.Min.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersTopLeft);
3903 if (fill_R && fill_U) draw_list->AddRectFilled(ImVec2(inner.Max.x, outer.Min.y), ImVec2(outer.Max.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersTopRight);
3904 if (fill_L && fill_D) draw_list->AddRectFilled(ImVec2(outer.Min.x, inner.Max.y), ImVec2(inner.Min.x, outer.Max.y), col, rounding, ImDrawFlags_RoundCornersBottomLeft);
3905 if (fill_R && fill_D) draw_list->AddRectFilled(ImVec2(inner.Max.x, inner.Max.y), ImVec2(outer.Max.x, outer.Max.y), col, rounding, ImDrawFlags_RoundCornersBottomRight);
3906}

References ImDrawList::AddRectFilled(), col(), ImDrawFlags_RoundCornersBottomLeft, ImDrawFlags_RoundCornersBottomRight, ImDrawFlags_RoundCornersTopLeft, ImDrawFlags_RoundCornersTopRight, ImRect::Max, ImRect::Min, ImVec2::x, and ImVec2::y.

+ Here is the call graph for this function:

◆ RenderText()

void ImGui::RenderText ( ImVec2  pos,
const char *  text,
const char *  text_end = NULL,
bool  hide_text_after_hash = true 
)
2666{
2667 ImGuiContext& g = *GImGui;
2668 ImGuiWindow* window = g.CurrentWindow;
2669
2670 // Hide anything after a '##' string
2671 const char* text_display_end;
2672 if (hide_text_after_hash)
2673 {
2674 text_display_end = FindRenderedTextEnd(text, text_end);
2675 }
2676 else
2677 {
2678 if (!text_end)
2679 text_end = text + strlen(text); // FIXME-OPT
2680 text_display_end = text_end;
2681 }
2682
2683 if (text != text_display_end)
2684 {
2685 window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end);
2686 if (g.LogEnabled)
2687 LogRenderedText(&pos, text, text_display_end);
2688 }
2689}

References ImDrawList::AddText(), ImGuiContext::CurrentWindow, ImGuiWindow::DrawList, FindRenderedTextEnd(), ImGuiContext::Font, ImGuiContext::FontSize, GetColorU32(), GImGui, ImGuiCol_Text, ImGuiContext::LogEnabled, and LogRenderedText().

Referenced by BeginCombo(), BeginListBox(), BulletTextV(), Checkbox(), DragScalar(), InputTextEx(), LabelTextV(), MenuItem(), PlotEx(), RadioButton(), SliderScalar(), TableHeader(), TextEx(), TreeNodeBehavior(), and VSliderScalar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderTextClipped()

void ImGui::RenderTextClipped ( const ImVec2 pos_min,
const ImVec2 pos_max,
const char *  text,
const char *  text_end,
const ImVec2 text_size_if_known,
const ImVec2 align = ImVec2(0, 0),
const ImRect clip_rect = NULL 
)
2738{
2739 // Hide anything after a '##' string
2740 const char* text_display_end = FindRenderedTextEnd(text, text_end);
2741 const int text_len = (int)(text_display_end - text);
2742 if (text_len == 0)
2743 return;
2744
2745 ImGuiContext& g = *GImGui;
2746 ImGuiWindow* window = g.CurrentWindow;
2747 RenderTextClippedEx(window->DrawList, pos_min, pos_max, text, text_display_end, text_size_if_known, align, clip_rect);
2748 if (g.LogEnabled)
2749 LogRenderedText(&pos_min, text, text_display_end);
2750}
IMGUI_API void RenderTextClippedEx(ImDrawList *draw_list, const ImVec2 &pos_min, const ImVec2 &pos_max, const char *text, const char *text_end, const ImVec2 *text_size_if_known, const ImVec2 &align=ImVec2(0, 0), const ImRect *clip_rect=NULL)
Definition imgui.cpp:2709

References ImGuiContext::CurrentWindow, ImGuiWindow::DrawList, FindRenderedTextEnd(), GImGui, ImGuiContext::LogEnabled, LogRenderedText(), and RenderTextClippedEx().

Referenced by BeginCombo(), ButtonEx(), DragScalar(), LabelTextV(), PlotEx(), ProgressBar(), RenderWindowTitleBarContents(), Slic3r::GUI::selectable(), Selectable(), SliderScalar(), TreeNodeBehavior(), and VSliderScalar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderTextClippedEx()

void ImGui::RenderTextClippedEx ( ImDrawList draw_list,
const ImVec2 pos_min,
const ImVec2 pos_max,
const char *  text,
const char *  text_end,
const ImVec2 text_size_if_known,
const ImVec2 align = ImVec2(0, 0),
const ImRect clip_rect = NULL 
)
2710{
2711 // Perform CPU side clipping for single clipped element to avoid using scissor state
2712 ImVec2 pos = pos_min;
2713 const ImVec2 text_size = text_size_if_known ? *text_size_if_known : CalcTextSize(text, text_display_end, false, 0.0f);
2714
2715 const ImVec2* clip_min = clip_rect ? &clip_rect->Min : &pos_min;
2716 const ImVec2* clip_max = clip_rect ? &clip_rect->Max : &pos_max;
2717 bool need_clipping = (pos.x + text_size.x >= clip_max->x) || (pos.y + text_size.y >= clip_max->y);
2718 if (clip_rect) // If we had no explicit clipping rectangle then pos==clip_min
2719 need_clipping |= (pos.x < clip_min->x) || (pos.y < clip_min->y);
2720
2721 // Align whole block. We should defer that to the better rendering function when we'll have support for individual line alignment.
2722 if (align.x > 0.0f) pos.x = ImMax(pos.x, pos.x + (pos_max.x - pos.x - text_size.x) * align.x);
2723 if (align.y > 0.0f) pos.y = ImMax(pos.y, pos.y + (pos_max.y - pos.y - text_size.y) * align.y);
2724
2725 // Render
2726 if (need_clipping)
2727 {
2728 ImVec4 fine_clip_rect(clip_min->x, clip_min->y, clip_max->x, clip_max->y);
2729 draw_list->AddText(NULL, 0.0f, pos, GetColorU32(ImGuiCol_Text), text, text_display_end, 0.0f, &fine_clip_rect);
2730 }
2731 else
2732 {
2733 draw_list->AddText(NULL, 0.0f, pos, GetColorU32(ImGuiCol_Text), text, text_display_end, 0.0f, NULL);
2734 }
2735}

References ImDrawList::AddText(), CalcTextSize(), GetColorU32(), ImGuiCol_Text, ImMax(), ImRect::Max, ImRect::Min, ImVec2::x, and ImVec2::y.

Referenced by RenderTextClipped(), RenderTextEllipsis(), and TabItemLabelAndCloseButton().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderTextEllipsis()

void ImGui::RenderTextEllipsis ( ImDrawList draw_list,
const ImVec2 pos_min,
const ImVec2 pos_max,
float  clip_max_x,
float  ellipsis_max_x,
const char *  text,
const char *  text_end,
const ImVec2 text_size_if_known 
)
2757{
2758 ImGuiContext& g = *GImGui;
2759 if (text_end_full == NULL)
2760 text_end_full = FindRenderedTextEnd(text);
2761 const ImVec2 text_size = text_size_if_known ? *text_size_if_known : CalcTextSize(text, text_end_full, false, 0.0f);
2762
2763 //draw_list->AddLine(ImVec2(pos_max.x, pos_min.y - 4), ImVec2(pos_max.x, pos_max.y + 4), IM_COL32(0, 0, 255, 255));
2764 //draw_list->AddLine(ImVec2(ellipsis_max_x, pos_min.y-2), ImVec2(ellipsis_max_x, pos_max.y+2), IM_COL32(0, 255, 0, 255));
2765 //draw_list->AddLine(ImVec2(clip_max_x, pos_min.y), ImVec2(clip_max_x, pos_max.y), IM_COL32(255, 0, 0, 255));
2766 // FIXME: We could technically remove (last_glyph->AdvanceX - last_glyph->X1) from text_size.x here and save a few pixels.
2767 if (text_size.x > pos_max.x - pos_min.x)
2768 {
2769 // Hello wo...
2770 // | | |
2771 // min max ellipsis_max
2772 // <-> this is generally some padding value
2773
2774 const ImFont* font = draw_list->_Data->Font;
2775 const float font_size = draw_list->_Data->FontSize;
2776 const char* text_end_ellipsis = NULL;
2777
2778 ImWchar ellipsis_char = font->EllipsisChar;
2779 int ellipsis_char_count = 1;
2780 if (ellipsis_char == (ImWchar)-1)
2781 {
2782 ellipsis_char = (ImWchar)'.';
2783 ellipsis_char_count = 3;
2784 }
2785 const ImFontGlyph* glyph = font->FindGlyph(ellipsis_char);
2786
2787 float ellipsis_glyph_width = glyph->X1; // Width of the glyph with no padding on either side
2788 float ellipsis_total_width = ellipsis_glyph_width; // Full width of entire ellipsis
2789
2790 if (ellipsis_char_count > 1)
2791 {
2792 // Full ellipsis size without free spacing after it.
2793 const float spacing_between_dots = 1.0f * (draw_list->_Data->FontSize / font->FontSize);
2794 ellipsis_glyph_width = glyph->X1 - glyph->X0 + spacing_between_dots;
2795 ellipsis_total_width = ellipsis_glyph_width * (float)ellipsis_char_count - spacing_between_dots;
2796 }
2797
2798 // We can now claim the space between pos_max.x and ellipsis_max.x
2799 const float text_avail_width = ImMax((ImMax(pos_max.x, ellipsis_max_x) - ellipsis_total_width) - pos_min.x, 1.0f);
2800 float text_size_clipped_x = font->CalcTextSizeA(font_size, text_avail_width, 0.0f, text, text_end_full, &text_end_ellipsis).x;
2801 if (text == text_end_ellipsis && text_end_ellipsis < text_end_full)
2802 {
2803 // Always display at least 1 character if there's no room for character + ellipsis
2804 text_end_ellipsis = text + ImTextCountUtf8BytesFromChar(text, text_end_full);
2805 text_size_clipped_x = font->CalcTextSizeA(font_size, FLT_MAX, 0.0f, text, text_end_ellipsis).x;
2806 }
2807 while (text_end_ellipsis > text && ImCharIsBlankA(text_end_ellipsis[-1]))
2808 {
2809 // Trim trailing space before ellipsis (FIXME: Supporting non-ascii blanks would be nice, for this we need a function to backtrack in UTF-8 text)
2810 text_end_ellipsis--;
2811 text_size_clipped_x -= font->CalcTextSizeA(font_size, FLT_MAX, 0.0f, text_end_ellipsis, text_end_ellipsis + 1).x; // Ascii blanks are always 1 byte
2812 }
2813
2814 // Render text, render ellipsis
2815 RenderTextClippedEx(draw_list, pos_min, ImVec2(clip_max_x, pos_max.y), text, text_end_ellipsis, &text_size, ImVec2(0.0f, 0.0f));
2816 float ellipsis_x = pos_min.x + text_size_clipped_x;
2817 if (ellipsis_x + ellipsis_total_width <= ellipsis_max_x)
2818 for (int i = 0; i < ellipsis_char_count; i++)
2819 {
2820 font->RenderChar(draw_list, font_size, ImVec2(ellipsis_x, pos_min.y), GetColorU32(ImGuiCol_Text), ellipsis_char);
2821 ellipsis_x += ellipsis_glyph_width;
2822 }
2823 }
2824 else
2825 {
2826 RenderTextClippedEx(draw_list, pos_min, ImVec2(clip_max_x, pos_max.y), text, text_end_full, &text_size, ImVec2(0.0f, 0.0f));
2827 }
2828
2829 if (g.LogEnabled)
2830 LogRenderedText(&pos_min, text, text_end_full);
2831}
int ImTextCountUtf8BytesFromChar(const char *in_text, const char *in_text_end)
Definition imgui.cpp:1740
float X1
Definition imgui.h:2529
float X0
Definition imgui.h:2529
ImWchar EllipsisChar
Definition imgui.h:2706
IMGUI_API void RenderChar(ImDrawList *draw_list, float size, ImVec2 pos, ImU32 col, ImWchar c) const
Definition imgui_draw.cpp:3497

References ImDrawList::_Data, CalcTextSize(), ImFont::CalcTextSizeA(), ImFont::EllipsisChar, ImFont::FindGlyph(), FindRenderedTextEnd(), ImDrawListSharedData::Font, ImFont::FontSize, ImDrawListSharedData::FontSize, GetColorU32(), GImGui, ImCharIsBlankA(), ImGuiCol_Text, ImMax(), ImTextCountUtf8BytesFromChar(), ImGuiContext::LogEnabled, LogRenderedText(), ImFont::RenderChar(), RenderTextClippedEx(), ImVec2::x, ImFontGlyph::X0, ImFontGlyph::X1, and ImVec2::y.

Referenced by TabItemLabelAndCloseButton(), and TableHeader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderTextWrapped()

void ImGui::RenderTextWrapped ( ImVec2  pos,
const char *  text,
const char *  text_end,
float  wrap_width 
)
2692{
2693 ImGuiContext& g = *GImGui;
2694 ImGuiWindow* window = g.CurrentWindow;
2695
2696 if (!text_end)
2697 text_end = text + strlen(text); // FIXME-OPT
2698
2699 if (text != text_end)
2700 {
2701 window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_end, wrap_width);
2702 if (g.LogEnabled)
2703 LogRenderedText(&pos, text, text_end);
2704 }
2705}

References ImDrawList::AddText(), ImGuiContext::CurrentWindow, ImGuiWindow::DrawList, ImGuiContext::Font, ImGuiContext::FontSize, GetColorU32(), GImGui, ImGuiCol_Text, ImGuiContext::LogEnabled, and LogRenderedText().

Referenced by TextEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderWindowDecorations()

void ImGui::RenderWindowDecorations ( ImGuiWindow window,
const ImRect title_bar_rect,
bool  title_bar_is_highlight,
int  resize_grip_count,
const ImU32  resize_grip_col[4],
float  resize_grip_draw_size 
)
static
5534{
5535 ImGuiContext& g = *GImGui;
5536 ImGuiStyle& style = g.Style;
5537 ImGuiWindowFlags flags = window->Flags;
5538
5539 // Ensure that ScrollBar doesn't read last frame's SkipItems
5540 IM_ASSERT(window->BeginCount == 0);
5541 window->SkipItems = false;
5542
5543 // Draw window + handle manual resize
5544 // As we highlight the title bar when want_focus is set, multiple reappearing windows will have have their title bar highlighted on their reappearing frame.
5545 const float window_rounding = window->WindowRounding;
5546 const float window_border_size = window->WindowBorderSize;
5547 if (window->Collapsed)
5548 {
5549 // Title bar only
5550 float backup_border_size = style.FrameBorderSize;
5552 ImU32 title_bar_col = GetColorU32((title_bar_is_highlight && !g.NavDisableHighlight) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBgCollapsed);
5553 RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding);
5554 g.Style.FrameBorderSize = backup_border_size;
5555 }
5556 else
5557 {
5558 // Window background
5559 if (!(flags & ImGuiWindowFlags_NoBackground))
5560 {
5561 ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags));
5562 bool override_alpha = false;
5563 float alpha = 1.0f;
5565 {
5566 alpha = g.NextWindowData.BgAlphaVal;
5567 override_alpha = true;
5568 }
5569 if (override_alpha)
5570 bg_col = (bg_col & ~IM_COL32_A_MASK) | (IM_F32_TO_INT8_SAT(alpha) << IM_COL32_A_SHIFT);
5571 window->DrawList->AddRectFilled(window->Pos + ImVec2(0, window->TitleBarHeight()), window->Pos + window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? 0 : ImDrawFlags_RoundCornersBottom);
5572 }
5573
5574 // Title bar
5575 if (!(flags & ImGuiWindowFlags_NoTitleBar))
5576 {
5577 ImU32 title_bar_col = GetColorU32(title_bar_is_highlight ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg);
5578 window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, window_rounding, ImDrawFlags_RoundCornersTop);
5579 }
5580
5581 // Menu bar
5582 if (flags & ImGuiWindowFlags_MenuBar)
5583 {
5584 ImRect menu_bar_rect = window->MenuBarRect();
5585 menu_bar_rect.ClipWith(window->Rect()); // Soft clipping, in particular child window don't have minimum size covering the menu bar so this is useful for them.
5586 window->DrawList->AddRectFilled(menu_bar_rect.Min + ImVec2(window_border_size, 0), menu_bar_rect.Max - ImVec2(window_border_size, 0), GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, ImDrawFlags_RoundCornersTop);
5587 if (style.FrameBorderSize > 0.0f && menu_bar_rect.Max.y < window->Pos.y + window->Size.y)
5588 window->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border), style.FrameBorderSize);
5589 }
5590
5591 // Scrollbars
5592 if (window->ScrollbarX)
5594 if (window->ScrollbarY)
5596
5597 // Render resize grips (after their input handling so we don't have a frame of latency)
5598 if (!(flags & ImGuiWindowFlags_NoResize))
5599 {
5600 for (int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++)
5601 {
5602 const ImGuiResizeGripDef& grip = resize_grip_def[resize_grip_n];
5603 const ImVec2 corner = ImLerp(window->Pos, window->Pos + window->Size, grip.CornerPosN);
5604 window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(window_border_size, resize_grip_draw_size) : ImVec2(resize_grip_draw_size, window_border_size)));
5605 window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(resize_grip_draw_size, window_border_size) : ImVec2(window_border_size, resize_grip_draw_size)));
5606 window->DrawList->PathArcToFast(ImVec2(corner.x + grip.InnerDir.x * (window_rounding + window_border_size), corner.y + grip.InnerDir.y * (window_rounding + window_border_size)), window_rounding, grip.AngleMin12, grip.AngleMax12);
5607 window->DrawList->PathFillConvex(resize_grip_col[resize_grip_n]);
5608 }
5609 }
5610
5611 // Borders
5613 }
5614}
static const ImGuiResizeGripDef resize_grip_def[4]
Definition imgui.cpp:5309
static ImGuiCol GetWindowBgColorIdxFromFlags(ImGuiWindowFlags flags)
Definition imgui.cpp:5279
int AngleMin12
Definition imgui.cpp:5307
int AngleMax12
Definition imgui.cpp:5307
ImVec2 InnerDir
Definition imgui.cpp:5306
ImVec2 CornerPosN
Definition imgui.cpp:5305
Definition imgui.cpp:5304
@ ImGuiWindowFlags_NoBackground
Definition imgui.h:923
@ ImDrawFlags_RoundCornersBottom
Definition imgui.h:2319
@ ImDrawFlags_RoundCornersTop
Definition imgui.h:2318
@ ImGuiNextWindowDataFlags_HasBgAlpha
Definition imgui_internal.h:1088
IMGUI_API void Scrollbar(ImGuiAxis axis)
Definition imgui_widgets.cpp:874
static void RenderWindowOuterBorders(ImGuiWindow *window)
Definition imgui.cpp:5507
float BgAlphaVal
Definition imgui_internal.h:1108

References ImDrawList::AddLine(), ImDrawList::AddRectFilled(), ImGuiResizeGripDef::AngleMax12, ImGuiResizeGripDef::AngleMin12, ImGuiWindow::BeginCount, ImGuiNextWindowData::BgAlphaVal, ImRect::ClipWith(), ImGuiWindow::Collapsed, ImGuiResizeGripDef::CornerPosN, ImGuiWindow::DrawList, ImGuiNextWindowData::Flags, ImGuiWindow::Flags, ImGuiStyle::FrameBorderSize, ImRect::GetBL(), ImRect::GetBR(), GetColorU32(), GetWindowBgColorIdxFromFlags(), GImGui, IM_ASSERT, IM_COL32_A_SHIFT, IM_F32_TO_INT8_SAT, ImDrawFlags_RoundCornersBottom, ImDrawFlags_RoundCornersTop, ImGuiAxis_X, ImGuiAxis_Y, ImGuiCol_Border, ImGuiCol_MenuBarBg, ImGuiCol_TitleBg, ImGuiCol_TitleBgActive, ImGuiCol_TitleBgCollapsed, ImGuiNextWindowDataFlags_HasBgAlpha, ImGuiWindowFlags_MenuBar, ImGuiWindowFlags_NoBackground, ImGuiWindowFlags_NoResize, ImGuiWindowFlags_NoTitleBar, ImLerp(), ImGuiResizeGripDef::InnerDir, ImRect::Max, ImGuiWindow::MenuBarRect(), ImRect::Min, ImGuiContext::NavDisableHighlight, ImGuiContext::NextWindowData, ImDrawList::PathArcToFast(), ImDrawList::PathFillConvex(), ImDrawList::PathLineTo(), ImGuiWindow::Pos, ImGuiWindow::Rect(), RenderFrame(), RenderWindowOuterBorders(), resize_grip_def, Scrollbar(), ImGuiWindow::ScrollbarX, ImGuiWindow::ScrollbarY, ImGuiWindow::Size, ImGuiWindow::SkipItems, ImGuiContext::Style, style, ImGuiWindow::TitleBarHeight(), ImGuiWindow::WindowBorderSize, ImGuiWindow::WindowRounding, ImVec2::x, and ImVec2::y.

Referenced by Begin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderWindowOuterBorders()

static void ImGui::RenderWindowOuterBorders ( ImGuiWindow window)
static
5508{
5509 ImGuiContext& g = *GImGui;
5510 float rounding = window->WindowRounding;
5511 float border_size = window->WindowBorderSize;
5512 if (border_size > 0.0f && !(window->Flags & ImGuiWindowFlags_NoBackground))
5513 window->DrawList->AddRect(window->Pos, window->Pos + window->Size, GetColorU32(ImGuiCol_Border), rounding, 0, border_size);
5514
5515 int border_held = window->ResizeBorderHeld;
5516 if (border_held != -1)
5517 {
5518 const ImGuiResizeBorderDef& def = resize_border_def[border_held];
5519 ImRect border_r = GetResizeBorderRect(window, border_held, rounding, 0.0f);
5520 window->DrawList->PathArcTo(ImLerp(border_r.Min, border_r.Max, def.SegmentN1) + ImVec2(0.5f, 0.5f) + def.InnerDir * rounding, rounding, def.OuterAngle - IM_PI * 0.25f, def.OuterAngle);
5521 window->DrawList->PathArcTo(ImLerp(border_r.Min, border_r.Max, def.SegmentN2) + ImVec2(0.5f, 0.5f) + def.InnerDir * rounding, rounding, def.OuterAngle, def.OuterAngle + IM_PI * 0.25f);
5522 window->DrawList->PathStroke(GetColorU32(ImGuiCol_SeparatorActive), 0, ImMax(2.0f, border_size)); // Thicker than usual
5523 }
5524 if (g.Style.FrameBorderSize > 0 && !(window->Flags & ImGuiWindowFlags_NoTitleBar))
5525 {
5526 float y = window->Pos.y + window->TitleBarHeight() - 1;
5527 window->DrawList->AddLine(ImVec2(window->Pos.x + border_size, y), ImVec2(window->Pos.x + window->Size.x - border_size, y), GetColorU32(ImGuiCol_Border), g.Style.FrameBorderSize);
5528 }
5529}
static ImRect GetResizeBorderRect(ImGuiWindow *window, int border_n, float perp_padding, float thickness)
Definition imgui.cpp:5332
static const ImGuiResizeBorderDef resize_border_def[4]
Definition imgui.cpp:5324
ImVec2 SegmentN1
Definition imgui.cpp:5321
ImVec2 SegmentN2
Definition imgui.cpp:5321
float OuterAngle
Definition imgui.cpp:5322
ImVec2 InnerDir
Definition imgui.cpp:5320
Definition imgui.cpp:5319

References ImDrawList::AddLine(), ImDrawList::AddRect(), ImGuiWindow::DrawList, ImGuiWindow::Flags, ImGuiStyle::FrameBorderSize, GetColorU32(), GetResizeBorderRect(), GImGui, IM_PI, ImGuiCol_Border, ImGuiCol_SeparatorActive, ImGuiWindowFlags_NoBackground, ImGuiWindowFlags_NoTitleBar, ImLerp(), ImMax(), ImGuiResizeBorderDef::InnerDir, ImRect::Max, ImRect::Min, ImGuiResizeBorderDef::OuterAngle, ImDrawList::PathArcTo(), ImDrawList::PathStroke(), ImGuiWindow::Pos, resize_border_def, ImGuiWindow::ResizeBorderHeld, ImGuiResizeBorderDef::SegmentN1, ImGuiResizeBorderDef::SegmentN2, ImGuiWindow::Size, ImGuiContext::Style, ImGuiWindow::TitleBarHeight(), ImGuiWindow::WindowBorderSize, ImGuiWindow::WindowRounding, ImVec2::x, and ImVec2::y.

Referenced by RenderWindowDecorations().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RenderWindowTitleBarContents()

void ImGui::RenderWindowTitleBarContents ( ImGuiWindow window,
const ImRect title_bar_rect,
const char *  name,
bool *  p_open 
)
static
5618{
5619 ImGuiContext& g = *GImGui;
5620 ImGuiStyle& style = g.Style;
5621 ImGuiWindowFlags flags = window->Flags;
5622
5623 const bool has_close_button = (p_open != NULL);
5624 const bool has_collapse_button = !(flags & ImGuiWindowFlags_NoCollapse) && (style.WindowMenuButtonPosition != ImGuiDir_None);
5625
5626 // Close & Collapse button are on the Menu NavLayer and don't default focus (unless there's nothing else on that layer)
5627 const ImGuiItemFlags item_flags_backup = g.CurrentItemFlags;
5630
5631 // Layout buttons
5632 // FIXME: Would be nice to generalize the subtleties expressed here into reusable code.
5633 float pad_l = style.FramePadding.x;
5634 float pad_r = style.FramePadding.x;
5635 float button_sz = g.FontSize;
5636 ImVec2 close_button_pos;
5637 ImVec2 collapse_button_pos;
5638 if (has_close_button)
5639 {
5640 pad_r += button_sz;
5641 close_button_pos = ImVec2(title_bar_rect.Max.x - pad_r - style.FramePadding.x, title_bar_rect.Min.y);
5642 }
5643 if (has_collapse_button && style.WindowMenuButtonPosition == ImGuiDir_Right)
5644 {
5645 pad_r += button_sz;
5646 collapse_button_pos = ImVec2(title_bar_rect.Max.x - pad_r - style.FramePadding.x, title_bar_rect.Min.y);
5647 }
5648 if (has_collapse_button && style.WindowMenuButtonPosition == ImGuiDir_Left)
5649 {
5650 collapse_button_pos = ImVec2(title_bar_rect.Min.x + pad_l - style.FramePadding.x, title_bar_rect.Min.y);
5651 pad_l += button_sz;
5652 }
5653
5654 // Collapse button (submitting first so it gets priority when choosing a navigation init fallback)
5655 if (has_collapse_button)
5656 if (CollapseButton(window->GetID("#COLLAPSE"), collapse_button_pos))
5657 window->WantCollapseToggle = true; // Defer actual collapsing to next frame as we are too far in the Begin() function
5658
5659 // Close button
5660 if (has_close_button)
5661 if (CloseButton(window->GetID("#CLOSE"), close_button_pos))
5662 *p_open = false;
5663
5665 g.CurrentItemFlags = item_flags_backup;
5666
5667 // Title bar text (with: horizontal alignment, avoiding collapse/close button, optional "unsaved document" marker)
5668 // FIXME: Refactor text alignment facilities along with RenderText helpers, this is WAY too much messy code..
5669 const char* UNSAVED_DOCUMENT_MARKER = "*";
5670 const float marker_size_x = (flags & ImGuiWindowFlags_UnsavedDocument) ? CalcTextSize(UNSAVED_DOCUMENT_MARKER, NULL, false).x : 0.0f;
5671 const ImVec2 text_size = CalcTextSize(name, NULL, true) + ImVec2(marker_size_x, 0.0f);
5672
5673 // As a nice touch we try to ensure that centered title text doesn't get affected by visibility of Close/Collapse button,
5674 // while uncentered title text will still reach edges correctly.
5675 if (pad_l > style.FramePadding.x)
5676 pad_l += g.Style.ItemInnerSpacing.x;
5677 if (pad_r > style.FramePadding.x)
5678 pad_r += g.Style.ItemInnerSpacing.x;
5679 if (style.WindowTitleAlign.x > 0.0f && style.WindowTitleAlign.x < 1.0f)
5680 {
5681 float centerness = ImSaturate(1.0f - ImFabs(style.WindowTitleAlign.x - 0.5f) * 2.0f); // 0.0f on either edges, 1.0f on center
5682 float pad_extend = ImMin(ImMax(pad_l, pad_r), title_bar_rect.GetWidth() - pad_l - pad_r - text_size.x);
5683 pad_l = ImMax(pad_l, pad_extend * centerness);
5684 pad_r = ImMax(pad_r, pad_extend * centerness);
5685 }
5686
5687 ImRect layout_r(title_bar_rect.Min.x + pad_l, title_bar_rect.Min.y, title_bar_rect.Max.x - pad_r, title_bar_rect.Max.y);
5688 ImRect clip_r(layout_r.Min.x, layout_r.Min.y, ImMin(layout_r.Max.x + g.Style.ItemInnerSpacing.x, title_bar_rect.Max.x), layout_r.Max.y);
5689 //if (g.IO.KeyShift) window->DrawList->AddRect(layout_r.Min, layout_r.Max, IM_COL32(255, 128, 0, 255)); // [DEBUG]
5690 //if (g.IO.KeyCtrl) window->DrawList->AddRect(clip_r.Min, clip_r.Max, IM_COL32(255, 128, 0, 255)); // [DEBUG]
5691 RenderTextClipped(layout_r.Min, layout_r.Max, name, NULL, &text_size, style.WindowTitleAlign, &clip_r);
5693 {
5694 ImVec2 marker_pos = ImVec2(ImMax(layout_r.Min.x, layout_r.Min.x + (layout_r.GetWidth() - text_size.x) * style.WindowTitleAlign.x) + text_size.x, layout_r.Min.y) + ImVec2(2 - marker_size_x, 0.0f);
5695 ImVec2 off = ImVec2(0.0f, IM_FLOOR(-g.FontSize * 0.25f));
5696 RenderTextClipped(marker_pos + off, layout_r.Max + off, UNSAVED_DOCUMENT_MARKER, NULL, NULL, ImVec2(0, style.WindowTitleAlign.y), &clip_r);
5697 }
5698}
@ ImGuiWindowFlags_UnsavedDocument
Definition imgui.h:935
IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2 &pos)
Definition imgui_widgets.cpp:830

References CalcTextSize(), CloseButton(), CollapseButton(), ImGuiContext::CurrentItemFlags, ImGuiWindow::DC, ImGuiWindow::Flags, ImGuiContext::FontSize, ImGuiWindow::GetID(), ImRect::GetWidth(), GImGui, IM_FLOOR, ImFabs, ImGuiDir_Left, ImGuiDir_None, ImGuiDir_Right, ImGuiItemFlags_NoNavDefaultFocus, ImGuiNavLayer_Main, ImGuiNavLayer_Menu, ImGuiWindowFlags_NoCollapse, ImGuiWindowFlags_UnsavedDocument, ImMax(), ImMin(), ImSaturate(), ImGuiStyle::ItemInnerSpacing, ImRect::Max, ImRect::Min, ImGuiWindowTempData::NavLayerCurrent, RenderTextClipped(), ImGuiContext::Style, style, ImGuiWindow::WantCollapseToggle, ImVec2::x, and ImVec2::y.

Referenced by Begin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ResetMouseDragDelta()

void ImGui::ResetMouseDragDelta ( ImGuiMouseButton  button = 0)
4804{
4805 ImGuiContext& g = *GImGui;
4806 IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
4807 // NB: We don't need to reset g.IO.MouseDragMaxDistanceSqr
4808 g.IO.MouseClickedPos[button] = g.IO.MousePos;
4809}

References GImGui, IM_ARRAYSIZE, IM_ASSERT, ImGuiContext::IO, ImGuiIO::MouseClickedPos, ImGuiIO::MouseDown, and ImGuiIO::MousePos.

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_style_list(), and ShowDemoWindowWidgets().

+ Here is the caller graph for this function:

◆ RoundScalarWithFormatT()

template<typename T , typename SIGNED_T >
IMGUI_API T ImGui::RoundScalarWithFormatT ( const char *  format,
ImGuiDataType  data_type,
v 
)

◆ SameLine()

void ImGui::SameLine ( float  offset_from_start_x = 0.0f,
float  spacing = -1.0f 
)
7456{
7457 ImGuiWindow* window = GetCurrentWindow();
7458 if (window->SkipItems)
7459 return;
7460
7461 ImGuiContext& g = *GImGui;
7462 if (offset_from_start_x != 0.0f)
7463 {
7464 if (spacing_w < 0.0f) spacing_w = 0.0f;
7465 window->DC.CursorPos.x = window->Pos.x - window->Scroll.x + offset_from_start_x + spacing_w + window->DC.GroupOffset.x + window->DC.ColumnsOffset.x;
7466 window->DC.CursorPos.y = window->DC.CursorPosPrevLine.y;
7467 }
7468 else
7469 {
7470 if (spacing_w < 0.0f) spacing_w = g.Style.ItemSpacing.x;
7471 window->DC.CursorPos.x = window->DC.CursorPosPrevLine.x + spacing_w;
7472 window->DC.CursorPos.y = window->DC.CursorPosPrevLine.y;
7473 }
7474 window->DC.CurrLineSize = window->DC.PrevLineSize;
7476}

References ImGuiWindowTempData::ColumnsOffset, ImGuiWindowTempData::CurrLineSize, ImGuiWindowTempData::CurrLineTextBaseOffset, ImGuiWindowTempData::CursorPos, ImGuiWindowTempData::CursorPosPrevLine, ImGuiWindow::DC, GetCurrentWindow(), GImGui, ImGuiWindowTempData::GroupOffset, ImGuiStyle::ItemSpacing, ImGuiWindow::Pos, ImGuiWindowTempData::PrevLineSize, ImGuiWindowTempData::PrevLineTextBaseOffset, ImGuiWindow::Scroll, ImGuiWindow::SkipItems, ImGuiContext::Style, ImVec2::x, ImVec1::x, and ImVec2::y.

Referenced by Slic3r::GUI::GLCanvas3D::_render_arrange_menu(), Bullet(), Slic3r::GUI::clickable(), ColorButton(), ColorEdit4(), ColorPicker4(), ColorTooltip(), Slic3r::GUI::ImGuiWrapper::combo(), DebugNodeDrawList(), DebugNodeTabBar(), MyDocument::DisplayContents(), DragFloatRange2(), DragIntRange2(), DragScalarN(), ExampleAppConsole::Draw(), ExampleAppLog::Draw(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), Slic3r::GUI::GLGizmoEmboss::draw_font_list_line(), Slic3r::GUI::GLGizmoEmboss::draw_font_preview(), Slic3r::GUI::GLGizmoEmboss::draw_model_type(), Slic3r::GUI::GLGizmoEmboss::draw_style_add_button(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), Slic3r::GUI::GLGizmoEmboss::draw_style_rename_popup(), Slic3r::GUI::GLGizmoEmboss::draw_style_save_as_popup(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_menu(), Slic3r::GUI::GLGizmoEmboss::draw_window(), EditTableColumnsFlags(), EditTableSizingFlags(), InputScalar(), InputScalarN(), ItemSize(), LogButtons(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GLGizmoHollow::on_render_input_window(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), Slic3r::GUI::GLGizmoSeam::on_render_input_window(), Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), Slic3r::GUI::GLGizmoSlaSupports::on_render_input_window(), Slic3r::GUI::GCodeViewer::SequentialView::Marker::render(), Slic3r::GUI::GLCanvas3D::render(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::GLGizmoCut3D::render_build_size(), Slic3r::GUI::GLGizmoCut3D::render_color_marker(), Slic3r::GUI::GLGizmoCut3D::render_connect_mode_radio_button(), Slic3r::GUI::GLGizmoCut3D::render_connect_type_radio_button(), Slic3r::GUI::GLGizmoCut3D::render_connectors_input_window(), Slic3r::GUI::GLGizmoCut3D::render_cut_plane_input_window(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::GLGizmoCut3D::render_double_input(), Slic3r::GUI::render_extruders_combo(), Slic3r::GUI::GLGizmoCut3D::render_flip_plane_button(), Slic3r::GUI::GCodeViewer::render_legend(), Slic3r::GUI::GLGizmoCut3D::render_move_center_input(), Slic3r::GUI::GLCanvas3D::LayersEditing::render_overlay(), Slic3r::GUI::Mouse3DController::render_settings_dialog(), Slic3r::GUI::GLGizmoCut3D::render_shortcuts(), Slic3r::GUI::GLGizmoCut3D::render_slider_double_input(), Slic3r::GUI::GLGizmoEmboss::rev_checkbox(), Slic3r::GUI::GLGizmoEmboss::rev_input(), Slic3r::GUI::GLGizmoEmboss::rev_slider(), Slic3r::GUI::GLGizmoEmboss::rev_slider(), Slic3r::GUI::GLGizmoEmboss::rev_slider(), Slic3r::GUI::GLGizmoEmboss::revertible(), Slic3r::GUI::ImGuiWrapper::search_list(), ShowDemoWindow(), ShowDemoWindowColumns(), ShowDemoWindowLayout(), ShowDemoWindowMisc(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppConstrainedResize(), ShowExampleAppCustomRendering(), ShowExampleAppDocuments(), ShowExampleAppFullscreen(), ShowExampleAppLayout(), ShowExampleAppLongText(), ShowExampleMenuFile(), ShowFont(), ShowFontSelector(), ShowMetricsWindow(), ShowStyleEditor(), Slic3r::GUI::ImGuiWrapper::slider_float(), and SliderScalarN().

+ Here is the call graph for this function:

◆ SaveIniSettingsToDisk()

void ImGui::SaveIniSettingsToDisk ( const char *  ini_filename)
10512{
10513 ImGuiContext& g = *GImGui;
10514 g.SettingsDirtyTimer = 0.0f;
10515 if (!ini_filename)
10516 return;
10517
10518 size_t ini_data_size = 0;
10519 const char* ini_data = SaveIniSettingsToMemory(&ini_data_size);
10520 ImFileHandle f = ImFileOpen(ini_filename, "wt");
10521 if (!f)
10522 return;
10523 ImFileWrite(ini_data, sizeof(char), ini_data_size, f);
10524 ImFileClose(f);
10525}
ImU64 ImFileWrite(const void *data, ImU64 sz, ImU64 count, ImFileHandle f)
Definition imgui.cpp:1567
IMGUI_API const char * SaveIniSettingsToMemory(size_t *out_ini_size=NULL)
Definition imgui.cpp:10528

References GImGui, ImFileClose(), ImFileOpen(), ImFileWrite(), SaveIniSettingsToMemory(), and ImGuiContext::SettingsDirtyTimer.

Referenced by ShowMetricsWindow(), Shutdown(), and UpdateSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SaveIniSettingsToMemory()

const char * ImGui::SaveIniSettingsToMemory ( size_t *  out_ini_size = NULL)
10529{
10530 ImGuiContext& g = *GImGui;
10531 g.SettingsDirtyTimer = 0.0f;
10534 for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++)
10535 {
10536 ImGuiSettingsHandler* handler = &g.SettingsHandlers[handler_n];
10537 handler->WriteAllFn(&g, handler, &g.SettingsIniData);
10538 }
10539 if (out_size)
10540 *out_size = (size_t)g.SettingsIniData.size();
10541 return g.SettingsIniData.c_str();
10542}
int size() const
Definition imgui.h:2059
const char * c_str() const
Definition imgui.h:2063

References ImGuiTextBuffer::Buf, ImGuiTextBuffer::c_str(), GImGui, ImVector< T >::push_back(), ImVector< T >::resize(), ImGuiContext::SettingsDirtyTimer, ImGuiContext::SettingsHandlers, ImGuiContext::SettingsIniData, ImVector< T >::Size, ImGuiTextBuffer::size(), and ImGuiSettingsHandler::WriteAllFn.

Referenced by SaveIniSettingsToDisk(), and ShowMetricsWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ScaleRatioFromValueT()

template<typename T , typename SIGNED_T , typename FLOAT_T >
IMGUI_API float ImGui::ScaleRatioFromValueT ( ImGuiDataType  data_type,
v,
v_min,
v_max,
bool  is_logarithmic,
float  logarithmic_zero_epsilon,
float  zero_deadzone_size 
)

◆ ScaleValueFromRatioT()

template<typename T , typename SIGNED_T , typename FLOAT_T >
IMGUI_API T ImGui::ScaleValueFromRatioT ( ImGuiDataType  data_type,
float  t,
v_min,
v_max,
bool  is_logarithmic,
float  logarithmic_zero_epsilon,
float  zero_deadzone_size 
)

◆ Scrollbar()

void ImGui::Scrollbar ( ImGuiAxis  axis)
875{
876 ImGuiContext& g = *GImGui;
877 ImGuiWindow* window = g.CurrentWindow;
878
879 const ImGuiID id = GetWindowScrollbarID(window, axis);
880 KeepAliveID(id);
881
882 // Calculate scrollbar bounding box
883 ImRect bb = GetWindowScrollbarRect(window, axis);
884 ImDrawFlags rounding_corners = ImDrawFlags_RoundCornersNone;
885 if (axis == ImGuiAxis_X)
886 {
887 rounding_corners |= ImDrawFlags_RoundCornersBottomLeft;
888 if (!window->ScrollbarY)
889 rounding_corners |= ImDrawFlags_RoundCornersBottomRight;
890 }
891 else
892 {
893 if ((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar))
894 rounding_corners |= ImDrawFlags_RoundCornersTopRight;
895 if (!window->ScrollbarX)
896 rounding_corners |= ImDrawFlags_RoundCornersBottomRight;
897 }
898 float size_avail = window->InnerRect.Max[axis] - window->InnerRect.Min[axis];
899 float size_contents = window->ContentSize[axis] + window->WindowPadding[axis] * 2.0f;
900 ScrollbarEx(bb, id, axis, &window->Scroll[axis], size_avail, size_contents, rounding_corners);
901}
IMGUI_API bool ScrollbarEx(const ImRect &bb, ImGuiID id, ImGuiAxis axis, float *p_scroll_v, float avail_v, float contents_v, ImDrawFlags flags)
Definition imgui_widgets.cpp:909
IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow *window, ImGuiAxis axis)
Definition imgui_widgets.cpp:861

References ImGuiWindow::ContentSize, ImGuiContext::CurrentWindow, ImGuiWindow::Flags, GetWindowScrollbarID(), GetWindowScrollbarRect(), GImGui, ImDrawFlags_RoundCornersBottomLeft, ImDrawFlags_RoundCornersBottomRight, ImDrawFlags_RoundCornersNone, ImDrawFlags_RoundCornersTopRight, ImGuiAxis_X, ImGuiWindowFlags_MenuBar, ImGuiWindowFlags_NoTitleBar, ImGuiWindow::InnerRect, KeepAliveID(), ImRect::Max, ImRect::Min, ImGuiWindow::Scroll, ScrollbarEx(), ImGuiWindow::ScrollbarX, ImGuiWindow::ScrollbarY, and ImGuiWindow::WindowPadding.

Referenced by RenderWindowDecorations().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ScrollbarEx()

bool ImGui::ScrollbarEx ( const ImRect bb,
ImGuiID  id,
ImGuiAxis  axis,
float *  p_scroll_v,
float  avail_v,
float  contents_v,
ImDrawFlags  flags 
)
910{
911 ImGuiContext& g = *GImGui;
912 ImGuiWindow* window = g.CurrentWindow;
913 if (window->SkipItems)
914 return false;
915
916 const float bb_frame_width = bb_frame.GetWidth();
917 const float bb_frame_height = bb_frame.GetHeight();
918 if (bb_frame_width <= 0.0f || bb_frame_height <= 0.0f)
919 return false;
920
921 // When we are too small, start hiding and disabling the grab (this reduce visual noise on very small window and facilitate using the window resize grab)
922 float alpha = 1.0f;
923 if ((axis == ImGuiAxis_Y) && bb_frame_height < g.FontSize + g.Style.FramePadding.y * 2.0f)
924 alpha = ImSaturate((bb_frame_height - g.FontSize) / (g.Style.FramePadding.y * 2.0f));
925 if (alpha <= 0.0f)
926 return false;
927
928 const ImGuiStyle& style = g.Style;
929 const bool allow_interaction = (alpha >= 1.0f);
930
931 ImRect bb = bb_frame;
932 bb.Expand(ImVec2(-ImClamp(IM_FLOOR((bb_frame_width - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp(IM_FLOOR((bb_frame_height - 2.0f) * 0.5f), 0.0f, 3.0f)));
933
934 // V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar)
935 const float scrollbar_size_v = (axis == ImGuiAxis_X) ? bb.GetWidth() : bb.GetHeight();
936
937 // Calculate the height of our grabbable box. It generally represent the amount visible (vs the total scrollable amount)
938 // But we maintain a minimum size in pixel to allow for the user to still aim inside.
939 IM_ASSERT(ImMax(size_contents_v, size_avail_v) > 0.0f); // Adding this assert to check if the ImMax(XXX,1.0f) is still needed. PLEASE CONTACT ME if this triggers.
940 const float win_size_v = ImMax(ImMax(size_contents_v, size_avail_v), 1.0f);
941 const float grab_h_pixels = ImClamp(scrollbar_size_v * (size_avail_v / win_size_v), style.GrabMinSize, scrollbar_size_v);
942 const float grab_h_norm = grab_h_pixels / scrollbar_size_v;
943
944 // Handle input right away. None of the code of Begin() is relying on scrolling position before calling Scrollbar().
945 bool held = false;
946 bool hovered = false;
947 ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_NoNavFocus);
948
949 float scroll_max = ImMax(1.0f, size_contents_v - size_avail_v);
950 float scroll_ratio = ImSaturate(*p_scroll_v / scroll_max);
951 float grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v; // Grab position in normalized space
952 if (held && allow_interaction && grab_h_norm < 1.0f)
953 {
954 float scrollbar_pos_v = bb.Min[axis];
955 float mouse_pos_v = g.IO.MousePos[axis];
956
957 // Click position in scrollbar normalized space (0.0f->1.0f)
958 const float clicked_v_norm = ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v);
959 SetHoveredID(id);
960
961 bool seek_absolute = false;
963 {
964 // On initial click calculate the distance between mouse and the center of the grab
965 seek_absolute = (clicked_v_norm < grab_v_norm || clicked_v_norm > grab_v_norm + grab_h_norm);
966 if (seek_absolute)
968 else
969 g.ScrollbarClickDeltaToGrabCenter = clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f;
970 }
971
972 // Apply scroll (p_scroll_v will generally point on one member of window->Scroll)
973 // It is ok to modify Scroll here because we are being called in Begin() after the calculation of ContentSize and before setting up our starting position
974 const float scroll_v_norm = ImSaturate((clicked_v_norm - g.ScrollbarClickDeltaToGrabCenter - grab_h_norm * 0.5f) / (1.0f - grab_h_norm));
975 *p_scroll_v = IM_ROUND(scroll_v_norm * scroll_max);//(win_size_contents_v - win_size_v));
976
977 // Update values for rendering
978 scroll_ratio = ImSaturate(*p_scroll_v / scroll_max);
979 grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;
980
981 // Update distance to grab now that we have seeked and saturated
982 if (seek_absolute)
983 g.ScrollbarClickDeltaToGrabCenter = clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f;
984 }
985
986 // Render
987 const ImU32 bg_col = GetColorU32(ImGuiCol_ScrollbarBg);
989 window->DrawList->AddRectFilled(bb_frame.Min, bb_frame.Max, bg_col, window->WindowRounding, flags);
990 ImRect grab_rect;
991 if (axis == ImGuiAxis_X)
992 grab_rect = ImRect(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm), bb.Min.y, ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) + grab_h_pixels, bb.Max.y);
993 else
994 grab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels);
995 window->DrawList->AddRectFilled(grab_rect.Min, grab_rect.Max, grab_col, style.ScrollbarRounding);
996
997 return held;
998}
IMGUI_API void SetHoveredID(ImGuiID id)
Definition imgui.cpp:3089
float ScrollbarClickDeltaToGrabCenter
Definition imgui_internal.h:1547

References ImGuiContext::ActiveIdIsJustActivated, ImDrawList::AddRectFilled(), ButtonBehavior(), ImGuiContext::CurrentWindow, ImGuiWindow::DrawList, ImRect::Expand(), ImGuiContext::FontSize, ImGuiStyle::FramePadding, GetColorU32(), ImRect::GetHeight(), ImRect::GetWidth(), GImGui, IM_ASSERT, IM_FLOOR, IM_ROUND, ImClamp(), ImGuiAxis_X, ImGuiAxis_Y, ImGuiButtonFlags_NoNavFocus, ImGuiCol_ScrollbarBg, ImGuiCol_ScrollbarGrab, ImGuiCol_ScrollbarGrabActive, ImGuiCol_ScrollbarGrabHovered, ImLerp(), ImMax(), ImSaturate(), ImGuiContext::IO, ImRect::Max, ImRect::Min, ImGuiIO::MousePos, ImGuiContext::ScrollbarClickDeltaToGrabCenter, SetHoveredID(), ImGuiWindow::SkipItems, ImGuiContext::Style, style, ImGuiWindow::WindowRounding, ImVec2::x, and ImVec2::y.

Referenced by Scrollbar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ScrollToBringRectIntoView()

ImVec2 ImGui::ScrollToBringRectIntoView ( ImGuiWindow window,
const ImRect item_rect 
)
7860{
7861 ImGuiContext& g = *GImGui;
7862 ImRect window_rect(window->InnerRect.Min - ImVec2(1, 1), window->InnerRect.Max + ImVec2(1, 1));
7863 //GetForegroundDrawList(window)->AddRect(window_rect.Min, window_rect.Max, IM_COL32_WHITE); // [DEBUG]
7864
7865 ImVec2 delta_scroll;
7866 if (!window_rect.Contains(item_rect))
7867 {
7868 if (window->ScrollbarX && item_rect.Min.x < window_rect.Min.x)
7869 SetScrollFromPosX(window, item_rect.Min.x - window->Pos.x - g.Style.ItemSpacing.x, 0.0f);
7870 else if (window->ScrollbarX && item_rect.Max.x >= window_rect.Max.x)
7871 SetScrollFromPosX(window, item_rect.Max.x - window->Pos.x + g.Style.ItemSpacing.x, 1.0f);
7872 if (item_rect.Min.y < window_rect.Min.y)
7873 SetScrollFromPosY(window, item_rect.Min.y - window->Pos.y - g.Style.ItemSpacing.y, 0.0f);
7874 else if (item_rect.Max.y >= window_rect.Max.y)
7875 SetScrollFromPosY(window, item_rect.Max.y - window->Pos.y + g.Style.ItemSpacing.y, 1.0f);
7876
7877 ImVec2 next_scroll = CalcNextScrollFromScrollTargetAndClamp(window);
7878 delta_scroll = next_scroll - window->Scroll;
7879 }
7880
7881 // Also scroll parent window to keep us into view if necessary
7882 if (window->Flags & ImGuiWindowFlags_ChildWindow)
7883 delta_scroll += ScrollToBringRectIntoView(window->ParentWindow, ImRect(item_rect.Min - delta_scroll, item_rect.Max - delta_scroll));
7884
7885 return delta_scroll;
7886}
IMGUI_API void SetScrollFromPosY(float local_y, float center_y_ratio=0.5f)
Definition imgui.cpp:7972

References CalcNextScrollFromScrollTargetAndClamp(), ImRect::Contains(), ImGuiWindow::Flags, GImGui, ImGuiWindowFlags_ChildWindow, ImGuiWindow::InnerRect, ImGuiStyle::ItemSpacing, ImRect::Max, ImRect::Min, ImGuiWindow::ParentWindow, ImGuiWindow::Pos, ImGuiWindow::Scroll, ImGuiWindow::ScrollbarX, ScrollToBringRectIntoView(), SetScrollFromPosX(), SetScrollFromPosY(), ImGuiContext::Style, ImVec2::x, and ImVec2::y.

Referenced by NavUpdateMoveResult(), and ScrollToBringRectIntoView().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Selectable() [1/2]

bool ImGui::Selectable ( const char *  label,
bool *  p_selected,
ImGuiSelectableFlags  flags = 0,
const ImVec2 size = ImVec2(0, 0) 
)
6161{
6162 if (Selectable(label, *p_selected, flags, size_arg))
6163 {
6164 *p_selected = !*p_selected;
6165 return true;
6166 }
6167 return false;
6168}

References Selectable().

+ Here is the call graph for this function:

◆ Selectable() [2/2]

bool ImGui::Selectable ( const char *  label,
bool  selected = false,
ImGuiSelectableFlags  flags = 0,
const ImVec2 size = ImVec2(0, 0) 
)
6017{
6018 ImGuiWindow* window = GetCurrentWindow();
6019 if (window->SkipItems)
6020 return false;
6021
6022 ImGuiContext& g = *GImGui;
6023 const ImGuiStyle& style = g.Style;
6024
6025 // Submit label or explicit size to ItemSize(), whereas ItemAdd() will submit a larger/spanning rectangle.
6026 ImGuiID id = window->GetID(label);
6027 ImVec2 label_size = CalcTextSize(label, NULL, true);
6028 ImVec2 size(size_arg.x != 0.0f ? size_arg.x : label_size.x, size_arg.y != 0.0f ? size_arg.y : label_size.y);
6029 ImVec2 pos = window->DC.CursorPos;
6030 pos.y += window->DC.CurrLineTextBaseOffset;
6031 ItemSize(size, 0.0f);
6032
6033 // Fill horizontal space
6034 // We don't support (size < 0.0f) in Selectable() because the ItemSpacing extension would make explicitly right-aligned sizes not visibly match other widgets.
6035 const bool span_all_columns = (flags & ImGuiSelectableFlags_SpanAllColumns) != 0;
6036 const float min_x = span_all_columns ? window->ParentWorkRect.Min.x : pos.x;
6037 const float max_x = span_all_columns ? window->ParentWorkRect.Max.x : window->WorkRect.Max.x;
6038 if (size_arg.x == 0.0f || (flags & ImGuiSelectableFlags_SpanAvailWidth))
6039 size.x = ImMax(label_size.x, max_x - min_x);
6040
6041 // Text stays at the submission position, but bounding box may be extended on both sides
6042 const ImVec2 text_min = pos;
6043 const ImVec2 text_max(min_x + size.x, pos.y + size.y);
6044
6045 // Selectables are meant to be tightly packed together with no click-gap, so we extend their box to cover spacing between selectable.
6046 ImRect bb(min_x, pos.y, text_max.x, text_max.y);
6048 {
6049 const float spacing_x = span_all_columns ? 0.0f : style.ItemSpacing.x;
6050 const float spacing_y = style.ItemSpacing.y;
6051 const float spacing_L = IM_FLOOR(spacing_x * 0.50f);
6052 const float spacing_U = IM_FLOOR(spacing_y * 0.50f);
6053 bb.Min.x -= spacing_L;
6054 bb.Min.y -= spacing_U;
6055 bb.Max.x += (spacing_x - spacing_L);
6056 bb.Max.y += (spacing_y - spacing_U);
6057 }
6058 //if (g.IO.KeyCtrl) { GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(0, 255, 0, 255)); }
6059
6060 // Modify ClipRect for the ItemAdd(), faster than doing a PushColumnsBackground/PushTableBackground for every Selectable..
6061 const float backup_clip_rect_min_x = window->ClipRect.Min.x;
6062 const float backup_clip_rect_max_x = window->ClipRect.Max.x;
6063 if (span_all_columns)
6064 {
6065 window->ClipRect.Min.x = window->ParentWorkRect.Min.x;
6066 window->ClipRect.Max.x = window->ParentWorkRect.Max.x;
6067 }
6068
6069 bool item_add;
6071 {
6072 ImGuiItemFlags backup_item_flags = g.CurrentItemFlags;
6074 item_add = ItemAdd(bb, id);
6075 g.CurrentItemFlags = backup_item_flags;
6076 }
6077 else
6078 {
6079 item_add = ItemAdd(bb, id);
6080 }
6081
6082 if (span_all_columns)
6083 {
6084 window->ClipRect.Min.x = backup_clip_rect_min_x;
6085 window->ClipRect.Max.x = backup_clip_rect_max_x;
6086 }
6087
6088 if (!item_add)
6089 return false;
6090
6091 // FIXME: We can standardize the behavior of those two, we could also keep the fast path of override ClipRect + full push on render only,
6092 // which would be advantageous since most selectable are not selected.
6093 if (span_all_columns && window->DC.CurrentColumns)
6095 else if (span_all_columns && g.CurrentTable)
6097
6098 // We use NoHoldingActiveID on menus so user can click and _hold_ on a menu then drag to browse child entries
6099 ImGuiButtonFlags button_flags = 0;
6103 if (flags & ImGuiSelectableFlags_Disabled) { button_flags |= ImGuiButtonFlags_Disabled; }
6106
6108 selected = false;
6109
6110 const bool was_selected = selected;
6111 bool hovered, held;
6112 bool pressed = ButtonBehavior(bb, id, &hovered, &held, button_flags);
6113
6114 // Update NavId when clicking or when Hovering (this doesn't happen on most widgets), so navigation can be resumed with gamepad/keyboard
6115 if (pressed || (hovered && (flags & ImGuiSelectableFlags_SetNavIdOnHover)))
6116 {
6117 if (!g.NavDisableMouseHover && g.NavWindow == window && g.NavLayer == window->DC.NavLayerCurrent)
6118 {
6119 SetNavID(id, window->DC.NavLayerCurrent, window->DC.NavFocusScopeIdCurrent, ImRect(bb.Min - window->Pos, bb.Max - window->Pos));
6120 g.NavDisableHighlight = true;
6121 }
6122 }
6123 if (pressed)
6124 MarkItemEdited(id);
6125
6128
6129 // In this branch, Selectable() cannot toggle the selection so this will never trigger.
6130 if (selected != was_selected) //-V547
6132
6133 // Render
6134 if (held && (flags & ImGuiSelectableFlags_DrawHoveredWhenHeld))
6135 hovered = true;
6136 if (hovered || selected)
6137 {
6139 RenderFrame(bb.Min, bb.Max, col, false, 0.0f);
6141 }
6142
6143 if (span_all_columns && window->DC.CurrentColumns)
6145 else if (span_all_columns && g.CurrentTable)
6147
6149 RenderTextClipped(text_min, text_max, label, NULL, &label_size, style.SelectableTextAlign, &bb);
6151
6152 // Automatically close popups
6155
6157 return pressed;
6158}
@ ImGuiSelectableFlags_AllowItemOverlap
Definition imgui.h:1036
@ ImGuiSelectableFlags_SpanAllColumns
Definition imgui.h:1033
@ ImGuiSelectableFlags_AllowDoubleClick
Definition imgui.h:1034
@ ImGuiItemFlags_SelectableDontClosePopup
Definition imgui_internal.h:728
@ ImGuiSelectableFlags_NoPadWithHalfSpacing
Definition imgui_internal.h:815
@ ImGuiSelectableFlags_DrawHoveredWhenHeld
Definition imgui_internal.h:813
IMGUI_API void PopColumnsBackground()
Definition imgui_tables.cpp:3762
IMGUI_API void SetItemAllowOverlap()
Definition imgui.cpp:4931
IMGUI_API void PushColumnsBackground()
Definition imgui_tables.cpp:3749
IMGUI_API void TablePopBackgroundChannel()
Definition imgui_tables.cpp:2214
IMGUI_API void TablePushBackgroundChannel()
Definition imgui_tables.cpp:2202
IMGUI_API void CloseCurrentPopup()
Definition imgui.cpp:8257

References ButtonBehavior(), CalcTextSize(), ImGuiWindow::ClipRect, CloseCurrentPopup(), col(), ImGuiWindowTempData::CurrentColumns, ImGuiContext::CurrentItemFlags, ImGuiContext::CurrentTable, ImGuiWindowTempData::CurrLineTextBaseOffset, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::Flags, GetColorU32(), GetCurrentWindow(), ImGuiWindow::GetID(), GImGui, IM_FLOOR, IMGUI_TEST_ENGINE_ITEM_INFO, ImGuiButtonFlags_AllowItemOverlap, ImGuiButtonFlags_Disabled, ImGuiButtonFlags_NoHoldingActiveId, ImGuiButtonFlags_PressedOnClick, ImGuiButtonFlags_PressedOnClickRelease, ImGuiButtonFlags_PressedOnDoubleClick, ImGuiButtonFlags_PressedOnRelease, ImGuiCol_Header, ImGuiCol_HeaderActive, ImGuiCol_HeaderHovered, ImGuiCol_Text, ImGuiCol_TextDisabled, ImGuiItemFlags_Disabled, ImGuiItemFlags_NoNavDefaultFocus, ImGuiItemFlags_SelectableDontClosePopup, ImGuiItemStatusFlags_ToggledSelection, ImGuiNavHighlightFlags_NoRounding, ImGuiNavHighlightFlags_TypeThin, ImGuiSelectableFlags_AllowDoubleClick, ImGuiSelectableFlags_AllowItemOverlap, ImGuiSelectableFlags_Disabled, ImGuiSelectableFlags_DontClosePopups, ImGuiSelectableFlags_DrawHoveredWhenHeld, ImGuiSelectableFlags_NoHoldingActiveID, ImGuiSelectableFlags_NoPadWithHalfSpacing, ImGuiSelectableFlags_SelectOnClick, ImGuiSelectableFlags_SelectOnRelease, ImGuiSelectableFlags_SetNavIdOnHover, ImGuiSelectableFlags_SpanAllColumns, ImGuiSelectableFlags_SpanAvailWidth, ImGuiWindowFlags_Popup, ImMax(), ItemAdd(), ItemSize(), ImGuiWindowTempData::LastItemStatusFlags, MarkItemEdited(), ImRect::Max, ImRect::Min, ImGuiContext::NavDisableHighlight, ImGuiContext::NavDisableMouseHover, ImGuiWindowTempData::NavFocusScopeIdCurrent, ImGuiContext::NavLayer, ImGuiWindowTempData::NavLayerCurrent, ImGuiContext::NavWindow, ImGuiWindow::ParentWorkRect, PopColumnsBackground(), PopStyleColor(), ImGuiWindow::Pos, PushColumnsBackground(), PushStyleColor(), RenderFrame(), RenderNavHighlight(), RenderTextClipped(), SetItemAllowOverlap(), SetNavID(), ImGuiWindow::SkipItems, ImGuiContext::Style, style, TablePopBackgroundChannel(), TablePushBackgroundChannel(), ImGuiWindow::WorkRect, ImVec2::x, and ImVec2::y.

Referenced by Slic3r::GUI::GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(), BeginMenu(), ColorEditOptionsPopup(), ColorPickerOptionsPopup(), Slic3r::GUI::ImGuiWrapper::combo(), DebugNodeDrawList(), DebugNodeTable(), ExampleAppConsole::Draw(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), EditTableSizingFlags(), MenuItem(), NavUpdateWindowingOverlay(), Slic3r::GUI::render_extruders_combo(), Selectable(), ShowDemoWindowColumns(), ShowDemoWindowLayout(), ShowDemoWindowMisc(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppLayout(), ShowFontSelector(), ShowMetricsWindow(), TabBarTabListPopupButton(), and Slic3r::GUI::ImGuiWrapper::undo_redo_list().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Separator()

void ImGui::Separator ( )
1420{
1421 ImGuiContext& g = *GImGui;
1422 ImGuiWindow* window = g.CurrentWindow;
1423 if (window->SkipItems)
1424 return;
1425
1426 // Those flags should eventually be overridable by the user
1429 SeparatorEx(flags);
1430}
@ ImGuiSeparatorFlags_Horizontal
Definition imgui_internal.h:827
@ ImGuiSeparatorFlags_SpanAllColumns
Definition imgui_internal.h:829
@ ImGuiSeparatorFlags_Vertical
Definition imgui_internal.h:828
int ImGuiSeparatorFlags
Definition imgui_internal.h:151
IMGUI_API void SeparatorEx(ImGuiSeparatorFlags flags)
Definition imgui_widgets.cpp:1359

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, ImGuiLayoutType_Horizontal, ImGuiSeparatorFlags_Horizontal, ImGuiSeparatorFlags_SpanAllColumns, ImGuiSeparatorFlags_Vertical, ImGuiWindowTempData::LayoutType, SeparatorEx(), and ImGuiWindow::SkipItems.

Referenced by Slic3r::GUI::GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(), Slic3r::GUI::GLCanvas3D::_picking_pass(), Slic3r::GUI::GLCanvas3D::_render_arrange_menu(), ColorEditOptionsPopup(), ColorPickerOptionsPopup(), ColorTooltip(), ExampleAppConsole::Draw(), ExampleAppLog::Draw(), Slic3r::GUI::GLGizmoEmboss::draw_window(), EditTableSizingFlags(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GLGizmoHollow::on_render_input_window(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), Slic3r::GUI::GLGizmoSeam::on_render_input_window(), Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), Slic3r::GUI::GLGizmoSlaSupports::on_render_input_window(), Slic3r::GUI::GLCanvas3D::render(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GLGizmoCut3D::render_connectors_input_window(), Slic3r::GUI::GLGizmoCut3D::render_cut_plane_input_window(), Slic3r::GUI::GLGizmoCut3D::render_debug_input_window(), Slic3r::GUI::GCodeViewer::render_legend(), Slic3r::GUI::GLCanvas3D::LayersEditing::render_overlay(), Slic3r::GUI::Mouse3DController::render_settings_dialog(), ShowAboutWindow(), ShowDemoWindow(), ShowDemoWindowColumns(), ShowDemoWindowLayout(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppDocuments(), ShowExampleAppLayout(), ShowExampleAppMainMenuBar(), ShowExampleAppSimpleOverlay(), ShowExampleMenuFile(), ShowFont(), ShowMetricsWindow(), ShowStyleEditor(), TableDrawContextMenu(), and Slic3r::GUI::ImGuiWrapper::title().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SeparatorEx()

void ImGui::SeparatorEx ( ImGuiSeparatorFlags  flags)
1360{
1361 ImGuiWindow* window = GetCurrentWindow();
1362 if (window->SkipItems)
1363 return;
1364
1365 ImGuiContext& g = *GImGui;
1366 IM_ASSERT(ImIsPowerOfTwo(flags & (ImGuiSeparatorFlags_Horizontal | ImGuiSeparatorFlags_Vertical))); // Check that only 1 option is selected
1367
1368 float thickness_draw = 1.0f;
1369 float thickness_layout = 0.0f;
1370 if (flags & ImGuiSeparatorFlags_Vertical)
1371 {
1372 // Vertical separator, for menu bars (use current line height). Not exposed because it is misleading and it doesn't have an effect on regular layout.
1373 float y1 = window->DC.CursorPos.y;
1374 float y2 = window->DC.CursorPos.y + window->DC.CurrLineSize.y;
1375 const ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + thickness_draw, y2));
1376 ItemSize(ImVec2(thickness_layout, 0.0f));
1377 if (!ItemAdd(bb, 0))
1378 return;
1379
1380 // Draw
1381 window->DrawList->AddLine(ImVec2(bb.Min.x, bb.Min.y), ImVec2(bb.Min.x, bb.Max.y), GetColorU32(ImGuiCol_Separator));
1382 if (g.LogEnabled)
1383 LogText(" |");
1384 }
1385 else if (flags & ImGuiSeparatorFlags_Horizontal)
1386 {
1387 // Horizontal Separator
1388 float x1 = window->Pos.x;
1389 float x2 = window->Pos.x + window->Size.x;
1390
1391 // FIXME-WORKRECT: old hack (#205) until we decide of consistent behavior with WorkRect/Indent and Separator
1392 if (g.GroupStack.Size > 0 && g.GroupStack.back().WindowID == window->ID)
1393 x1 += window->DC.Indent.x;
1394
1395 ImGuiOldColumns* columns = (flags & ImGuiSeparatorFlags_SpanAllColumns) ? window->DC.CurrentColumns : NULL;
1396 if (columns)
1397 PushColumnsBackground();
1398
1399 // We don't provide our width to the layout so that it doesn't get feed back into AutoFit
1400 const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y + thickness_draw));
1401 ItemSize(ImVec2(0.0f, thickness_layout));
1402 const bool item_visible = ItemAdd(bb, 0);
1403 if (item_visible)
1404 {
1405 // Draw
1406 window->DrawList->AddLine(bb.Min, ImVec2(bb.Max.x, bb.Min.y), GetColorU32(ImGuiCol_Separator));
1407 if (g.LogEnabled)
1408 LogRenderedText(&bb.Min, "--------------------------------\n");
1409
1410 }
1411 if (columns)
1412 {
1414 columns->LineMinY = window->DC.CursorPos.y;
1415 }
1416 }
1417}

References ImDrawList::AddLine(), ImVector< T >::back(), ImGuiWindowTempData::CurrentColumns, ImGuiWindowTempData::CurrLineSize, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiWindow::DrawList, GetColorU32(), GetCurrentWindow(), GImGui, ImGuiContext::GroupStack, ImGuiWindow::ID, IM_ASSERT, ImGuiCol_Separator, ImGuiSeparatorFlags_Horizontal, ImGuiSeparatorFlags_SpanAllColumns, ImGuiSeparatorFlags_Vertical, ImIsPowerOfTwo(), ImGuiWindowTempData::Indent, ItemAdd(), ItemSize(), ImGuiOldColumns::LineMinY, ImGuiContext::LogEnabled, LogRenderedText(), LogText(), ImRect::Max, ImRect::Min, PopColumnsBackground(), ImGuiWindow::Pos, PushColumnsBackground(), ImVector< T >::Size, ImGuiWindow::Size, ImGuiWindow::SkipItems, ImGuiGroupData::WindowID, ImVec2::x, ImVec1::x, and ImVec2::y.

Referenced by Separator().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetActiveID()

void ImGui::SetActiveID ( ImGuiID  id,
ImGuiWindow window 
)
3050{
3051 ImGuiContext& g = *GImGui;
3052 g.ActiveIdIsJustActivated = (g.ActiveId != id);
3054 {
3055 g.ActiveIdTimer = 0.0f;
3058 g.ActiveIdMouseButton = -1;
3059 if (id != 0)
3060 {
3061 g.LastActiveId = id;
3062 g.LastActiveIdTimer = 0.0f;
3063 }
3064 }
3065 g.ActiveId = id;
3066 g.ActiveIdAllowOverlap = false;
3068 g.ActiveIdWindow = window;
3070 if (id)
3071 {
3072 g.ActiveIdIsAlive = id;
3074 }
3075
3076 // Clear declaration of inputs claimed by the widget
3077 // (Please note that this is WIP and not all keys/inputs are thoroughly declared by all widgets yet)
3078 g.ActiveIdUsingMouseWheel = false;
3079 g.ActiveIdUsingNavDirMask = 0x00;
3082}
bool ActiveIdUsingMouseWheel
Definition imgui_internal.h:1407
ImGuiID LastActiveId
Definition imgui_internal.h:1419

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdAllowOverlap, ImGuiContext::ActiveIdHasBeenEditedBefore, ImGuiContext::ActiveIdHasBeenEditedThisFrame, ImGuiContext::ActiveIdHasBeenPressedBefore, ImGuiContext::ActiveIdIsAlive, ImGuiContext::ActiveIdIsJustActivated, ImGuiContext::ActiveIdMouseButton, ImGuiContext::ActiveIdNoClearOnFocusLoss, ImGuiContext::ActiveIdSource, ImGuiContext::ActiveIdTimer, ImGuiContext::ActiveIdUsingKeyInputMask, ImGuiContext::ActiveIdUsingMouseWheel, ImGuiContext::ActiveIdUsingNavDirMask, ImGuiContext::ActiveIdUsingNavInputMask, ImGuiContext::ActiveIdWindow, GImGui, ImGuiInputSource_Mouse, ImGuiInputSource_Nav, ImGuiContext::LastActiveId, ImGuiContext::LastActiveIdTimer, ImGuiContext::NavActivateId, ImGuiContext::NavInputId, ImGuiContext::NavJustMovedToId, and ImGuiContext::NavJustTabbedId.

Referenced by BeginChildEx(), BeginDragDropSource(), ButtonBehavior(), ClearActiveID(), DragScalar(), InputTextEx(), SliderScalar(), StartMouseMovingWindow(), and VSliderScalar().

+ Here is the caller graph for this function:

◆ SetAllocatorFunctions()

void ImGui::SetAllocatorFunctions ( ImGuiMemAllocFunc  alloc_func,
ImGuiMemFreeFunc  free_func,
void user_data = NULL 
)
3376{
3379 GImAllocatorUserData = user_data;
3380}
#define alloc_func
Definition miniz.h:439
#define free_func
Definition miniz.h:440

References alloc_func, free_func, GImAllocatorAllocFunc, GImAllocatorFreeFunc, and GImAllocatorUserData.

◆ SetClipboardText()

void ImGui::SetClipboardText ( const char *  text)
3348{
3349 ImGuiContext& g = *GImGui;
3350 if (g.IO.SetClipboardTextFn)
3352}

References ImGuiIO::ClipboardUserData, GImGui, ImGuiContext::IO, and ImGuiIO::SetClipboardTextFn.

Referenced by ColorEditOptionsPopup(), InputTextEx(), and LogFinish().

+ Here is the caller graph for this function:

◆ SetColorEditOptions()

void ImGui::SetColorEditOptions ( ImGuiColorEditFlags  flags)
5419{
5420 ImGuiContext& g = *GImGui;
5421 if ((flags & ImGuiColorEditFlags__DisplayMask) == 0)
5423 if ((flags & ImGuiColorEditFlags__DataTypeMask) == 0)
5425 if ((flags & ImGuiColorEditFlags__PickerMask) == 0)
5427 if ((flags & ImGuiColorEditFlags__InputMask) == 0)
5429 IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags__DisplayMask)); // Check only 1 option is selected
5430 IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags__DataTypeMask)); // Check only 1 option is selected
5431 IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags__PickerMask)); // Check only 1 option is selected
5432 IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags__InputMask)); // Check only 1 option is selected
5433 g.ColorEditOptions = flags;
5434}

References ImGuiContext::ColorEditOptions, GImGui, IM_ASSERT, ImGuiColorEditFlags__DataTypeMask, ImGuiColorEditFlags__DisplayMask, ImGuiColorEditFlags__InputMask, ImGuiColorEditFlags__OptionsDefault, ImGuiColorEditFlags__PickerMask, and ImIsPowerOfTwo().

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetColumnOffset()

void ImGui::SetColumnOffset ( int  column_index,
float  offset_x 
)
3705{
3706 ImGuiContext& g = *GImGui;
3707 ImGuiWindow* window = g.CurrentWindow;
3708 ImGuiOldColumns* columns = window->DC.CurrentColumns;
3709 IM_ASSERT(columns != NULL);
3710
3711 if (column_index < 0)
3712 column_index = columns->Current;
3713 IM_ASSERT(column_index < columns->Columns.Size);
3714
3715 const bool preserve_width = !(columns->Flags & ImGuiOldColumnFlags_NoPreserveWidths) && (column_index < columns->Count - 1);
3716 const float width = preserve_width ? GetColumnWidthEx(columns, column_index, columns->IsBeingResized) : 0.0f;
3717
3719 offset = ImMin(offset, columns->OffMaxX - g.Style.ColumnsMinSpacing * (columns->Count - column_index));
3720 columns->Columns[column_index].OffsetNorm = GetColumnNormFromOffset(columns, offset - columns->OffMinX);
3721
3722 if (preserve_width)
3723 SetColumnOffset(column_index + 1, offset + ImMax(g.Style.ColumnsMinSpacing, width));
3724}
@ ImGuiOldColumnFlags_NoPreserveWidths
Definition imgui_internal.h:1159
@ ImGuiOldColumnFlags_NoForceWithinWindow
Definition imgui_internal.h:1160
static float GetColumnWidthEx(ImGuiOldColumns *columns, int column_index, bool before_resize=false)
Definition imgui_tables.cpp:3678
IMGUI_API float GetColumnNormFromOffset(const ImGuiOldColumns *columns, float offset)
Definition imgui_tables.cpp:3638
float ColumnsMinSpacing
Definition imgui.h:1741

References Columns(), ImGuiOldColumns::Columns, ImGuiStyle::ColumnsMinSpacing, ImGuiOldColumns::Count, ImGuiOldColumns::Current, ImGuiWindowTempData::CurrentColumns, ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiOldColumns::Flags, GetColumnNormFromOffset(), GetColumnWidthEx(), GImGui, IM_ASSERT, ImGuiOldColumnFlags_NoForceWithinWindow, ImGuiOldColumnFlags_NoPreserveWidths, ImMax(), ImMin(), ImGuiOldColumns::IsBeingResized, ImGuiOldColumns::OffMaxX, ImGuiOldColumns::OffMinX, SetColumnOffset(), and ImGuiContext::Style.

Referenced by EndColumns(), SetColumnOffset(), and SetColumnWidth().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetColumnWidth()

void ImGui::SetColumnWidth ( int  column_index,
float  width 
)
3727{
3729 ImGuiOldColumns* columns = window->DC.CurrentColumns;
3730 IM_ASSERT(columns != NULL);
3731
3732 if (column_index < 0)
3733 column_index = columns->Current;
3734 SetColumnOffset(column_index + 1, GetColumnOffset(column_index) + width);
3735}

References ImGuiOldColumns::Current, ImGuiWindowTempData::CurrentColumns, ImGuiWindow::DC, GetColumnOffset(), GetCurrentWindowRead(), IM_ASSERT, and SetColumnOffset().

+ Here is the call graph for this function:

◆ SetCurrentContext()

void ImGui::SetCurrentContext ( ImGuiContext ctx)
3367{
3368#ifdef IMGUI_SET_CURRENT_CONTEXT_FUNC
3369 IMGUI_SET_CURRENT_CONTEXT_FUNC(ctx); // For custom thread-based hackery you may want to have control over this.
3370#else
3371 GImGui = ctx;
3372#endif
3373}

References GImGui.

Referenced by CreateContext(), DestroyContext(), and Shutdown().

+ Here is the caller graph for this function:

◆ SetCurrentFont()

void ImGui::SetCurrentFont ( ImFont font)
6517{
6518 ImGuiContext& g = *GImGui;
6519 IM_ASSERT(font && font->IsLoaded()); // Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ?
6520 IM_ASSERT(font->Scale > 0.0f);
6521 g.Font = font;
6522 g.FontBaseSize = ImMax(1.0f, g.IO.FontGlobalScale * g.Font->FontSize * g.Font->Scale);
6524
6525 ImFontAtlas* atlas = g.Font->ContainerAtlas;
6530}
const ImVec4 * TexUvLines
Definition imgui_internal.h:698
ImVec4 TexUvLines[IM_DRAWLIST_TEX_LINES_WIDTH_MAX+1]
Definition imgui.h:2671
ImVec2 TexUvWhitePixel
Definition imgui.h:2667
float FontBaseSize
Definition imgui_internal.h:1358
float FontGlobalScale
Definition imgui.h:1796

References ImGuiWindow::CalcFontSize(), ImFont::ContainerAtlas, ImGuiContext::CurrentWindow, ImGuiContext::DrawListSharedData, ImDrawListSharedData::Font, ImGuiContext::Font, ImGuiContext::FontBaseSize, ImGuiIO::FontGlobalScale, ImFont::FontSize, ImDrawListSharedData::FontSize, ImGuiContext::FontSize, GImGui, IM_ASSERT, ImMax(), ImGuiContext::IO, ImFont::IsLoaded(), ImFont::Scale, ImFontAtlas::TexUvLines, ImDrawListSharedData::TexUvLines, ImFontAtlas::TexUvWhitePixel, and ImDrawListSharedData::TexUvWhitePixel.

Referenced by NewFrame(), PopFont(), and PushFont().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetCursorPos()

void ImGui::SetCursorPos ( const ImVec2 local_pos)
7512{
7513 ImGuiWindow* window = GetCurrentWindow();
7514 window->DC.CursorPos = window->Pos - window->Scroll + local_pos;
7515 window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos);
7516}

References ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetCurrentWindow(), ImMax(), ImGuiWindow::Pos, and ImGuiWindow::Scroll.

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_text_input().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetCursorPosX()

void ImGui::SetCursorPosX ( float  local_x)
7519{
7520 ImGuiWindow* window = GetCurrentWindow();
7521 window->DC.CursorPos.x = window->Pos.x - window->Scroll.x + x;
7522 window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPos.x);
7523}

References ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetCurrentWindow(), ImMax(), ImGuiWindow::Pos, ImGuiWindow::Scroll, and ImVec2::x.

Referenced by Slic3r::GUI::GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(), EditTableSizingFlags(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::NotificationManager::ProgressBarNotification::render_bar(), Slic3r::GUI::NotificationManager::ProgressBarWithCancelNotification::render_bar(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_bar(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_bar(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressBarWithCancelNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::PopNotification::render_close_button(), Slic3r::GUI::NotificationManager::HintNotification::render_close_button(), Slic3r::GUI::NotificationManager::ProgressBarWithCancelNotification::render_close_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_close_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_documentation_button(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_eject_button(), Slic3r::GUI::NotificationManager::PopNotification::render_hypertext(), Slic3r::GUI::NotificationManager::PopNotification::render_left_sign(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_left_sign(), Slic3r::GUI::NotificationManager::HintNotification::render_logo(), Slic3r::GUI::NotificationManager::PopNotification::render_minimize_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_open_button_inner(), Slic3r::GUI::GLCanvas3D::LayersEditing::render_overlay(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_pause_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_preferences_button(), Slic3r::GUI::NotificationManager::HintNotification::render_right_arrow_button(), Slic3r::GUI::NotificationManager::PopNotification::render_text(), Slic3r::GUI::NotificationManager::HintNotification::render_text(), Slic3r::GUI::NotificationManager::ProgressBarNotification::render_text(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_text(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_text(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_text(), ShowDemoWindowLayout(), and TreeAdvanceToLabelPos().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetCursorPosY()

void ImGui::SetCursorPosY ( float  local_y)
7526{
7527 ImGuiWindow* window = GetCurrentWindow();
7528 window->DC.CursorPos.y = window->Pos.y - window->Scroll.y + y;
7529 window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y);
7530}

References ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetCurrentWindow(), ImMax(), ImGuiWindow::Pos, ImGuiWindow::Scroll, and ImVec2::y.

Referenced by Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::NotificationManager::ProgressBarNotification::render_bar(), Slic3r::GUI::NotificationManager::ProgressBarWithCancelNotification::render_bar(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_bar(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_bar(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressBarWithCancelNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::PopNotification::render_close_button(), Slic3r::GUI::NotificationManager::HintNotification::render_close_button(), Slic3r::GUI::NotificationManager::ProgressBarWithCancelNotification::render_close_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_close_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_documentation_button(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_eject_button(), Slic3r::GUI::NotificationManager::PopNotification::render_hypertext(), Slic3r::GUI::NotificationManager::PopNotification::render_left_sign(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_left_sign(), Slic3r::GUI::NotificationManager::HintNotification::render_logo(), Slic3r::GUI::NotificationManager::PopNotification::render_minimize_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_open_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_pause_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_preferences_button(), Slic3r::GUI::NotificationManager::HintNotification::render_right_arrow_button(), Slic3r::GUI::NotificationManager::PopNotification::render_text(), Slic3r::GUI::NotificationManager::HintNotification::render_text(), Slic3r::GUI::NotificationManager::ProgressBarNotification::render_text(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_text(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_text(), and Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_text().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetCursorScreenPos()

void ImGui::SetCursorScreenPos ( const ImVec2 pos)
7485{
7486 ImGuiWindow* window = GetCurrentWindow();
7487 window->DC.CursorPos = pos;
7488 window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos);
7489}

References ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetCurrentWindow(), and ImMax().

Referenced by ColorPicker4(), ColorPickerOptionsPopup(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), and Slic3r::GUI::render_extruders_combo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDragDropPayload()

bool ImGui::SetDragDropPayload ( const char *  type,
const void data,
size_t  sz,
ImGuiCond  cond = 0 
)
9906{
9907 ImGuiContext& g = *GImGui;
9908 ImGuiPayload& payload = g.DragDropPayload;
9909 if (cond == 0)
9910 cond = ImGuiCond_Always;
9911
9912 IM_ASSERT(type != NULL);
9913 IM_ASSERT(strlen(type) < IM_ARRAYSIZE(payload.DataType) && "Payload type can be at most 32 characters long");
9914 IM_ASSERT((data != NULL && data_size > 0) || (data == NULL && data_size == 0));
9915 IM_ASSERT(cond == ImGuiCond_Always || cond == ImGuiCond_Once);
9916 IM_ASSERT(payload.SourceId != 0); // Not called between BeginDragDropSource() and EndDragDropSource()
9917
9918 if (cond == ImGuiCond_Always || payload.DataFrameCount == -1)
9919 {
9920 // Copy payload
9921 ImStrncpy(payload.DataType, type, IM_ARRAYSIZE(payload.DataType));
9923 if (data_size > sizeof(g.DragDropPayloadBufLocal))
9924 {
9925 // Store in heap
9926 g.DragDropPayloadBufHeap.resize((int)data_size);
9927 payload.Data = g.DragDropPayloadBufHeap.Data;
9928 memcpy(payload.Data, data, data_size);
9929 }
9930 else if (data_size > 0)
9931 {
9932 // Store locally
9933 memset(&g.DragDropPayloadBufLocal, 0, sizeof(g.DragDropPayloadBufLocal));
9934 payload.Data = g.DragDropPayloadBufLocal;
9935 memcpy(payload.Data, data, data_size);
9936 }
9937 else
9938 {
9939 payload.Data = NULL;
9940 }
9941 payload.DataSize = (int)data_size;
9942 }
9943 payload.DataFrameCount = g.FrameCount;
9944
9946}
int DataSize
Definition imgui.h:1960
char DataType[32+1]
Definition imgui.h:1966
void * Data
Definition imgui.h:1959

References ImVector< T >::Data, ImGuiPayload::Data, ImGuiPayload::DataFrameCount, ImGuiPayload::DataSize, ImGuiPayload::DataType, ImGuiContext::DragDropAcceptFrameCount, ImGuiContext::DragDropPayload, ImGuiContext::DragDropPayloadBufHeap, ImGuiContext::DragDropPayloadBufLocal, ImGuiContext::FrameCount, GImGui, IM_ARRAYSIZE, IM_ASSERT, ImGuiCond_Always, ImGuiCond_Once, ImStrncpy(), ImVector< T >::resize(), and ImGuiPayload::SourceId.

Referenced by ColorButton(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetFocusID()

void ImGui::SetFocusID ( ImGuiID  id,
ImGuiWindow window 
)
8595{
8596 ImGuiContext& g = *GImGui;
8597 IM_ASSERT(id != 0);
8598
8599 // Assume that SetFocusID() is called in the context where its window->DC.NavLayerCurrent and window->DC.NavFocusScopeIdCurrent are valid.
8600 // Note that window may be != g.CurrentWindow (e.g. SetFocusID call in InputTextEx for multi-line text)
8601 const ImGuiNavLayer nav_layer = window->DC.NavLayerCurrent;
8602 if (g.NavWindow != window)
8603 g.NavInitRequest = false;
8604 g.NavWindow = window;
8605 g.NavId = id;
8606 g.NavLayer = nav_layer;
8608 window->NavLastIds[nav_layer] = id;
8609 if (window->DC.LastItemId == id)
8610 window->NavRectRel[nav_layer] = ImRect(window->DC.LastItemRect.Min - window->Pos, window->DC.LastItemRect.Max - window->Pos);
8611
8613 g.NavDisableMouseHover = true;
8614 else
8615 g.NavDisableHighlight = true;
8616}

References ImGuiContext::ActiveIdSource, ImGuiWindow::DC, GImGui, IM_ASSERT, ImGuiInputSource_Nav, ImGuiWindowTempData::LastItemId, ImGuiWindowTempData::LastItemRect, ImRect::Max, ImRect::Min, ImGuiContext::NavDisableHighlight, ImGuiContext::NavDisableMouseHover, ImGuiContext::NavFocusScopeId, ImGuiWindowTempData::NavFocusScopeIdCurrent, ImGuiContext::NavId, ImGuiContext::NavInitRequest, ImGuiWindow::NavLastIds, ImGuiContext::NavLayer, ImGuiWindowTempData::NavLayerCurrent, ImGuiWindow::NavRectRel, ImGuiContext::NavWindow, and ImGuiWindow::Pos.

Referenced by ButtonBehavior(), DragScalar(), InputTextEx(), SliderScalar(), and VSliderScalar().

+ Here is the caller graph for this function:

◆ SetHoveredID()

void ImGui::SetHoveredID ( ImGuiID  id)
3090{
3091 ImGuiContext& g = *GImGui;
3092 g.HoveredId = id;
3093 g.HoveredIdAllowOverlap = false;
3094 g.HoveredIdUsingMouseWheel = false;
3095 if (id != 0 && g.HoveredIdPreviousFrame != id)
3097}

References GImGui, ImGuiContext::HoveredId, ImGuiContext::HoveredIdAllowOverlap, ImGuiContext::HoveredIdNotActiveTimer, ImGuiContext::HoveredIdPreviousFrame, ImGuiContext::HoveredIdTimer, and ImGuiContext::HoveredIdUsingMouseWheel.

Referenced by ButtonBehavior(), ItemHoverable(), and ScrollbarEx().

+ Here is the caller graph for this function:

◆ SetItemAllowOverlap()

void ImGui::SetItemAllowOverlap ( )
4932{
4933 ImGuiContext& g = *GImGui;
4935 if (g.HoveredId == id)
4936 g.HoveredIdAllowOverlap = true;
4937 if (g.ActiveId == id)
4938 g.ActiveIdAllowOverlap = true;
4939}

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdAllowOverlap, ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, ImGuiContext::HoveredId, ImGuiContext::HoveredIdAllowOverlap, and ImGuiWindowTempData::LastItemId.

Referenced by Slic3r::GUI::selectable(), Selectable(), SplitterBehavior(), TabItemEx(), TableHeader(), and TreeNodeBehavior().

+ Here is the caller graph for this function:

◆ SetItemDefaultFocus()

void ImGui::SetItemDefaultFocus ( )
6990{
6991 ImGuiContext& g = *GImGui;
6992 ImGuiWindow* window = g.CurrentWindow;
6993 if (!window->Appearing)
6994 return;
6995 if (g.NavWindow == window->RootWindowForNav && (g.NavInitRequest || g.NavInitResultId != 0) && g.NavLayer == window->DC.NavLayerCurrent)
6996 {
6997 g.NavInitRequest = false;
6998 g.NavInitResultId = window->DC.LastItemId;
6999 g.NavInitResultRectRel = ImRect(window->DC.LastItemRect.Min - window->Pos, window->DC.LastItemRect.Max - window->Pos);
7001 if (!IsItemVisible())
7003 }
7004}
IMGUI_API void SetScrollHereY(float center_y_ratio=0.5f)
Definition imgui.cpp:7992

References ImGuiWindow::Appearing, ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, IsItemVisible(), ImGuiWindowTempData::LastItemId, ImGuiWindowTempData::LastItemRect, ImRect::Max, ImRect::Min, ImGuiContext::NavInitRequest, ImGuiContext::NavInitResultId, ImGuiContext::NavInitResultRectRel, ImGuiContext::NavLayer, ImGuiWindowTempData::NavLayerCurrent, NavUpdateAnyRequestFlag(), ImGuiContext::NavWindow, ImGuiWindow::Pos, ImGuiWindow::RootWindowForNav, and SetScrollHereY().

Referenced by ExampleAppConsole::Draw(), ShowDemoWindowPopups(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetItemUsingMouseWheel()

◆ SetKeyboardFocusHere()

void ImGui::SetKeyboardFocusHere ( int  offset = 0)
6980{
6981 IM_ASSERT(offset >= -1); // -1 is allowed but not below
6982 ImGuiContext& g = *GImGui;
6983 ImGuiWindow* window = g.CurrentWindow;
6984 g.TabFocusRequestNextWindow = window;
6987}
int TabFocusRequestNextCounterRegular
Definition imgui_internal.h:1491

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiWindowTempData::FocusCounterRegular, GImGui, IM_ASSERT, ImGuiContext::TabFocusRequestNextCounterRegular, ImGuiContext::TabFocusRequestNextCounterTabStop, and ImGuiContext::TabFocusRequestNextWindow.

Referenced by ExampleAppConsole::Draw(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::ImGuiWrapper::search_list(), ShowDemoWindowMisc(), and Slic3r::GUI::ImGuiWrapper::slider_float().

+ Here is the caller graph for this function:

◆ SetLastItemData()

void ImGui::SetLastItemData ( ImGuiWindow window,
ImGuiID  item_id,
ImGuiItemStatusFlags  status_flags,
const ImRect item_rect 
)
3248{
3249 window->DC.LastItemId = item_id;
3250 window->DC.LastItemStatusFlags = item_flags;
3251 window->DC.LastItemRect = item_rect;
3252}

References ImGuiWindow::DC, ImGuiWindowTempData::LastItemId, ImGuiWindowTempData::LastItemRect, and ImGuiWindowTempData::LastItemStatusFlags.

Referenced by Begin().

+ Here is the caller graph for this function:

◆ SetMouseCursor()

void ImGui::SetMouseCursor ( ImGuiMouseCursor  cursor_type)
4817{
4818 GImGui->MouseCursor = cursor_type;
4819}

References GImGui, and ImGuiContext::MouseCursor.

Referenced by ShowDemoWindowMisc(), SplitterBehavior(), TableUpdateBorders(), and UpdateDebugToolItemPicker().

+ Here is the caller graph for this function:

◆ SetNavID()

void ImGui::SetNavID ( ImGuiID  id,
ImGuiNavLayer  nav_layer,
ImGuiID  focus_scope_id,
const ImRect rect_rel 
)
8581{
8582 ImGuiContext& g = *GImGui;
8583 IM_ASSERT(g.NavWindow != NULL);
8584 IM_ASSERT(nav_layer == ImGuiNavLayer_Main || nav_layer == ImGuiNavLayer_Menu);
8585 g.NavId = id;
8586 g.NavLayer = nav_layer;
8587 g.NavFocusScopeId = focus_scope_id;
8588 g.NavWindow->NavLastIds[nav_layer] = id;
8589 g.NavWindow->NavRectRel[nav_layer] = rect_rel;
8590 //g.NavDisableHighlight = false;
8591 //g.NavDisableMouseHover = g.NavMousePosDirty = true;
8592}

References GImGui, IM_ASSERT, ImGuiNavLayer_Main, ImGuiNavLayer_Menu, ImGuiContext::NavFocusScopeId, ImGuiContext::NavId, ImGuiWindow::NavLastIds, ImGuiContext::NavLayer, ImGuiWindow::NavRectRel, and ImGuiContext::NavWindow.

Referenced by EndMenuBar(), NavInitWindow(), NavRestoreLayer(), NavUpdate(), NavUpdateInitResult(), NavUpdateMoveResult(), Slic3r::GUI::selectable(), Selectable(), and TreePop().

+ Here is the caller graph for this function:

◆ SetNextItemOpen()

void ImGui::SetNextItemOpen ( bool  is_open,
ImGuiCond  cond = 0 
)
5949{
5950 ImGuiContext& g = *GImGui;
5951 if (g.CurrentWindow->SkipItems)
5952 return;
5954 g.NextItemData.OpenVal = is_open;
5955 g.NextItemData.OpenCond = cond ? cond : ImGuiCond_Always;
5956}
@ ImGuiNextItemDataFlags_HasOpen
Definition imgui_internal.h:1119
bool OpenVal
Definition imgui_internal.h:1128
ImGuiCond OpenCond
Definition imgui_internal.h:1127

References ImGuiContext::CurrentWindow, ImGuiNextItemData::Flags, GImGui, ImGuiCond_Always, ImGuiNextItemDataFlags_HasOpen, ImGuiContext::NextItemData, ImGuiNextItemData::OpenCond, ImGuiNextItemData::OpenVal, and ImGuiWindow::SkipItems.

Referenced by DebugNodeViewport(), SetNextTreeNodeOpen(), ShowDemoWindowTables(), and ShowDemoWindowWidgets().

+ Here is the caller graph for this function:

◆ SetNextItemWidth()

◆ SetNextTreeNodeOpen()

static void ImGui::SetNextTreeNodeOpen ( bool  open,
ImGuiCond  cond = 0 
)
inlinestatic
2810{ SetNextItemOpen(open, cond); }

References SetNextItemOpen(), and SetNextTreeNodeOpen().

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_window(), and SetNextTreeNodeOpen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetNextWindowBgAlpha()

◆ SetNextWindowCollapsed()

void ImGui::SetNextWindowCollapsed ( bool  collapsed,
ImGuiCond  cond = 0 
)
6905{
6906 ImGuiContext& g = *GImGui;
6907 IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
6909 g.NextWindowData.CollapsedVal = collapsed;
6911}

References ImGuiNextWindowData::CollapsedCond, ImGuiNextWindowData::CollapsedVal, ImGuiNextWindowData::Flags, GImGui, IM_ASSERT, ImGuiCond_Always, ImGuiNextWindowDataFlags_HasCollapsed, ImIsPowerOfTwo(), and ImGuiContext::NextWindowData.

+ Here is the call graph for this function:

◆ SetNextWindowContentSize()

void ImGui::SetNextWindowContentSize ( const ImVec2 size)

References ImGuiNextWindowData::ContentSizeVal, ImGuiNextWindowData::Flags, GImGui, ImFloor(), ImGuiNextWindowDataFlags_HasContentSize, and ImGuiContext::NextWindowData.

Referenced by BeginTableEx(), ShowDemoWindowColumns(), and ShowDemoWindowLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetNextWindowFocus()

◆ SetNextWindowPos()

void ImGui::SetNextWindowPos ( const ImVec2 pos,
ImGuiCond  cond = 0,
const ImVec2 pivot = ImVec2(0, 0) 
)
6861{
6862 ImGuiContext& g = *GImGui;
6863 IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
6865 g.NextWindowData.PosVal = pos;
6866 g.NextWindowData.PosPivotVal = pivot;
6867 g.NextWindowData.PosCond = cond ? cond : ImGuiCond_Always;
6868}

References ImGuiNextWindowData::Flags, GImGui, IM_ASSERT, ImGuiCond_Always, ImGuiNextWindowDataFlags_HasPos, ImIsPowerOfTwo(), ImGuiContext::NextWindowData, ImGuiNextWindowData::PosCond, ImGuiNextWindowData::PosPivotVal, and ImGuiNextWindowData::PosVal.

Referenced by BeginCombo(), BeginMenu(), BeginPopupModal(), BeginTooltipEx(), BeginViewportSideBar(), ColorEdit4(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), igl::opengl::glfw::imgui::ImGuiMenu::draw_labels_window(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_window(), NavUpdateWindowingOverlay(), Slic3r::GUI::GLGizmoEmboss::on_render_input_window(), Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), Slic3r::GUI::GLCanvas3D::SLAView::render_switch_button(), Slic3r::GUI::ImGuiWrapper::set_next_window_pos(), ShowDemoWindow(), ShowDemoWindowPopups(), ShowExampleAppFullscreen(), ShowExampleAppSimpleOverlay(), ShowExampleAppWindowTitles(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetNextWindowScroll()

void ImGui::SetNextWindowScroll ( const ImVec2 scroll)

References ImGuiNextWindowData::Flags, GImGui, ImGuiNextWindowDataFlags_HasScroll, ImGuiContext::NextWindowData, and ImGuiNextWindowData::ScrollVal.

Referenced by BeginTableEx().

+ Here is the caller graph for this function:

◆ SetNextWindowSize()

void ImGui::SetNextWindowSize ( const ImVec2 size,
ImGuiCond  cond = 0 
)
6871{
6872 ImGuiContext& g = *GImGui;
6873 IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
6875 g.NextWindowData.SizeVal = size;
6876 g.NextWindowData.SizeCond = cond ? cond : ImGuiCond_Always;
6877}

References ImGuiNextWindowData::Flags, GImGui, IM_ASSERT, ImGuiCond_Always, ImGuiNextWindowDataFlags_HasSize, ImIsPowerOfTwo(), ImGuiContext::NextWindowData, ImGuiNextWindowData::SizeCond, and ImGuiNextWindowData::SizeVal.

Referenced by BeginChildEx(), BeginViewportSideBar(), ExampleAppConsole::Draw(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), igl::opengl::glfw::imgui::ImGuiMenu::draw_labels_window(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_window(), NewFrame(), Slic3r::GUI::ImGuiWrapper::set_next_window_pos(), Slic3r::GUI::ImGuiWrapper::set_next_window_size(), ShowDemoWindow(), ShowExampleAppFullscreen(), ShowExampleAppLayout(), ShowExampleAppLog(), ShowExampleAppLongText(), and ShowExampleAppPropertyEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetNextWindowSizeConstraints()

void ImGui::SetNextWindowSizeConstraints ( const ImVec2 size_min,
const ImVec2 size_max,
ImGuiSizeCallback  custom_callback = NULL,
void custom_callback_data = NULL 
)
6880{
6881 ImGuiContext& g = *GImGui;
6883 g.NextWindowData.SizeConstraintRect = ImRect(size_min, size_max);
6884 g.NextWindowData.SizeCallback = custom_callback;
6885 g.NextWindowData.SizeCallbackUserData = custom_callback_user_data;
6886}
void * SizeCallbackUserData
Definition imgui_internal.h:1107
ImGuiSizeCallback SizeCallback
Definition imgui_internal.h:1106

References ImGuiNextWindowData::Flags, GImGui, ImGuiNextWindowDataFlags_HasSizeConstraint, ImGuiContext::NextWindowData, ImGuiNextWindowData::SizeCallback, ImGuiNextWindowData::SizeCallbackUserData, and ImGuiNextWindowData::SizeConstraintRect.

Referenced by BeginCombo(), igl::opengl::glfw::imgui::ImGuiMenu::draw_viewer_window(), NavUpdateWindowingOverlay(), Slic3r::GUI::GCodeViewer::render_legend(), and ShowExampleAppConstrainedResize().

+ Here is the caller graph for this function:

◆ SetScrollFromPosX() [1/2]

void ImGui::SetScrollFromPosX ( float  local_x,
float  center_x_ratio = 0.5f 
)
7967{
7968 ImGuiContext& g = *GImGui;
7969 SetScrollFromPosX(g.CurrentWindow, local_x, center_x_ratio);
7970}

References ImGuiContext::CurrentWindow, GImGui, and SetScrollFromPosX().

Referenced by EndTable(), ScrollToBringRectIntoView(), SetScrollFromPosX(), SetScrollHereX(), and ShowDemoWindowLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetScrollFromPosX() [2/2]

void ImGui::SetScrollFromPosX ( ImGuiWindow window,
float  local_x,
float  center_x_ratio 
)
7949{
7950 IM_ASSERT(center_x_ratio >= 0.0f && center_x_ratio <= 1.0f);
7951 window->ScrollTarget.x = IM_FLOOR(local_x + window->Scroll.x); // Convert local position to scroll offset
7952 window->ScrollTargetCenterRatio.x = center_x_ratio;
7953 window->ScrollTargetEdgeSnapDist.x = 0.0f;
7954}
ImVec2 ScrollTargetEdgeSnapDist
Definition imgui_internal.h:1827

References IM_ASSERT, IM_FLOOR, ImGuiWindow::Scroll, ImGuiWindow::ScrollTarget, ImGuiWindow::ScrollTargetCenterRatio, ImGuiWindow::ScrollTargetEdgeSnapDist, and ImVec2::x.

◆ SetScrollFromPosY() [1/2]

void ImGui::SetScrollFromPosY ( float  local_y,
float  center_y_ratio = 0.5f 
)
7973{
7974 ImGuiContext& g = *GImGui;
7975 SetScrollFromPosY(g.CurrentWindow, local_y, center_y_ratio);
7976}

References ImGuiContext::CurrentWindow, GImGui, and SetScrollFromPosY().

Referenced by ScrollToBringRectIntoView(), SetScrollFromPosY(), SetScrollHereY(), and ShowDemoWindowLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetScrollFromPosY() [2/2]

void ImGui::SetScrollFromPosY ( ImGuiWindow window,
float  local_y,
float  center_y_ratio 
)
7957{
7958 IM_ASSERT(center_y_ratio >= 0.0f && center_y_ratio <= 1.0f);
7959 const float decoration_up_height = window->TitleBarHeight() + window->MenuBarHeight(); // FIXME: Would be nice to have a more standardized access to our scrollable/client rect;
7960 local_y -= decoration_up_height;
7961 window->ScrollTarget.y = IM_FLOOR(local_y + window->Scroll.y); // Convert local position to scroll offset
7962 window->ScrollTargetCenterRatio.y = center_y_ratio;
7963 window->ScrollTargetEdgeSnapDist.y = 0.0f;
7964}

References IM_ASSERT, IM_FLOOR, ImGuiWindow::MenuBarHeight(), ImGuiWindow::Scroll, ImGuiWindow::ScrollTarget, ImGuiWindow::ScrollTargetCenterRatio, ImGuiWindow::ScrollTargetEdgeSnapDist, ImGuiWindow::TitleBarHeight(), and ImVec2::y.

+ Here is the call graph for this function:

◆ SetScrollHereX()

void ImGui::SetScrollHereX ( float  center_x_ratio = 0.5f)
7980{
7981 ImGuiContext& g = *GImGui;
7982 ImGuiWindow* window = g.CurrentWindow;
7983 float spacing_x = ImMax(window->WindowPadding.x, g.Style.ItemSpacing.x);
7984 float target_pos_x = ImLerp(window->DC.LastItemRect.Min.x - spacing_x, window->DC.LastItemRect.Max.x + spacing_x, center_x_ratio);
7985 SetScrollFromPosX(window, target_pos_x - window->Pos.x, center_x_ratio); // Convert from absolute to local pos
7986
7987 // Tweak: snap on edges when aiming at an item very close to the edge
7988 window->ScrollTargetEdgeSnapDist.x = ImMax(0.0f, window->WindowPadding.x - spacing_x);
7989}

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, ImLerp(), ImMax(), ImGuiStyle::ItemSpacing, ImGuiWindowTempData::LastItemRect, ImRect::Max, ImRect::Min, ImGuiWindow::Pos, ImGuiWindow::ScrollTargetEdgeSnapDist, SetScrollFromPosX(), ImGuiContext::Style, ImGuiWindow::WindowPadding, and ImVec2::x.

Referenced by ShowDemoWindowLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetScrollHereY()

void ImGui::SetScrollHereY ( float  center_y_ratio = 0.5f)
7993{
7994 ImGuiContext& g = *GImGui;
7995 ImGuiWindow* window = g.CurrentWindow;
7996 float spacing_y = ImMax(window->WindowPadding.y, g.Style.ItemSpacing.y);
7997 float target_pos_y = ImLerp(window->DC.CursorPosPrevLine.y - spacing_y, window->DC.CursorPosPrevLine.y + window->DC.PrevLineSize.y + spacing_y, center_y_ratio);
7998 SetScrollFromPosY(window, target_pos_y - window->Pos.y, center_y_ratio); // Convert from absolute to local pos
7999
8000 // Tweak: snap on edges when aiming at an item very close to the edge
8001 window->ScrollTargetEdgeSnapDist.y = ImMax(0.0f, window->WindowPadding.y - spacing_y);
8002}

References ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPosPrevLine, ImGuiWindow::DC, GImGui, ImLerp(), ImMax(), ImGuiStyle::ItemSpacing, ImGuiWindow::Pos, ImGuiWindowTempData::PrevLineSize, ImGuiWindow::ScrollTargetEdgeSnapDist, SetScrollFromPosY(), ImGuiContext::Style, ImGuiWindow::WindowPadding, and ImVec2::y.

Referenced by ExampleAppConsole::Draw(), ExampleAppLog::Draw(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), SetItemDefaultFocus(), and ShowDemoWindowLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetScrollX() [1/2]

void ImGui::SetScrollX ( float  scroll_x)
7927{
7928 ImGuiContext& g = *GImGui;
7930}
static double scroll_x
Definition Viewer.cpp:50

References ImGuiContext::CurrentWindow, GImGui, scroll_x, and SetScrollX().

Referenced by NavUpdate(), SetScrollX(), ShowDemoWindowLayout(), and UpdateMouseWheel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetScrollX() [2/2]

void ImGui::SetScrollX ( ImGuiWindow window,
float  scroll_x 
)

◆ SetScrollY() [1/2]

void ImGui::SetScrollY ( float  scroll_y)
7933{
7934 ImGuiContext& g = *GImGui;
7936}

References ImGuiContext::CurrentWindow, GImGui, scroll_y, and SetScrollY().

Referenced by InputTextEx(), NavUpdate(), NavUpdateMoveResult(), NavUpdatePageUpPageDown(), Slic3r::GUI::scroll_down(), Slic3r::GUI::scroll_up(), Slic3r::GUI::scroll_y(), SetScrollY(), ShowDemoWindowLayout(), and UpdateMouseWheel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetScrollY() [2/2]

void ImGui::SetScrollY ( ImGuiWindow window,
float  scroll_y 
)

◆ SetStateStorage()

void ImGui::SetStateStorage ( ImGuiStorage storage)

◆ SetTabItemClosed()

void ImGui::SetTabItemClosed ( const char *  tab_or_docked_window_label)
7926{
7927 ImGuiContext& g = *GImGui;
7928 bool is_within_manual_tab_bar = g.CurrentTabBar && !(g.CurrentTabBar->Flags & ImGuiTabBarFlags_DockNode);
7929 if (is_within_manual_tab_bar)
7930 {
7931 ImGuiTabBar* tab_bar = g.CurrentTabBar;
7932 ImGuiID tab_id = TabBarCalcTabID(tab_bar, label);
7933 if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id))
7934 tab->WantClose = true; // Will be processed by next call to TabBarLayout()
7935 }
7936}
static ImU32 TabBarCalcTabID(ImGuiTabBar *tab_bar, const char *label)
Definition imgui_widgets.cpp:7359
IMGUI_API ImGuiTabItem * TabBarFindTabByID(ImGuiTabBar *tab_bar, ImGuiID tab_id)
Definition imgui_widgets.cpp:7380

References ImGuiContext::CurrentTabBar, ImGuiTabBar::Flags, GImGui, ImGuiTabBarFlags_DockNode, TabBarCalcTabID(), and TabBarFindTabByID().

Referenced by NotifyOfDocumentsClosedElsewhere().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetTooltip()

void ImGui::SetTooltip ( const char *  fmt,
  ... 
)
8059{
8060 va_list args;
8061 va_start(args, fmt);
8062 SetTooltipV(fmt, args);
8063 va_end(args);
8064}
IMGUI_API void SetTooltipV(const char *fmt, va_list args) IM_FMTLIST(1)
Definition imgui.cpp:8051

References SetTooltipV().

Referenced by Slic3r::GUI::GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(), Slic3r::GUI::ImGuiWrapper::button(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoEmboss::draw_bold_button(), Slic3r::GUI::GLGizmoEmboss::draw_delete_style_button(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), Slic3r::GUI::GLGizmoEmboss::draw_font_list_line(), Slic3r::GUI::GLGizmoEmboss::draw_italic_button(), Slic3r::GUI::GLGizmoEmboss::draw_model_type(), Slic3r::GUI::GLGizmoEmboss::draw_style_add_button(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), Slic3r::GUI::GLGizmoEmboss::draw_style_rename_button(), Slic3r::GUI::GLGizmoEmboss::draw_style_save_button(), Slic3r::GUI::GLGizmoEmboss::draw_text_input(), Slic3r::GUI::GLGizmoEmboss::draw_window(), EndFrame(), Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), PlotEx(), Slic3r::GUI::GLGizmoEmboss::revertible(), Slic3r::GUI::ImGuiWrapper::search_list(), ShowDemoWindowLayout(), ShowDemoWindowPopups(), ShowDemoWindowWidgets(), TabItemEx(), TableHeader(), and Slic3r::GUI::ImGuiWrapper::undo_redo_list().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetTooltipV()

void ImGui::SetTooltipV ( const char *  fmt,
va_list  args 
)
8052{
8054 TextV(fmt, args);
8055 EndTooltip();
8056}
IMGUI_API void TextV(const char *fmt, va_list args) IM_FMTLIST(1)
Definition imgui_widgets.cpp:268

References BeginTooltipEx(), EndTooltip(), ImGuiTooltipFlags_OverridePreviousTooltip, and TextV().

Referenced by SetTooltip().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetWindowClipRectBeforeSetChannel()

void ImGui::SetWindowClipRectBeforeSetChannel ( ImGuiWindow window,
const ImRect clip_rect 
)
3614{
3615 ImVec4 clip_rect_vec4 = clip_rect.ToVec4();
3616 window->ClipRect = clip_rect;
3617 window->DrawList->_CmdHeader.ClipRect = clip_rect_vec4;
3618 window->DrawList->_ClipRectStack.Data[window->DrawList->_ClipRectStack.Size - 1] = clip_rect_vec4;
3619}
ImVec4 ClipRect
Definition imgui.h:2277
ImDrawCmdHeader _CmdHeader
Definition imgui.h:2364
ImVec4 ToVec4() const
Definition imgui_internal.h:503

References ImDrawList::_ClipRectStack, ImDrawList::_CmdHeader, ImDrawCmdHeader::ClipRect, ImGuiWindow::ClipRect, ImVector< T >::Data, ImGuiWindow::DrawList, ImVector< T >::Size, and ImRect::ToVec4().

Referenced by NextColumn(), PopColumnsBackground(), PushColumnsBackground(), TableBeginCell(), TableEndRow(), TablePopBackgroundChannel(), and TablePushBackgroundChannel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetWindowCollapsed() [1/3]

void ImGui::SetWindowCollapsed ( bool  collapsed,
ImGuiCond  cond = 0 
)
6820{
6821 SetWindowCollapsed(GImGui->CurrentWindow, collapsed, cond);
6822}

References ImGuiContext::CurrentWindow, GImGui, and SetWindowCollapsed().

Referenced by Begin(), SetWindowCollapsed(), and SetWindowCollapsed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetWindowCollapsed() [2/3]

void ImGui::SetWindowCollapsed ( const char *  name,
bool  collapsed,
ImGuiCond  cond = 0 
)
6837{
6838 if (ImGuiWindow* window = FindWindowByName(name))
6839 SetWindowCollapsed(window, collapsed, cond);
6840}

References FindWindowByName(), and SetWindowCollapsed().

+ Here is the call graph for this function:

◆ SetWindowCollapsed() [3/3]

void ImGui::SetWindowCollapsed ( ImGuiWindow window,
bool  collapsed,
ImGuiCond  cond = 0 
)
6802{
6803 // Test condition (NB: bit 0 is always true) and clear flags for next time
6804 if (cond && (window->SetWindowCollapsedAllowFlags & cond) == 0)
6805 return;
6807
6808 // Set
6809 window->Collapsed = collapsed;
6810}
ImGuiCond SetWindowCollapsedAllowFlags
Definition imgui_internal.h:1856

References ImGuiWindow::Collapsed, ImGuiCond_Appearing, ImGuiCond_FirstUseEver, ImGuiCond_Once, and ImGuiWindow::SetWindowCollapsedAllowFlags.

◆ SetWindowFocus() [1/2]

void ImGui::SetWindowFocus ( )
6843{
6845}

References ImGuiContext::CurrentWindow, FocusWindow(), and GImGui.

+ Here is the call graph for this function:

◆ SetWindowFocus() [2/2]

void ImGui::SetWindowFocus ( const char *  name)
6848{
6849 if (name)
6850 {
6851 if (ImGuiWindow* window = FindWindowByName(name))
6852 FocusWindow(window);
6853 }
6854 else
6855 {
6856 FocusWindow(NULL);
6857 }
6858}

References FindWindowByName(), and FocusWindow().

+ Here is the call graph for this function:

◆ SetWindowFontScale()

void ImGui::SetWindowFontScale ( float  scale)
6948{
6949 IM_ASSERT(scale > 0.0f);
6950 ImGuiContext& g = *GImGui;
6951 ImGuiWindow* window = GetCurrentWindow();
6952 window->FontWindowScale = scale;
6954}
float FontWindowScale
Definition imgui_internal.h:1880

References ImGuiWindow::CalcFontSize(), ImGuiContext::DrawListSharedData, ImDrawListSharedData::FontSize, ImGuiContext::FontSize, ImGuiWindow::FontWindowScale, GetCurrentWindow(), GImGui, IM_ASSERT, and scale().

Referenced by ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetWindowHitTestHole()

void ImGui::SetWindowHitTestHole ( ImGuiWindow window,
const ImVec2 pos,
const ImVec2 size 
)
6813{
6814 IM_ASSERT(window->HitTestHoleSize.x == 0); // We don't support multiple holes/hit test filters
6815 window->HitTestHoleSize = ImVec2ih(size);
6816 window->HitTestHoleOffset = ImVec2ih(pos - window->Pos);
6817}
ImVec2ih HitTestHoleOffset
Definition imgui_internal.h:1873
Definition imgui_internal.h:461

References ImGuiWindow::HitTestHoleOffset, ImGuiWindow::HitTestHoleSize, IM_ASSERT, ImGuiWindow::Pos, and ImVec2ih::x.

◆ SetWindowPos() [1/3]

void ImGui::SetWindowPos ( const char *  name,
const ImVec2 pos,
ImGuiCond  cond = 0 
)
6747{
6748 if (ImGuiWindow* window = FindWindowByName(name))
6749 SetWindowPos(window, pos, cond);
6750}

References FindWindowByName(), and SetWindowPos().

+ Here is the call graph for this function:

◆ SetWindowPos() [2/3]

void ImGui::SetWindowPos ( const ImVec2 pos,
ImGuiCond  cond = 0 
)
6741{
6743 SetWindowPos(window, pos, cond);
6744}

References GetCurrentWindowRead(), and SetWindowPos().

Referenced by Slic3r::GUI::GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(), Slic3r::GUI::GLGizmoCut3D::adjust_window_position(), Begin(), NavUpdateWindowing(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::GLGizmoSlaSupports::on_render_input_window(), Slic3r::GUI::GLGizmoCut3D::render_debug_input_window(), SetWindowPos(), SetWindowPos(), UpdateMouseMovingWindowNewFrame(), and UpdateMouseWheel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetWindowPos() [3/3]

void ImGui::SetWindowPos ( ImGuiWindow window,
const ImVec2 pos,
ImGuiCond  cond = 0 
)
6721{
6722 // Test condition (NB: bit 0 is always true) and clear flags for next time
6723 if (cond && (window->SetWindowPosAllowFlags & cond) == 0)
6724 return;
6725
6726 IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
6728 window->SetWindowPosVal = ImVec2(FLT_MAX, FLT_MAX);
6729
6730 // Set
6731 const ImVec2 old_pos = window->Pos;
6732 window->Pos = ImFloor(pos);
6733 ImVec2 offset = window->Pos - old_pos;
6734 window->DC.CursorPos += offset; // As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor
6735 window->DC.CursorMaxPos += offset; // And more importantly we need to offset CursorMaxPos/CursorStartPos this so ContentSize calculation doesn't get affected.
6736 window->DC.IdealMaxPos += offset;
6737 window->DC.CursorStartPos += offset;
6738}

References ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindowTempData::CursorStartPos, ImGuiWindow::DC, ImGuiWindowTempData::IdealMaxPos, IM_ASSERT, ImFloor(), ImGuiCond_Appearing, ImGuiCond_FirstUseEver, ImGuiCond_Once, ImIsPowerOfTwo(), ImGuiWindow::Pos, ImGuiWindow::SetWindowPosAllowFlags, and ImGuiWindow::SetWindowPosVal.

+ Here is the call graph for this function:

◆ SetWindowSize() [1/3]

void ImGui::SetWindowSize ( const char *  name,
const ImVec2 size,
ImGuiCond  cond = 0 
)
6796{
6797 if (ImGuiWindow* window = FindWindowByName(name))
6798 SetWindowSize(window, size, cond);
6799}

References FindWindowByName(), and SetWindowSize().

+ Here is the call graph for this function:

◆ SetWindowSize() [2/3]

void ImGui::SetWindowSize ( const ImVec2 size,
ImGuiCond  cond = 0 
)
6791{
6792 SetWindowSize(GImGui->CurrentWindow, size, cond);
6793}

References ImGuiContext::CurrentWindow, GImGui, and SetWindowSize().

Referenced by Begin(), Slic3r::GUI::GLGizmoEmboss::on_render_input_window(), Slic3r::GUI::GLGizmoEmboss::set_minimal_window_size(), SetWindowSize(), SetWindowSize(), and ShowExampleAppConstrainedResize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetWindowSize() [3/3]

void ImGui::SetWindowSize ( ImGuiWindow window,
const ImVec2 size,
ImGuiCond  cond = 0 
)
6759{
6760 // Test condition (NB: bit 0 is always true) and clear flags for next time
6761 if (cond && (window->SetWindowSizeAllowFlags & cond) == 0)
6762 return;
6763
6764 IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags.
6766
6767 // Set
6768 if (size.x > 0.0f)
6769 {
6770 window->AutoFitFramesX = 0;
6771 window->SizeFull.x = IM_FLOOR(size.x);
6772 }
6773 else
6774 {
6775 window->AutoFitFramesX = 2;
6776 window->AutoFitOnlyGrows = false;
6777 }
6778 if (size.y > 0.0f)
6779 {
6780 window->AutoFitFramesY = 0;
6781 window->SizeFull.y = IM_FLOOR(size.y);
6782 }
6783 else
6784 {
6785 window->AutoFitFramesY = 2;
6786 window->AutoFitOnlyGrows = false;
6787 }
6788}

References ImGuiWindow::AutoFitFramesX, ImGuiWindow::AutoFitFramesY, ImGuiWindow::AutoFitOnlyGrows, IM_ASSERT, IM_FLOOR, ImGuiCond_Appearing, ImGuiCond_FirstUseEver, ImGuiCond_Once, ImIsPowerOfTwo(), ImGuiWindow::SetWindowSizeAllowFlags, ImGuiWindow::SizeFull, ImVec2::x, and ImVec2::y.

+ Here is the call graph for this function:

◆ ShadeVertsLinearColorGradientKeepAlpha()

void ImGui::ShadeVertsLinearColorGradientKeepAlpha ( ImDrawList draw_list,
int  vert_start_idx,
int  vert_end_idx,
ImVec2  gradient_p0,
ImVec2  gradient_p1,
ImU32  col0,
ImU32  col1 
)
1847{
1848 ImVec2 gradient_extent = gradient_p1 - gradient_p0;
1849 float gradient_inv_length2 = 1.0f / ImLengthSqr(gradient_extent);
1850 ImDrawVert* vert_start = draw_list->VtxBuffer.Data + vert_start_idx;
1851 ImDrawVert* vert_end = draw_list->VtxBuffer.Data + vert_end_idx;
1852 const int col0_r = (int)(col0 >> IM_COL32_R_SHIFT) & 0xFF;
1853 const int col0_g = (int)(col0 >> IM_COL32_G_SHIFT) & 0xFF;
1854 const int col0_b = (int)(col0 >> IM_COL32_B_SHIFT) & 0xFF;
1855 const int col_delta_r = ((int)(col1 >> IM_COL32_R_SHIFT) & 0xFF) - col0_r;
1856 const int col_delta_g = ((int)(col1 >> IM_COL32_G_SHIFT) & 0xFF) - col0_g;
1857 const int col_delta_b = ((int)(col1 >> IM_COL32_B_SHIFT) & 0xFF) - col0_b;
1858 for (ImDrawVert* vert = vert_start; vert < vert_end; vert++)
1859 {
1860 float d = ImDot(vert->pos - gradient_p0, gradient_extent);
1861 float t = ImClamp(d * gradient_inv_length2, 0.0f, 1.0f);
1862 int r = (int)(col0_r + col_delta_r * t);
1863 int g = (int)(col0_g + col_delta_g * t);
1864 int b = (int)(col0_b + col_delta_b * t);
1865 vert->col = (r << IM_COL32_R_SHIFT) | (g << IM_COL32_G_SHIFT) | (b << IM_COL32_B_SHIFT) | (vert->col & IM_COL32_A_MASK);
1866 }
1867}
static float ImDot(const ImVec2 &a, const ImVec2 &b)
Definition imgui_internal.h:431

References ImVector< T >::Data, IM_COL32_A_MASK, IM_COL32_B_SHIFT, IM_COL32_G_SHIFT, IM_COL32_R_SHIFT, ImClamp(), ImDot(), ImLengthSqr(), and ImDrawList::VtxBuffer.

Referenced by ColorPicker4().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ShadeVertsLinearUV()

void ImGui::ShadeVertsLinearUV ( ImDrawList draw_list,
int  vert_start_idx,
int  vert_end_idx,
const ImVec2 a,
const ImVec2 b,
const ImVec2 uv_a,
const ImVec2 uv_b,
bool  clamp 
)
1871{
1872 const ImVec2 size = b - a;
1873 const ImVec2 uv_size = uv_b - uv_a;
1874 const ImVec2 scale = ImVec2(
1875 size.x != 0.0f ? (uv_size.x / size.x) : 0.0f,
1876 size.y != 0.0f ? (uv_size.y / size.y) : 0.0f);
1877
1878 ImDrawVert* vert_start = draw_list->VtxBuffer.Data + vert_start_idx;
1879 ImDrawVert* vert_end = draw_list->VtxBuffer.Data + vert_end_idx;
1880 if (clamp)
1881 {
1882 const ImVec2 min = ImMin(uv_a, uv_b);
1883 const ImVec2 max = ImMax(uv_a, uv_b);
1884 for (ImDrawVert* vertex = vert_start; vertex < vert_end; ++vertex)
1885 vertex->uv = ImClamp(uv_a + ImMul(ImVec2(vertex->pos.x, vertex->pos.y) - a, scale), min, max);
1886 }
1887 else
1888 {
1889 for (ImDrawVert* vertex = vert_start; vertex < vert_end; ++vertex)
1890 vertex->uv = uv_a + ImMul(ImVec2(vertex->pos.x, vertex->pos.y) - a, scale);
1891 }
1892}
static ImVec2 ImMul(const ImVec2 &lhs, const ImVec2 &rhs)
Definition imgui_internal.h:434

References ImVector< T >::Data, ImClamp(), ImMax(), ImMin(), ImMul(), scale(), ImDrawList::VtxBuffer, ImVec2::x, and ImVec2::y.

Referenced by ImDrawList::AddImageRounded().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ShowAboutWindow()

void ImGui::ShowAboutWindow ( bool *  p_open = NULL)
5611{
5612 if (!ImGui::Begin("About Dear ImGui", p_open, ImGuiWindowFlags_AlwaysAutoResize))
5613 {
5614 ImGui::End();
5615 return;
5616 }
5617 ImGui::Text("Dear ImGui %s", ImGui::GetVersion());
5619 ImGui::Text("By Omar Cornut and all Dear ImGui contributors.");
5620 ImGui::Text("Dear ImGui is licensed under the MIT License, see LICENSE for more information.");
5621
5622 static bool show_config_info = false;
5623 ImGui::Checkbox("Config/Build Information", &show_config_info);
5624 if (show_config_info)
5625 {
5626 ImGuiIO& io = ImGui::GetIO();
5628
5629 bool copy_to_clipboard = ImGui::Button("Copy to clipboard");
5630 ImVec2 child_size = ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 18);
5632 if (copy_to_clipboard)
5633 {
5635 ImGui::LogText("```\n"); // Back quotes will make text appears without formatting when pasting on GitHub
5636 }
5637
5638 ImGui::Text("Dear ImGui %s (%d)", IMGUI_VERSION, IMGUI_VERSION_NUM);
5640 ImGui::Text("sizeof(size_t): %d, sizeof(ImDrawIdx): %d, sizeof(ImDrawVert): %d", (int)sizeof(size_t), (int)sizeof(ImDrawIdx), (int)sizeof(ImDrawVert));
5641 ImGui::Text("define: __cplusplus=%d", (int)__cplusplus);
5642#ifdef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
5643 ImGui::Text("define: IMGUI_DISABLE_OBSOLETE_FUNCTIONS");
5644#endif
5645#ifdef IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS
5646 ImGui::Text("define: IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS");
5647#endif
5648#ifdef IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS
5649 ImGui::Text("define: IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS");
5650#endif
5651#ifdef IMGUI_DISABLE_WIN32_FUNCTIONS
5652 ImGui::Text("define: IMGUI_DISABLE_WIN32_FUNCTIONS");
5653#endif
5654#ifdef IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS
5655 ImGui::Text("define: IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS");
5656#endif
5657#ifdef IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS
5658 ImGui::Text("define: IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS");
5659#endif
5660#ifdef IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS
5661 ImGui::Text("define: IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS");
5662#endif
5663#ifdef IMGUI_DISABLE_FILE_FUNCTIONS
5664 ImGui::Text("define: IMGUI_DISABLE_FILE_FUNCTIONS");
5665#endif
5666#ifdef IMGUI_DISABLE_DEFAULT_ALLOCATORS
5667 ImGui::Text("define: IMGUI_DISABLE_DEFAULT_ALLOCATORS");
5668#endif
5669#ifdef IMGUI_USE_BGRA_PACKED_COLOR
5670 ImGui::Text("define: IMGUI_USE_BGRA_PACKED_COLOR");
5671#endif
5672#ifdef _WIN32
5673 ImGui::Text("define: _WIN32");
5674#endif
5675#ifdef _WIN64
5676 ImGui::Text("define: _WIN64");
5677#endif
5678#ifdef __linux__
5679 ImGui::Text("define: __linux__");
5680#endif
5681#ifdef __APPLE__
5682 ImGui::Text("define: __APPLE__");
5683#endif
5684#ifdef _MSC_VER
5685 ImGui::Text("define: _MSC_VER=%d", _MSC_VER);
5686#endif
5687#ifdef _MSVC_LANG
5688 ImGui::Text("define: _MSVC_LANG=%d", (int)_MSVC_LANG);
5689#endif
5690#ifdef __MINGW32__
5691 ImGui::Text("define: __MINGW32__");
5692#endif
5693#ifdef __MINGW64__
5694 ImGui::Text("define: __MINGW64__");
5695#endif
5696#ifdef __GNUC__
5697 ImGui::Text("define: __GNUC__=%d", (int)__GNUC__);
5698#endif
5699#ifdef __clang_version__
5700 ImGui::Text("define: __clang_version__=%s", __clang_version__);
5701#endif
5703 ImGui::Text("io.BackendPlatformName: %s", io.BackendPlatformName ? io.BackendPlatformName : "NULL");
5704 ImGui::Text("io.BackendRendererName: %s", io.BackendRendererName ? io.BackendRendererName : "NULL");
5705 ImGui::Text("io.ConfigFlags: 0x%08X", io.ConfigFlags);
5706 if (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) ImGui::Text(" NavEnableKeyboard");
5707 if (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) ImGui::Text(" NavEnableGamepad");
5708 if (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) ImGui::Text(" NavEnableSetMousePos");
5709 if (io.ConfigFlags & ImGuiConfigFlags_NavNoCaptureKeyboard) ImGui::Text(" NavNoCaptureKeyboard");
5710 if (io.ConfigFlags & ImGuiConfigFlags_NoMouse) ImGui::Text(" NoMouse");
5711 if (io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange) ImGui::Text(" NoMouseCursorChange");
5712 if (io.MouseDrawCursor) ImGui::Text("io.MouseDrawCursor");
5713 if (io.ConfigMacOSXBehaviors) ImGui::Text("io.ConfigMacOSXBehaviors");
5714 if (io.ConfigInputTextCursorBlink) ImGui::Text("io.ConfigInputTextCursorBlink");
5715 if (io.ConfigWindowsResizeFromEdges) ImGui::Text("io.ConfigWindowsResizeFromEdges");
5716 if (io.ConfigWindowsMoveFromTitleBarOnly) ImGui::Text("io.ConfigWindowsMoveFromTitleBarOnly");
5717 if (io.ConfigMemoryCompactTimer >= 0.0f) ImGui::Text("io.ConfigMemoryCompactTimer = %.1f", io.ConfigMemoryCompactTimer);
5718 ImGui::Text("io.BackendFlags: 0x%08X", io.BackendFlags);
5719 if (io.BackendFlags & ImGuiBackendFlags_HasGamepad) ImGui::Text(" HasGamepad");
5720 if (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) ImGui::Text(" HasMouseCursors");
5721 if (io.BackendFlags & ImGuiBackendFlags_HasSetMousePos) ImGui::Text(" HasSetMousePos");
5722 if (io.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset) ImGui::Text(" RendererHasVtxOffset");
5724 ImGui::Text("io.Fonts: %d fonts, Flags: 0x%08X, TexSize: %d,%d", io.Fonts->Fonts.Size, io.Fonts->Flags, io.Fonts->TexWidth, io.Fonts->TexHeight);
5725 ImGui::Text("io.DisplaySize: %.2f,%.2f", io.DisplaySize.x, io.DisplaySize.y);
5726 ImGui::Text("io.DisplayFramebufferScale: %.2f,%.2f", io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y);
5728 ImGui::Text("style.WindowPadding: %.2f,%.2f", style.WindowPadding.x, style.WindowPadding.y);
5729 ImGui::Text("style.WindowBorderSize: %.2f", style.WindowBorderSize);
5730 ImGui::Text("style.FramePadding: %.2f,%.2f", style.FramePadding.x, style.FramePadding.y);
5731 ImGui::Text("style.FrameRounding: %.2f", style.FrameRounding);
5732 ImGui::Text("style.FrameBorderSize: %.2f", style.FrameBorderSize);
5733 ImGui::Text("style.ItemSpacing: %.2f,%.2f", style.ItemSpacing.x, style.ItemSpacing.y);
5734 ImGui::Text("style.ItemInnerSpacing: %.2f,%.2f", style.ItemInnerSpacing.x, style.ItemInnerSpacing.y);
5735
5736 if (copy_to_clipboard)
5737 {
5738 ImGui::LogText("\n```\n");
5740 }
5742 }
5743 ImGui::End();
5744}
@ ImGuiConfigFlags_NoMouse
Definition imgui.h:1392
@ ImGuiConfigFlags_NoMouseCursorChange
Definition imgui.h:1393
@ ImGuiConfigFlags_NavNoCaptureKeyboard
Definition imgui.h:1391
#define IMGUI_VERSION_NUM
Definition imgui.h:64
IMGUI_API void LogFinish()
Definition imgui.cpp:10249
IMGUI_API ImGuiIO & GetIO()
Definition imgui.cpp:3439
IMGUI_API bool Checkbox(const char *label, bool *v)
Definition imgui_widgets.cpp:1071
IMGUI_API const char * GetVersion()
Definition imgui.cpp:3354
IMGUI_API ImGuiStyle & GetStyle()
Definition imgui.cpp:2423
int TexWidth
Definition imgui.h:2664
int TexHeight
Definition imgui.h:2665
bool ConfigWindowsMoveFromTitleBarOnly
Definition imgui.h:1807
const char * BackendPlatformName
Definition imgui.h:1816
const char * BackendRendererName
Definition imgui.h:1817

References ImGuiIO::BackendFlags, ImGuiIO::BackendPlatformName, ImGuiIO::BackendRendererName, Begin(), BeginChildFrame(), Button(), Checkbox(), ImGuiIO::ConfigFlags, ImGuiIO::ConfigInputTextCursorBlink, ImGuiIO::ConfigMacOSXBehaviors, ImGuiIO::ConfigMemoryCompactTimer, ImGuiIO::ConfigWindowsMoveFromTitleBarOnly, ImGuiIO::ConfigWindowsResizeFromEdges, ImGuiIO::DisplayFramebufferScale, ImGuiIO::DisplaySize, End(), EndChildFrame(), ImFontAtlas::Flags, ImGuiIO::Fonts, ImFontAtlas::Fonts, GetID(), GetIO(), GetStyle(), GetTextLineHeightWithSpacing(), GetVersion(), IMGUI_VERSION, IMGUI_VERSION_NUM, ImGuiBackendFlags_HasGamepad, ImGuiBackendFlags_HasMouseCursors, ImGuiBackendFlags_HasSetMousePos, ImGuiBackendFlags_RendererHasVtxOffset, ImGuiConfigFlags_NavEnableGamepad, ImGuiConfigFlags_NavEnableKeyboard, ImGuiConfigFlags_NavEnableSetMousePos, ImGuiConfigFlags_NavNoCaptureKeyboard, ImGuiConfigFlags_NoMouse, ImGuiConfigFlags_NoMouseCursorChange, ImGuiWindowFlags_AlwaysAutoResize, ImGuiWindowFlags_NoMove, LogFinish(), LogText(), LogToClipboard(), ImGuiIO::MouseDrawCursor, Separator(), ImVector< T >::Size, style, ImFontAtlas::TexHeight, Text(), ImFontAtlas::TexWidth, ImVec2::x, and ImVec2::y.

Referenced by ShowDemoWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ShowDemoWindow()

void ImGui::ShowDemoWindow ( bool *  p_open = NULL)
260{
261 // Exceptionally add an extra assert here for people confused about initial Dear ImGui setup
262 // Most ImGui functions would normally just crash if the context is missing.
263 IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing dear imgui context. Refer to examples app!");
264
265 // Examples Apps (accessible from the "Examples" menu)
266 static bool show_app_main_menu_bar = false;
267 static bool show_app_documents = false;
268
269 static bool show_app_console = false;
270 static bool show_app_log = false;
271 static bool show_app_layout = false;
272 static bool show_app_property_editor = false;
273 static bool show_app_long_text = false;
274 static bool show_app_auto_resize = false;
275 static bool show_app_constrained_resize = false;
276 static bool show_app_simple_overlay = false;
277 static bool show_app_fullscreen = false;
278 static bool show_app_window_titles = false;
279 static bool show_app_custom_rendering = false;
280
281 if (show_app_main_menu_bar) ShowExampleAppMainMenuBar();
282 if (show_app_documents) ShowExampleAppDocuments(&show_app_documents);
283
284 if (show_app_console) ShowExampleAppConsole(&show_app_console);
285 if (show_app_log) ShowExampleAppLog(&show_app_log);
286 if (show_app_layout) ShowExampleAppLayout(&show_app_layout);
287 if (show_app_property_editor) ShowExampleAppPropertyEditor(&show_app_property_editor);
288 if (show_app_long_text) ShowExampleAppLongText(&show_app_long_text);
289 if (show_app_auto_resize) ShowExampleAppAutoResize(&show_app_auto_resize);
290 if (show_app_constrained_resize) ShowExampleAppConstrainedResize(&show_app_constrained_resize);
291 if (show_app_simple_overlay) ShowExampleAppSimpleOverlay(&show_app_simple_overlay);
292 if (show_app_fullscreen) ShowExampleAppFullscreen(&show_app_fullscreen);
293 if (show_app_window_titles) ShowExampleAppWindowTitles(&show_app_window_titles);
294 if (show_app_custom_rendering) ShowExampleAppCustomRendering(&show_app_custom_rendering);
295
296 // Dear ImGui Apps (accessible from the "Tools" menu)
297 static bool show_app_metrics = false;
298 static bool show_app_style_editor = false;
299 static bool show_app_about = false;
300
301 if (show_app_metrics) { ImGui::ShowMetricsWindow(&show_app_metrics); }
302 if (show_app_about) { ImGui::ShowAboutWindow(&show_app_about); }
303 if (show_app_style_editor)
304 {
305 ImGui::Begin("Dear ImGui Style Editor", &show_app_style_editor);
307 ImGui::End();
308 }
309
310 // Demonstrate the various window flags. Typically you would just use the default!
311 static bool no_titlebar = false;
312 static bool no_scrollbar = false;
313 static bool no_menu = false;
314 static bool no_move = false;
315 static bool no_resize = false;
316 static bool no_collapse = false;
317 static bool no_close = false;
318 static bool no_nav = false;
319 static bool no_background = false;
320 static bool no_bring_to_front = false;
321
322 ImGuiWindowFlags window_flags = 0;
323 if (no_titlebar) window_flags |= ImGuiWindowFlags_NoTitleBar;
324 if (no_scrollbar) window_flags |= ImGuiWindowFlags_NoScrollbar;
325 if (!no_menu) window_flags |= ImGuiWindowFlags_MenuBar;
326 if (no_move) window_flags |= ImGuiWindowFlags_NoMove;
327 if (no_resize) window_flags |= ImGuiWindowFlags_NoResize;
328 if (no_collapse) window_flags |= ImGuiWindowFlags_NoCollapse;
329 if (no_nav) window_flags |= ImGuiWindowFlags_NoNav;
330 if (no_background) window_flags |= ImGuiWindowFlags_NoBackground;
331 if (no_bring_to_front) window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus;
332 if (no_close) p_open = NULL; // Don't pass our bool* to Begin
333
334 // We specify a default position/size in case there's no data in the .ini file.
335 // We only do it to make the demo applications a little more welcoming, but typically this isn't required.
336 const ImGuiViewport* main_viewport = ImGui::GetMainViewport();
337 ImGui::SetNextWindowPos(ImVec2(main_viewport->WorkPos.x + 650, main_viewport->WorkPos.y + 20), ImGuiCond_FirstUseEver);
339
340 // Main body of the Demo window starts here.
341 if (!ImGui::Begin("Dear ImGui Demo", p_open, window_flags))
342 {
343 // Early out if the window is collapsed, as an optimization.
344 ImGui::End();
345 return;
346 }
347
348 // Most "big" widgets share a common width settings by default. See 'Demo->Layout->Widgets Width' for details.
349
350 // e.g. Use 2/3 of the space for widgets and 1/3 for labels (right align)
351 //ImGui::PushItemWidth(-ImGui::GetWindowWidth() * 0.35f);
352
353 // e.g. Leave a fixed amount of width for labels (by passing a negative value), the rest goes to widgets.
355
356 // Menu Bar
358 {
359 if (ImGui::BeginMenu("Menu"))
360 {
363 }
364 if (ImGui::BeginMenu("Examples"))
365 {
366 ImGui::MenuItem("Main menu bar", NULL, &show_app_main_menu_bar);
367 ImGui::MenuItem("Console", NULL, &show_app_console);
368 ImGui::MenuItem("Log", NULL, &show_app_log);
369 ImGui::MenuItem("Simple layout", NULL, &show_app_layout);
370 ImGui::MenuItem("Property editor", NULL, &show_app_property_editor);
371 ImGui::MenuItem("Long text display", NULL, &show_app_long_text);
372 ImGui::MenuItem("Auto-resizing window", NULL, &show_app_auto_resize);
373 ImGui::MenuItem("Constrained-resizing window", NULL, &show_app_constrained_resize);
374 ImGui::MenuItem("Simple overlay", NULL, &show_app_simple_overlay);
375 ImGui::MenuItem("Fullscreen window", NULL, &show_app_fullscreen);
376 ImGui::MenuItem("Manipulating window titles", NULL, &show_app_window_titles);
377 ImGui::MenuItem("Custom rendering", NULL, &show_app_custom_rendering);
378 ImGui::MenuItem("Documents", NULL, &show_app_documents);
380 }
381 if (ImGui::BeginMenu("Tools"))
382 {
383 ImGui::MenuItem("Metrics/Debugger", NULL, &show_app_metrics);
384 ImGui::MenuItem("Style Editor", NULL, &show_app_style_editor);
385 ImGui::MenuItem("About Dear ImGui", NULL, &show_app_about);
387 }
389 }
390
391 ImGui::Text("dear imgui says hello. (%s)", IMGUI_VERSION);
393
394 if (ImGui::CollapsingHeader("Help"))
395 {
396 ImGui::Text("ABOUT THIS DEMO:");
397 ImGui::BulletText("Sections below are demonstrating many aspects of the library.");
398 ImGui::BulletText("The \"Examples\" menu above leads to more demo contents.");
399 ImGui::BulletText("The \"Tools\" menu above gives access to: About Box, Style Editor,\n"
400 "and Metrics/Debugger (general purpose Dear ImGui debugging tool).");
402
403 ImGui::Text("PROGRAMMER GUIDE:");
404 ImGui::BulletText("See the ShowDemoWindow() code in imgui_demo.cpp. <- you are here!");
405 ImGui::BulletText("See comments in imgui.cpp.");
406 ImGui::BulletText("See example applications in the examples/ folder.");
407 ImGui::BulletText("Read the FAQ at http://www.dearimgui.org/faq/");
408 ImGui::BulletText("Set 'io.ConfigFlags |= NavEnableKeyboard' for keyboard controls.");
409 ImGui::BulletText("Set 'io.ConfigFlags |= NavEnableGamepad' for gamepad controls.");
411
412 ImGui::Text("USER GUIDE:");
414 }
415
416 if (ImGui::CollapsingHeader("Configuration"))
417 {
418 ImGuiIO& io = ImGui::GetIO();
419
420 if (ImGui::TreeNode("Configuration##2"))
421 {
422 ImGui::CheckboxFlags("io.ConfigFlags: NavEnableKeyboard", &io.ConfigFlags, ImGuiConfigFlags_NavEnableKeyboard);
423 ImGui::SameLine(); HelpMarker("Enable keyboard controls.");
424 ImGui::CheckboxFlags("io.ConfigFlags: NavEnableGamepad", &io.ConfigFlags, ImGuiConfigFlags_NavEnableGamepad);
425 ImGui::SameLine(); HelpMarker("Enable gamepad controls. Require backend to set io.BackendFlags |= ImGuiBackendFlags_HasGamepad.\n\nRead instructions in imgui.cpp for details.");
426 ImGui::CheckboxFlags("io.ConfigFlags: NavEnableSetMousePos", &io.ConfigFlags, ImGuiConfigFlags_NavEnableSetMousePos);
427 ImGui::SameLine(); HelpMarker("Instruct navigation to move the mouse cursor. See comment for ImGuiConfigFlags_NavEnableSetMousePos.");
428 ImGui::CheckboxFlags("io.ConfigFlags: NoMouse", &io.ConfigFlags, ImGuiConfigFlags_NoMouse);
430 {
431 // The "NoMouse" option can get us stuck with a disabled mouse! Let's provide an alternative way to fix it:
432 if (fmodf((float)ImGui::GetTime(), 0.40f) < 0.20f)
433 {
435 ImGui::Text("<<PRESS SPACE TO DISABLE>>");
436 }
438 io.ConfigFlags &= ~ImGuiConfigFlags_NoMouse;
439 }
440 ImGui::CheckboxFlags("io.ConfigFlags: NoMouseCursorChange", &io.ConfigFlags, ImGuiConfigFlags_NoMouseCursorChange);
441 ImGui::SameLine(); HelpMarker("Instruct backend to not alter mouse cursor shape and visibility.");
442 ImGui::Checkbox("io.ConfigInputTextCursorBlink", &io.ConfigInputTextCursorBlink);
443 ImGui::SameLine(); HelpMarker("Enable blinking cursor (optional as some users consider it to be distracting)");
444 ImGui::Checkbox("io.ConfigDragClickToInputText", &io.ConfigDragClickToInputText);
445 ImGui::SameLine(); HelpMarker("Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving).");
446 ImGui::Checkbox("io.ConfigWindowsResizeFromEdges", &io.ConfigWindowsResizeFromEdges);
447 ImGui::SameLine(); HelpMarker("Enable resizing of windows from their edges and from the lower-left corner.\nThis requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback.");
448 ImGui::Checkbox("io.ConfigWindowsMoveFromTitleBarOnly", &io.ConfigWindowsMoveFromTitleBarOnly);
449 ImGui::Checkbox("io.MouseDrawCursor", &io.MouseDrawCursor);
450 ImGui::SameLine(); HelpMarker("Instruct Dear ImGui to render a mouse cursor itself. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something).");
451 ImGui::Text("Also see Style->Rendering for rendering options.");
454 }
455
456 if (ImGui::TreeNode("Backend Flags"))
457 {
459 "Those flags are set by the backends (imgui_impl_xxx files) to specify their capabilities.\n"
460 "Here we expose then as read-only fields to avoid breaking interactions with your backend.");
461
462 // Make a local copy to avoid modifying actual backend flags.
463 ImGuiBackendFlags backend_flags = io.BackendFlags;
464 ImGui::CheckboxFlags("io.BackendFlags: HasGamepad", &backend_flags, ImGuiBackendFlags_HasGamepad);
465 ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", &backend_flags, ImGuiBackendFlags_HasMouseCursors);
466 ImGui::CheckboxFlags("io.BackendFlags: HasSetMousePos", &backend_flags, ImGuiBackendFlags_HasSetMousePos);
467 ImGui::CheckboxFlags("io.BackendFlags: RendererHasVtxOffset", &backend_flags, ImGuiBackendFlags_RendererHasVtxOffset);
470 }
471
472 if (ImGui::TreeNode("Style"))
473 {
474 HelpMarker("The same contents can be accessed in 'Tools->Style Editor' or by calling the ShowStyleEditor() function.");
478 }
479
480 if (ImGui::TreeNode("Capture/Logging"))
481 {
483 "The logging API redirects all text output so you can easily capture the content of "
484 "a window or a block. Tree nodes can be automatically expanded.\n"
485 "Try opening any of the contents below in this window and then click one of the \"Log To\" button.");
487
488 HelpMarker("You can also call ImGui::LogText() to output directly to the log without a visual output.");
489 if (ImGui::Button("Copy \"Hello, world!\" to clipboard"))
490 {
492 ImGui::LogText("Hello, world!");
494 }
496 }
497 }
498
499 if (ImGui::CollapsingHeader("Window options"))
500 {
501 if (ImGui::BeginTable("split", 3))
502 {
503 ImGui::TableNextColumn(); ImGui::Checkbox("No titlebar", &no_titlebar);
504 ImGui::TableNextColumn(); ImGui::Checkbox("No scrollbar", &no_scrollbar);
505 ImGui::TableNextColumn(); ImGui::Checkbox("No menu", &no_menu);
506 ImGui::TableNextColumn(); ImGui::Checkbox("No move", &no_move);
507 ImGui::TableNextColumn(); ImGui::Checkbox("No resize", &no_resize);
508 ImGui::TableNextColumn(); ImGui::Checkbox("No collapse", &no_collapse);
509 ImGui::TableNextColumn(); ImGui::Checkbox("No close", &no_close);
510 ImGui::TableNextColumn(); ImGui::Checkbox("No nav", &no_nav);
511 ImGui::TableNextColumn(); ImGui::Checkbox("No background", &no_background);
512 ImGui::TableNextColumn(); ImGui::Checkbox("No bring to front", &no_bring_to_front);
514 }
515 }
516
517 // All demo contents
523
524 // End of ShowDemoWindow()
526 ImGui::End();
527}
int ImGuiBackendFlags
Definition imgui.h:181
@ ImGuiWindowFlags_NoNav
Definition imgui.h:936
static void ShowExampleAppCustomRendering(bool *p_open)
Definition imgui_demo.cpp:7204
static void ShowDemoWindowTables()
Definition imgui_demo.cpp:3528
static void ShowExampleAppFullscreen(bool *p_open)
Definition imgui_demo.cpp:7133
static void ShowExampleAppAutoResize(bool *p_open)
Definition imgui_demo.cpp:7008
static void ShowExampleAppSimpleOverlay(bool *p_open)
Definition imgui_demo.cpp:7086
static void ShowExampleAppMainMenuBar()
Definition imgui_demo.cpp:6177
static void ShowExampleAppPropertyEditor(bool *p_open)
Definition imgui_demo.cpp:6911
static void ShowExampleAppLongText(bool *p_open)
Definition imgui_demo.cpp:6946
static void ShowExampleAppConstrainedResize(bool *p_open)
Definition imgui_demo.cpp:7032
static void ShowExampleAppConsole(bool *p_open)
Definition imgui_demo.cpp:6630
static void ShowExampleAppWindowTitles(bool *p_open)
Definition imgui_demo.cpp:7171
static void ShowExampleAppDocuments(bool *p_open)
Definition imgui_demo.cpp:7534
static void ShowDemoWindowPopups()
Definition imgui_demo.cpp:3093
static void ShowDemoWindowLayout()
Definition imgui_demo.cpp:2327
static void ShowExampleAppLog(bool *p_open)
Definition imgui_demo.cpp:6765
static void ShowDemoWindowMisc()
Definition imgui_demo.cpp:5427
static void ShowExampleAppLayout(bool *p_open)
Definition imgui_demo.cpp:6799
static void HelpMarker(const char *desc)
Definition imgui_demo.cpp:191
static void ShowDemoWindowWidgets()
Definition imgui_demo.cpp:529
static void ShowExampleMenuFile()
Definition imgui_demo.cpp:6202
IMGUI_API bool BeginTable(const char *str_id, int column, ImGuiTableFlags flags=0, const ImVec2 &outer_size=ImVec2(0.0f, 0.0f), float inner_width=0.0f)
Definition imgui_tables.cpp:309
IMGUI_API void EndMenu()
Definition imgui_widgets.cpp:6856
IMGUI_API bool BeginMenu(const char *label, bool enabled=true)
Definition imgui_widgets.cpp:6692
IMGUI_API double GetTime()
Definition imgui.cpp:3453
IMGUI_API int GetKeyIndex(ImGuiKey imgui_key)
Definition imgui.cpp:4625
IMGUI_API void LogButtons()
Definition imgui.cpp:10285
IMGUI_API void ShowStyleEditor(ImGuiStyle *ref=NULL)
Definition imgui_demo.cpp:5920
IMGUI_API bool CollapsingHeader(const char *label, ImGuiTreeNodeFlags flags=0)
Definition imgui_widgets.cpp:5960
IMGUI_API void ShowAboutWindow(bool *p_open=NULL)
Definition imgui_demo.cpp:5610
IMGUI_API float GetFontSize()
Definition imgui.cpp:6937
IMGUI_API bool TableNextColumn()
Definition imgui_tables.cpp:1890
IMGUI_API void ShowUserGuide()
Definition imgui_demo.cpp:205
IMGUI_API ImGuiContext * GetCurrentContext()
Definition imgui.cpp:3361
IMGUI_API void ShowMetricsWindow(bool *p_open=NULL)
Definition imgui.cpp:10917
ImVec2 WorkPos
Definition imgui.h:2765

References ImGuiIO::BackendFlags, Begin(), BeginMenu(), BeginMenuBar(), BeginTable(), BulletText(), Button(), Checkbox(), CheckboxFlags(), CollapsingHeader(), ImGuiIO::ConfigDragClickToInputText, ImGuiIO::ConfigFlags, ImGuiIO::ConfigInputTextCursorBlink, ImGuiIO::ConfigWindowsMoveFromTitleBarOnly, ImGuiIO::ConfigWindowsResizeFromEdges, End(), EndMenu(), EndMenuBar(), EndTable(), GetCurrentContext(), GetFontSize(), GetIO(), GetKeyIndex(), GetMainViewport(), GetTime(), HelpMarker(), IM_ASSERT, IMGUI_VERSION, ImGuiBackendFlags_HasGamepad, ImGuiBackendFlags_HasMouseCursors, ImGuiBackendFlags_HasSetMousePos, ImGuiBackendFlags_RendererHasVtxOffset, ImGuiCond_FirstUseEver, ImGuiConfigFlags_NavEnableGamepad, ImGuiConfigFlags_NavEnableKeyboard, ImGuiConfigFlags_NavEnableSetMousePos, ImGuiConfigFlags_NoMouse, ImGuiConfigFlags_NoMouseCursorChange, ImGuiKey_Space, ImGuiWindowFlags_MenuBar, ImGuiWindowFlags_NoBackground, ImGuiWindowFlags_NoBringToFrontOnFocus, ImGuiWindowFlags_NoCollapse, ImGuiWindowFlags_NoMove, ImGuiWindowFlags_NoNav, ImGuiWindowFlags_NoResize, ImGuiWindowFlags_NoScrollbar, ImGuiWindowFlags_NoTitleBar, IsKeyPressed(), LogButtons(), LogFinish(), LogText(), LogToClipboard(), MenuItem(), ImGuiIO::MouseDrawCursor, PopItemWidth(), PushItemWidth(), SameLine(), Separator(), SetNextWindowPos(), SetNextWindowSize(), ShowAboutWindow(), ShowDemoWindowLayout(), ShowDemoWindowMisc(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppAutoResize(), ShowExampleAppConsole(), ShowExampleAppConstrainedResize(), ShowExampleAppCustomRendering(), ShowExampleAppDocuments(), ShowExampleAppFullscreen(), ShowExampleAppLayout(), ShowExampleAppLog(), ShowExampleAppLongText(), ShowExampleAppMainMenuBar(), ShowExampleAppPropertyEditor(), ShowExampleAppSimpleOverlay(), ShowExampleAppWindowTitles(), ShowExampleMenuFile(), ShowMetricsWindow(), ShowStyleEditor(), ShowUserGuide(), Spacing(), TableNextColumn(), Text(), TreeNode(), TreePop(), ImGuiViewport::WorkPos, ImVec2::x, and ImVec2::y.

Referenced by Slic3r::GUI::GLCanvas3D::render().

+ Here is the caller graph for this function:

◆ ShowFontAtlas()

void ImGui::ShowFontAtlas ( ImFontAtlas atlas)
5877{
5878 for (int i = 0; i < atlas->Fonts.Size; i++)
5879 {
5880 ImFont* font = atlas->Fonts[i];
5881 ImGui::PushID(font);
5882 ShowFont(font);
5883 ImGui::PopID();
5884 }
5885 if (ImGui::TreeNode("Atlas texture", "Atlas texture (%dx%d pixels)", atlas->TexWidth, atlas->TexHeight))
5886 {
5887 ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
5888 ImVec4 border_col = ImVec4(1.0f, 1.0f, 1.0f, 0.5f);
5889 ImGui::Image(atlas->TexID, ImVec2((float)atlas->TexWidth, (float)atlas->TexHeight), ImVec2(0, 0), ImVec2(1, 1), tint_col, border_col);
5891 }
5892}
static void ShowFont(ImFont *font)
Definition imgui_demo.cpp:5784
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1), const ImVec4 &border_col=ImVec4(0, 0, 0, 0))
Definition imgui_widgets.cpp:1000

References ImFontAtlas::Fonts, Image(), PopID(), PushID(), ShowFont(), ImVector< T >::Size, ImFontAtlas::TexHeight, ImFontAtlas::TexID, ImFontAtlas::TexWidth, TreeNode(), and TreePop().

Referenced by ShowMetricsWindow(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ShowFontSelector()

void ImGui::ShowFontSelector ( const char *  label)
5760{
5761 ImGuiIO& io = ImGui::GetIO();
5762 ImFont* font_current = ImGui::GetFont();
5763 if (ImGui::BeginCombo(label, font_current->GetDebugName()))
5764 {
5765 for (int n = 0; n < io.Fonts->Fonts.Size; n++)
5766 {
5767 ImFont* font = io.Fonts->Fonts[n];
5768 ImGui::PushID((void*)font);
5769 if (ImGui::Selectable(font->GetDebugName(), font == font_current))
5770 io.FontDefault = font;
5771 ImGui::PopID();
5772 }
5774 }
5776 HelpMarker(
5777 "- Load additional fonts with io.Fonts->AddFontFromFileTTF().\n"
5778 "- The font atlas is built when calling io.Fonts->GetTexDataAsXXXX() or io.Fonts->Build().\n"
5779 "- Read FAQ and docs/FONTS.md for more details.\n"
5780 "- If you need to add/remove fonts at runtime (e.g. for DPI change), do it before calling NewFrame().");
5781}
IMGUI_API ImFont * GetFont()
Definition imgui.cpp:6932
IMGUI_API void EndCombo()
Definition imgui_widgets.cpp:1674
IMGUI_API bool BeginCombo(const char *label, const char *preview_value, ImGuiComboFlags flags=0)
Definition imgui_widgets.cpp:1555
const char * GetDebugName() const
Definition imgui.h:2720

References BeginCombo(), EndCombo(), ImGuiIO::FontDefault, ImGuiIO::Fonts, ImFontAtlas::Fonts, ImFont::GetDebugName(), GetFont(), GetIO(), HelpMarker(), PopID(), PushID(), SameLine(), Selectable(), and ImVector< T >::Size.

Referenced by ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ShowMetricsWindow()

void ImGui::ShowMetricsWindow ( bool *  p_open = NULL)
10918{
10919 if (!Begin("Dear ImGui Metrics/Debugger", p_open))
10920 {
10921 End();
10922 return;
10923 }
10924
10925 ImGuiContext& g = *GImGui;
10926 ImGuiIO& io = g.IO;
10928
10929 // Basic info
10930 Text("Dear ImGui %s", GetVersion());
10931 Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
10932 Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3);
10933 Text("%d active windows (%d visible)", io.MetricsActiveWindows, io.MetricsRenderWindows);
10934 Text("%d active allocations", io.MetricsActiveAllocations);
10935 //SameLine(); if (SmallButton("GC")) { g.GcCompactAll = true; }
10936
10937 Separator();
10938
10939 // Debugging enums
10940 enum { WRT_OuterRect, WRT_OuterRectClipped, WRT_InnerRect, WRT_InnerClipRect, WRT_WorkRect, WRT_Content, WRT_ContentIdeal, WRT_ContentRegionRect, WRT_Count }; // Windows Rect Type
10941 const char* wrt_rects_names[WRT_Count] = { "OuterRect", "OuterRectClipped", "InnerRect", "InnerClipRect", "WorkRect", "Content", "ContentIdeal", "ContentRegionRect" };
10942 enum { TRT_OuterRect, TRT_InnerRect, TRT_WorkRect, TRT_HostClipRect, TRT_InnerClipRect, TRT_BackgroundClipRect, TRT_ColumnsRect, TRT_ColumnsWorkRect, TRT_ColumnsClipRect, TRT_ColumnsContentHeadersUsed, TRT_ColumnsContentHeadersIdeal, TRT_ColumnsContentFrozen, TRT_ColumnsContentUnfrozen, TRT_Count }; // Tables Rect Type
10943 const char* trt_rects_names[TRT_Count] = { "OuterRect", "InnerRect", "WorkRect", "HostClipRect", "InnerClipRect", "BackgroundClipRect", "ColumnsRect", "ColumnsWorkRect", "ColumnsClipRect", "ColumnsContentHeadersUsed", "ColumnsContentHeadersIdeal", "ColumnsContentFrozen", "ColumnsContentUnfrozen" };
10944 if (cfg->ShowWindowsRectsType < 0)
10945 cfg->ShowWindowsRectsType = WRT_WorkRect;
10946 if (cfg->ShowTablesRectsType < 0)
10947 cfg->ShowTablesRectsType = TRT_WorkRect;
10948
10949 struct Funcs
10950 {
10951 static ImRect GetTableRect(ImGuiTable* table, int rect_type, int n)
10952 {
10953 if (rect_type == TRT_OuterRect) { return table->OuterRect; }
10954 else if (rect_type == TRT_InnerRect) { return table->InnerRect; }
10955 else if (rect_type == TRT_WorkRect) { return table->WorkRect; }
10956 else if (rect_type == TRT_HostClipRect) { return table->HostClipRect; }
10957 else if (rect_type == TRT_InnerClipRect) { return table->InnerClipRect; }
10958 else if (rect_type == TRT_BackgroundClipRect) { return table->BgClipRect; }
10959 else if (rect_type == TRT_ColumnsRect) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->MinX, table->InnerClipRect.Min.y, c->MaxX, table->InnerClipRect.Min.y + table->LastOuterHeight); }
10960 else if (rect_type == TRT_ColumnsWorkRect) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->WorkRect.Min.y, c->WorkMaxX, table->WorkRect.Max.y); }
10961 else if (rect_type == TRT_ColumnsClipRect) { ImGuiTableColumn* c = &table->Columns[n]; return c->ClipRect; }
10962 else if (rect_type == TRT_ColumnsContentHeadersUsed){ ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersUsed, table->InnerClipRect.Min.y + table->LastFirstRowHeight); } // Note: y1/y2 not always accurate
10963 else if (rect_type == TRT_ColumnsContentHeadersIdeal){ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersIdeal, table->InnerClipRect.Min.y + table->LastFirstRowHeight); }
10964 else if (rect_type == TRT_ColumnsContentFrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXFrozen, table->InnerClipRect.Min.y + table->LastFirstRowHeight); }
10965 else if (rect_type == TRT_ColumnsContentUnfrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y + table->LastFirstRowHeight, c->ContentMaxXUnfrozen, table->InnerClipRect.Max.y); }
10966 IM_ASSERT(0);
10967 return ImRect();
10968 }
10969
10970 static ImRect GetWindowRect(ImGuiWindow* window, int rect_type)
10971 {
10972 if (rect_type == WRT_OuterRect) { return window->Rect(); }
10973 else if (rect_type == WRT_OuterRectClipped) { return window->OuterRectClipped; }
10974 else if (rect_type == WRT_InnerRect) { return window->InnerRect; }
10975 else if (rect_type == WRT_InnerClipRect) { return window->InnerClipRect; }
10976 else if (rect_type == WRT_WorkRect) { return window->WorkRect; }
10977 else if (rect_type == WRT_Content) { ImVec2 min = window->InnerRect.Min - window->Scroll + window->WindowPadding; return ImRect(min, min + window->ContentSize); }
10978 else if (rect_type == WRT_ContentIdeal) { ImVec2 min = window->InnerRect.Min - window->Scroll + window->WindowPadding; return ImRect(min, min + window->ContentSizeIdeal); }
10979 else if (rect_type == WRT_ContentRegionRect) { return window->ContentRegionRect; }
10980 IM_ASSERT(0);
10981 return ImRect();
10982 }
10983 };
10984
10985 // Tools
10986 if (TreeNode("Tools"))
10987 {
10988 // The Item Picker tool is super useful to visually select an item and break into the call-stack of where it was submitted.
10989 if (Button("Item Picker.."))
10991 SameLine();
10992 MetricsHelpMarker("Will call the IM_DEBUG_BREAK() macro to break in debugger.\nWarning: If you don't have a debugger attached, this will probably crash.");
10993
10994 Checkbox("Show windows begin order", &cfg->ShowWindowsBeginOrder);
10995 Checkbox("Show windows rectangles", &cfg->ShowWindowsRects);
10996 SameLine();
10998 cfg->ShowWindowsRects |= Combo("##show_windows_rect_type", &cfg->ShowWindowsRectsType, wrt_rects_names, WRT_Count, WRT_Count);
10999 if (cfg->ShowWindowsRects && g.NavWindow != NULL)
11000 {
11001 BulletText("'%s':", g.NavWindow->Name);
11002 Indent();
11003 for (int rect_n = 0; rect_n < WRT_Count; rect_n++)
11004 {
11005 ImRect r = Funcs::GetWindowRect(g.NavWindow, rect_n);
11006 Text("(%6.1f,%6.1f) (%6.1f,%6.1f) Size (%6.1f,%6.1f) %s", r.Min.x, r.Min.y, r.Max.x, r.Max.y, r.GetWidth(), r.GetHeight(), wrt_rects_names[rect_n]);
11007 }
11008 Unindent();
11009 }
11010 Checkbox("Show ImDrawCmd mesh when hovering", &cfg->ShowDrawCmdMesh);
11011 Checkbox("Show ImDrawCmd bounding boxes when hovering", &cfg->ShowDrawCmdBoundingBoxes);
11012
11013 Checkbox("Show tables rectangles", &cfg->ShowTablesRects);
11014 SameLine();
11016 cfg->ShowTablesRects |= Combo("##show_table_rects_type", &cfg->ShowTablesRectsType, trt_rects_names, TRT_Count, TRT_Count);
11017 if (cfg->ShowTablesRects && g.NavWindow != NULL)
11018 {
11019 for (int table_n = 0; table_n < g.Tables.GetSize(); table_n++)
11020 {
11021 ImGuiTable* table = g.Tables.GetByIndex(table_n);
11022 if (table->LastFrameActive < g.FrameCount - 1 || (table->OuterWindow != g.NavWindow && table->InnerWindow != g.NavWindow))
11023 continue;
11024
11025 BulletText("Table 0x%08X (%d columns, in '%s')", table->ID, table->ColumnsCount, table->OuterWindow->Name);
11026 if (IsItemHovered())
11027 GetForegroundDrawList()->AddRect(table->OuterRect.Min - ImVec2(1, 1), table->OuterRect.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255), 0.0f, 0, 2.0f);
11028 Indent();
11029 char buf[128];
11030 for (int rect_n = 0; rect_n < TRT_Count; rect_n++)
11031 {
11032 if (rect_n >= TRT_ColumnsRect)
11033 {
11034 if (rect_n != TRT_ColumnsRect && rect_n != TRT_ColumnsClipRect)
11035 continue;
11036 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
11037 {
11038 ImRect r = Funcs::GetTableRect(table, rect_n, column_n);
11039 ImFormatString(buf, IM_ARRAYSIZE(buf), "(%6.1f,%6.1f) (%6.1f,%6.1f) Size (%6.1f,%6.1f) Col %d %s", r.Min.x, r.Min.y, r.Max.x, r.Max.y, r.GetWidth(), r.GetHeight(), column_n, trt_rects_names[rect_n]);
11040 Selectable(buf);
11041 if (IsItemHovered())
11042 GetForegroundDrawList()->AddRect(r.Min - ImVec2(1, 1), r.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255), 0.0f, 0, 2.0f);
11043 }
11044 }
11045 else
11046 {
11047 ImRect r = Funcs::GetTableRect(table, rect_n, -1);
11048 ImFormatString(buf, IM_ARRAYSIZE(buf), "(%6.1f,%6.1f) (%6.1f,%6.1f) Size (%6.1f,%6.1f) %s", r.Min.x, r.Min.y, r.Max.x, r.Max.y, r.GetWidth(), r.GetHeight(), trt_rects_names[rect_n]);
11049 Selectable(buf);
11050 if (IsItemHovered())
11051 GetForegroundDrawList()->AddRect(r.Min - ImVec2(1, 1), r.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255), 0.0f, 0, 2.0f);
11052 }
11053 }
11054 Unindent();
11055 }
11056 }
11057
11058 TreePop();
11059 }
11060
11061 // Windows
11062 DebugNodeWindowsList(&g.Windows, "Windows");
11063 //DebugNodeWindowsList(&g.WindowsFocusOrder, "WindowsFocusOrder");
11064
11065 // DrawLists
11066 int drawlist_count = 0;
11067 for (int viewport_i = 0; viewport_i < g.Viewports.Size; viewport_i++)
11068 drawlist_count += g.Viewports[viewport_i]->DrawDataBuilder.GetDrawListCount();
11069 if (TreeNode("DrawLists", "DrawLists (%d)", drawlist_count))
11070 {
11071 for (int viewport_i = 0; viewport_i < g.Viewports.Size; viewport_i++)
11072 {
11073 ImGuiViewportP* viewport = g.Viewports[viewport_i];
11074 for (int layer_i = 0; layer_i < IM_ARRAYSIZE(viewport->DrawDataBuilder.Layers); layer_i++)
11075 for (int draw_list_i = 0; draw_list_i < viewport->DrawDataBuilder.Layers[layer_i].Size; draw_list_i++)
11076 DebugNodeDrawList(NULL, viewport->DrawDataBuilder.Layers[layer_i][draw_list_i], "DrawList");
11077 }
11078 TreePop();
11079 }
11080
11081 // Viewports
11082 if (TreeNode("Viewports", "Viewports (%d)", g.Viewports.Size))
11083 {
11087 for (int i = 0; i < g.Viewports.Size; i++)
11089 TreePop();
11090 }
11091
11092 // Details for Popups
11093 if (TreeNode("Popups", "Popups (%d)", g.OpenPopupStack.Size))
11094 {
11095 for (int i = 0; i < g.OpenPopupStack.Size; i++)
11096 {
11097 ImGuiWindow* window = g.OpenPopupStack[i].Window;
11098 BulletText("PopupID: %08x, Window: '%s'%s%s", g.OpenPopupStack[i].PopupId, window ? window->Name : "NULL", window && (window->Flags & ImGuiWindowFlags_ChildWindow) ? " ChildWindow" : "", window && (window->Flags & ImGuiWindowFlags_ChildMenu) ? " ChildMenu" : "");
11099 }
11100 TreePop();
11101 }
11102
11103 // Details for TabBars
11104 if (TreeNode("TabBars", "Tab Bars (%d)", g.TabBars.GetSize()))
11105 {
11106 for (int n = 0; n < g.TabBars.GetSize(); n++)
11107 DebugNodeTabBar(g.TabBars.GetByIndex(n), "TabBar");
11108 TreePop();
11109 }
11110
11111 // Details for Tables
11112 if (TreeNode("Tables", "Tables (%d)", g.Tables.GetSize()))
11113 {
11114 for (int n = 0; n < g.Tables.GetSize(); n++)
11116 TreePop();
11117 }
11118
11119 // Details for Fonts
11120#ifndef IMGUI_DISABLE_DEMO_WINDOWS
11121 ImFontAtlas* atlas = g.IO.Fonts;
11122 if (TreeNode("Fonts", "Fonts (%d)", atlas->Fonts.Size))
11123 {
11124 ShowFontAtlas(atlas);
11125 TreePop();
11126 }
11127#endif
11128
11129 // Details for Docking
11130#ifdef IMGUI_HAS_DOCK
11131 if (TreeNode("Docking"))
11132 {
11133 TreePop();
11134 }
11135#endif // #ifdef IMGUI_HAS_DOCK
11136
11137 // Settings
11138 if (TreeNode("Settings"))
11139 {
11140 if (SmallButton("Clear"))
11142 SameLine();
11143 if (SmallButton("Save to memory"))
11145 SameLine();
11146 if (SmallButton("Save to disk"))
11148 SameLine();
11149 if (g.IO.IniFilename)
11150 Text("\"%s\"", g.IO.IniFilename);
11151 else
11152 TextUnformatted("<NULL>");
11153 Text("SettingsDirtyTimer %.2f", g.SettingsDirtyTimer);
11154 if (TreeNode("SettingsHandlers", "Settings handlers: (%d)", g.SettingsHandlers.Size))
11155 {
11156 for (int n = 0; n < g.SettingsHandlers.Size; n++)
11157 BulletText("%s", g.SettingsHandlers[n].TypeName);
11158 TreePop();
11159 }
11160 if (TreeNode("SettingsWindows", "Settings packed data: Windows: %d bytes", g.SettingsWindows.size()))
11161 {
11162 for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings))
11163 DebugNodeWindowSettings(settings);
11164 TreePop();
11165 }
11166
11167 if (TreeNode("SettingsTables", "Settings packed data: Tables: %d bytes", g.SettingsTables.size()))
11168 {
11169 for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings))
11170 DebugNodeTableSettings(settings);
11171 TreePop();
11172 }
11173
11174#ifdef IMGUI_HAS_DOCK
11175#endif // #ifdef IMGUI_HAS_DOCK
11176
11177 if (TreeNode("SettingsIniData", "Settings unpacked data (.ini): %d bytes", g.SettingsIniData.size()))
11178 {
11180 TreePop();
11181 }
11182 TreePop();
11183 }
11184
11185 // Misc Details
11186 if (TreeNode("Internal state"))
11187 {
11188 const char* input_source_names[] = { "None", "Mouse", "Keyboard", "Gamepad", "Nav", "Clipboard" }; IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_COUNT);
11189
11190 Text("WINDOWING");
11191 Indent();
11192 Text("HoveredWindow: '%s'", g.HoveredWindow ? g.HoveredWindow->Name : "NULL");
11193 Text("HoveredWindow->Root: '%s'", g.HoveredWindow ? g.HoveredWindow->RootWindow->Name : "NULL");
11194 Text("HoveredWindowUnderMovingWindow: '%s'", g.HoveredWindowUnderMovingWindow ? g.HoveredWindowUnderMovingWindow->Name : "NULL");
11195 Text("MovingWindow: '%s'", g.MovingWindow ? g.MovingWindow->Name : "NULL");
11196 Unindent();
11197
11198 Text("ITEMS");
11199 Indent();
11200 Text("ActiveId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d, Source: %s", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer, g.ActiveIdAllowOverlap, input_source_names[g.ActiveIdSource]);
11201 Text("ActiveIdWindow: '%s'", g.ActiveIdWindow ? g.ActiveIdWindow->Name : "NULL");
11202 Text("HoveredId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d", g.HoveredId, g.HoveredIdPreviousFrame, g.HoveredIdTimer, g.HoveredIdAllowOverlap); // Data is "in-flight" so depending on when the Metrics window is called we may see current frame information or not
11203 Text("DragDrop: %d, SourceId = 0x%08X, Payload \"%s\" (%d bytes)", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize);
11204 Unindent();
11205
11206 Text("NAV,FOCUS");
11207 Indent();
11208 Text("NavWindow: '%s'", g.NavWindow ? g.NavWindow->Name : "NULL");
11209 Text("NavId: 0x%08X, NavLayer: %d", g.NavId, g.NavLayer);
11210 Text("NavInputSource: %s", input_source_names[g.NavInputSource]);
11211 Text("NavActive: %d, NavVisible: %d", g.IO.NavActive, g.IO.NavVisible);
11212 Text("NavActivateId: 0x%08X, NavInputId: 0x%08X", g.NavActivateId, g.NavInputId);
11213 Text("NavDisableHighlight: %d, NavDisableMouseHover: %d", g.NavDisableHighlight, g.NavDisableMouseHover);
11214 Text("NavFocusScopeId = 0x%08X", g.NavFocusScopeId);
11215 Text("NavWindowingTarget: '%s'", g.NavWindowingTarget ? g.NavWindowingTarget->Name : "NULL");
11216 Unindent();
11217
11218 TreePop();
11219 }
11220
11221 // Overlay: Display windows Rectangles and Begin Order
11222 if (cfg->ShowWindowsRects || cfg->ShowWindowsBeginOrder)
11223 {
11224 for (int n = 0; n < g.Windows.Size; n++)
11225 {
11226 ImGuiWindow* window = g.Windows[n];
11227 if (!window->WasActive)
11228 continue;
11229 ImDrawList* draw_list = GetForegroundDrawList(window);
11230 if (cfg->ShowWindowsRects)
11231 {
11232 ImRect r = Funcs::GetWindowRect(window, cfg->ShowWindowsRectsType);
11233 draw_list->AddRect(r.Min, r.Max, IM_COL32(255, 0, 128, 255));
11234 }
11236 {
11237 char buf[32];
11238 ImFormatString(buf, IM_ARRAYSIZE(buf), "%d", window->BeginOrderWithinContext);
11239 float font_size = GetFontSize();
11240 draw_list->AddRectFilled(window->Pos, window->Pos + ImVec2(font_size, font_size), IM_COL32(200, 100, 100, 255));
11241 draw_list->AddText(window->Pos, IM_COL32(255, 255, 255, 255), buf);
11242 }
11243 }
11244 }
11245
11246 // Overlay: Display Tables Rectangles
11247 if (cfg->ShowTablesRects)
11248 {
11249 for (int table_n = 0; table_n < g.Tables.GetSize(); table_n++)
11250 {
11251 ImGuiTable* table = g.Tables.GetByIndex(table_n);
11252 if (table->LastFrameActive < g.FrameCount - 1)
11253 continue;
11254 ImDrawList* draw_list = GetForegroundDrawList(table->OuterWindow);
11255 if (cfg->ShowTablesRectsType >= TRT_ColumnsRect)
11256 {
11257 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
11258 {
11259 ImRect r = Funcs::GetTableRect(table, cfg->ShowTablesRectsType, column_n);
11260 ImU32 col = (table->HoveredColumnBody == column_n) ? IM_COL32(255, 255, 128, 255) : IM_COL32(255, 0, 128, 255);
11261 float thickness = (table->HoveredColumnBody == column_n) ? 3.0f : 1.0f;
11262 draw_list->AddRect(r.Min, r.Max, col, 0.0f, 0, thickness);
11263 }
11264 }
11265 else
11266 {
11267 ImRect r = Funcs::GetTableRect(table, cfg->ShowTablesRectsType, -1);
11268 draw_list->AddRect(r.Min, r.Max, IM_COL32(255, 0, 128, 255));
11269 }
11270 }
11271 }
11272
11273#ifdef IMGUI_HAS_DOCK
11274 // Overlay: Display Docking info
11275 if (show_docking_nodes && g.IO.KeyCtrl)
11276 {
11277 }
11278#endif // #ifdef IMGUI_HAS_DOCK
11279
11280 End();
11281}
static void MetricsHelpMarker(const char *desc)
Definition imgui.cpp:10900
static void RenderViewportsThumbnails()
Definition imgui.cpp:10878
@ ImGuiInputSource_COUNT
Definition imgui_internal.h:883
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half() min(const half &a, const half &b)
Definition Half.h:507
void ShowFontAtlas(ImFontAtlas *atlas)
Definition imgui_demo.cpp:5876
IMGUI_API float GetTreeNodeToLabelSpacing()
Definition imgui_widgets.cpp:5941
IMGUI_API void Indent(float indent_w=0.0f)
Definition imgui.cpp:7538
IMGUI_API void ClearIniSettings()
Definition imgui.cpp:10421
IMGUI_API void TextUnformatted(const char *text, const char *text_end=NULL)
Definition imgui_widgets.cpp:255
IMGUI_API void DebugNodeViewport(ImGuiViewportP *viewport)
Definition imgui.cpp:11466
IMGUI_API float GetTextLineHeight()
Definition imgui.cpp:7639
void DebugStartItemPicker()
Definition imgui_internal.h:2614
IMGUI_API void DebugNodeTabBar(ImGuiTabBar *tab_bar, const char *label)
Definition imgui.cpp:11431
IMGUI_API void Unindent(float indent_w=0.0f)
Definition imgui.cpp:7546
IMGUI_API void DebugNodeWindowSettings(ImGuiWindowSettings *settings)
Definition imgui.cpp:11544
IMGUI_API void DebugNodeTable(ImGuiTable *table)
Definition imgui_tables.cpp:3497
IMGUI_API void SaveIniSettingsToDisk(const char *ini_filename)
Definition imgui.cpp:10511
int size() const
Definition imgui_internal.h:640
ImGuiWindow * MovingWindow
Definition imgui_internal.h:1383
ImChunkStream< ImGuiTableSettings > SettingsTables
Definition imgui_internal.h:1564
int MetricsActiveAllocations
Definition imgui.h:1872
const char * IniFilename
Definition imgui.h:1785
int ShowWindowsRectsType
Definition imgui_internal.h:1298
int ShowTablesRectsType
Definition imgui_internal.h:1299
bool ShowWindowsRects
Definition imgui_internal.h:1293
bool ShowTablesRects
Definition imgui_internal.h:1295
bool ShowWindowsBeginOrder
Definition imgui_internal.h:1294
ImRect BgClipRect
Definition imgui_internal.h:2148
float LastFirstRowHeight
Definition imgui_internal.h:2137
int GetSize() const
Definition imgui_internal.h:625

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdAllowOverlap, ImGuiContext::ActiveIdPreviousFrame, ImGuiContext::ActiveIdSource, ImGuiContext::ActiveIdTimer, ImGuiContext::ActiveIdWindow, ImDrawList::AddRect(), ImDrawList::AddRectFilled(), ImDrawList::AddText(), ImChunkStream< T >::begin(), Begin(), ImGuiWindow::BeginOrderWithinContext, ImGuiTable::BgClipRect, ImGuiTextBuffer::Buf, BulletText(), Button(), ImGuiTextBuffer::c_str(), Checkbox(), ClearIniSettings(), col(), ImGuiTable::Columns, ImGuiTable::ColumnsCount, Combo(), ImGuiWindow::ContentRegionRect, ImGuiWindow::ContentSize, ImGuiWindow::ContentSizeIdeal, ImGuiPayload::DataSize, ImGuiPayload::DataType, ImGuiContext::DebugMetricsConfig, DebugNodeDrawList(), DebugNodeTabBar(), DebugNodeTable(), DebugNodeTableSettings(), DebugNodeViewport(), DebugNodeWindowSettings(), DebugNodeWindowsList(), DebugStartItemPicker(), ImGuiContext::DragDropActive, ImGuiContext::DragDropPayload, ImGuiViewportP::DrawDataBuilder, End(), ImGuiWindow::Flags, ImGuiIO::Fonts, ImFontAtlas::Fonts, ImGuiContext::FrameCount, ImGuiIO::Framerate, ImPool< T >::GetByIndex(), GetFontSize(), GetForegroundDrawList(), ImRect::GetHeight(), ImPool< T >::GetSize(), GetTextLineHeight(), GetTreeNodeToLabelSpacing(), GetVersion(), ImRect::GetWidth(), GImGui, ImGuiTable::HostClipRect, ImGuiTable::HoveredColumnBody, ImGuiContext::HoveredId, ImGuiContext::HoveredIdAllowOverlap, ImGuiContext::HoveredIdPreviousFrame, ImGuiContext::HoveredIdTimer, ImGuiContext::HoveredWindow, ImGuiContext::HoveredWindowUnderMovingWindow, ImGuiTable::ID, IM_ARRAYSIZE, IM_ASSERT, IM_COL32, ImFormatString(), ImGuiInputSource_COUNT, ImGuiInputTextFlags_ReadOnly, ImGuiWindowFlags_ChildMenu, ImGuiWindowFlags_ChildWindow, Indent(), ImGuiIO::IniFilename, ImGuiWindow::InnerClipRect, ImGuiTable::InnerClipRect, ImGuiWindow::InnerRect, ImGuiTable::InnerRect, ImGuiTable::InnerWindow, InputTextMultiline(), ImGuiContext::IO, IsItemHovered(), ImGuiIO::KeyCtrl, ImGuiTable::LastFirstRowHeight, ImGuiTable::LastFrameActive, ImGuiTable::LastOuterHeight, ImDrawDataBuilder::Layers, ImRect::Max, ImGuiIO::MetricsActiveAllocations, ImGuiIO::MetricsActiveWindows, MetricsHelpMarker(), ImGuiIO::MetricsRenderIndices, ImGuiIO::MetricsRenderVertices, ImGuiIO::MetricsRenderWindows, ImRect::Min, ImGuiContext::MovingWindow, ImGuiWindow::Name, ImGuiContext::NavActivateId, ImGuiIO::NavActive, ImGuiContext::NavDisableHighlight, ImGuiContext::NavDisableMouseHover, ImGuiContext::NavFocusScopeId, ImGuiContext::NavId, ImGuiContext::NavInputId, ImGuiContext::NavInputSource, ImGuiContext::NavLayer, ImGuiIO::NavVisible, ImGuiContext::NavWindow, ImGuiContext::NavWindowingTarget, ImChunkStream< T >::next_chunk(), ImGuiContext::OpenPopupStack, ImGuiTable::OuterRect, ImGuiWindow::OuterRectClipped, ImGuiTable::OuterWindow, ImGuiWindow::Pos, ImGuiWindow::Rect(), RenderViewportsThumbnails(), ImGuiWindow::RootWindow, SameLine(), SaveIniSettingsToDisk(), SaveIniSettingsToMemory(), ImGuiWindow::Scroll, Selectable(), Separator(), SetNextItemWidth(), ImGuiContext::SettingsDirtyTimer, ImGuiContext::SettingsHandlers, ImGuiContext::SettingsIniData, ImGuiContext::SettingsTables, ImGuiContext::SettingsWindows, ImGuiMetricsConfig::ShowDrawCmdBoundingBoxes, ImGuiMetricsConfig::ShowDrawCmdMesh, ShowFontAtlas(), ImGuiMetricsConfig::ShowTablesRects, ImGuiMetricsConfig::ShowTablesRectsType, ImGuiMetricsConfig::ShowWindowsBeginOrder, ImGuiMetricsConfig::ShowWindowsRects, ImGuiMetricsConfig::ShowWindowsRectsType, ImVector< T >::Size, ImGuiTextBuffer::size(), ImChunkStream< T >::size(), SmallButton(), ImGuiPayload::SourceId, ImGuiContext::TabBars, ImGuiContext::Tables, Text(), TextUnformatted(), TreeNode(), TreePop(), Unindent(), ImGuiContext::Viewports, ImGuiWindow::WasActive, ImGuiWindow::WindowPadding, ImGuiContext::Windows, ImGuiWindow::WorkRect, ImGuiTable::WorkRect, ImVec2::x, and ImVec2::y.

Referenced by ShowDemoWindow().

+ Here is the caller graph for this function:

◆ ShowStyleEditor()

void ImGui::ShowStyleEditor ( ImGuiStyle ref = NULL)
5921{
5922 // You can pass in a reference ImGuiStyle structure to compare to, revert to and save to
5923 // (without a reference style pointer, we will use one compared locally as a reference)
5925 static ImGuiStyle ref_saved_style;
5926
5927 // Default to using internal storage as reference
5928 static bool init = true;
5929 if (init && ref == NULL)
5930 ref_saved_style = style;
5931 init = false;
5932 if (ref == NULL)
5933 ref = &ref_saved_style;
5934
5936
5937 if (ImGui::ShowStyleSelector("Colors##Selector"))
5938 ref_saved_style = style;
5939 ImGui::ShowFontSelector("Fonts##Selector");
5940
5941 // Simplified Settings (expose floating-pointer border sizes as boolean representing 0.0f or 1.0f)
5942 if (ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f"))
5943 style.GrabRounding = style.FrameRounding; // Make GrabRounding always the same value as FrameRounding
5944 { bool border = (style.WindowBorderSize > 0.0f); if (ImGui::Checkbox("WindowBorder", &border)) { style.WindowBorderSize = border ? 1.0f : 0.0f; } }
5946 { bool border = (style.FrameBorderSize > 0.0f); if (ImGui::Checkbox("FrameBorder", &border)) { style.FrameBorderSize = border ? 1.0f : 0.0f; } }
5948 { bool border = (style.PopupBorderSize > 0.0f); if (ImGui::Checkbox("PopupBorder", &border)) { style.PopupBorderSize = border ? 1.0f : 0.0f; } }
5949
5950 // Save/Revert button
5951 if (ImGui::Button("Save Ref"))
5952 *ref = ref_saved_style = style;
5954 if (ImGui::Button("Revert Ref"))
5955 style = *ref;
5957 HelpMarker(
5958 "Save/Revert in local non-persistent storage. Default Colors definition are not affected. "
5959 "Use \"Export\" below to save them somewhere.");
5960
5962
5964 {
5965 if (ImGui::BeginTabItem("Sizes"))
5966 {
5967 ImGui::Text("Main");
5968 ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f");
5969 ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f");
5970 ImGui::SliderFloat2("CellPadding", (float*)&style.CellPadding, 0.0f, 20.0f, "%.0f");
5971 ImGui::SliderFloat2("ItemSpacing", (float*)&style.ItemSpacing, 0.0f, 20.0f, "%.0f");
5972 ImGui::SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f");
5973 ImGui::SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f");
5974 ImGui::SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f");
5975 ImGui::SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f");
5976 ImGui::SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f");
5977 ImGui::Text("Borders");
5978 ImGui::SliderFloat("WindowBorderSize", &style.WindowBorderSize, 0.0f, 1.0f, "%.0f");
5979 ImGui::SliderFloat("ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f, "%.0f");
5980 ImGui::SliderFloat("PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f, "%.0f");
5981 ImGui::SliderFloat("FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f, "%.0f");
5982 ImGui::SliderFloat("TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f, "%.0f");
5983 ImGui::Text("Rounding");
5984 ImGui::SliderFloat("WindowRounding", &style.WindowRounding, 0.0f, 12.0f, "%.0f");
5985 ImGui::SliderFloat("ChildRounding", &style.ChildRounding, 0.0f, 12.0f, "%.0f");
5986 ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f");
5987 ImGui::SliderFloat("PopupRounding", &style.PopupRounding, 0.0f, 12.0f, "%.0f");
5988 ImGui::SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 12.0f, "%.0f");
5989 ImGui::SliderFloat("GrabRounding", &style.GrabRounding, 0.0f, 12.0f, "%.0f");
5990 ImGui::SliderFloat("LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f, 12.0f, "%.0f");
5991 ImGui::SliderFloat("TabRounding", &style.TabRounding, 0.0f, 12.0f, "%.0f");
5992 ImGui::Text("Alignment");
5993 ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");
5994 int window_menu_button_position = style.WindowMenuButtonPosition + 1;
5995 if (ImGui::Combo("WindowMenuButtonPosition", (int*)&window_menu_button_position, "None\0Left\0Right\0"))
5996 style.WindowMenuButtonPosition = window_menu_button_position - 1;
5997 ImGui::Combo("ColorButtonPosition", (int*)&style.ColorButtonPosition, "Left\0Right\0");
5998 ImGui::SliderFloat2("ButtonTextAlign", (float*)&style.ButtonTextAlign, 0.0f, 1.0f, "%.2f");
5999 ImGui::SameLine(); HelpMarker("Alignment applies when a button is larger than its text content.");
6000 ImGui::SliderFloat2("SelectableTextAlign", (float*)&style.SelectableTextAlign, 0.0f, 1.0f, "%.2f");
6001 ImGui::SameLine(); HelpMarker("Alignment applies when a selectable is larger than its text content.");
6002 ImGui::Text("Safe Area Padding");
6003 ImGui::SameLine(); HelpMarker("Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured).");
6004 ImGui::SliderFloat2("DisplaySafeAreaPadding", (float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f, "%.0f");
6006 }
6007
6008 if (ImGui::BeginTabItem("Colors"))
6009 {
6010 static int output_dest = 0;
6011 static bool output_only_modified = true;
6012 if (ImGui::Button("Export"))
6013 {
6014 if (output_dest == 0)
6016 else
6018 ImGui::LogText("ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
6019 for (int i = 0; i < ImGuiCol_COUNT; i++)
6020 {
6021 const ImVec4& col = style.Colors[i];
6022 const char* name = ImGui::GetStyleColorName(i);
6023 if (!output_only_modified || memcmp(&col, &ref->Colors[i], sizeof(ImVec4)) != 0)
6024 ImGui::LogText("colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, %.2ff);" IM_NEWLINE,
6025 name, 23 - (int)strlen(name), "", col.x, col.y, col.z, col.w);
6026 }
6028 }
6029 ImGui::SameLine(); ImGui::SetNextItemWidth(120); ImGui::Combo("##output_type", &output_dest, "To Clipboard\0To TTY\0");
6030 ImGui::SameLine(); ImGui::Checkbox("Only Modified Colors", &output_only_modified);
6031
6032 static ImGuiTextFilter filter;
6033 filter.Draw("Filter colors", ImGui::GetFontSize() * 16);
6034
6035 static ImGuiColorEditFlags alpha_flags = 0;
6036 if (ImGui::RadioButton("Opaque", alpha_flags == ImGuiColorEditFlags_None)) { alpha_flags = ImGuiColorEditFlags_None; } ImGui::SameLine();
6039 HelpMarker(
6040 "In the color list:\n"
6041 "Left-click on color square to open color picker,\n"
6042 "Right-click to open edit options menu.");
6043
6046 for (int i = 0; i < ImGuiCol_COUNT; i++)
6047 {
6048 const char* name = ImGui::GetStyleColorName(i);
6049 if (!filter.PassFilter(name))
6050 continue;
6051 ImGui::PushID(i);
6052 ImGui::ColorEdit4("##color", (float*)&style.Colors[i], ImGuiColorEditFlags_AlphaBar | alpha_flags);
6053 if (memcmp(&style.Colors[i], &ref->Colors[i], sizeof(ImVec4)) != 0)
6054 {
6055 // Tips: in a real user application, you may want to merge and use an icon font into the main font,
6056 // so instead of "Save"/"Revert" you'd use icons!
6057 // Read the FAQ and docs/FONTS.md about using icon fonts. It's really easy and super convenient!
6058 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button("Save")) { ref->Colors[i] = style.Colors[i]; }
6059 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button("Revert")) { style.Colors[i] = ref->Colors[i]; }
6060 }
6061 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
6063 ImGui::PopID();
6064 }
6067
6069 }
6070
6071 if (ImGui::BeginTabItem("Fonts"))
6072 {
6073 ImGuiIO& io = ImGui::GetIO();
6074 ImFontAtlas* atlas = io.Fonts;
6075 HelpMarker("Read FAQ and docs/FONTS.md for details on font loading.");
6076 ImGui::ShowFontAtlas(atlas);
6077
6078 // Post-baking font scaling. Note that this is NOT the nice way of scaling fonts, read below.
6079 // (we enforce hard clamping manually as by default DragFloat/SliderFloat allows CTRL+Click text to get out of bounds).
6080 const float MIN_SCALE = 0.3f;
6081 const float MAX_SCALE = 2.0f;
6082 HelpMarker(
6083 "Those are old settings provided for convenience.\n"
6084 "However, the _correct_ way of scaling your UI is currently to reload your font at the designed size, "
6085 "rebuild the font atlas, and call style.ScaleAllSizes() on a reference ImGuiStyle structure.\n"
6086 "Using those settings here will give you poor quality results.");
6087 static float window_scale = 1.0f;
6089 if (ImGui::DragFloat("window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE, "%.2f", ImGuiSliderFlags_AlwaysClamp)) // Scale only this window
6090 ImGui::SetWindowFontScale(window_scale);
6091 ImGui::DragFloat("global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE, MAX_SCALE, "%.2f", ImGuiSliderFlags_AlwaysClamp); // Scale everything
6093
6095 }
6096
6097 if (ImGui::BeginTabItem("Rendering"))
6098 {
6099 ImGui::Checkbox("Anti-aliased lines", &style.AntiAliasedLines);
6101 HelpMarker("When disabling anti-aliasing lines, you'll probably want to disable borders in your style as well.");
6102
6103 ImGui::Checkbox("Anti-aliased lines use texture", &style.AntiAliasedLinesUseTex);
6105 HelpMarker("Faster lines using texture data. Require backend to render with bilinear filtering (not point/nearest filtering).");
6106
6107 ImGui::Checkbox("Anti-aliased fill", &style.AntiAliasedFill);
6109 ImGui::DragFloat("Curve Tessellation Tolerance", &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f, "%.2f");
6110 if (style.CurveTessellationTol < 0.10f) style.CurveTessellationTol = 0.10f;
6111
6112 // When editing the "Circle Segment Max Error" value, draw a preview of its effect on auto-tessellated circles.
6113 ImGui::DragFloat("Circle Tessellation Max Error", &style.CircleTessellationMaxError , 0.005f, 0.10f, 5.0f, "%.2f", ImGuiSliderFlags_AlwaysClamp);
6114 if (ImGui::IsItemActive())
6115 {
6118 ImGui::TextUnformatted("(R = radius, N = number of segments)");
6120 ImDrawList* draw_list = ImGui::GetWindowDrawList();
6121 const float min_widget_width = ImGui::CalcTextSize("N: MMM\nR: MMM").x;
6122 for (int n = 0; n < 8; n++)
6123 {
6124 const float RAD_MIN = 5.0f;
6125 const float RAD_MAX = 70.0f;
6126 const float rad = RAD_MIN + (RAD_MAX - RAD_MIN) * (float)n / (8.0f - 1.0f);
6127
6129
6130 ImGui::Text("R: %.f\nN: %d", rad, draw_list->_CalcCircleAutoSegmentCount(rad));
6131
6132 const float canvas_width = IM_MAX(min_widget_width, rad * 2.0f);
6133 const float offset_x = floorf(canvas_width * 0.5f);
6134 const float offset_y = floorf(RAD_MAX);
6135
6136 const ImVec2 p1 = ImGui::GetCursorScreenPos();
6137 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad, ImGui::GetColorU32(ImGuiCol_Text));
6138 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
6139
6140 /*
6141 const ImVec2 p2 = ImGui::GetCursorScreenPos();
6142 draw_list->AddCircleFilled(ImVec2(p2.x + offset_x, p2.y + offset_y), rad, ImGui::GetColorU32(ImGuiCol_Text));
6143 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
6144 */
6145
6148 }
6150 }
6152 HelpMarker("When drawing circle primitives with \"num_segments == 0\" tesselation will be calculated automatically.");
6153
6154 ImGui::DragFloat("Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.
6156
6158 }
6159
6161 }
6162
6164}
@ ImGuiTabBarFlags_None
Definition imgui.h:1056
@ ImGuiCol_COUNT
Definition imgui.h:1466
@ ImGuiColorEditFlags_None
Definition imgui.h:1522
#define IM_MAX(A, B)
Definition imgui_demo.cpp:155
IMGUI_API void ShowFontSelector(const char *label)
Definition imgui_demo.cpp:5759
IMGUI_API void SetWindowFontScale(float scale)
Definition imgui.cpp:6947
IMGUI_API void EndTabItem()
Definition imgui_widgets.cpp:7674
IMGUI_API float GetWindowWidth()
Definition imgui.cpp:6701
IMGUI_API bool BeginTabItem(const char *label, bool *p_open=NULL, ImGuiTabItemFlags flags=0)
Definition imgui_widgets.cpp:7650
IMGUI_API bool SliderFloat2(const char *label, float v[2], float v_min, float v_max, const char *format="%.3f", ImGuiSliderFlags flags=0)
Definition imgui_widgets.cpp:3043
IMGUI_API bool ShowStyleSelector(const char *label)
Definition imgui_demo.cpp:5904
IMGUI_API void EndTabBar()
Definition imgui_widgets.cpp:7088
IMGUI_API bool SliderFloat(const char *label, float *v, float v_min, float v_max, const char *format="%.3f", ImGuiSliderFlags flags=0)
Definition imgui_widgets.cpp:3038
IMGUI_API bool BeginTabBar(const char *str_id, ImGuiTabBarFlags flags=0)
Definition imgui_widgets.cpp:7015
IMGUI_API int _CalcCircleAutoSegmentCount(float radius) const
Definition imgui_draw.cpp:557
Definition imgui.h:2024
IMGUI_API bool PassFilter(const char *text, const char *text_end=NULL) const
Definition imgui.cpp:2087
IMGUI_API bool Draw(const char *label="Filter (inc,-exc)", float width=0.0f)
Definition imgui.cpp:2038

References ImDrawList::_CalcCircleAutoSegmentCount(), ImDrawList::AddCircle(), BeginChild(), BeginGroup(), BeginTabBar(), BeginTabItem(), BeginTooltip(), Button(), CalcTextSize(), Checkbox(), col(), ColorEdit4(), ImGuiStyle::Colors, Combo(), DragFloat(), ImGuiTextFilter::Draw(), Dummy(), EndChild(), EndGroup(), EndTabBar(), EndTabItem(), EndTooltip(), ImGuiIO::FontGlobalScale, ImGuiIO::Fonts, GetColorU32(), GetCursorScreenPos(), GetFontSize(), GetIO(), GetStyle(), GetStyleColorName(), GetWindowDrawList(), GetWindowWidth(), HelpMarker(), IM_MAX, IM_NEWLINE, ImGuiCol_COUNT, ImGuiCol_Text, ImGuiColorEditFlags_AlphaBar, ImGuiColorEditFlags_AlphaPreview, ImGuiColorEditFlags_AlphaPreviewHalf, ImGuiColorEditFlags_None, ImGuiSliderFlags_AlwaysClamp, ImGuiTabBarFlags_None, ImGuiWindowFlags_AlwaysHorizontalScrollbar, ImGuiWindowFlags_AlwaysVerticalScrollbar, ImGuiWindowFlags_NavFlattened, IsItemActive(), LogFinish(), LogText(), LogToClipboard(), LogToTTY(), ImGuiTextFilter::PassFilter(), PopID(), PopItemWidth(), PushID(), PushItemWidth(), RadioButton(), SameLine(), Separator(), SetNextItemWidth(), SetNextWindowPos(), SetWindowFontScale(), ShowFontAtlas(), ShowFontSelector(), ShowStyleSelector(), SliderFloat(), SliderFloat2(), Spacing(), style, Text(), TextUnformatted(), ImVec2::x, and ImVec2::y.

Referenced by ShowDemoWindow().

+ Here is the caller graph for this function:

◆ ShowStyleSelector()

bool ImGui::ShowStyleSelector ( const char *  label)
5905{
5906 static int style_idx = -1;
5907 if (ImGui::Combo(label, &style_idx, "Dark\0Light\0Classic\0"))
5908 {
5909 switch (style_idx)
5910 {
5911 case 0: ImGui::StyleColorsDark(); break;
5912 case 1: ImGui::StyleColorsLight(); break;
5913 case 2: ImGui::StyleColorsClassic(); break;
5914 }
5915 return true;
5916 }
5917 return false;
5918}
IMGUI_API void StyleColorsClassic(ImGuiStyle *dst=NULL)
Definition imgui_draw.cpp:252
IMGUI_API void StyleColorsDark(ImGuiStyle *dst=NULL)
Definition imgui_draw.cpp:192
IMGUI_API void StyleColorsLight(ImGuiStyle *dst=NULL)
Definition imgui_draw.cpp:313

References Combo(), StyleColorsClassic(), StyleColorsDark(), and StyleColorsLight().

Referenced by ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ShowUserGuide()

void ImGui::ShowUserGuide ( )
206{
207 ImGuiIO& io = ImGui::GetIO();
208 ImGui::BulletText("Double-click on title bar to collapse window.");
210 "Click and drag on lower corner to resize window\n"
211 "(double-click to auto fit window to its contents).");
212 ImGui::BulletText("CTRL+Click on a slider or drag box to input value as text.");
213 ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields.");
215 ImGui::BulletText("CTRL+Mouse Wheel to zoom window contents.");
216 ImGui::BulletText("While inputing text:\n");
218 ImGui::BulletText("CTRL+Left/Right to word jump.");
219 ImGui::BulletText("CTRL+A or double-click to select all.");
220 ImGui::BulletText("CTRL+X/C/V to use clipboard cut/copy/paste.");
221 ImGui::BulletText("CTRL+Z,CTRL+Y to undo/redo.");
222 ImGui::BulletText("ESCAPE to revert.");
223 ImGui::BulletText("You can apply arithmetic operators +,*,/ on numerical values.\nUse +- to subtract.");
225 ImGui::BulletText("With keyboard navigation enabled:");
227 ImGui::BulletText("Arrow keys to navigate.");
228 ImGui::BulletText("Space to activate a widget.");
229 ImGui::BulletText("Return to input text into a widget.");
230 ImGui::BulletText("Escape to deactivate a widget, close popup, exit child window.");
231 ImGui::BulletText("Alt to jump to the menu layer of a window.");
232 ImGui::BulletText("CTRL+Tab to select a window.");
234}
bool FontAllowUserScaling
Definition imgui.h:1797

References BulletText(), ImGuiIO::FontAllowUserScaling, GetIO(), Indent(), and Unindent().

Referenced by ShowDemoWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ShrinkWidths()

void ImGui::ShrinkWidths ( ImGuiShrinkWidthItem items,
int  count,
float  width_excess 
)
1502{
1503 if (count == 1)
1504 {
1505 if (items[0].Width >= 0.0f)
1506 items[0].Width = ImMax(items[0].Width - width_excess, 1.0f);
1507 return;
1508 }
1509 ImQsort(items, (size_t)count, sizeof(ImGuiShrinkWidthItem), ShrinkWidthItemComparer);
1510 int count_same_width = 1;
1511 while (width_excess > 0.0f && count_same_width < count)
1512 {
1513 while (count_same_width < count && items[0].Width <= items[count_same_width].Width)
1514 count_same_width++;
1515 float max_width_to_remove_per_item = (count_same_width < count && items[count_same_width].Width >= 0.0f) ? (items[0].Width - items[count_same_width].Width) : (items[0].Width - 1.0f);
1516 if (max_width_to_remove_per_item <= 0.0f)
1517 break;
1518 float width_to_remove_per_item = ImMin(width_excess / count_same_width, max_width_to_remove_per_item);
1519 for (int item_n = 0; item_n < count_same_width; item_n++)
1520 items[item_n].Width -= width_to_remove_per_item;
1521 width_excess -= width_to_remove_per_item * count_same_width;
1522 }
1523
1524 // Round width and redistribute remainder left-to-right (could make it an option of the function?)
1525 // Ensure that e.g. the right-most tab of a shrunk tab-bar always reaches exactly at the same distance from the right-most edge of the tab bar separator.
1526 width_excess = 0.0f;
1527 for (int n = 0; n < count; n++)
1528 {
1529 float width_rounded = ImFloor(items[n].Width);
1530 width_excess += items[n].Width - width_rounded;
1531 items[n].Width = width_rounded;
1532 }
1533 if (width_excess > 0.0f)
1534 for (int n = 0; n < count; n++)
1535 if (items[n].Index < (int)(width_excess + 0.01f))
1536 items[n].Width += 1.0f;
1537}
float Width
Definition imgui_internal.h:1137
Definition imgui_internal.h:1135
static int IMGUI_CDECL ShrinkWidthItemComparer(const void *lhs, const void *rhs)
Definition imgui_widgets.cpp:1490

References ImFloor(), ImMax(), ImMin(), ImQsort, ShrinkWidthItemComparer(), and ImGuiShrinkWidthItem::Width.

Referenced by TabBarLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Shutdown()

void ImGui::Shutdown ( ImGuiContext context)
4159{
4160 // The fonts atlas can be used prior to calling NewFrame(), so we clear it even if g.Initialized is FALSE (which would happen if we never called NewFrame)
4161 ImGuiContext& g = *context;
4162 if (g.IO.Fonts && g.FontAtlasOwnedByContext)
4163 {
4164 g.IO.Fonts->Locked = false;
4165 IM_DELETE(g.IO.Fonts);
4166 }
4167 g.IO.Fonts = NULL;
4168
4169 // Cleanup of other data are conditional on actually having initialized Dear ImGui.
4170 if (!g.Initialized)
4171 return;
4172
4173 // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file)
4174 if (g.SettingsLoaded && g.IO.IniFilename != NULL)
4175 {
4176 ImGuiContext* backup_context = GImGui;
4177 SetCurrentContext(&g);
4178 SaveIniSettingsToDisk(g.IO.IniFilename);
4179 SetCurrentContext(backup_context);
4180 }
4181
4183
4184 // Clear everything else
4185 for (int i = 0; i < g.Windows.Size; i++)
4186 IM_DELETE(g.Windows[i]);
4187 g.Windows.clear();
4190 g.CurrentWindow = NULL;
4192 g.WindowsById.Clear();
4193 g.NavWindow = NULL;
4196 g.MovingWindow = NULL;
4197 g.ColorStack.clear();
4198 g.StyleVarStack.clear();
4199 g.FontStack.clear();
4202
4203 for (int i = 0; i < g.Viewports.Size; i++)
4204 IM_DELETE(g.Viewports[i]);
4205 g.Viewports.clear();
4206
4207 g.TabBars.Clear();
4210
4211 g.Tables.Clear();
4212 for (int i = 0; i < g.TablesTempDataStack.Size; i++)
4213 g.TablesTempDataStack[i].~ImGuiTableTempData();
4216
4220
4223
4224 if (g.LogFile)
4225 {
4226#ifndef IMGUI_DISABLE_TTY_FUNCTIONS
4227 if (g.LogFile != stdout)
4228#endif
4230 g.LogFile = NULL;
4231 }
4232 g.LogBuffer.clear();
4233
4234 g.Initialized = false;
4235}
@ ImGuiContextHookType_Shutdown
Definition imgui_internal.h:1333
void clear()
Definition imgui_internal.h:638
bool FontAtlasOwnedByContext
Definition imgui_internal.h:1353
ImVector< ImGuiShrinkWidthItem > ShrinkWidthBuffer
Definition imgui_internal.h:1530
ImVector< char > ClipboardHandlerData
Definition imgui_internal.h:1550
ImVector< ImDrawChannel > DrawChannelsTempMergeBuffer
Definition imgui_internal.h:1524
void ClearFreeMemory()
Definition imgui_internal.h:1038
void Clear()
Definition imgui.h:2094
void Clear()
Definition imgui_internal.h:620

References ImGuiContext::ActiveIdPreviousFrameWindow, ImGuiContext::ActiveIdWindow, ImGuiContext::BeginPopupStack, CallContextHooks(), ImVector< T >::clear(), ImGuiTextBuffer::clear(), ImGuiStorage::Clear(), ImPool< T >::Clear(), ImChunkStream< T >::clear(), ImGuiInputTextState::ClearFreeMemory(), ImGuiContext::ClipboardHandlerData, ImGuiContext::ColorStack, ImGuiContext::CurrentTabBarStack, ImGuiContext::CurrentWindow, ImGuiContext::CurrentWindowStack, ImGuiContext::DrawChannelsTempMergeBuffer, ImGuiContext::FontAtlasOwnedByContext, ImGuiIO::Fonts, ImGuiContext::FontStack, GImGui, ImGuiContext::HoveredWindow, ImGuiContext::HoveredWindowUnderMovingWindow, IM_DELETE(), ImFileClose(), ImGuiContextHookType_Shutdown, ImGuiIO::IniFilename, ImGuiContext::Initialized, ImGuiContext::InputTextState, ImGuiContext::IO, ImFontAtlas::Locked, ImGuiContext::LogBuffer, ImGuiContext::LogFile, ImGuiContext::MenusIdSubmittedThisFrame, ImGuiContext::MovingWindow, ImGuiContext::NavWindow, ImGuiContext::OpenPopupStack, SaveIniSettingsToDisk(), SetCurrentContext(), ImGuiContext::SettingsHandlers, ImGuiContext::SettingsLoaded, ImGuiContext::SettingsWindows, ImGuiContext::ShrinkWidthBuffer, ImVector< T >::Size, ImGuiContext::StyleVarStack, ImGuiContext::TabBars, ImGuiContext::Tables, ImGuiContext::TablesTempDataStack, ImGuiContext::Viewports, ImGuiContext::Windows, ImGuiContext::WindowsById, ImGuiContext::WindowsFocusOrder, and ImGuiContext::WindowsTempSortBuffer.

Referenced by DestroyContext().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SliderAngle()

bool ImGui::SliderAngle ( const char *  label,
float *  v_rad,
float  v_degrees_min = -360.0f,
float  v_degrees_max = +360.0f,
const char *  format = "%.0f deg",
ImGuiSliderFlags  flags = 0 
)
3059{
3060 if (format == NULL)
3061 format = "%.0f deg";
3062 float v_deg = (*v_rad) * 360.0f / (2 * IM_PI);
3063 bool value_changed = SliderFloat(label, &v_deg, v_degrees_min, v_degrees_max, format, flags);
3064 *v_rad = v_deg * (2 * IM_PI) / 360.0f;
3065 return value_changed;
3066}

References IM_PI, and SliderFloat().

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SliderBehavior()

bool ImGui::SliderBehavior ( const ImRect bb,
ImGuiID  id,
ImGuiDataType  data_type,
void p_v,
const void p_min,
const void p_max,
const char *  format,
ImGuiSliderFlags  flags,
ImRect out_grab_bb 
)
2882{
2883 // Read imgui.cpp "API BREAKING CHANGES" section for 1.78 if you hit this assert.
2884 IM_ASSERT((flags == 1 || (flags & ImGuiSliderFlags_InvalidMask_) == 0) && "Invalid ImGuiSliderFlags flag! Has the 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead.");
2885
2886 ImGuiContext& g = *GImGui;
2888 return false;
2889
2890 switch (data_type)
2891 {
2892 case ImGuiDataType_S8: { ImS32 v32 = (ImS32)*(ImS8*)p_v; bool r = SliderBehaviorT<ImS32, ImS32, float>(bb, id, ImGuiDataType_S32, &v32, *(const ImS8*)p_min, *(const ImS8*)p_max, format, flags, out_grab_bb); if (r) *(ImS8*)p_v = (ImS8)v32; return r; }
2893 case ImGuiDataType_U8: { ImU32 v32 = (ImU32)*(ImU8*)p_v; bool r = SliderBehaviorT<ImU32, ImS32, float>(bb, id, ImGuiDataType_U32, &v32, *(const ImU8*)p_min, *(const ImU8*)p_max, format, flags, out_grab_bb); if (r) *(ImU8*)p_v = (ImU8)v32; return r; }
2894 case ImGuiDataType_S16: { ImS32 v32 = (ImS32)*(ImS16*)p_v; bool r = SliderBehaviorT<ImS32, ImS32, float>(bb, id, ImGuiDataType_S32, &v32, *(const ImS16*)p_min, *(const ImS16*)p_max, format, flags, out_grab_bb); if (r) *(ImS16*)p_v = (ImS16)v32; return r; }
2895 case ImGuiDataType_U16: { ImU32 v32 = (ImU32)*(ImU16*)p_v; bool r = SliderBehaviorT<ImU32, ImS32, float>(bb, id, ImGuiDataType_U32, &v32, *(const ImU16*)p_min, *(const ImU16*)p_max, format, flags, out_grab_bb); if (r) *(ImU16*)p_v = (ImU16)v32; return r; }
2896 case ImGuiDataType_S32:
2897 IM_ASSERT(*(const ImS32*)p_min >= IM_S32_MIN / 2 && *(const ImS32*)p_max <= IM_S32_MAX / 2);
2898 return SliderBehaviorT<ImS32, ImS32, float >(bb, id, data_type, (ImS32*)p_v, *(const ImS32*)p_min, *(const ImS32*)p_max, format, flags, out_grab_bb);
2899 case ImGuiDataType_U32:
2900 IM_ASSERT(*(const ImU32*)p_max <= IM_U32_MAX / 2);
2901 return SliderBehaviorT<ImU32, ImS32, float >(bb, id, data_type, (ImU32*)p_v, *(const ImU32*)p_min, *(const ImU32*)p_max, format, flags, out_grab_bb);
2902 case ImGuiDataType_S64:
2903 IM_ASSERT(*(const ImS64*)p_min >= IM_S64_MIN / 2 && *(const ImS64*)p_max <= IM_S64_MAX / 2);
2904 return SliderBehaviorT<ImS64, ImS64, double>(bb, id, data_type, (ImS64*)p_v, *(const ImS64*)p_min, *(const ImS64*)p_max, format, flags, out_grab_bb);
2905 case ImGuiDataType_U64:
2906 IM_ASSERT(*(const ImU64*)p_max <= IM_U64_MAX / 2);
2907 return SliderBehaviorT<ImU64, ImS64, double>(bb, id, data_type, (ImU64*)p_v, *(const ImU64*)p_min, *(const ImU64*)p_max, format, flags, out_grab_bb);
2909 IM_ASSERT(*(const float*)p_min >= -FLT_MAX / 2.0f && *(const float*)p_max <= FLT_MAX / 2.0f);
2910 return SliderBehaviorT<float, float, float >(bb, id, data_type, (float*)p_v, *(const float*)p_min, *(const float*)p_max, format, flags, out_grab_bb);
2912 IM_ASSERT(*(const double*)p_min >= -DBL_MAX / 2.0f && *(const double*)p_max <= DBL_MAX / 2.0f);
2913 return SliderBehaviorT<double, double, double>(bb, id, data_type, (double*)p_v, *(const double*)p_min, *(const double*)p_max, format, flags, out_grab_bb);
2914 case ImGuiDataType_COUNT: break;
2915 }
2916 IM_ASSERT(0);
2917 return false;
2918}

References ImGuiContext::CurrentItemFlags, GImGui, IM_ASSERT, IM_S32_MAX, IM_S32_MIN, IM_S64_MAX, IM_S64_MIN, IM_U32_MAX, IM_U64_MAX, ImGuiDataType_COUNT, ImGuiDataType_Double, ImGuiDataType_Float, ImGuiDataType_S16, ImGuiDataType_S32, ImGuiDataType_S64, ImGuiDataType_S8, ImGuiDataType_U16, ImGuiDataType_U32, ImGuiDataType_U64, ImGuiDataType_U8, ImGuiItemFlags_ReadOnly, ImGuiSliderFlags_InvalidMask_, and ImGuiSliderFlags_ReadOnly.

Referenced by SliderScalar(), and VSliderScalar().

+ Here is the caller graph for this function:

◆ SliderBehaviorT()

template<typename T , typename SIGNED_T , typename FLOAT_T >
IMGUI_API bool ImGui::SliderBehaviorT ( const ImRect bb,
ImGuiID  id,
ImGuiDataType  data_type,
T *  v,
v_min,
v_max,
const char *  format,
ImGuiSliderFlags  flags,
ImRect out_grab_bb 
)

◆ SliderFloat() [1/2]

static bool ImGui::SliderFloat ( const char *  label,
float *  v,
float  v_min,
float  v_max,
const char *  format,
float  power 
)
inlinestatic
2801{ return SliderScalar(label, ImGuiDataType_Float, v, &v_min, &v_max, format, power); }
IMGUI_API bool SliderScalar(const char *label, ImGuiDataType data_type, void *p_data, const void *p_min, const void *p_max, const char *format=NULL, ImGuiSliderFlags flags=0)
Definition imgui_widgets.cpp:2922

References ImGuiDataType_Float, SliderFloat(), and SliderScalar().

+ Here is the call graph for this function:

◆ SliderFloat() [2/2]

bool ImGui::SliderFloat ( const char *  label,
float *  v,
float  v_min,
float  v_max,
const char *  format = "%.3f",
ImGuiSliderFlags  flags = 0 
)
3039{
3040 return SliderScalar(label, ImGuiDataType_Float, v, &v_min, &v_max, format, flags);
3041}

References ImGuiDataType_Float, and SliderScalar().

Referenced by ShowDemoWindowLayout(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleMenuFile(), ShowStyleEditor(), Slic3r::GUI::ImGuiWrapper::slider_float(), SliderAngle(), and SliderFloat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SliderFloat2() [1/2]

static bool ImGui::SliderFloat2 ( const char *  label,
float  v[2],
float  v_min,
float  v_max,
const char *  format,
float  power 
)
inlinestatic
2802{ return SliderScalarN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, power); }
IMGUI_API bool SliderScalarN(const char *label, ImGuiDataType data_type, void *p_data, int components, const void *p_min, const void *p_max, const char *format=NULL, ImGuiSliderFlags flags=0)
Definition imgui_widgets.cpp:3003

References ImGuiDataType_Float, SliderFloat2(), and SliderScalarN().

+ Here is the call graph for this function:

◆ SliderFloat2() [2/2]

bool ImGui::SliderFloat2 ( const char *  label,
float  v[2],
float  v_min,
float  v_max,
const char *  format = "%.3f",
ImGuiSliderFlags  flags = 0 
)
3044{
3045 return SliderScalarN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, flags);
3046}

References ImGuiDataType_Float, and SliderScalarN().

Referenced by ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowStyleEditor(), and SliderFloat2().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SliderFloat3() [1/2]

static bool ImGui::SliderFloat3 ( const char *  label,
float  v[3],
float  v_min,
float  v_max,
const char *  format,
float  power 
)
inlinestatic
2803{ return SliderScalarN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, power); }

References ImGuiDataType_Float, SliderFloat3(), and SliderScalarN().

+ Here is the call graph for this function:

◆ SliderFloat3() [2/2]

bool ImGui::SliderFloat3 ( const char *  label,
float  v[3],
float  v_min,
float  v_max,
const char *  format = "%.3f",
ImGuiSliderFlags  flags = 0 
)
3049{
3050 return SliderScalarN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, flags);
3051}

References ImGuiDataType_Float, and SliderScalarN().

Referenced by ShowDemoWindowMisc(), ShowDemoWindowWidgets(), and SliderFloat3().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SliderFloat4() [1/2]

static bool ImGui::SliderFloat4 ( const char *  label,
float  v[4],
float  v_min,
float  v_max,
const char *  format,
float  power 
)
inlinestatic
2804{ return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power); }

References ImGuiDataType_Float, SliderFloat4(), and SliderScalarN().

+ Here is the call graph for this function:

◆ SliderFloat4() [2/2]

bool ImGui::SliderFloat4 ( const char *  label,
float  v[4],
float  v_min,
float  v_max,
const char *  format = "%.3f",
ImGuiSliderFlags  flags = 0 
)
3054{
3055 return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, flags);
3056}

References ImGuiDataType_Float, and SliderScalarN().

Referenced by ShowDemoWindowWidgets(), and SliderFloat4().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SliderInt()

bool ImGui::SliderInt ( const char *  label,
int *  v,
int  v_min,
int  v_max,
const char *  format = "%d",
ImGuiSliderFlags  flags = 0 
)
3069{
3070 return SliderScalar(label, ImGuiDataType_S32, v, &v_min, &v_max, format, flags);
3071}

References ImGuiDataType_S32, and SliderScalar().

Referenced by LogButtons(), Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), Slic3r::GUI::GLCanvas3D::LayersEditing::render_overlay(), ShowDemoWindowLayout(), ShowDemoWindowWidgets(), ShowExampleAppAutoResize(), and ShowExampleAppCustomRendering().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SliderInt2()

bool ImGui::SliderInt2 ( const char *  label,
int  v[2],
int  v_min,
int  v_max,
const char *  format = "%d",
ImGuiSliderFlags  flags = 0 
)
3074{
3075 return SliderScalarN(label, ImGuiDataType_S32, v, 2, &v_min, &v_max, format, flags);
3076}

References ImGuiDataType_S32, and SliderScalarN().

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SliderInt3()

bool ImGui::SliderInt3 ( const char *  label,
int  v[3],
int  v_min,
int  v_max,
const char *  format = "%d",
ImGuiSliderFlags  flags = 0 
)
3079{
3080 return SliderScalarN(label, ImGuiDataType_S32, v, 3, &v_min, &v_max, format, flags);
3081}

References ImGuiDataType_S32, and SliderScalarN().

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SliderInt4()

bool ImGui::SliderInt4 ( const char *  label,
int  v[4],
int  v_min,
int  v_max,
const char *  format = "%d",
ImGuiSliderFlags  flags = 0 
)
3084{
3085 return SliderScalarN(label, ImGuiDataType_S32, v, 4, &v_min, &v_max, format, flags);
3086}

References ImGuiDataType_S32, and SliderScalarN().

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SliderScalar() [1/2]

bool ImGui::SliderScalar ( const char *  label,
ImGuiDataType  data_type,
void p_data,
const void p_min,
const void p_max,
const char *  format,
float  power 
)
3161{
3163 if (power != 1.0f)
3164 {
3165 IM_ASSERT(power == 1.0f && "Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!");
3166 slider_flags |= ImGuiSliderFlags_Logarithmic; // Fallback for non-asserting paths
3167 }
3168 return SliderScalar(label, data_type, p_data, p_min, p_max, format, slider_flags);
3169}

References IM_ASSERT, ImGuiSliderFlags_Logarithmic, ImGuiSliderFlags_None, and SliderScalar().

+ Here is the call graph for this function:

◆ SliderScalar() [2/2]

bool ImGui::SliderScalar ( const char *  label,
ImGuiDataType  data_type,
void p_data,
const void p_min,
const void p_max,
const char *  format = NULL,
ImGuiSliderFlags  flags = 0 
)
2923{
2924 ImGuiWindow* window = GetCurrentWindow();
2925 if (window->SkipItems)
2926 return false;
2927
2928 ImGuiContext& g = *GImGui;
2929 const ImGuiStyle& style = g.Style;
2930 const ImGuiID id = window->GetID(label);
2931 const float w = CalcItemWidth();
2932
2933 const ImVec2 label_size = CalcTextSize(label, NULL, true);
2934 const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f));
2935 const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
2936
2937 const bool temp_input_allowed = (flags & ImGuiSliderFlags_NoInput) == 0;
2938 ItemSize(total_bb, style.FramePadding.y);
2939 if (!ItemAdd(total_bb, id, &frame_bb, temp_input_allowed ? ImGuiItemAddFlags_Focusable : 0))
2940 return false;
2941
2942 // Default format string when passing NULL
2943 if (format == NULL)
2944 format = DataTypeGetInfo(data_type)->PrintFmt;
2945 else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) // (FIXME-LEGACY: Patch old "%.0f" format string to use "%d", read function more details.)
2946 format = PatchFormatStringFloatToInt(format);
2947
2948 // Tabbing or CTRL-clicking on Slider turns it into an input box
2949 const bool hovered = ItemHoverable(frame_bb, id);
2950 bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
2951 if (!temp_input_is_active)
2952 {
2953 const bool focus_requested = temp_input_allowed && (window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_Focused) != 0;
2954 const bool clicked = (hovered && g.IO.MouseClicked[0]);
2955 if (focus_requested || clicked || g.NavActivateId == id || g.NavInputId == id)
2956 {
2957 SetActiveID(id, window);
2958 SetFocusID(id, window);
2959 FocusWindow(window);
2961 if (temp_input_allowed && (focus_requested || (clicked && g.IO.KeyCtrl) || g.NavInputId == id))
2962 temp_input_is_active = true;
2963 }
2964 }
2965
2966 if (temp_input_is_active)
2967 {
2968 // Only clamp CTRL+Click input when ImGuiSliderFlags_AlwaysClamp is set
2969 const bool is_clamp_input = (flags & ImGuiSliderFlags_AlwaysClamp) != 0;
2970 return TempInputScalar(frame_bb, id, label, data_type, p_data, format, is_clamp_input ? p_min : NULL, is_clamp_input ? p_max : NULL);
2971 }
2972
2973 // Draw frame
2974 const ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : g.HoveredId == id ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);
2975 RenderNavHighlight(frame_bb, id);
2976 RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, g.Style.FrameRounding);
2977
2978 // Slider behavior
2979 ImRect grab_bb;
2980 const bool value_changed = SliderBehavior(frame_bb, id, data_type, p_data, p_min, p_max, format, flags, &grab_bb);
2981 if (value_changed)
2982 MarkItemEdited(id);
2983
2984 // Render grab
2985 if (grab_bb.Max.x > grab_bb.Min.x)
2986 window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding);
2987
2988 // Display value using user-provided display format so user can add prefix/suffix/decorations to the value.
2989 char value_buf[64];
2990 const char* value_buf_end = value_buf + DataTypeFormatString(value_buf, IM_ARRAYSIZE(value_buf), data_type, p_data, format);
2991 if (g.LogEnabled)
2992 LogSetNextTextDecoration("{", "}");
2993 RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f, 0.5f));
2994
2995 if (label_size.x > 0.0f)
2996 RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
2997
2999 return value_changed;
3000}
IMGUI_API bool SliderBehavior(const ImRect &bb, ImGuiID id, ImGuiDataType data_type, void *p_v, const void *p_min, const void *p_max, const char *format, ImGuiSliderFlags flags, ImRect *out_grab_bb)
Definition imgui_widgets.cpp:2881

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdUsingNavDirMask, ImDrawList::AddRectFilled(), CalcItemWidth(), CalcTextSize(), ImGuiWindowTempData::CursorPos, DataTypeFormatString(), DataTypeGetInfo(), ImGuiWindow::DC, ImGuiWindow::DrawList, FocusWindow(), ImGuiStyle::FrameRounding, GetColorU32(), GetCurrentWindow(), ImGuiWindow::GetID(), GImGui, ImGuiContext::HoveredId, IM_ARRAYSIZE, IMGUI_TEST_ENGINE_ITEM_INFO, ImGuiCol_FrameBg, ImGuiCol_FrameBgActive, ImGuiCol_FrameBgHovered, ImGuiCol_SliderGrab, ImGuiCol_SliderGrabActive, ImGuiDataType_S32, ImGuiDir_Left, ImGuiDir_Right, ImGuiItemAddFlags_Focusable, ImGuiItemStatusFlags_Focused, ImGuiSliderFlags_AlwaysClamp, ImGuiSliderFlags_NoInput, ImGuiContext::IO, ItemAdd(), ItemHoverable(), ItemSize(), ImGuiIO::KeyCtrl, ImGuiWindowTempData::LastItemStatusFlags, ImGuiContext::LogEnabled, LogSetNextTextDecoration(), MarkItemEdited(), ImRect::Max, ImRect::Min, ImGuiIO::MouseClicked, ImGuiContext::NavActivateId, ImGuiContext::NavInputId, PatchFormatStringFloatToInt(), ImGuiDataTypeInfo::PrintFmt, RenderFrame(), RenderNavHighlight(), RenderText(), RenderTextClipped(), SetActiveID(), SetFocusID(), ImGuiWindow::SkipItems, SliderBehavior(), ImGuiContext::Style, style, TempInputIsActive(), TempInputScalar(), ImVec2::x, and ImVec2::y.

Referenced by ShowDemoWindowWidgets(), SliderFloat(), SliderFloat(), SliderInt(), SliderScalar(), and SliderScalarN().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SliderScalarN() [1/2]

bool ImGui::SliderScalarN ( const char *  label,
ImGuiDataType  data_type,
void p_data,
int  components,
const void p_min,
const void p_max,
const char *  format,
float  power 
)
3172{
3174 if (power != 1.0f)
3175 {
3176 IM_ASSERT(power == 1.0f && "Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!");
3177 slider_flags |= ImGuiSliderFlags_Logarithmic; // Fallback for non-asserting paths
3178 }
3179 return SliderScalarN(label, data_type, v, components, v_min, v_max, format, slider_flags);
3180}

References IM_ASSERT, ImGuiSliderFlags_Logarithmic, ImGuiSliderFlags_None, and SliderScalarN().

+ Here is the call graph for this function:

◆ SliderScalarN() [2/2]

bool ImGui::SliderScalarN ( const char *  label,
ImGuiDataType  data_type,
void p_data,
int  components,
const void p_min,
const void p_max,
const char *  format = NULL,
ImGuiSliderFlags  flags = 0 
)
3004{
3005 ImGuiWindow* window = GetCurrentWindow();
3006 if (window->SkipItems)
3007 return false;
3008
3009 ImGuiContext& g = *GImGui;
3010 bool value_changed = false;
3011 BeginGroup();
3012 PushID(label);
3013 PushMultiItemsWidths(components, CalcItemWidth());
3014 size_t type_size = GDataTypeInfo[data_type].Size;
3015 for (int i = 0; i < components; i++)
3016 {
3017 PushID(i);
3018 if (i > 0)
3020 value_changed |= SliderScalar("", data_type, v, v_min, v_max, format, flags);
3021 PopID();
3022 PopItemWidth();
3023 v = (void*)((char*)v + type_size);
3024 }
3025 PopID();
3026
3027 const char* label_end = FindRenderedTextEnd(label);
3028 if (label != label_end)
3029 {
3030 SameLine(0, g.Style.ItemInnerSpacing.x);
3031 TextEx(label, label_end);
3032 }
3033
3034 EndGroup();
3035 return value_changed;
3036}

References BeginGroup(), CalcItemWidth(), EndGroup(), FindRenderedTextEnd(), GDataTypeInfo, GetCurrentWindow(), GImGui, ImGuiStyle::ItemInnerSpacing, PopID(), PopItemWidth(), PushID(), PushMultiItemsWidths(), SameLine(), ImGuiDataTypeInfo::Size, ImGuiWindow::SkipItems, SliderScalar(), ImGuiContext::Style, TextEx(), and ImVec2::x.

Referenced by SliderFloat2(), SliderFloat2(), SliderFloat3(), SliderFloat3(), SliderFloat4(), SliderFloat4(), SliderInt2(), SliderInt3(), SliderInt4(), and SliderScalarN().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SmallButton()

bool ImGui::SmallButton ( const char *  label)
722{
723 ImGuiContext& g = *GImGui;
724 float backup_padding_y = g.Style.FramePadding.y;
725 g.Style.FramePadding.y = 0.0f;
726 bool pressed = ButtonEx(label, ImVec2(0, 0), ImGuiButtonFlags_AlignTextBaseLine);
727 g.Style.FramePadding.y = backup_padding_y;
728 return pressed;
729}

References ButtonEx(), ImGuiStyle::FramePadding, GImGui, ImGuiButtonFlags_AlignTextBaseLine, ImGuiContext::Style, and ImVec2::y.

Referenced by DebugNodeTabBar(), DebugNodeTable(), ExampleAppConsole::Draw(), ShowDemoWindowLayout(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppLog(), ShowFont(), and ShowMetricsWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Spacing()

void ImGui::Spacing ( )
1313{
1314 ImGuiWindow* window = GetCurrentWindow();
1315 if (window->SkipItems)
1316 return;
1317 ItemSize(ImVec2(0, 0));
1318}

References GetCurrentWindow(), ItemSize(), and ImGuiWindow::SkipItems.

Referenced by ColorEdit4(), Slic3r::GUI::GCodeViewer::render_legend(), ShowDemoWindow(), ShowDemoWindowLayout(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), and ShowStyleEditor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SplitterBehavior()

bool ImGui::SplitterBehavior ( const ImRect bb,
ImGuiID  id,
ImGuiAxis  axis,
float *  size1,
float *  size2,
float  min_size1,
float  min_size2,
float  hover_extend = 0.0f,
float  hover_visibility_delay = 0.0f 
)
1434{
1435 ImGuiContext& g = *GImGui;
1436 ImGuiWindow* window = g.CurrentWindow;
1437
1438 const ImGuiItemFlags item_flags_backup = g.CurrentItemFlags;
1440 bool item_add = ItemAdd(bb, id);
1441 g.CurrentItemFlags = item_flags_backup;
1442 if (!item_add)
1443 return false;
1444
1445 bool hovered, held;
1446 ImRect bb_interact = bb;
1447 bb_interact.Expand(axis == ImGuiAxis_Y ? ImVec2(0.0f, hover_extend) : ImVec2(hover_extend, 0.0f));
1449 if (g.ActiveId != id)
1451
1452 if (held || (g.HoveredId == id && g.HoveredIdPreviousFrame == id && g.HoveredIdTimer >= hover_visibility_delay))
1454
1455 ImRect bb_render = bb;
1456 if (held)
1457 {
1458 ImVec2 mouse_delta_2d = g.IO.MousePos - g.ActiveIdClickOffset - bb_interact.Min;
1459 float mouse_delta = (axis == ImGuiAxis_Y) ? mouse_delta_2d.y : mouse_delta_2d.x;
1460
1461 // Minimum pane size
1462 float size_1_maximum_delta = ImMax(0.0f, *size1 - min_size1);
1463 float size_2_maximum_delta = ImMax(0.0f, *size2 - min_size2);
1464 if (mouse_delta < -size_1_maximum_delta)
1465 mouse_delta = -size_1_maximum_delta;
1466 if (mouse_delta > size_2_maximum_delta)
1467 mouse_delta = size_2_maximum_delta;
1468
1469 // Apply resize
1470 if (mouse_delta != 0.0f)
1471 {
1472 if (mouse_delta < 0.0f)
1473 IM_ASSERT(*size1 + mouse_delta >= min_size1);
1474 if (mouse_delta > 0.0f)
1475 IM_ASSERT(*size2 - mouse_delta >= min_size2);
1476 *size1 += mouse_delta;
1477 *size2 -= mouse_delta;
1478 bb_render.Translate((axis == ImGuiAxis_X) ? ImVec2(mouse_delta, 0.0f) : ImVec2(0.0f, mouse_delta));
1479 MarkItemEdited(id);
1480 }
1481 }
1482
1483 // Render
1484 const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : (hovered && g.HoveredIdTimer >= hover_visibility_delay) ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);
1485 window->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, col, 0.0f);
1486
1487 return held;
1488}
@ ImGuiMouseCursor_ResizeNS
Definition imgui.h:1600
IMGUI_API void SetMouseCursor(ImGuiMouseCursor cursor_type)
Definition imgui.cpp:4816
void Translate(const ImVec2 &d)
Definition imgui_internal.h:496

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdClickOffset, ImDrawList::AddRectFilled(), ButtonBehavior(), col(), ImGuiContext::CurrentItemFlags, ImGuiContext::CurrentWindow, ImGuiWindow::DrawList, ImRect::Expand(), GetColorU32(), GImGui, ImGuiContext::HoveredId, ImGuiContext::HoveredIdPreviousFrame, ImGuiContext::HoveredIdTimer, IM_ASSERT, ImGuiAxis_X, ImGuiAxis_Y, ImGuiButtonFlags_AllowItemOverlap, ImGuiButtonFlags_FlattenChildren, ImGuiCol_Separator, ImGuiCol_SeparatorActive, ImGuiCol_SeparatorHovered, ImGuiItemFlags_NoNav, ImGuiItemFlags_NoNavDefaultFocus, ImGuiMouseCursor_ResizeEW, ImGuiMouseCursor_ResizeNS, ImMax(), ImGuiContext::IO, ItemAdd(), MarkItemEdited(), ImRect::Min, ImGuiIO::MousePos, SetItemAllowOverlap(), SetMouseCursor(), ImVec2::x, and ImVec2::y.

+ Here is the call graph for this function:

◆ StartMouseMovingWindow()

void ImGui::StartMouseMovingWindow ( ImGuiWindow window)
3515{
3516 // Set ActiveId even if the _NoMove flag is set. Without it, dragging away from a window with _NoMove would activate hover on other windows.
3517 // We _also_ call this when clicking in a window empty space when io.ConfigWindowsMoveFromTitleBarOnly is set, but clear g.MovingWindow afterward.
3518 // This is because we want ActiveId to be set even when the window is not permitted to move.
3519 ImGuiContext& g = *GImGui;
3520 FocusWindow(window);
3521 SetActiveID(window->MoveId, window);
3522 g.NavDisableHighlight = true;
3524 g.ActiveIdClickOffset = g.IO.MousePos - window->RootWindow->Pos;
3525
3526 bool can_move_window = true;
3528 can_move_window = false;
3529 if (can_move_window)
3530 g.MovingWindow = window;
3531}

References ImGuiContext::ActiveIdClickOffset, ImGuiContext::ActiveIdNoClearOnFocusLoss, ImGuiWindow::Flags, FocusWindow(), GImGui, ImGuiWindowFlags_NoMove, ImGuiContext::IO, ImGuiIO::MousePos, ImGuiWindow::MoveId, ImGuiContext::MovingWindow, ImGuiContext::NavDisableHighlight, ImGuiWindow::Pos, ImGuiWindow::RootWindow, and SetActiveID().

Referenced by CollapseButton(), and UpdateMouseMovingWindowEndFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StyleColorsClassic()

void ImGui::StyleColorsClassic ( ImGuiStyle dst = NULL)
253{
254 ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();
255 ImVec4* colors = style->Colors;
256
257 colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
258 colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
259 colors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.85f);
260 colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
261 colors[ImGuiCol_PopupBg] = ImVec4(0.11f, 0.11f, 0.14f, 0.92f);
262 colors[ImGuiCol_Border] = ImVec4(0.50f, 0.50f, 0.50f, 0.50f);
263 colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
264 colors[ImGuiCol_FrameBg] = ImVec4(0.43f, 0.43f, 0.43f, 0.39f);
265 colors[ImGuiCol_FrameBgHovered] = ImVec4(0.47f, 0.47f, 0.69f, 0.40f);
266 colors[ImGuiCol_FrameBgActive] = ImVec4(0.42f, 0.41f, 0.64f, 0.69f);
267 colors[ImGuiCol_TitleBg] = ImVec4(0.27f, 0.27f, 0.54f, 0.83f);
268 colors[ImGuiCol_TitleBgActive] = ImVec4(0.32f, 0.32f, 0.63f, 0.87f);
269 colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.40f, 0.40f, 0.80f, 0.20f);
270 colors[ImGuiCol_MenuBarBg] = ImVec4(0.40f, 0.40f, 0.55f, 0.80f);
271 colors[ImGuiCol_ScrollbarBg] = ImVec4(0.20f, 0.25f, 0.30f, 0.60f);
272 colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.40f, 0.80f, 0.30f);
273 colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.40f, 0.40f, 0.80f, 0.40f);
274 colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.41f, 0.39f, 0.80f, 0.60f);
275 colors[ImGuiCol_CheckMark] = ImVec4(0.90f, 0.90f, 0.90f, 0.50f);
276 colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);
277 colors[ImGuiCol_SliderGrabActive] = ImVec4(0.41f, 0.39f, 0.80f, 0.60f);
278 colors[ImGuiCol_Button] = ImVec4(0.35f, 0.40f, 0.61f, 0.62f);
279 colors[ImGuiCol_ButtonHovered] = ImVec4(0.40f, 0.48f, 0.71f, 0.79f);
280 colors[ImGuiCol_ButtonActive] = ImVec4(0.46f, 0.54f, 0.80f, 1.00f);
281 colors[ImGuiCol_Header] = ImVec4(0.40f, 0.40f, 0.90f, 0.45f);
282 colors[ImGuiCol_HeaderHovered] = ImVec4(0.45f, 0.45f, 0.90f, 0.80f);
283 colors[ImGuiCol_HeaderActive] = ImVec4(0.53f, 0.53f, 0.87f, 0.80f);
284 colors[ImGuiCol_Separator] = ImVec4(0.50f, 0.50f, 0.50f, 0.60f);
285 colors[ImGuiCol_SeparatorHovered] = ImVec4(0.60f, 0.60f, 0.70f, 1.00f);
286 colors[ImGuiCol_SeparatorActive] = ImVec4(0.70f, 0.70f, 0.90f, 1.00f);
287 colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.10f);
288 colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.78f, 0.82f, 1.00f, 0.60f);
289 colors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.82f, 1.00f, 0.90f);
290 colors[ImGuiCol_Tab] = ImLerp(colors[ImGuiCol_Header], colors[ImGuiCol_TitleBgActive], 0.80f);
293 colors[ImGuiCol_TabUnfocused] = ImLerp(colors[ImGuiCol_Tab], colors[ImGuiCol_TitleBg], 0.80f);
295 colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
296 colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
297 colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
298 colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
299 colors[ImGuiCol_TableHeaderBg] = ImVec4(0.27f, 0.27f, 0.38f, 1.00f);
300 colors[ImGuiCol_TableBorderStrong] = ImVec4(0.31f, 0.31f, 0.45f, 1.00f); // Prefer using Alpha=1.0 here
301 colors[ImGuiCol_TableBorderLight] = ImVec4(0.26f, 0.26f, 0.28f, 1.00f); // Prefer using Alpha=1.0 here
302 colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
303 colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.07f);
304 colors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);
305 colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
307 colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
308 colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
309 colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
310}

References GetStyle(), ImGuiCol_Border, ImGuiCol_BorderShadow, ImGuiCol_Button, ImGuiCol_ButtonActive, ImGuiCol_ButtonHovered, ImGuiCol_CheckMark, ImGuiCol_ChildBg, ImGuiCol_DragDropTarget, ImGuiCol_FrameBg, ImGuiCol_FrameBgActive, ImGuiCol_FrameBgHovered, ImGuiCol_Header, ImGuiCol_HeaderActive, ImGuiCol_HeaderHovered, ImGuiCol_MenuBarBg, ImGuiCol_ModalWindowDimBg, ImGuiCol_NavHighlight, ImGuiCol_NavWindowingDimBg, ImGuiCol_NavWindowingHighlight, ImGuiCol_PlotHistogram, ImGuiCol_PlotHistogramHovered, ImGuiCol_PlotLines, ImGuiCol_PlotLinesHovered, ImGuiCol_PopupBg, ImGuiCol_ResizeGrip, ImGuiCol_ResizeGripActive, ImGuiCol_ResizeGripHovered, ImGuiCol_ScrollbarBg, ImGuiCol_ScrollbarGrab, ImGuiCol_ScrollbarGrabActive, ImGuiCol_ScrollbarGrabHovered, ImGuiCol_Separator, ImGuiCol_SeparatorActive, ImGuiCol_SeparatorHovered, ImGuiCol_SliderGrab, ImGuiCol_SliderGrabActive, ImGuiCol_Tab, ImGuiCol_TabActive, ImGuiCol_TabHovered, ImGuiCol_TableBorderLight, ImGuiCol_TableBorderStrong, ImGuiCol_TableHeaderBg, ImGuiCol_TableRowBg, ImGuiCol_TableRowBgAlt, ImGuiCol_TabUnfocused, ImGuiCol_TabUnfocusedActive, ImGuiCol_Text, ImGuiCol_TextDisabled, ImGuiCol_TextSelectedBg, ImGuiCol_TitleBg, ImGuiCol_TitleBgActive, ImGuiCol_TitleBgCollapsed, ImGuiCol_WindowBg, ImLerp(), and style.

Referenced by ShowStyleSelector().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StyleColorsDark()

void ImGui::StyleColorsDark ( ImGuiStyle dst = NULL)
193{
194 ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();
195 ImVec4* colors = style->Colors;
196
197 colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
198 colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
199 colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.06f, 0.06f, 0.94f);
200 colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
201 colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f);
202 colors[ImGuiCol_Border] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f);
203 colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
204 colors[ImGuiCol_FrameBg] = ImVec4(0.16f, 0.29f, 0.48f, 0.54f);
205 colors[ImGuiCol_FrameBgHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);
206 colors[ImGuiCol_FrameBgActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
207 colors[ImGuiCol_TitleBg] = ImVec4(0.04f, 0.04f, 0.04f, 1.00f);
208 colors[ImGuiCol_TitleBgActive] = ImVec4(0.16f, 0.29f, 0.48f, 1.00f);
209 colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f);
210 colors[ImGuiCol_MenuBarBg] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f);
211 colors[ImGuiCol_ScrollbarBg] = ImVec4(0.02f, 0.02f, 0.02f, 0.53f);
212 colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.31f, 0.31f, 0.31f, 1.00f);
213 colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
214 colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.51f, 0.51f, 0.51f, 1.00f);
215 colors[ImGuiCol_CheckMark] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
216 colors[ImGuiCol_SliderGrab] = ImVec4(0.24f, 0.52f, 0.88f, 1.00f);
217 colors[ImGuiCol_SliderGrabActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
218 colors[ImGuiCol_Button] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);
219 colors[ImGuiCol_ButtonHovered] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
220 colors[ImGuiCol_ButtonActive] = ImVec4(0.06f, 0.53f, 0.98f, 1.00f);
221 colors[ImGuiCol_Header] = ImVec4(0.26f, 0.59f, 0.98f, 0.31f);
222 colors[ImGuiCol_HeaderHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f);
223 colors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
224 colors[ImGuiCol_Separator] = colors[ImGuiCol_Border];
225 colors[ImGuiCol_SeparatorHovered] = ImVec4(0.10f, 0.40f, 0.75f, 0.78f);
226 colors[ImGuiCol_SeparatorActive] = ImVec4(0.10f, 0.40f, 0.75f, 1.00f);
227 colors[ImGuiCol_ResizeGrip] = ImVec4(0.26f, 0.59f, 0.98f, 0.20f);
228 colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
229 colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);
230 colors[ImGuiCol_Tab] = ImLerp(colors[ImGuiCol_Header], colors[ImGuiCol_TitleBgActive], 0.80f);
233 colors[ImGuiCol_TabUnfocused] = ImLerp(colors[ImGuiCol_Tab], colors[ImGuiCol_TitleBg], 0.80f);
235 colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);
236 colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);
237 colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
238 colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
239 colors[ImGuiCol_TableHeaderBg] = ImVec4(0.19f, 0.19f, 0.20f, 1.00f);
240 colors[ImGuiCol_TableBorderStrong] = ImVec4(0.31f, 0.31f, 0.35f, 1.00f); // Prefer using Alpha=1.0 here
241 colors[ImGuiCol_TableBorderLight] = ImVec4(0.23f, 0.23f, 0.25f, 1.00f); // Prefer using Alpha=1.0 here
242 colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
243 colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.06f);
244 colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);
245 colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
246 colors[ImGuiCol_NavHighlight] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
247 colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
248 colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
249 colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f);
250}

References GetStyle(), ImGuiCol_Border, ImGuiCol_BorderShadow, ImGuiCol_Button, ImGuiCol_ButtonActive, ImGuiCol_ButtonHovered, ImGuiCol_CheckMark, ImGuiCol_ChildBg, ImGuiCol_DragDropTarget, ImGuiCol_FrameBg, ImGuiCol_FrameBgActive, ImGuiCol_FrameBgHovered, ImGuiCol_Header, ImGuiCol_HeaderActive, ImGuiCol_HeaderHovered, ImGuiCol_MenuBarBg, ImGuiCol_ModalWindowDimBg, ImGuiCol_NavHighlight, ImGuiCol_NavWindowingDimBg, ImGuiCol_NavWindowingHighlight, ImGuiCol_PlotHistogram, ImGuiCol_PlotHistogramHovered, ImGuiCol_PlotLines, ImGuiCol_PlotLinesHovered, ImGuiCol_PopupBg, ImGuiCol_ResizeGrip, ImGuiCol_ResizeGripActive, ImGuiCol_ResizeGripHovered, ImGuiCol_ScrollbarBg, ImGuiCol_ScrollbarGrab, ImGuiCol_ScrollbarGrabActive, ImGuiCol_ScrollbarGrabHovered, ImGuiCol_Separator, ImGuiCol_SeparatorActive, ImGuiCol_SeparatorHovered, ImGuiCol_SliderGrab, ImGuiCol_SliderGrabActive, ImGuiCol_Tab, ImGuiCol_TabActive, ImGuiCol_TabHovered, ImGuiCol_TableBorderLight, ImGuiCol_TableBorderStrong, ImGuiCol_TableHeaderBg, ImGuiCol_TableRowBg, ImGuiCol_TableRowBgAlt, ImGuiCol_TabUnfocused, ImGuiCol_TabUnfocusedActive, ImGuiCol_Text, ImGuiCol_TextDisabled, ImGuiCol_TextSelectedBg, ImGuiCol_TitleBg, ImGuiCol_TitleBgActive, ImGuiCol_TitleBgCollapsed, ImGuiCol_WindowBg, ImLerp(), and style.

Referenced by ImGuiStyle::ImGuiStyle(), igl::opengl::glfw::imgui::ImGuiMenu::init(), and ShowStyleSelector().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StyleColorsLight()

void ImGui::StyleColorsLight ( ImGuiStyle dst = NULL)
314{
315 ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();
316 ImVec4* colors = style->Colors;
317
318 colors[ImGuiCol_Text] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
319 colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
320 colors[ImGuiCol_WindowBg] = ImVec4(0.94f, 0.94f, 0.94f, 1.00f);
321 colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
322 colors[ImGuiCol_PopupBg] = ImVec4(1.00f, 1.00f, 1.00f, 0.98f);
323 colors[ImGuiCol_Border] = ImVec4(0.00f, 0.00f, 0.00f, 0.30f);
324 colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
325 colors[ImGuiCol_FrameBg] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
326 colors[ImGuiCol_FrameBgHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);
327 colors[ImGuiCol_FrameBgActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
328 colors[ImGuiCol_TitleBg] = ImVec4(0.96f, 0.96f, 0.96f, 1.00f);
329 colors[ImGuiCol_TitleBgActive] = ImVec4(0.82f, 0.82f, 0.82f, 1.00f);
330 colors[ImGuiCol_TitleBgCollapsed] = ImVec4(1.00f, 1.00f, 1.00f, 0.51f);
331 colors[ImGuiCol_MenuBarBg] = ImVec4(0.86f, 0.86f, 0.86f, 1.00f);
332 colors[ImGuiCol_ScrollbarBg] = ImVec4(0.98f, 0.98f, 0.98f, 0.53f);
333 colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.69f, 0.69f, 0.69f, 0.80f);
334 colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.49f, 0.49f, 0.49f, 0.80f);
335 colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.49f, 0.49f, 0.49f, 1.00f);
336 colors[ImGuiCol_CheckMark] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
337 colors[ImGuiCol_SliderGrab] = ImVec4(0.26f, 0.59f, 0.98f, 0.78f);
338 colors[ImGuiCol_SliderGrabActive] = ImVec4(0.46f, 0.54f, 0.80f, 0.60f);
339 colors[ImGuiCol_Button] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);
340 colors[ImGuiCol_ButtonHovered] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
341 colors[ImGuiCol_ButtonActive] = ImVec4(0.06f, 0.53f, 0.98f, 1.00f);
342 colors[ImGuiCol_Header] = ImVec4(0.26f, 0.59f, 0.98f, 0.31f);
343 colors[ImGuiCol_HeaderHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f);
344 colors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
345 colors[ImGuiCol_Separator] = ImVec4(0.39f, 0.39f, 0.39f, 0.62f);
346 colors[ImGuiCol_SeparatorHovered] = ImVec4(0.14f, 0.44f, 0.80f, 0.78f);
347 colors[ImGuiCol_SeparatorActive] = ImVec4(0.14f, 0.44f, 0.80f, 1.00f);
348 colors[ImGuiCol_ResizeGrip] = ImVec4(0.35f, 0.35f, 0.35f, 0.17f);
349 colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
350 colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);
351 colors[ImGuiCol_Tab] = ImLerp(colors[ImGuiCol_Header], colors[ImGuiCol_TitleBgActive], 0.90f);
354 colors[ImGuiCol_TabUnfocused] = ImLerp(colors[ImGuiCol_Tab], colors[ImGuiCol_TitleBg], 0.80f);
356 colors[ImGuiCol_PlotLines] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f);
357 colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);
358 colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
359 colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.45f, 0.00f, 1.00f);
360 colors[ImGuiCol_TableHeaderBg] = ImVec4(0.78f, 0.87f, 0.98f, 1.00f);
361 colors[ImGuiCol_TableBorderStrong] = ImVec4(0.57f, 0.57f, 0.64f, 1.00f); // Prefer using Alpha=1.0 here
362 colors[ImGuiCol_TableBorderLight] = ImVec4(0.68f, 0.68f, 0.74f, 1.00f); // Prefer using Alpha=1.0 here
363 colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
364 colors[ImGuiCol_TableRowBgAlt] = ImVec4(0.30f, 0.30f, 0.30f, 0.09f);
365 colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);
366 colors[ImGuiCol_DragDropTarget] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);
368 colors[ImGuiCol_NavWindowingHighlight] = ImVec4(0.70f, 0.70f, 0.70f, 0.70f);
369 colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.20f);
370 colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
371}

References GetStyle(), ImGuiCol_Border, ImGuiCol_BorderShadow, ImGuiCol_Button, ImGuiCol_ButtonActive, ImGuiCol_ButtonHovered, ImGuiCol_CheckMark, ImGuiCol_ChildBg, ImGuiCol_DragDropTarget, ImGuiCol_FrameBg, ImGuiCol_FrameBgActive, ImGuiCol_FrameBgHovered, ImGuiCol_Header, ImGuiCol_HeaderActive, ImGuiCol_HeaderHovered, ImGuiCol_MenuBarBg, ImGuiCol_ModalWindowDimBg, ImGuiCol_NavHighlight, ImGuiCol_NavWindowingDimBg, ImGuiCol_NavWindowingHighlight, ImGuiCol_PlotHistogram, ImGuiCol_PlotHistogramHovered, ImGuiCol_PlotLines, ImGuiCol_PlotLinesHovered, ImGuiCol_PopupBg, ImGuiCol_ResizeGrip, ImGuiCol_ResizeGripActive, ImGuiCol_ResizeGripHovered, ImGuiCol_ScrollbarBg, ImGuiCol_ScrollbarGrab, ImGuiCol_ScrollbarGrabActive, ImGuiCol_ScrollbarGrabHovered, ImGuiCol_Separator, ImGuiCol_SeparatorActive, ImGuiCol_SeparatorHovered, ImGuiCol_SliderGrab, ImGuiCol_SliderGrabActive, ImGuiCol_Tab, ImGuiCol_TabActive, ImGuiCol_TabHovered, ImGuiCol_TableBorderLight, ImGuiCol_TableBorderStrong, ImGuiCol_TableHeaderBg, ImGuiCol_TableRowBg, ImGuiCol_TableRowBgAlt, ImGuiCol_TabUnfocused, ImGuiCol_TabUnfocusedActive, ImGuiCol_Text, ImGuiCol_TextDisabled, ImGuiCol_TextSelectedBg, ImGuiCol_TitleBg, ImGuiCol_TitleBgActive, ImGuiCol_TitleBgCollapsed, ImGuiCol_WindowBg, ImLerp(), and style.

Referenced by ShowStyleSelector().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TabBarCalcMaxTabWidth()

static float ImGui::TabBarCalcMaxTabWidth ( )
static
7375{
7376 ImGuiContext& g = *GImGui;
7377 return g.FontSize * 20.0f;
7378}

References ImGuiContext::FontSize, and GImGui.

Referenced by TabItemCalcSize().

+ Here is the caller graph for this function:

◆ TabBarCalcTabID()

static ImU32 ImGui::TabBarCalcTabID ( ImGuiTabBar tab_bar,
const char *  label 
)
static
7360{
7361 if (tab_bar->Flags & ImGuiTabBarFlags_DockNode)
7362 {
7363 ImGuiID id = ImHashStr(label);
7364 KeepAliveID(id);
7365 return id;
7366 }
7367 else
7368 {
7369 ImGuiWindow* window = GImGui->CurrentWindow;
7370 return window->GetID(label);
7371 }
7372}

References ImGuiContext::CurrentWindow, ImGuiTabBar::Flags, ImGuiWindow::GetID(), GImGui, ImGuiTabBarFlags_DockNode, ImHashStr(), and KeepAliveID().

Referenced by SetTabItemClosed(), and TabItemEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TabBarCloseTab()

void ImGui::TabBarCloseTab ( ImGuiTabBar tab_bar,
ImGuiTabItem tab 
)
7401{
7404 {
7405 // This will remove a frame of lag for selecting another tab on closure.
7406 // However we don't run it in the case where the 'Unsaved' flag is set, so user gets a chance to fully undo the closure
7407 tab->WantClose = true;
7408 if (tab_bar->VisibleTabId == tab->ID)
7409 {
7410 tab->LastFrameVisible = -1;
7411 tab_bar->SelectedTabId = tab_bar->NextSelectedTabId = 0;
7412 }
7413 }
7414 else
7415 {
7416 // Actually select before expecting closure attempt (on an UnsavedDocument tab user is expect to e.g. show a popup)
7417 if (tab_bar->VisibleTabId != tab->ID)
7418 tab_bar->NextSelectedTabId = tab->ID;
7419 }
7420}
@ ImGuiTabItemFlags_UnsavedDocument
Definition imgui.h:1073
ImGuiID NextSelectedTabId
Definition imgui_internal.h:1977
int LastFrameVisible
Definition imgui_internal.h:1957
bool WantClose
Definition imgui_internal.h:1965

References ImGuiTabItem::Flags, ImGuiTabItem::ID, IM_ASSERT, ImGuiTabItemFlags_Button, ImGuiTabItemFlags_UnsavedDocument, ImGuiTabItem::LastFrameVisible, ImGuiTabBar::NextSelectedTabId, ImGuiTabBar::SelectedTabId, ImGuiTabBar::VisibleTabId, and ImGuiTabItem::WantClose.

Referenced by TabItemEx().

+ Here is the caller graph for this function:

◆ TabBarFindTabByID()

ImGuiTabItem * ImGui::TabBarFindTabByID ( ImGuiTabBar tab_bar,
ImGuiID  tab_id 
)
7381{
7382 if (tab_id != 0)
7383 for (int n = 0; n < tab_bar->Tabs.Size; n++)
7384 if (tab_bar->Tabs[n].ID == tab_id)
7385 return &tab_bar->Tabs[n];
7386 return NULL;
7387}

References ImVector< T >::Size, and ImGuiTabBar::Tabs.

Referenced by SetTabItemClosed(), TabBarProcessReorder(), TabBarRemoveTab(), TabBarScrollingButtons(), TabBarScrollToTab(), and TabItemEx().

+ Here is the caller graph for this function:

◆ TabBarLayout()

static void ImGui::TabBarLayout ( ImGuiTabBar tab_bar)
static
7130{
7131 ImGuiContext& g = *GImGui;
7132 tab_bar->WantLayout = false;
7133
7134 // Garbage collect by compacting list
7135 // Detect if we need to sort out tab list (e.g. in rare case where a tab changed section)
7136 int tab_dst_n = 0;
7137 bool need_sort_by_section = false;
7138 ImGuiTabBarSection sections[3]; // Layout sections: Leading, Central, Trailing
7139 for (int tab_src_n = 0; tab_src_n < tab_bar->Tabs.Size; tab_src_n++)
7140 {
7141 ImGuiTabItem* tab = &tab_bar->Tabs[tab_src_n];
7142 if (tab->LastFrameVisible < tab_bar->PrevFrameVisible || tab->WantClose)
7143 {
7144 // Remove tab
7145 if (tab_bar->VisibleTabId == tab->ID) { tab_bar->VisibleTabId = 0; }
7146 if (tab_bar->SelectedTabId == tab->ID) { tab_bar->SelectedTabId = 0; }
7147 if (tab_bar->NextSelectedTabId == tab->ID) { tab_bar->NextSelectedTabId = 0; }
7148 continue;
7149 }
7150 if (tab_dst_n != tab_src_n)
7151 tab_bar->Tabs[tab_dst_n] = tab_bar->Tabs[tab_src_n];
7152
7153 tab = &tab_bar->Tabs[tab_dst_n];
7154 tab->IndexDuringLayout = (ImS16)tab_dst_n;
7155
7156 // We will need sorting if tabs have changed section (e.g. moved from one of Leading/Central/Trailing to another)
7157 int curr_tab_section_n = TabItemGetSectionIdx(tab);
7158 if (tab_dst_n > 0)
7159 {
7160 ImGuiTabItem* prev_tab = &tab_bar->Tabs[tab_dst_n - 1];
7161 int prev_tab_section_n = TabItemGetSectionIdx(prev_tab);
7162 if (curr_tab_section_n == 0 && prev_tab_section_n != 0)
7163 need_sort_by_section = true;
7164 if (prev_tab_section_n == 2 && curr_tab_section_n != 2)
7165 need_sort_by_section = true;
7166 }
7167
7168 sections[curr_tab_section_n].TabCount++;
7169 tab_dst_n++;
7170 }
7171 if (tab_bar->Tabs.Size != tab_dst_n)
7172 tab_bar->Tabs.resize(tab_dst_n);
7173
7174 if (need_sort_by_section)
7175 ImQsort(tab_bar->Tabs.Data, tab_bar->Tabs.Size, sizeof(ImGuiTabItem), TabItemComparerBySection);
7176
7177 // Calculate spacing between sections
7178 sections[0].Spacing = sections[0].TabCount > 0 && (sections[1].TabCount + sections[2].TabCount) > 0 ? g.Style.ItemInnerSpacing.x : 0.0f;
7179 sections[1].Spacing = sections[1].TabCount > 0 && sections[2].TabCount > 0 ? g.Style.ItemInnerSpacing.x : 0.0f;
7180
7181 // Setup next selected tab
7182 ImGuiID scroll_to_tab_id = 0;
7183 if (tab_bar->NextSelectedTabId)
7184 {
7185 tab_bar->SelectedTabId = tab_bar->NextSelectedTabId;
7186 tab_bar->NextSelectedTabId = 0;
7187 scroll_to_tab_id = tab_bar->SelectedTabId;
7188 }
7189
7190 // Process order change request (we could probably process it when requested but it's just saner to do it in a single spot).
7191 if (tab_bar->ReorderRequestTabId != 0)
7192 {
7193 if (TabBarProcessReorder(tab_bar))
7194 if (tab_bar->ReorderRequestTabId == tab_bar->SelectedTabId)
7195 scroll_to_tab_id = tab_bar->ReorderRequestTabId;
7196 tab_bar->ReorderRequestTabId = 0;
7197 }
7198
7199 // Tab List Popup (will alter tab_bar->BarRect and therefore the available width!)
7200 const bool tab_list_popup_button = (tab_bar->Flags & ImGuiTabBarFlags_TabListPopupButton) != 0;
7201 if (tab_list_popup_button)
7202 if (ImGuiTabItem* tab_to_select = TabBarTabListPopupButton(tab_bar)) // NB: Will alter BarRect.Min.x!
7203 scroll_to_tab_id = tab_bar->SelectedTabId = tab_to_select->ID;
7204
7205 // Leading/Trailing tabs will be shrink only if central one aren't visible anymore, so layout the shrink data as: leading, trailing, central
7206 // (whereas our tabs are stored as: leading, central, trailing)
7207 int shrink_buffer_indexes[3] = { 0, sections[0].TabCount + sections[2].TabCount, sections[0].TabCount };
7208 g.ShrinkWidthBuffer.resize(tab_bar->Tabs.Size);
7209
7210 // Compute ideal tabs widths + store them into shrink buffer
7211 ImGuiTabItem* most_recently_selected_tab = NULL;
7212 int curr_section_n = -1;
7213 bool found_selected_tab_id = false;
7214 for (int tab_n = 0; tab_n < tab_bar->Tabs.Size; tab_n++)
7215 {
7216 ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
7218
7219 if ((most_recently_selected_tab == NULL || most_recently_selected_tab->LastFrameSelected < tab->LastFrameSelected) && !(tab->Flags & ImGuiTabItemFlags_Button))
7220 most_recently_selected_tab = tab;
7221 if (tab->ID == tab_bar->SelectedTabId)
7222 found_selected_tab_id = true;
7223 if (scroll_to_tab_id == 0 && g.NavJustMovedToId == tab->ID)
7224 scroll_to_tab_id = tab->ID;
7225
7226 // Refresh tab width immediately, otherwise changes of style e.g. style.FramePadding.x would noticeably lag in the tab bar.
7227 // Additionally, when using TabBarAddTab() to manipulate tab bar order we occasionally insert new tabs that don't have a width yet,
7228 // and we cannot wait for the next BeginTabItem() call. We cannot compute this width within TabBarAddTab() because font size depends on the active window.
7229 const char* tab_name = tab_bar->GetTabName(tab);
7230 const bool has_close_button = (tab->Flags & ImGuiTabItemFlags_NoCloseButton) ? false : true;
7231 tab->ContentWidth = TabItemCalcSize(tab_name, has_close_button).x;
7232
7233 int section_n = TabItemGetSectionIdx(tab);
7234 ImGuiTabBarSection* section = &sections[section_n];
7235 section->Width += tab->ContentWidth + (section_n == curr_section_n ? g.Style.ItemInnerSpacing.x : 0.0f);
7236 curr_section_n = section_n;
7237
7238 // Store data so we can build an array sorted by width if we need to shrink tabs down
7240 int shrink_buffer_index = shrink_buffer_indexes[section_n]++;
7241 g.ShrinkWidthBuffer[shrink_buffer_index].Index = tab_n;
7242 g.ShrinkWidthBuffer[shrink_buffer_index].Width = tab->ContentWidth;
7243
7244 IM_ASSERT(tab->ContentWidth > 0.0f);
7245 tab->Width = tab->ContentWidth;
7246 }
7247
7248 // Compute total ideal width (used for e.g. auto-resizing a window)
7249 tab_bar->WidthAllTabsIdeal = 0.0f;
7250 for (int section_n = 0; section_n < 3; section_n++)
7251 tab_bar->WidthAllTabsIdeal += sections[section_n].Width + sections[section_n].Spacing;
7252
7253 // Horizontal scrolling buttons
7254 // (note that TabBarScrollButtons() will alter BarRect.Max.x)
7255 if ((tab_bar->WidthAllTabsIdeal > tab_bar->BarRect.GetWidth() && tab_bar->Tabs.Size > 1) && !(tab_bar->Flags & ImGuiTabBarFlags_NoTabListScrollingButtons) && (tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyScroll))
7256 if (ImGuiTabItem* scroll_and_select_tab = TabBarScrollingButtons(tab_bar))
7257 {
7258 scroll_to_tab_id = scroll_and_select_tab->ID;
7259 if ((scroll_and_select_tab->Flags & ImGuiTabItemFlags_Button) == 0)
7260 tab_bar->SelectedTabId = scroll_to_tab_id;
7261 }
7262
7263 // Shrink widths if full tabs don't fit in their allocated space
7264 float section_0_w = sections[0].Width + sections[0].Spacing;
7265 float section_1_w = sections[1].Width + sections[1].Spacing;
7266 float section_2_w = sections[2].Width + sections[2].Spacing;
7267 bool central_section_is_visible = (section_0_w + section_2_w) < tab_bar->BarRect.GetWidth();
7268 float width_excess;
7269 if (central_section_is_visible)
7270 width_excess = ImMax(section_1_w - (tab_bar->BarRect.GetWidth() - section_0_w - section_2_w), 0.0f); // Excess used to shrink central section
7271 else
7272 width_excess = (section_0_w + section_2_w) - tab_bar->BarRect.GetWidth(); // Excess used to shrink leading/trailing section
7273
7274 // With ImGuiTabBarFlags_FittingPolicyScroll policy, we will only shrink leading/trailing if the central section is not visible anymore
7275 if (width_excess > 0.0f && ((tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyResizeDown) || !central_section_is_visible))
7276 {
7277 int shrink_data_count = (central_section_is_visible ? sections[1].TabCount : sections[0].TabCount + sections[2].TabCount);
7278 int shrink_data_offset = (central_section_is_visible ? sections[0].TabCount + sections[2].TabCount : 0);
7279 ShrinkWidths(g.ShrinkWidthBuffer.Data + shrink_data_offset, shrink_data_count, width_excess);
7280
7281 // Apply shrunk values into tabs and sections
7282 for (int tab_n = shrink_data_offset; tab_n < shrink_data_offset + shrink_data_count; tab_n++)
7283 {
7284 ImGuiTabItem* tab = &tab_bar->Tabs[g.ShrinkWidthBuffer[tab_n].Index];
7285 float shrinked_width = IM_FLOOR(g.ShrinkWidthBuffer[tab_n].Width);
7286 if (shrinked_width < 0.0f)
7287 continue;
7288
7289 int section_n = TabItemGetSectionIdx(tab);
7290 sections[section_n].Width -= (tab->Width - shrinked_width);
7291 tab->Width = shrinked_width;
7292 }
7293 }
7294
7295 // Layout all active tabs
7296 int section_tab_index = 0;
7297 float tab_offset = 0.0f;
7298 tab_bar->WidthAllTabs = 0.0f;
7299 for (int section_n = 0; section_n < 3; section_n++)
7300 {
7301 ImGuiTabBarSection* section = &sections[section_n];
7302 if (section_n == 2)
7303 tab_offset = ImMin(ImMax(0.0f, tab_bar->BarRect.GetWidth() - section->Width), tab_offset);
7304
7305 for (int tab_n = 0; tab_n < section->TabCount; tab_n++)
7306 {
7307 ImGuiTabItem* tab = &tab_bar->Tabs[section_tab_index + tab_n];
7308 tab->Offset = tab_offset;
7309 tab_offset += tab->Width + (tab_n < section->TabCount - 1 ? g.Style.ItemInnerSpacing.x : 0.0f);
7310 }
7311 tab_bar->WidthAllTabs += ImMax(section->Width + section->Spacing, 0.0f);
7312 tab_offset += section->Spacing;
7313 section_tab_index += section->TabCount;
7314 }
7315
7316 // If we have lost the selected tab, select the next most recently active one
7317 if (found_selected_tab_id == false)
7318 tab_bar->SelectedTabId = 0;
7319 if (tab_bar->SelectedTabId == 0 && tab_bar->NextSelectedTabId == 0 && most_recently_selected_tab != NULL)
7320 scroll_to_tab_id = tab_bar->SelectedTabId = most_recently_selected_tab->ID;
7321
7322 // Lock in visible tab
7323 tab_bar->VisibleTabId = tab_bar->SelectedTabId;
7324 tab_bar->VisibleTabWasSubmitted = false;
7325
7326 // Update scrolling
7327 if (scroll_to_tab_id != 0)
7328 TabBarScrollToTab(tab_bar, scroll_to_tab_id, sections);
7329 tab_bar->ScrollingAnim = TabBarScrollClamp(tab_bar, tab_bar->ScrollingAnim);
7330 tab_bar->ScrollingTarget = TabBarScrollClamp(tab_bar, tab_bar->ScrollingTarget);
7331 if (tab_bar->ScrollingAnim != tab_bar->ScrollingTarget)
7332 {
7333 // Scrolling speed adjust itself so we can always reach our target in 1/3 seconds.
7334 // Teleport if we are aiming far off the visible line
7335 tab_bar->ScrollingSpeed = ImMax(tab_bar->ScrollingSpeed, 70.0f * g.FontSize);
7336 tab_bar->ScrollingSpeed = ImMax(tab_bar->ScrollingSpeed, ImFabs(tab_bar->ScrollingTarget - tab_bar->ScrollingAnim) / 0.3f);
7337 const bool teleport = (tab_bar->PrevFrameVisible + 1 < g.FrameCount) || (tab_bar->ScrollingTargetDistToVisibility > 10.0f * g.FontSize);
7338 tab_bar->ScrollingAnim = teleport ? tab_bar->ScrollingTarget : ImLinearSweep(tab_bar->ScrollingAnim, tab_bar->ScrollingTarget, g.IO.DeltaTime * tab_bar->ScrollingSpeed);
7339 }
7340 else
7341 {
7342 tab_bar->ScrollingSpeed = 0.0f;
7343 }
7344 tab_bar->ScrollingRectMinX = tab_bar->BarRect.Min.x + sections[0].Width + sections[0].Spacing;
7345 tab_bar->ScrollingRectMaxX = tab_bar->BarRect.Max.x - sections[2].Width - sections[1].Spacing;
7346
7347 // Clear name buffers
7348 if ((tab_bar->Flags & ImGuiTabBarFlags_DockNode) == 0)
7349 tab_bar->TabsNames.Buf.resize(0);
7350
7351 // Actual layout in host window (we don't do it in BeginTabBar() so as not to waste an extra frame)
7352 ImGuiWindow* window = g.CurrentWindow;
7353 window->DC.CursorPos = tab_bar->BarRect.Min;
7354 ItemSize(ImVec2(tab_bar->WidthAllTabs, tab_bar->BarRect.GetHeight()), tab_bar->FramePadding.y);
7355 window->DC.IdealMaxPos.x = ImMax(window->DC.IdealMaxPos.x, tab_bar->BarRect.Min.x + tab_bar->WidthAllTabsIdeal);
7356}
@ ImGuiTabBarFlags_TabListPopupButton
Definition imgui.h:1059
@ ImGuiTabBarFlags_NoTabListScrollingButtons
Definition imgui.h:1061
@ ImGuiTabBarFlags_FittingPolicyScroll
Definition imgui.h:1064
@ ImGuiTabBarFlags_FittingPolicyResizeDown
Definition imgui.h:1063
static float ImLinearSweep(float current, float target, float speed)
Definition imgui_internal.h:433
@ ImGuiTabItemFlags_NoCloseButton
Definition imgui_internal.h:1948
static int IMGUI_CDECL TabItemComparerBySection(const void *lhs, const void *rhs)
Definition imgui_widgets.cpp:6983
static int TabItemGetSectionIdx(const ImGuiTabItem *tab)
Definition imgui_widgets.cpp:6978
IMGUI_API ImVec2 TabItemCalcSize(const char *label, bool has_close_button)
Definition imgui_widgets.cpp:7938
static ImGuiTabItem * TabBarTabListPopupButton(ImGuiTabBar *tab_bar)
Definition imgui_widgets.cpp:7599
static ImGuiTabItem * TabBarScrollingButtons(ImGuiTabBar *tab_bar)
Definition imgui_widgets.cpp:7538
static float TabBarScrollClamp(ImGuiTabBar *tab_bar, float scrolling)
Definition imgui_widgets.cpp:7422
IMGUI_API bool TabBarProcessReorder(ImGuiTabBar *tab_bar)
Definition imgui_widgets.cpp:7507
static void TabBarScrollToTab(ImGuiTabBar *tab_bar, ImGuiID tab_id, ImGuiTabBarSection *sections)
Definition imgui_widgets.cpp:7429
IMGUI_API void ShrinkWidths(ImGuiShrinkWidthItem *items, int count, float width_excess)
Definition imgui_widgets.cpp:1501
float ScrollingAnim
Definition imgui_internal.h:1986
float ScrollingTarget
Definition imgui_internal.h:1987
float WidthAllTabs
Definition imgui_internal.h:1984
float ScrollingSpeed
Definition imgui_internal.h:1989
ImGuiID ReorderRequestTabId
Definition imgui_internal.h:1992
float ScrollingTargetDistToVisibility
Definition imgui_internal.h:1988
const char * GetTabName(const ImGuiTabItem *tab) const
Definition imgui_internal.h:2007
float WidthAllTabsIdeal
Definition imgui_internal.h:1985
ImGuiTextBuffer TabsNames
Definition imgui_internal.h:2003
Definition imgui_widgets.cpp:6952
float Spacing
Definition imgui_widgets.cpp:6955
int TabCount
Definition imgui_widgets.cpp:6953
float Width
Definition imgui_widgets.cpp:6954
float ContentWidth
Definition imgui_internal.h:1961
float Width
Definition imgui_internal.h:1960
ImS16 IndexDuringLayout
Definition imgui_internal.h:1964
float Offset
Definition imgui_internal.h:1959
int LastFrameSelected
Definition imgui_internal.h:1958

References ImGuiTabBar::BarRect, ImGuiTextBuffer::Buf, ImGuiTabItem::ContentWidth, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPos, ImVector< T >::Data, ImGuiWindow::DC, ImGuiIO::DeltaTime, ImGuiTabItem::Flags, ImGuiTabBar::Flags, ImGuiContext::FontSize, ImGuiContext::FrameCount, ImGuiTabBar::FramePadding, ImRect::GetHeight(), ImGuiTabBar::GetTabName(), ImRect::GetWidth(), GImGui, ImGuiTabItem::ID, ImGuiWindowTempData::IdealMaxPos, IM_ASSERT, IM_FLOOR, IM_MSVC_WARNING_SUPPRESS, ImFabs, ImGuiTabBarFlags_DockNode, ImGuiTabBarFlags_FittingPolicyResizeDown, ImGuiTabBarFlags_FittingPolicyScroll, ImGuiTabBarFlags_NoTabListScrollingButtons, ImGuiTabBarFlags_TabListPopupButton, ImGuiTabItemFlags_Button, ImGuiTabItemFlags_NoCloseButton, ImLinearSweep(), ImMax(), ImMin(), ImQsort, ImGuiTabItem::IndexDuringLayout, ImGuiContext::IO, ImGuiStyle::ItemInnerSpacing, ItemSize(), ImGuiTabItem::LastFrameSelected, ImGuiTabItem::LastFrameVisible, ImRect::Max, ImRect::Min, ImGuiContext::NavJustMovedToId, ImGuiTabBar::NextSelectedTabId, ImGuiTabItem::Offset, ImGuiTabBar::PrevFrameVisible, ImGuiTabBar::ReorderRequestTabId, ImVector< T >::resize(), ImGuiTabBar::ScrollingAnim, ImGuiTabBar::ScrollingRectMaxX, ImGuiTabBar::ScrollingRectMinX, ImGuiTabBar::ScrollingSpeed, ImGuiTabBar::ScrollingTarget, ImGuiTabBar::ScrollingTargetDistToVisibility, ImGuiTabBar::SelectedTabId, ImGuiContext::ShrinkWidthBuffer, ShrinkWidths(), ImVector< T >::Size, ImGuiTabBarSection::Spacing, ImGuiContext::Style, TabBarProcessReorder(), TabBarScrollClamp(), TabBarScrollingButtons(), TabBarScrollToTab(), TabBarTabListPopupButton(), ImGuiTabBarSection::TabCount, TabItemCalcSize(), TabItemComparerBySection(), TabItemGetSectionIdx(), ImGuiTabBar::Tabs, ImGuiTabBar::TabsNames, ImGuiTabBar::VisibleTabId, ImGuiTabBar::VisibleTabWasSubmitted, ImGuiTabItem::WantClose, ImGuiTabBar::WantLayout, ImGuiTabItem::Width, ImGuiTabBarSection::Width, ImGuiTabBar::WidthAllTabs, ImGuiTabBar::WidthAllTabsIdeal, ImVec2::x, and ImVec2::y.

Referenced by EndTabBar(), and TabItemEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TabBarProcessReorder()

bool ImGui::TabBarProcessReorder ( ImGuiTabBar tab_bar)
7508{
7509 ImGuiTabItem* tab1 = TabBarFindTabByID(tab_bar, tab_bar->ReorderRequestTabId);
7510 if (tab1 == NULL || (tab1->Flags & ImGuiTabItemFlags_NoReorder))
7511 return false;
7512
7513 //IM_ASSERT(tab_bar->Flags & ImGuiTabBarFlags_Reorderable); // <- this may happen when using debug tools
7514 int tab2_order = tab_bar->GetTabOrder(tab1) + tab_bar->ReorderRequestOffset;
7515 if (tab2_order < 0 || tab2_order >= tab_bar->Tabs.Size)
7516 return false;
7517
7518 // Reordered tabs must share the same section
7519 // (Note: TabBarQueueReorderFromMousePos() also has a similar test but since we allow direct calls to TabBarQueueReorder() we do it here too)
7520 ImGuiTabItem* tab2 = &tab_bar->Tabs[tab2_order];
7522 return false;
7524 return false;
7525
7526 ImGuiTabItem item_tmp = *tab1;
7527 ImGuiTabItem* src_tab = (tab_bar->ReorderRequestOffset > 0) ? tab1 + 1 : tab2;
7528 ImGuiTabItem* dst_tab = (tab_bar->ReorderRequestOffset > 0) ? tab1 : tab2 + 1;
7529 const int move_count = (tab_bar->ReorderRequestOffset > 0) ? tab_bar->ReorderRequestOffset : -tab_bar->ReorderRequestOffset;
7530 memmove(dst_tab, src_tab, move_count * sizeof(ImGuiTabItem));
7531 *tab2 = item_tmp;
7532
7533 if (tab_bar->Flags & ImGuiTabBarFlags_SaveSettings)
7535 return true;
7536}
@ ImGuiTabItemFlags_NoReorder
Definition imgui.h:1078
@ ImGuiTabBarFlags_SaveSettings
Definition imgui_internal.h:1941
@ ImGuiTabItemFlags_SectionMask_
Definition imgui_internal.h:1947
int GetTabOrder(const ImGuiTabItem *tab) const
Definition imgui_internal.h:2006
ImS16 ReorderRequestOffset
Definition imgui_internal.h:1993

References ImGuiTabItem::Flags, ImGuiTabBar::Flags, ImGuiTabBar::GetTabOrder(), ImGuiTabBarFlags_SaveSettings, ImGuiTabItemFlags_NoReorder, ImGuiTabItemFlags_SectionMask_, MarkIniSettingsDirty(), ImGuiTabBar::ReorderRequestOffset, ImGuiTabBar::ReorderRequestTabId, ImVector< T >::Size, TabBarFindTabByID(), and ImGuiTabBar::Tabs.

Referenced by TabBarLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TabBarQueueReorder()

void ImGui::TabBarQueueReorder ( ImGuiTabBar tab_bar,
const ImGuiTabItem tab,
int  offset 
)
7464{
7465 IM_ASSERT(offset != 0);
7466 IM_ASSERT(tab_bar->ReorderRequestTabId == 0);
7467 tab_bar->ReorderRequestTabId = tab->ID;
7468 tab_bar->ReorderRequestOffset = (ImS16)offset;
7469}

References ImGuiTabItem::ID, IM_ASSERT, ImGuiTabBar::ReorderRequestOffset, and ImGuiTabBar::ReorderRequestTabId.

Referenced by DebugNodeTabBar(), and TabBarQueueReorderFromMousePos().

+ Here is the caller graph for this function:

◆ TabBarQueueReorderFromMousePos()

void ImGui::TabBarQueueReorderFromMousePos ( ImGuiTabBar tab_bar,
const ImGuiTabItem tab,
ImVec2  mouse_pos 
)
7472{
7473 ImGuiContext& g = *GImGui;
7474 IM_ASSERT(tab_bar->ReorderRequestTabId == 0);
7475 if ((tab_bar->Flags & ImGuiTabBarFlags_Reorderable) == 0)
7476 return;
7477
7478 const bool is_central_section = (src_tab->Flags & ImGuiTabItemFlags_SectionMask_) == 0;
7479 const float bar_offset = tab_bar->BarRect.Min.x - (is_central_section ? tab_bar->ScrollingTarget : 0);
7480
7481 // Count number of contiguous tabs we are crossing over
7482 const int dir = (bar_offset + src_tab->Offset) > mouse_pos.x ? -1 : +1;
7483 const int src_idx = tab_bar->Tabs.index_from_ptr(src_tab);
7484 int dst_idx = src_idx;
7485 for (int i = src_idx; i >= 0 && i < tab_bar->Tabs.Size; i += dir)
7486 {
7487 // Reordered tabs must share the same section
7488 const ImGuiTabItem* dst_tab = &tab_bar->Tabs[i];
7489 if (dst_tab->Flags & ImGuiTabItemFlags_NoReorder)
7490 break;
7491 if ((dst_tab->Flags & ImGuiTabItemFlags_SectionMask_) != (src_tab->Flags & ImGuiTabItemFlags_SectionMask_))
7492 break;
7493 dst_idx = i;
7494
7495 // Include spacing after tab, so when mouse cursor is between tabs we would not continue checking further tabs that are not hovered.
7496 const float x1 = bar_offset + dst_tab->Offset - g.Style.ItemInnerSpacing.x;
7497 const float x2 = bar_offset + dst_tab->Offset + dst_tab->Width + g.Style.ItemInnerSpacing.x;
7498 //GetForegroundDrawList()->AddRect(ImVec2(x1, tab_bar->BarRect.Min.y), ImVec2(x2, tab_bar->BarRect.Max.y), IM_COL32(255, 0, 0, 255));
7499 if ((dir < 0 && mouse_pos.x > x1) || (dir > 0 && mouse_pos.x < x2))
7500 break;
7501 }
7502
7503 if (dst_idx != src_idx)
7504 TabBarQueueReorder(tab_bar, src_tab, dst_idx - src_idx);
7505}
int index_from_ptr(const T *it) const
Definition imgui.h:1708

References ImGuiTabBar::BarRect, ImGuiTabItem::Flags, ImGuiTabBar::Flags, GImGui, IM_ASSERT, ImGuiTabBarFlags_Reorderable, ImGuiTabItemFlags_NoReorder, ImGuiTabItemFlags_SectionMask_, ImVector< T >::index_from_ptr(), ImGuiStyle::ItemInnerSpacing, ImRect::Min, ImGuiTabItem::Offset, ImGuiTabBar::ReorderRequestTabId, ImGuiTabBar::ScrollingTarget, ImVector< T >::Size, ImGuiContext::Style, TabBarQueueReorder(), ImGuiTabBar::Tabs, ImGuiTabItem::Width, and ImVec2::x.

Referenced by TabItemEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TabBarRemoveTab()

void ImGui::TabBarRemoveTab ( ImGuiTabBar tab_bar,
ImGuiID  tab_id 
)
7391{
7392 if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id))
7393 tab_bar->Tabs.erase(tab);
7394 if (tab_bar->VisibleTabId == tab_id) { tab_bar->VisibleTabId = 0; }
7395 if (tab_bar->SelectedTabId == tab_id) { tab_bar->SelectedTabId = 0; }
7396 if (tab_bar->NextSelectedTabId == tab_id) { tab_bar->NextSelectedTabId = 0; }
7397}

References ImVector< T >::erase(), ImGuiTabBar::NextSelectedTabId, ImGuiTabBar::SelectedTabId, TabBarFindTabByID(), ImGuiTabBar::Tabs, and ImGuiTabBar::VisibleTabId.

+ Here is the call graph for this function:

◆ TabBarScrollClamp()

static float ImGui::TabBarScrollClamp ( ImGuiTabBar tab_bar,
float  scrolling 
)
static
7423{
7424 scrolling = ImMin(scrolling, tab_bar->WidthAllTabs - tab_bar->BarRect.GetWidth());
7425 return ImMax(scrolling, 0.0f);
7426}

References ImGuiTabBar::BarRect, ImRect::GetWidth(), ImMax(), ImMin(), and ImGuiTabBar::WidthAllTabs.

Referenced by TabBarLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TabBarScrollingButtons()

static ImGuiTabItem * ImGui::TabBarScrollingButtons ( ImGuiTabBar tab_bar)
static
7539{
7540 ImGuiContext& g = *GImGui;
7541 ImGuiWindow* window = g.CurrentWindow;
7542
7543 const ImVec2 arrow_button_size(g.FontSize - 2.0f, g.FontSize + g.Style.FramePadding.y * 2.0f);
7544 const float scrolling_buttons_width = arrow_button_size.x * 2.0f;
7545
7546 const ImVec2 backup_cursor_pos = window->DC.CursorPos;
7547 //window->DrawList->AddRect(ImVec2(tab_bar->BarRect.Max.x - scrolling_buttons_width, tab_bar->BarRect.Min.y), ImVec2(tab_bar->BarRect.Max.x, tab_bar->BarRect.Max.y), IM_COL32(255,0,0,255));
7548
7549 int select_dir = 0;
7550 ImVec4 arrow_col = g.Style.Colors[ImGuiCol_Text];
7551 arrow_col.w *= 0.5f;
7552
7553 PushStyleColor(ImGuiCol_Text, arrow_col);
7555 const float backup_repeat_delay = g.IO.KeyRepeatDelay;
7556 const float backup_repeat_rate = g.IO.KeyRepeatRate;
7557 g.IO.KeyRepeatDelay = 0.250f;
7558 g.IO.KeyRepeatRate = 0.200f;
7559 float x = ImMax(tab_bar->BarRect.Min.x, tab_bar->BarRect.Max.x - scrolling_buttons_width);
7560 window->DC.CursorPos = ImVec2(x, tab_bar->BarRect.Min.y);
7562 select_dir = -1;
7563 window->DC.CursorPos = ImVec2(x + arrow_button_size.x, tab_bar->BarRect.Min.y);
7565 select_dir = +1;
7566 PopStyleColor(2);
7567 g.IO.KeyRepeatRate = backup_repeat_rate;
7568 g.IO.KeyRepeatDelay = backup_repeat_delay;
7569
7570 ImGuiTabItem* tab_to_scroll_to = NULL;
7571 if (select_dir != 0)
7572 if (ImGuiTabItem* tab_item = TabBarFindTabByID(tab_bar, tab_bar->SelectedTabId))
7573 {
7574 int selected_order = tab_bar->GetTabOrder(tab_item);
7575 int target_order = selected_order + select_dir;
7576
7577 // Skip tab item buttons until another tab item is found or end is reached
7578 while (tab_to_scroll_to == NULL)
7579 {
7580 // If we are at the end of the list, still scroll to make our tab visible
7581 tab_to_scroll_to = &tab_bar->Tabs[(target_order >= 0 && target_order < tab_bar->Tabs.Size) ? target_order : selected_order];
7582
7583 // Cross through buttons
7584 // (even if first/last item is a button, return it so we can update the scroll)
7585 if (tab_to_scroll_to->Flags & ImGuiTabItemFlags_Button)
7586 {
7587 target_order += select_dir;
7588 selected_order += select_dir;
7589 tab_to_scroll_to = (target_order < 0 || target_order >= tab_bar->Tabs.Size) ? tab_to_scroll_to : NULL;
7590 }
7591 }
7592 }
7593 window->DC.CursorPos = backup_cursor_pos;
7594 tab_bar->BarRect.Max.x -= scrolling_buttons_width + 1.0f;
7595
7596 return tab_to_scroll_to;
7597}

References ArrowButtonEx(), ImGuiTabBar::BarRect, ImGuiStyle::Colors, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiTabItem::Flags, ImGuiContext::FontSize, ImGuiStyle::FramePadding, ImGuiTabBar::GetTabOrder(), GImGui, ImGuiButtonFlags_PressedOnClick, ImGuiButtonFlags_Repeat, ImGuiCol_Button, ImGuiCol_Text, ImGuiDir_Left, ImGuiDir_Right, ImGuiTabItemFlags_Button, ImMax(), ImGuiContext::IO, ImGuiIO::KeyRepeatDelay, ImGuiIO::KeyRepeatRate, ImRect::Max, ImRect::Min, PopStyleColor(), PushStyleColor(), ImGuiTabBar::SelectedTabId, ImVector< T >::Size, ImGuiContext::Style, TabBarFindTabByID(), ImGuiTabBar::Tabs, ImVec4::w, ImVec2::x, and ImVec2::y.

Referenced by TabBarLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TabBarScrollToTab()

static void ImGui::TabBarScrollToTab ( ImGuiTabBar tab_bar,
ImGuiID  tab_id,
ImGuiTabBarSection sections 
)
static
7430{
7431 ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id);
7432 if (tab == NULL)
7433 return;
7435 return;
7436
7437 ImGuiContext& g = *GImGui;
7438 float margin = g.FontSize * 1.0f; // When to scroll to make Tab N+1 visible always make a bit of N visible to suggest more scrolling area (since we don't have a scrollbar)
7439 int order = tab_bar->GetTabOrder(tab);
7440
7441 // Scrolling happens only in the central section (leading/trailing sections are not scrolling)
7442 // FIXME: This is all confusing.
7443 float scrollable_width = tab_bar->BarRect.GetWidth() - sections[0].Width - sections[2].Width - sections[1].Spacing;
7444
7445 // We make all tabs positions all relative Sections[0].Width to make code simpler
7446 float tab_x1 = tab->Offset - sections[0].Width + (order > sections[0].TabCount - 1 ? -margin : 0.0f);
7447 float tab_x2 = tab->Offset - sections[0].Width + tab->Width + (order + 1 < tab_bar->Tabs.Size - sections[2].TabCount ? margin : 1.0f);
7448 tab_bar->ScrollingTargetDistToVisibility = 0.0f;
7449 if (tab_bar->ScrollingTarget > tab_x1 || (tab_x2 - tab_x1 >= scrollable_width))
7450 {
7451 // Scroll to the left
7452 tab_bar->ScrollingTargetDistToVisibility = ImMax(tab_bar->ScrollingAnim - tab_x2, 0.0f);
7453 tab_bar->ScrollingTarget = tab_x1;
7454 }
7455 else if (tab_bar->ScrollingTarget < tab_x2 - scrollable_width)
7456 {
7457 // Scroll to the right
7458 tab_bar->ScrollingTargetDistToVisibility = ImMax((tab_x1 - scrollable_width) - tab_bar->ScrollingAnim, 0.0f);
7459 tab_bar->ScrollingTarget = tab_x2 - scrollable_width;
7460 }
7461}

References ImGuiTabBar::BarRect, ImGuiTabItem::Flags, ImGuiContext::FontSize, ImGuiTabBar::GetTabOrder(), ImRect::GetWidth(), GImGui, ImGuiTabItemFlags_SectionMask_, ImMax(), ImGuiTabItem::Offset, ImGuiTabBar::ScrollingAnim, ImGuiTabBar::ScrollingTarget, ImGuiTabBar::ScrollingTargetDistToVisibility, ImVector< T >::Size, ImGuiTabBarSection::Spacing, TabBarFindTabByID(), ImGuiTabBarSection::TabCount, ImGuiTabBar::Tabs, ImGuiTabItem::Width, and ImGuiTabBarSection::Width.

Referenced by TabBarLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TabBarTabListPopupButton()

static ImGuiTabItem * ImGui::TabBarTabListPopupButton ( ImGuiTabBar tab_bar)
static
7600{
7601 ImGuiContext& g = *GImGui;
7602 ImGuiWindow* window = g.CurrentWindow;
7603
7604 // We use g.Style.FramePadding.y to match the square ArrowButton size
7605 const float tab_list_popup_button_width = g.FontSize + g.Style.FramePadding.y;
7606 const ImVec2 backup_cursor_pos = window->DC.CursorPos;
7607 window->DC.CursorPos = ImVec2(tab_bar->BarRect.Min.x - g.Style.FramePadding.y, tab_bar->BarRect.Min.y);
7608 tab_bar->BarRect.Min.x += tab_list_popup_button_width;
7609
7610 ImVec4 arrow_col = g.Style.Colors[ImGuiCol_Text];
7611 arrow_col.w *= 0.5f;
7612 PushStyleColor(ImGuiCol_Text, arrow_col);
7615 PopStyleColor(2);
7616
7617 ImGuiTabItem* tab_to_select = NULL;
7618 if (open)
7619 {
7620 for (int tab_n = 0; tab_n < tab_bar->Tabs.Size; tab_n++)
7621 {
7622 ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
7624 continue;
7625
7626 const char* tab_name = tab_bar->GetTabName(tab);
7627 if (Selectable(tab_name, tab_bar->SelectedTabId == tab->ID))
7628 tab_to_select = tab;
7629 }
7630 EndCombo();
7631 }
7632
7633 window->DC.CursorPos = backup_cursor_pos;
7634 return tab_to_select;
7635}
@ ImGuiComboFlags_HeightLargest
Definition imgui.h:1047

References ImGuiTabBar::BarRect, BeginCombo(), ImGuiStyle::Colors, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, EndCombo(), ImGuiTabItem::Flags, ImGuiContext::FontSize, ImGuiStyle::FramePadding, ImGuiTabBar::GetTabName(), GImGui, ImGuiTabItem::ID, ImGuiCol_Button, ImGuiCol_Text, ImGuiComboFlags_HeightLargest, ImGuiComboFlags_NoPreview, ImGuiTabItemFlags_Button, ImRect::Min, PopStyleColor(), PushStyleColor(), Selectable(), ImGuiTabBar::SelectedTabId, ImVector< T >::Size, ImGuiContext::Style, ImGuiTabBar::Tabs, ImVec4::w, ImVec2::x, and ImVec2::y.

Referenced by TabBarLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TabItemBackground()

void ImGui::TabItemBackground ( ImDrawList draw_list,
const ImRect bb,
ImGuiTabItemFlags  flags,
ImU32  col 
)
7951{
7952 // While rendering tabs, we trim 1 pixel off the top of our bounding box so they can fit within a regular frame height while looking "detached" from it.
7953 ImGuiContext& g = *GImGui;
7954 const float width = bb.GetWidth();
7955 IM_UNUSED(flags);
7956 IM_ASSERT(width > 0.0f);
7957 const float rounding = ImMax(0.0f, ImMin((flags & ImGuiTabItemFlags_Button) ? g.Style.FrameRounding : g.Style.TabRounding, width * 0.5f - 1.0f));
7958 const float y1 = bb.Min.y + 1.0f;
7959 const float y2 = bb.Max.y - 1.0f;
7960 draw_list->PathLineTo(ImVec2(bb.Min.x, y2));
7961 draw_list->PathArcToFast(ImVec2(bb.Min.x + rounding, y1 + rounding), rounding, 6, 9);
7962 draw_list->PathArcToFast(ImVec2(bb.Max.x - rounding, y1 + rounding), rounding, 9, 12);
7963 draw_list->PathLineTo(ImVec2(bb.Max.x, y2));
7964 draw_list->PathFillConvex(col);
7965 if (g.Style.TabBorderSize > 0.0f)
7966 {
7967 draw_list->PathLineTo(ImVec2(bb.Min.x + 0.5f, y2));
7968 draw_list->PathArcToFast(ImVec2(bb.Min.x + rounding + 0.5f, y1 + rounding + 0.5f), rounding, 6, 9);
7969 draw_list->PathArcToFast(ImVec2(bb.Max.x - rounding - 0.5f, y1 + rounding + 0.5f), rounding, 9, 12);
7970 draw_list->PathLineTo(ImVec2(bb.Max.x - 0.5f, y2));
7972 }
7973}
float TabBorderSize
Definition imgui.h:1748

References col(), ImGuiStyle::FrameRounding, GetColorU32(), ImRect::GetWidth(), GImGui, IM_ASSERT, IM_UNUSED, ImGuiCol_Border, ImGuiTabItemFlags_Button, ImMax(), ImMin(), ImRect::Max, ImRect::Min, ImDrawList::PathArcToFast(), ImDrawList::PathFillConvex(), ImDrawList::PathLineTo(), ImDrawList::PathStroke(), ImGuiContext::Style, ImGuiStyle::TabBorderSize, ImGuiStyle::TabRounding, ImVec2::x, and ImVec2::y.

Referenced by TabItemEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TabItemButton()

bool ImGui::TabItemButton ( const char *  label,
ImGuiTabItemFlags  flags = 0 
)
7694{
7695 ImGuiContext& g = *GImGui;
7696 ImGuiWindow* window = g.CurrentWindow;
7697 if (window->SkipItems)
7698 return false;
7699
7700 ImGuiTabBar* tab_bar = g.CurrentTabBar;
7701 if (tab_bar == NULL)
7702 {
7703 IM_ASSERT_USER_ERROR(tab_bar != NULL, "Needs to be called between BeginTabBar() and EndTabBar()!");
7704 return false;
7705 }
7706 return TabItemEx(tab_bar, label, NULL, flags | ImGuiTabItemFlags_Button | ImGuiTabItemFlags_NoReorder);
7707}

References ImGuiContext::CurrentTabBar, ImGuiContext::CurrentWindow, GImGui, IM_ASSERT_USER_ERROR, ImGuiTabItemFlags_Button, ImGuiTabItemFlags_NoReorder, ImGuiWindow::SkipItems, and TabItemEx().

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TabItemCalcSize()

ImVec2 ImGui::TabItemCalcSize ( const char *  label,
bool  has_close_button 
)
7939{
7940 ImGuiContext& g = *GImGui;
7941 ImVec2 label_size = CalcTextSize(label, NULL, true);
7942 ImVec2 size = ImVec2(label_size.x + g.Style.FramePadding.x, label_size.y + g.Style.FramePadding.y * 2.0f);
7943 if (has_close_button)
7944 size.x += g.Style.FramePadding.x + (g.Style.ItemInnerSpacing.x + g.FontSize); // We use Y intentionally to fit the close button circle.
7945 else
7946 size.x += g.Style.FramePadding.x + 1.0f;
7947 return ImVec2(ImMin(size.x, TabBarCalcMaxTabWidth()), size.y);
7948}
static float TabBarCalcMaxTabWidth()
Definition imgui_widgets.cpp:7374

References CalcTextSize(), ImGuiContext::FontSize, ImGuiStyle::FramePadding, GImGui, ImMin(), ImGuiStyle::ItemInnerSpacing, ImGuiContext::Style, TabBarCalcMaxTabWidth(), ImVec2::x, and ImVec2::y.

Referenced by TabBarLayout(), and TabItemEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TabItemEx()

bool ImGui::TabItemEx ( ImGuiTabBar tab_bar,
const char *  label,
bool *  p_open,
ImGuiTabItemFlags  flags 
)
7710{
7711 // Layout whole tab bar if not already done
7712 if (tab_bar->WantLayout)
7713 TabBarLayout(tab_bar);
7714
7715 ImGuiContext& g = *GImGui;
7716 ImGuiWindow* window = g.CurrentWindow;
7717 if (window->SkipItems)
7718 return false;
7719
7720 const ImGuiStyle& style = g.Style;
7721 const ImGuiID id = TabBarCalcTabID(tab_bar, label);
7722
7723 // If the user called us with *p_open == false, we early out and don't render.
7724 // We make a call to ItemAdd() so that attempts to use a contextual popup menu with an implicit ID won't use an older ID.
7726 if (p_open && !*p_open)
7727 {
7729 ItemAdd(ImRect(), id);
7730 PopItemFlag();
7731 return false;
7732 }
7733
7734 IM_ASSERT(!p_open || !(flags & ImGuiTabItemFlags_Button));
7736
7737 // Store into ImGuiTabItemFlags_NoCloseButton, also honor ImGuiTabItemFlags_NoCloseButton passed by user (although not documented)
7739 p_open = NULL;
7740 else if (p_open == NULL)
7742
7743 // Calculate tab contents size
7744 ImVec2 size = TabItemCalcSize(label, p_open != NULL);
7745
7746 // Acquire tab data
7747 ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, id);
7748 bool tab_is_new = false;
7749 if (tab == NULL)
7750 {
7751 tab_bar->Tabs.push_back(ImGuiTabItem());
7752 tab = &tab_bar->Tabs.back();
7753 tab->ID = id;
7754 tab->Width = size.x;
7755 tab_bar->TabsAddedNew = true;
7756 tab_is_new = true;
7757 }
7758 tab_bar->LastTabItemIdx = (ImS16)tab_bar->Tabs.index_from_ptr(tab);
7759 tab->ContentWidth = size.x;
7760 tab->BeginOrder = tab_bar->TabsActiveCount++;
7761
7762 const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount);
7763 const bool tab_bar_focused = (tab_bar->Flags & ImGuiTabBarFlags_IsFocused) != 0;
7764 const bool tab_appearing = (tab->LastFrameVisible + 1 < g.FrameCount);
7765 const bool is_tab_button = (flags & ImGuiTabItemFlags_Button) != 0;
7767 tab->Flags = flags;
7768
7769 // Append name with zero-terminator
7770 tab->NameOffset = (ImS16)tab_bar->TabsNames.size();
7771 tab_bar->TabsNames.append(label, label + strlen(label) + 1);
7772
7773 // Update selected tab
7774 if (tab_appearing && (tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs) && tab_bar->NextSelectedTabId == 0)
7775 if (!tab_bar_appearing || tab_bar->SelectedTabId == 0)
7776 if (!is_tab_button)
7777 tab_bar->NextSelectedTabId = id; // New tabs gets activated
7778 if ((flags & ImGuiTabItemFlags_SetSelected) && (tab_bar->SelectedTabId != id)) // SetSelected can only be passed on explicit tab bar
7779 if (!is_tab_button)
7780 tab_bar->NextSelectedTabId = id;
7781
7782 // Lock visibility
7783 // (Note: tab_contents_visible != tab_selected... because CTRL+TAB operations may preview some tabs without selecting them!)
7784 bool tab_contents_visible = (tab_bar->VisibleTabId == id);
7785 if (tab_contents_visible)
7786 tab_bar->VisibleTabWasSubmitted = true;
7787
7788 // On the very first frame of a tab bar we let first tab contents be visible to minimize appearing glitches
7789 if (!tab_contents_visible && tab_bar->SelectedTabId == 0 && tab_bar_appearing)
7790 if (tab_bar->Tabs.Size == 1 && !(tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs))
7791 tab_contents_visible = true;
7792
7793 // Note that tab_is_new is not necessarily the same as tab_appearing! When a tab bar stops being submitted
7794 // and then gets submitted again, the tabs will have 'tab_appearing=true' but 'tab_is_new=false'.
7795 if (tab_appearing && (!tab_bar_appearing || tab_is_new))
7796 {
7798 ItemAdd(ImRect(), id);
7799 PopItemFlag();
7800 if (is_tab_button)
7801 return false;
7802 return tab_contents_visible;
7803 }
7804
7805 if (tab_bar->SelectedTabId == id)
7807
7808 // Backup current layout position
7809 const ImVec2 backup_main_cursor_pos = window->DC.CursorPos;
7810
7811 // Layout
7812 const bool is_central_section = (tab->Flags & ImGuiTabItemFlags_SectionMask_) == 0;
7813 size.x = tab->Width;
7814 if (is_central_section)
7815 window->DC.CursorPos = tab_bar->BarRect.Min + ImVec2(IM_FLOOR(tab->Offset - tab_bar->ScrollingAnim), 0.0f);
7816 else
7817 window->DC.CursorPos = tab_bar->BarRect.Min + ImVec2(tab->Offset, 0.0f);
7818 ImVec2 pos = window->DC.CursorPos;
7819 ImRect bb(pos, pos + size);
7820
7821 // We don't have CPU clipping primitives to clip the CloseButton (until it becomes a texture), so need to add an extra draw call (temporary in the case of vertical animation)
7822 const bool want_clip_rect = is_central_section && (bb.Min.x < tab_bar->ScrollingRectMinX || bb.Max.x > tab_bar->ScrollingRectMaxX);
7823 if (want_clip_rect)
7824 PushClipRect(ImVec2(ImMax(bb.Min.x, tab_bar->ScrollingRectMinX), bb.Min.y - 1), ImVec2(tab_bar->ScrollingRectMaxX, bb.Max.y), true);
7825
7826 ImVec2 backup_cursor_max_pos = window->DC.CursorMaxPos;
7827 ItemSize(bb.GetSize(), style.FramePadding.y);
7828 window->DC.CursorMaxPos = backup_cursor_max_pos;
7829
7830 if (!ItemAdd(bb, id))
7831 {
7832 if (want_clip_rect)
7833 PopClipRect();
7834 window->DC.CursorPos = backup_main_cursor_pos;
7835 return tab_contents_visible;
7836 }
7837
7838 // Click to Select a tab
7840 if (g.DragDropActive)
7842 bool hovered, held;
7843 bool pressed = ButtonBehavior(bb, id, &hovered, &held, button_flags);
7844 if (pressed && !is_tab_button)
7845 tab_bar->NextSelectedTabId = id;
7846 hovered |= (g.HoveredId == id);
7847
7848 // Allow the close button to overlap unless we are dragging (in which case we don't want any overlapping tabs to be hovered)
7849 if (g.ActiveId != id)
7851
7852 // Drag and drop: re-order tabs
7853 if (held && !tab_appearing && IsMouseDragging(0))
7854 {
7855 if (!g.DragDropActive && (tab_bar->Flags & ImGuiTabBarFlags_Reorderable))
7856 {
7857 // While moving a tab it will jump on the other side of the mouse, so we also test for MouseDelta.x
7858 if (g.IO.MouseDelta.x < 0.0f && g.IO.MousePos.x < bb.Min.x)
7859 {
7861 }
7862 else if (g.IO.MouseDelta.x > 0.0f && g.IO.MousePos.x > bb.Max.x)
7863 {
7865 }
7866 }
7867 }
7868
7869#if 0
7870 if (hovered && g.HoveredIdNotActiveTimer > TOOLTIP_DELAY && bb.GetWidth() < tab->ContentWidth)
7871 {
7872 // Enlarge tab display when hovering
7873 bb.Max.x = bb.Min.x + IM_FLOOR(ImLerp(bb.GetWidth(), tab->ContentWidth, ImSaturate((g.HoveredIdNotActiveTimer - 0.40f) * 6.0f)));
7874 display_draw_list = GetForegroundDrawList(window);
7875 TabItemBackground(display_draw_list, bb, flags, GetColorU32(ImGuiCol_TitleBgActive));
7876 }
7877#endif
7878
7879 // Render tab shape
7880 ImDrawList* display_draw_list = window->DrawList;
7881 const ImU32 tab_col = GetColorU32((held || hovered) ? ImGuiCol_TabHovered : tab_contents_visible ? (tab_bar_focused ? ImGuiCol_TabActive : ImGuiCol_TabUnfocusedActive) : (tab_bar_focused ? ImGuiCol_Tab : ImGuiCol_TabUnfocused));
7882 TabItemBackground(display_draw_list, bb, flags, tab_col);
7883 RenderNavHighlight(bb, id);
7884
7885 // Select with right mouse button. This is so the common idiom for context menu automatically highlight the current widget.
7886 const bool hovered_unblocked = IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup);
7887 if (hovered_unblocked && (IsMouseClicked(1) || IsMouseReleased(1)))
7888 if (!is_tab_button)
7889 tab_bar->NextSelectedTabId = id;
7890
7893
7894 // Render tab label, process close button
7895 const ImGuiID close_button_id = p_open ? GetIDWithSeed("#CLOSE", NULL, id) : 0;
7896 bool just_closed;
7897 bool text_clipped;
7898 TabItemLabelAndCloseButton(display_draw_list, bb, flags, tab_bar->FramePadding, label, id, close_button_id, tab_contents_visible, &just_closed, &text_clipped);
7899 if (just_closed && p_open != NULL)
7900 {
7901 *p_open = false;
7902 TabBarCloseTab(tab_bar, tab);
7903 }
7904
7905 // Restore main window position so user can draw there
7906 if (want_clip_rect)
7907 PopClipRect();
7908 window->DC.CursorPos = backup_main_cursor_pos;
7909
7910 // Tooltip (FIXME: Won't work over the close button because ItemOverlap systems messes up with HoveredIdTimer)
7911 // We test IsItemHovered() to discard e.g. when another item is active or drag and drop over the tab bar (which g.HoveredId ignores)
7912 if (text_clipped && g.HoveredId == id && !held && g.HoveredIdNotActiveTimer > g.TooltipSlowDelay && IsItemHovered())
7914 SetTooltip("%.*s", (int)(FindRenderedTextEnd(label) - label), label);
7915
7916 IM_ASSERT(!is_tab_button || !(tab_bar->SelectedTabId == tab->ID && is_tab_button)); // TabItemButton should not be selected
7917 if (is_tab_button)
7918 return pressed;
7919 return tab_contents_visible;
7920}
@ ImGuiTabBarFlags_NoCloseWithMiddleMouseButton
Definition imgui.h:1060
@ ImGuiTabBarFlags_NoTooltip
Definition imgui.h:1062
@ ImGuiTabBarFlags_AutoSelectNewTabs
Definition imgui.h:1058
@ ImGuiTabItemFlags_Trailing
Definition imgui.h:1080
@ ImGuiTabItemFlags_Leading
Definition imgui.h:1079
@ ImGuiTabItemFlags_SetSelected
Definition imgui.h:1074
@ ImGuiTabItemFlags_NoTooltip
Definition imgui.h:1077
@ ImGuiTabItemFlags_NoCloseWithMiddleMouseButton
Definition imgui.h:1075
static void TabBarLayout(ImGuiTabBar *tab_bar)
Definition imgui_widgets.cpp:7129
IMGUI_API void TabItemBackground(ImDrawList *draw_list, const ImRect &bb, ImGuiTabItemFlags flags, ImU32 col)
Definition imgui_widgets.cpp:7950
IMGUI_API void TabItemLabelAndCloseButton(ImDrawList *draw_list, const ImRect &bb, ImGuiTabItemFlags flags, ImVec2 frame_padding, const char *label, ImGuiID tab_id, ImGuiID close_button_id, bool is_contents_visible, bool *out_just_closed, bool *out_text_clipped)
Definition imgui_widgets.cpp:7977
IMGUI_API void TabBarCloseTab(ImGuiTabBar *tab_bar, ImGuiTabItem *tab)
Definition imgui_widgets.cpp:7400
IMGUI_API void TabBarQueueReorderFromMousePos(ImGuiTabBar *tab_bar, const ImGuiTabItem *tab, ImVec2 mouse_pos)
Definition imgui_widgets.cpp:7471
float TooltipSlowDelay
Definition imgui_internal.h:1549
ImS16 NameOffset
Definition imgui_internal.h:1962
ImS16 BeginOrder
Definition imgui_internal.h:1963
IMGUI_API void append(const char *str, const char *str_end=NULL)
Definition imgui.cpp:2137

References ImGuiContext::ActiveId, ImGuiTextBuffer::append(), ImVector< T >::back(), ImGuiTabBar::BarRect, ImGuiTabItem::BeginOrder, ButtonBehavior(), ImGuiTabItem::ContentWidth, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiContext::DragDropActive, ImGuiWindow::DrawList, FindRenderedTextEnd(), ImGuiTabItem::Flags, ImGuiTabBar::Flags, ImGuiContext::FrameCount, ImGuiTabBar::FramePadding, GetColorU32(), GetForegroundDrawList(), GetIDWithSeed(), ImRect::GetSize(), ImRect::GetWidth(), GImGui, ImGuiContext::HoveredId, ImGuiContext::HoveredIdNotActiveTimer, ImGuiTabItem::ID, IM_ASSERT, IM_FLOOR, IMGUI_TEST_ENGINE_ITEM_INFO, ImGuiButtonFlags_AllowItemOverlap, ImGuiButtonFlags_PressedOnClick, ImGuiButtonFlags_PressedOnClickRelease, ImGuiButtonFlags_PressedOnDragDropHold, ImGuiCol_Tab, ImGuiCol_TabActive, ImGuiCol_TabHovered, ImGuiCol_TabUnfocused, ImGuiCol_TabUnfocusedActive, ImGuiCol_TitleBgActive, ImGuiHoveredFlags_AllowWhenBlockedByPopup, ImGuiItemFlags_NoNav, ImGuiItemFlags_NoNavDefaultFocus, ImGuiTabBarFlags_AutoSelectNewTabs, ImGuiTabBarFlags_IsFocused, ImGuiTabBarFlags_NoCloseWithMiddleMouseButton, ImGuiTabBarFlags_NoTooltip, ImGuiTabBarFlags_Reorderable, ImGuiTabItemFlags_Button, ImGuiTabItemFlags_Leading, ImGuiTabItemFlags_NoCloseButton, ImGuiTabItemFlags_NoCloseWithMiddleMouseButton, ImGuiTabItemFlags_NoTooltip, ImGuiTabItemFlags_SectionMask_, ImGuiTabItemFlags_SetSelected, ImGuiTabItemFlags_Trailing, ImLerp(), ImMax(), ImSaturate(), ImVector< T >::index_from_ptr(), ImGuiContext::IO, IsItemHovered(), IsMouseClicked(), IsMouseDragging(), IsMouseReleased(), ItemAdd(), ItemSize(), ImGuiTabItem::LastFrameSelected, ImGuiTabItem::LastFrameVisible, ImGuiWindowTempData::LastItemStatusFlags, ImGuiTabBar::LastTabItemIdx, ImRect::Max, ImRect::Min, ImGuiIO::MouseDelta, ImGuiIO::MousePos, ImGuiTabItem::NameOffset, ImGuiTabBar::NextSelectedTabId, ImGuiTabItem::Offset, PopClipRect(), PopItemFlag(), ImGuiTabBar::PrevFrameVisible, ImVector< T >::push_back(), PushClipRect(), PushItemFlag(), RenderNavHighlight(), ImGuiTabBar::ScrollingAnim, ImGuiTabBar::ScrollingRectMaxX, ImGuiTabBar::ScrollingRectMinX, ImGuiTabBar::SelectedTabId, SetItemAllowOverlap(), SetTooltip(), ImVector< T >::Size, ImGuiTextBuffer::size(), ImGuiWindow::SkipItems, ImGuiContext::Style, style, TabBarCalcTabID(), TabBarCloseTab(), TabBarFindTabByID(), TabBarLayout(), TabBarQueueReorderFromMousePos(), TabItemBackground(), TabItemCalcSize(), TabItemLabelAndCloseButton(), ImGuiTabBar::Tabs, ImGuiTabBar::TabsActiveCount, ImGuiTabBar::TabsAddedNew, ImGuiTabBar::TabsNames, ImGuiContext::TooltipSlowDelay, ImGuiTabBar::VisibleTabId, ImGuiTabBar::VisibleTabWasSubmitted, ImGuiTabBar::WantLayout, ImGuiTabItem::Width, ImVec2::x, and ImVec2::y.

Referenced by BeginTabItem(), and TabItemButton().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TabItemLabelAndCloseButton()

void ImGui::TabItemLabelAndCloseButton ( ImDrawList draw_list,
const ImRect bb,
ImGuiTabItemFlags  flags,
ImVec2  frame_padding,
const char *  label,
ImGuiID  tab_id,
ImGuiID  close_button_id,
bool  is_contents_visible,
bool *  out_just_closed,
bool *  out_text_clipped 
)
7978{
7979 ImGuiContext& g = *GImGui;
7980 ImVec2 label_size = CalcTextSize(label, NULL, true);
7981
7982 if (out_just_closed)
7983 *out_just_closed = false;
7984 if (out_text_clipped)
7985 *out_text_clipped = false;
7986
7987 if (bb.GetWidth() <= 1.0f)
7988 return;
7989
7990 // In Style V2 we'll have full override of all colors per state (e.g. focused, selected)
7991 // But right now if you want to alter text color of tabs this is what you need to do.
7992#if 0
7993 const float backup_alpha = g.Style.Alpha;
7994 if (!is_contents_visible)
7995 g.Style.Alpha *= 0.7f;
7996#endif
7997
7998 // Render text label (with clipping + alpha gradient) + unsaved marker
7999 const char* TAB_UNSAVED_MARKER = "*";
8000 ImRect text_pixel_clip_bb(bb.Min.x + frame_padding.x, bb.Min.y + frame_padding.y, bb.Max.x - frame_padding.x, bb.Max.y);
8002 {
8003 text_pixel_clip_bb.Max.x -= CalcTextSize(TAB_UNSAVED_MARKER, NULL, false).x;
8004 ImVec2 unsaved_marker_pos(ImMin(bb.Min.x + frame_padding.x + label_size.x + 2, text_pixel_clip_bb.Max.x), bb.Min.y + frame_padding.y + IM_FLOOR(-g.FontSize * 0.25f));
8005 RenderTextClippedEx(draw_list, unsaved_marker_pos, bb.Max - frame_padding, TAB_UNSAVED_MARKER, NULL, NULL);
8006 }
8007 ImRect text_ellipsis_clip_bb = text_pixel_clip_bb;
8008
8009 // Return clipped state ignoring the close button
8010 if (out_text_clipped)
8011 {
8012 *out_text_clipped = (text_ellipsis_clip_bb.Min.x + label_size.x) > text_pixel_clip_bb.Max.x;
8013 //draw_list->AddCircle(text_ellipsis_clip_bb.Min, 3.0f, *out_text_clipped ? IM_COL32(255, 0, 0, 255) : IM_COL32(0, 255, 0, 255));
8014 }
8015
8016 // Close Button
8017 // We are relying on a subtle and confusing distinction between 'hovered' and 'g.HoveredId' which happens because we are using ImGuiButtonFlags_AllowOverlapMode + SetItemAllowOverlap()
8018 // 'hovered' will be true when hovering the Tab but NOT when hovering the close button
8019 // 'g.HoveredId==id' will be true when hovering the Tab including when hovering the close button
8020 // 'g.ActiveId==close_button_id' will be true when we are holding on the close button, in which case both hovered booleans are false
8021 bool close_button_pressed = false;
8022 bool close_button_visible = false;
8023 if (close_button_id != 0)
8024 if (is_contents_visible || bb.GetWidth() >= g.Style.TabMinWidthForCloseButton)
8025 if (g.HoveredId == tab_id || g.HoveredId == close_button_id || g.ActiveId == tab_id || g.ActiveId == close_button_id)
8026 close_button_visible = true;
8027 if (close_button_visible)
8028 {
8029 ImGuiLastItemDataBackup last_item_backup;
8030 const float close_button_sz = g.FontSize;
8032 if (CloseButton(close_button_id, ImVec2(bb.Max.x - frame_padding.x * 2.0f - close_button_sz, bb.Min.y)))
8033 close_button_pressed = true;
8034 PopStyleVar();
8035 last_item_backup.Restore();
8036
8037 // Close with middle mouse button
8039 close_button_pressed = true;
8040
8041 text_pixel_clip_bb.Max.x -= close_button_sz;
8042 }
8043
8044 // FIXME: if FramePadding is noticeably large, ellipsis_max_x will be wrong here (e.g. #3497), maybe for consistency that parameter of RenderTextEllipsis() shouldn't exist..
8045 float ellipsis_max_x = close_button_visible ? text_pixel_clip_bb.Max.x : bb.Max.x - 1.0f;
8046 RenderTextEllipsis(draw_list, text_ellipsis_clip_bb.Min, text_ellipsis_clip_bb.Max, text_pixel_clip_bb.Max.x, ellipsis_max_x, label, NULL, &label_size);
8047
8048#if 0
8049 if (!is_contents_visible)
8050 g.Style.Alpha = backup_alpha;
8051#endif
8052
8053 if (out_just_closed)
8054 *out_just_closed = close_button_pressed;
8055}
@ ImGuiStyleVar_FramePadding
Definition imgui.h:1489
IMGUI_API void RenderTextEllipsis(ImDrawList *draw_list, const ImVec2 &pos_min, const ImVec2 &pos_max, float clip_max_x, float ellipsis_max_x, const char *text, const char *text_end, const ImVec2 *text_size_if_known)
Definition imgui.cpp:2756
float TabMinWidthForCloseButton
Definition imgui.h:1749

References ImGuiContext::ActiveId, ImGuiStyle::Alpha, CalcTextSize(), CloseButton(), ImGuiContext::FontSize, ImRect::GetWidth(), GImGui, ImGuiContext::HoveredId, IM_FLOOR, ImGuiStyleVar_FramePadding, ImGuiTabItemFlags_NoCloseWithMiddleMouseButton, ImGuiTabItemFlags_UnsavedDocument, ImMin(), IsMouseClicked(), ImRect::Max, ImRect::Min, PopStyleVar(), PushStyleVar(), RenderTextClippedEx(), RenderTextEllipsis(), ImGuiLastItemDataBackup::Restore(), ImGuiContext::Style, ImGuiStyle::TabMinWidthForCloseButton, ImVec2::x, and ImVec2::y.

Referenced by TabItemEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableBeginApplyRequests()

void ImGui::TableBeginApplyRequests ( ImGuiTable table)
593{
594 // Handle resizing request
595 // (We process this at the first TableBegin of the frame)
596 // FIXME-TABLE: Contains columns if our work area doesn't allow for scrolling?
597 if (table->InstanceCurrent == 0)
598 {
599 if (table->ResizedColumn != -1 && table->ResizedColumnNextWidth != FLT_MAX)
601 table->LastResizedColumn = table->ResizedColumn;
602 table->ResizedColumnNextWidth = FLT_MAX;
603 table->ResizedColumn = -1;
604
605 // Process auto-fit for single column, which is a special case for stretch columns and fixed columns with FixedSame policy.
606 // FIXME-TABLE: Would be nice to redistribute available stretch space accordingly to other weights, instead of giving it all to siblings.
607 if (table->AutoFitSingleColumn != -1)
608 {
609 TableSetColumnWidth(table->AutoFitSingleColumn, table->Columns[table->AutoFitSingleColumn].WidthAuto);
610 table->AutoFitSingleColumn = -1;
611 }
612 }
613
614 // Handle reordering request
615 // Note: we don't clear ReorderColumn after handling the request.
616 if (table->InstanceCurrent == 0)
617 {
618 if (table->HeldHeaderColumn == -1 && table->ReorderColumn != -1)
619 table->ReorderColumn = -1;
620 table->HeldHeaderColumn = -1;
621 if (table->ReorderColumn != -1 && table->ReorderColumnDir != 0)
622 {
623 // We need to handle reordering across hidden columns.
624 // In the configuration below, moving C to the right of E will lead to:
625 // ... C [D] E ---> ... [D] E C (Column name/index)
626 // ... 2 3 4 ... 2 3 4 (Display order)
627 const int reorder_dir = table->ReorderColumnDir;
628 IM_ASSERT(reorder_dir == -1 || reorder_dir == +1);
630 ImGuiTableColumn* src_column = &table->Columns[table->ReorderColumn];
631 ImGuiTableColumn* dst_column = &table->Columns[(reorder_dir == -1) ? src_column->PrevEnabledColumn : src_column->NextEnabledColumn];
632 IM_UNUSED(dst_column);
633 const int src_order = src_column->DisplayOrder;
634 const int dst_order = dst_column->DisplayOrder;
635 src_column->DisplayOrder = (ImGuiTableColumnIdx)dst_order;
636 for (int order_n = src_order + reorder_dir; order_n != dst_order + reorder_dir; order_n += reorder_dir)
637 table->Columns[table->DisplayOrderToIndex[order_n]].DisplayOrder -= (ImGuiTableColumnIdx)reorder_dir;
638 IM_ASSERT(dst_column->DisplayOrder == dst_order - reorder_dir);
639
640 // Display order is stored in both columns->IndexDisplayOrder and table->DisplayOrder[],
641 // rebuild the later from the former.
642 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
643 table->DisplayOrderToIndex[table->Columns[column_n].DisplayOrder] = (ImGuiTableColumnIdx)column_n;
644 table->ReorderColumnDir = 0;
645 table->IsSettingsDirty = true;
646 }
647 }
648
649 // Handle display order reset request
651 {
652 for (int n = 0; n < table->ColumnsCount; n++)
653 table->DisplayOrderToIndex[n] = table->Columns[n].DisplayOrder = (ImGuiTableColumnIdx)n;
654 table->IsResetDisplayOrderRequest = false;
655 table->IsSettingsDirty = true;
656 }
657}
IMGUI_API void TableSetColumnWidth(int column_n, float width)
Definition imgui_tables.cpp:2056
ImGuiTableColumnIdx PrevEnabledColumn
Definition imgui_internal.h:2052
ImGuiTableColumnIdx ReorderColumnDir
Definition imgui_internal.h:2169

References ImGuiTable::AutoFitSingleColumn, ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTableColumn::DisplayOrder, ImGuiTable::DisplayOrderToIndex, ImGuiTable::Flags, ImGuiTable::HeldHeaderColumn, IM_ASSERT, IM_UNUSED, ImGuiTableFlags_Reorderable, ImGuiTable::InstanceCurrent, ImGuiTable::IsResetDisplayOrderRequest, ImGuiTable::IsSettingsDirty, ImGuiTable::LastResizedColumn, ImGuiTableColumn::NextEnabledColumn, ImGuiTableColumn::PrevEnabledColumn, ImGuiTable::ReorderColumn, ImGuiTable::ReorderColumnDir, ImGuiTable::ResizedColumn, ImGuiTable::ResizedColumnNextWidth, and TableSetColumnWidth().

Referenced by BeginTableEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableBeginCell()

void ImGui::TableBeginCell ( ImGuiTable table,
int  column_n 
)
1920{
1921 ImGuiTableColumn* column = &table->Columns[column_n];
1922 ImGuiWindow* window = table->InnerWindow;
1923 table->CurrentColumn = column_n;
1924
1925 // Start position is roughly ~~ CellRect.Min + CellPadding + Indent
1926 float start_x = column->WorkMinX;
1928 start_x += table->RowIndentOffsetX; // ~~ += window.DC.Indent.x - table->HostIndentX, except we locked it for the row.
1929
1930 window->DC.CursorPos.x = start_x;
1931 window->DC.CursorPos.y = table->RowPosY1 + table->CellPaddingY;
1932 window->DC.CursorMaxPos.x = window->DC.CursorPos.x;
1933 window->DC.ColumnsOffset.x = start_x - window->Pos.x - window->DC.Indent.x; // FIXME-WORKRECT
1934 window->DC.CurrLineTextBaseOffset = table->RowTextBaseline;
1936
1937 window->WorkRect.Min.y = window->DC.CursorPos.y;
1938 window->WorkRect.Min.x = column->WorkMinX;
1939 window->WorkRect.Max.x = column->WorkMaxX;
1940 window->DC.ItemWidth = column->ItemWidth;
1941
1942 // To allow ImGuiListClipper to function we propagate our row height
1943 if (!column->IsEnabled)
1944 window->DC.CursorPos.y = ImMax(window->DC.CursorPos.y, table->RowPosY2);
1945
1946 window->SkipItems = column->IsSkipItems;
1947 if (column->IsSkipItems)
1948 {
1949 window->DC.LastItemId = 0;
1950 window->DC.LastItemStatusFlags = 0;
1951 }
1952
1953 if (table->Flags & ImGuiTableFlags_NoClip)
1954 {
1955 // FIXME: if we end up drawing all borders/bg in EndTable, could remove this and just assert that channel hasn't changed.
1957 //IM_ASSERT(table->DrawSplitter._Current == TABLE_DRAW_CHANNEL_NOCLIP);
1958 }
1959 else
1960 {
1961 // FIXME-TABLE: Could avoid this if draw channel is dummy channel?
1964 }
1965
1966 // Logging
1967 ImGuiContext& g = *GImGui;
1968 if (g.LogEnabled && !column->IsSkipItems)
1969 {
1970 LogRenderedText(&window->DC.CursorPos, "|");
1971 g.LogLinePosY = FLT_MAX;
1972 }
1973}
@ ImGuiTableColumnFlags_IndentEnable
Definition imgui.h:1181
static const int TABLE_DRAW_CHANNEL_NOCLIP
Definition imgui_tables.cpp:258
ImS8 NavLayerCurrent
Definition imgui_internal.h:2065
float WorkMaxX
Definition imgui_internal.h:2043
bool IsSkipItems
Definition imgui_internal.h:2063
ImRect ClipRect
Definition imgui_internal.h:2040
float WorkMinX
Definition imgui_internal.h:2042
ImGuiTableDrawChannelIdx DrawChannelCurrent
Definition imgui_internal.h:2055
float ItemWidth
Definition imgui_internal.h:2044
float RowIndentOffsetX
Definition imgui_internal.h:2120

References ImGuiTable::CellPaddingY, ImGuiTableColumn::ClipRect, ImGuiTable::Columns, ImGuiWindowTempData::ColumnsOffset, ImGuiTable::CurrentColumn, ImGuiWindowTempData::CurrLineTextBaseOffset, ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiTableColumn::DrawChannelCurrent, ImGuiWindow::DrawList, ImGuiTable::DrawSplitter, ImGuiTableColumn::Flags, ImGuiTable::Flags, GImGui, ImGuiTableColumnFlags_IndentEnable, ImGuiTableFlags_NoClip, ImMax(), ImGuiWindowTempData::Indent, ImGuiTable::InnerWindow, ImGuiTableColumn::IsEnabled, ImGuiTableColumn::IsSkipItems, ImGuiWindowTempData::ItemWidth, ImGuiTableColumn::ItemWidth, ImGuiWindowTempData::LastItemId, ImGuiWindowTempData::LastItemStatusFlags, ImGuiContext::LogEnabled, ImGuiContext::LogLinePosY, LogRenderedText(), ImRect::Max, ImRect::Min, ImGuiWindowTempData::NavLayerCurrent, ImGuiTableColumn::NavLayerCurrent, ImGuiWindow::Pos, ImGuiTable::RowIndentOffsetX, ImGuiTable::RowPosY1, ImGuiTable::RowPosY2, ImGuiTable::RowTextBaseline, ImDrawListSplitter::SetCurrentChannel(), SetWindowClipRectBeforeSetChannel(), ImGuiWindow::SkipItems, TABLE_DRAW_CHANNEL_NOCLIP, ImGuiTableColumn::WorkMaxX, ImGuiTableColumn::WorkMinX, ImGuiWindow::WorkRect, ImVec2::x, ImVec1::x, and ImVec2::y.

Referenced by TableNextColumn(), and TableSetColumnIndex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableBeginInitMemory()

void ImGui::TableBeginInitMemory ( ImGuiTable table,
int  columns_count 
)
577{
578 // Allocate single buffer for our arrays
579 ImSpanAllocator<3> span_allocator;
580 span_allocator.Reserve(0, columns_count * sizeof(ImGuiTableColumn));
581 span_allocator.Reserve(1, columns_count * sizeof(ImGuiTableColumnIdx));
582 span_allocator.Reserve(2, columns_count * sizeof(ImGuiTableCellData), 4);
583 table->RawData = IM_ALLOC(span_allocator.GetArenaSizeInBytes());
584 memset(table->RawData, 0, span_allocator.GetArenaSizeInBytes());
585 span_allocator.SetArenaBasePtr(table->RawData);
586 span_allocator.GetSpan(0, &table->Columns);
587 span_allocator.GetSpan(1, &table->DisplayOrderToIndex);
588 span_allocator.GetSpan(2, &table->RowCellData);
589}
Definition imgui_internal.h:2089
ImSpan< ImGuiTableCellData > RowCellData
Definition imgui_internal.h:2103
Definition imgui_internal.h:585
void GetSpan(int n, ImSpan< T > *span)
Definition imgui_internal.h:599
int GetArenaSizeInBytes()
Definition imgui_internal.h:594
void Reserve(int n, size_t sz, int a=4)
Definition imgui_internal.h:593
void SetArenaBasePtr(void *base_ptr)
Definition imgui_internal.h:595

References ImGuiTable::Columns, ImGuiTable::DisplayOrderToIndex, ImSpanAllocator< CHUNKS >::GetArenaSizeInBytes(), ImSpanAllocator< CHUNKS >::GetSpan(), IM_ALLOC, ImGuiTable::RawData, ImSpanAllocator< CHUNKS >::Reserve(), ImGuiTable::RowCellData, and ImSpanAllocator< CHUNKS >::SetArenaBasePtr().

Referenced by BeginTableEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableBeginRow()

void ImGui::TableBeginRow ( ImGuiTable table)
1683{
1684 ImGuiWindow* window = table->InnerWindow;
1685 IM_ASSERT(!table->IsInsideRow);
1686
1687 // New row
1688 table->CurrentRow++;
1689 table->CurrentColumn = -1;
1690 table->RowBgColor[0] = table->RowBgColor[1] = IM_COL32_DISABLE;
1691 table->RowCellDataCurrent = -1;
1692 table->IsInsideRow = true;
1693
1694 // Begin frozen rows
1695 float next_y1 = table->RowPosY2;
1696 if (table->CurrentRow == 0 && table->FreezeRowsCount > 0)
1697 next_y1 = window->DC.CursorPos.y = table->OuterRect.Min.y;
1698
1699 table->RowPosY1 = table->RowPosY2 = next_y1;
1700 table->RowTextBaseline = 0.0f;
1701 table->RowIndentOffsetX = window->DC.Indent.x - table->HostIndentX; // Lock indent
1702 window->DC.PrevLineTextBaseOffset = 0.0f;
1703 window->DC.CursorMaxPos.y = next_y1;
1704
1705 // Making the header BG color non-transparent will allow us to overlay it multiple times when handling smooth dragging.
1707 {
1709 if (table->CurrentRow == 0)
1710 table->IsUsingHeaders = true;
1711 }
1712}
@ ImGuiTableBgTarget_RowBg0
Definition imgui.h:1221
@ ImGuiTableRowFlags_Headers
Definition imgui.h:1206
#define IM_COL32_DISABLE
Definition imgui_internal.h:2018
IMGUI_API void TableSetBgColor(ImGuiTableBgTarget target, ImU32 color, int column_n=-1)
Definition imgui_tables.cpp:1595
ImU32 RowBgColor[2]
Definition imgui_internal.h:2124
ImGuiTableColumnIdx RowCellDataCurrent
Definition imgui_internal.h:2179
bool IsUsingHeaders
Definition imgui_internal.h:2187
ImGuiTableRowFlags RowFlags
Definition imgui_internal.h:2121

References ImGuiTable::CurrentColumn, ImGuiTable::CurrentRow, ImGuiWindowTempData::CursorMaxPos, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiTable::FreezeRowsCount, GetColorU32(), ImGuiTable::HostIndentX, IM_ASSERT, IM_COL32_DISABLE, ImGuiCol_TableHeaderBg, ImGuiTableBgTarget_RowBg0, ImGuiTableRowFlags_Headers, ImGuiWindowTempData::Indent, ImGuiTable::InnerWindow, ImGuiTable::IsInsideRow, ImGuiTable::IsUsingHeaders, ImRect::Min, ImGuiTable::OuterRect, ImGuiWindowTempData::PrevLineTextBaseOffset, ImGuiTable::RowBgColor, ImGuiTable::RowCellDataCurrent, ImGuiTable::RowFlags, ImGuiTable::RowIndentOffsetX, ImGuiTable::RowPosY1, ImGuiTable::RowPosY2, ImGuiTable::RowTextBaseline, TableSetBgColor(), ImVec1::x, and ImVec2::y.

Referenced by TableNextRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableDrawBorders()

void ImGui::TableDrawBorders ( ImGuiTable table)
2478{
2479 ImGuiWindow* inner_window = table->InnerWindow;
2480 if (!table->OuterWindow->ClipRect.Overlaps(table->OuterRect))
2481 return;
2482
2483 ImDrawList* inner_drawlist = inner_window->DrawList;
2484 table->DrawSplitter->SetCurrentChannel(inner_drawlist, TABLE_DRAW_CHANNEL_BG0);
2485 inner_drawlist->PushClipRect(table->Bg0ClipRectForDrawCmd.Min, table->Bg0ClipRectForDrawCmd.Max, false);
2486
2487 // Draw inner border and resizing feedback
2488 const float border_size = TABLE_BORDER_SIZE;
2489 const float draw_y1 = table->InnerRect.Min.y;
2490 const float draw_y2_body = table->InnerRect.Max.y;
2491 const float draw_y2_head = table->IsUsingHeaders ? ImMin(table->InnerRect.Max.y, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table->LastFirstRowHeight) : draw_y1;
2493 {
2494 for (int order_n = 0; order_n < table->ColumnsCount; order_n++)
2495 {
2496 if (!(table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n)))
2497 continue;
2498
2499 const int column_n = table->DisplayOrderToIndex[order_n];
2500 ImGuiTableColumn* column = &table->Columns[column_n];
2501 const bool is_hovered = (table->HoveredColumnBorder == column_n);
2502 const bool is_resized = (table->ResizedColumn == column_n) && (table->InstanceInteracted == table->InstanceCurrent);
2503 const bool is_resizable = (column->Flags & (ImGuiTableColumnFlags_NoResize | ImGuiTableColumnFlags_NoDirectResize_)) == 0;
2504 const bool is_frozen_separator = (table->FreezeColumnsCount != -1 && table->FreezeColumnsCount == order_n + 1);
2505 if (column->MaxX > table->InnerClipRect.Max.x && !is_resized)
2506 continue;
2507
2508 // Decide whether right-most column is visible
2509 if (column->NextEnabledColumn == -1 && !is_resizable)
2511 continue;
2512 if (column->MaxX <= column->ClipRect.Min.x) // FIXME-TABLE FIXME-STYLE: Assume BorderSize==1, this is problematic if we want to increase the border size..
2513 continue;
2514
2515 // Draw in outer window so right-most column won't be clipped
2516 // Always draw full height border when being resized/hovered, or on the delimitation of frozen column scrolling.
2517 ImU32 col;
2518 float draw_y2;
2519 if (is_hovered || is_resized || is_frozen_separator)
2520 {
2521 draw_y2 = draw_y2_body;
2522 col = is_resized ? GetColorU32(ImGuiCol_SeparatorActive) : is_hovered ? GetColorU32(ImGuiCol_SeparatorHovered) : table->BorderColorStrong;
2523 }
2524 else
2525 {
2526 draw_y2 = (table->Flags & (ImGuiTableFlags_NoBordersInBody | ImGuiTableFlags_NoBordersInBodyUntilResize)) ? draw_y2_head : draw_y2_body;
2528 }
2529
2530 if (draw_y2 > draw_y1)
2531 inner_drawlist->AddLine(ImVec2(column->MaxX, draw_y1), ImVec2(column->MaxX, draw_y2), col, border_size);
2532 }
2533 }
2534
2535 // Draw outer border
2536 // FIXME: could use AddRect or explicit VLine/HLine helper?
2538 {
2539 // Display outer border offset by 1 which is a simple way to display it without adding an extra draw call
2540 // (Without the offset, in outer_window it would be rendered behind cells, because child windows are above their
2541 // parent. In inner_window, it won't reach out over scrollbars. Another weird solution would be to display part
2542 // of it in inner window, and the part that's over scrollbars in the outer window..)
2543 // Either solution currently won't allow us to use a larger border size: the border would clipped.
2544 const ImRect outer_border = table->OuterRect;
2545 const ImU32 outer_col = table->BorderColorStrong;
2547 {
2548 inner_drawlist->AddRect(outer_border.Min, outer_border.Max, outer_col, 0.0f, 0, border_size);
2549 }
2550 else if (table->Flags & ImGuiTableFlags_BordersOuterV)
2551 {
2552 inner_drawlist->AddLine(outer_border.Min, ImVec2(outer_border.Min.x, outer_border.Max.y), outer_col, border_size);
2553 inner_drawlist->AddLine(ImVec2(outer_border.Max.x, outer_border.Min.y), outer_border.Max, outer_col, border_size);
2554 }
2555 else if (table->Flags & ImGuiTableFlags_BordersOuterH)
2556 {
2557 inner_drawlist->AddLine(outer_border.Min, ImVec2(outer_border.Max.x, outer_border.Min.y), outer_col, border_size);
2558 inner_drawlist->AddLine(ImVec2(outer_border.Min.x, outer_border.Max.y), outer_border.Max, outer_col, border_size);
2559 }
2560 }
2561 if ((table->Flags & ImGuiTableFlags_BordersInnerH) && table->RowPosY2 < table->OuterRect.Max.y)
2562 {
2563 // Draw bottom-most row border
2564 const float border_y = table->RowPosY2;
2565 if (border_y >= table->BgClipRect.Min.y && border_y < table->BgClipRect.Max.y)
2566 inner_drawlist->AddLine(ImVec2(table->BorderX1, border_y), ImVec2(table->BorderX2, border_y), table->BorderColorLight, border_size);
2567 }
2568
2569 inner_drawlist->PopClipRect();
2570}
@ ImGuiTableColumnFlags_NoDirectResize_
Definition imgui.h:1194
@ ImGuiTableFlags_SizingFixedSame
Definition imgui.h:1131
@ ImGuiTableFlags_NoBordersInBodyUntilResize
Definition imgui.h:1128
@ ImGuiTableFlags_NoBordersInBody
Definition imgui.h:1127
@ ImGuiTableFlags_BordersInnerH
Definition imgui.h:1118
@ ImGuiTableFlags_BordersOuterH
Definition imgui.h:1119
@ ImGuiTableFlags_BordersOuter
Definition imgui.h:1125
static const int TABLE_DRAW_CHANNEL_BG0
Definition imgui_tables.cpp:256
ImGuiTableColumnIdx NextEnabledColumn
Definition imgui_internal.h:2053
float BorderX2
Definition imgui_internal.h:2128
ImRect Bg0ClipRectForDrawCmd
Definition imgui_internal.h:2149
ImU64 EnabledMaskByDisplayOrder
Definition imgui_internal.h:2104
float BorderX1
Definition imgui_internal.h:2127

References ImDrawList::AddLine(), ImDrawList::AddRect(), ImGuiTable::Bg0ClipRectForDrawCmd, ImGuiTable::BgClipRect, ImGuiTable::BorderColorLight, ImGuiTable::BorderColorStrong, ImGuiTable::BorderX1, ImGuiTable::BorderX2, ImGuiWindow::ClipRect, ImGuiTableColumn::ClipRect, col(), ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTable::DisplayOrderToIndex, ImGuiWindow::DrawList, ImGuiTable::DrawSplitter, ImGuiTable::EnabledMaskByDisplayOrder, ImGuiTableColumn::Flags, ImGuiTable::Flags, ImGuiTable::FreezeColumnsCount, ImGuiTable::FreezeRowsCount, GetColorU32(), ImGuiTable::HoveredColumnBorder, ImGuiCol_SeparatorActive, ImGuiCol_SeparatorHovered, ImGuiTableColumnFlags_NoDirectResize_, ImGuiTableColumnFlags_NoResize, ImGuiTableFlags_BordersInnerH, ImGuiTableFlags_BordersInnerV, ImGuiTableFlags_BordersOuter, ImGuiTableFlags_BordersOuterH, ImGuiTableFlags_BordersOuterV, ImGuiTableFlags_NoBordersInBody, ImGuiTableFlags_NoBordersInBodyUntilResize, ImGuiTableFlags_NoHostExtendX, ImGuiTableFlags_SizingFixedSame, ImGuiTableFlags_SizingMask_, ImMin(), ImGuiTable::InnerClipRect, ImGuiTable::InnerRect, ImGuiTable::InnerWindow, ImGuiTable::InstanceCurrent, ImGuiTable::InstanceInteracted, ImGuiTable::IsUsingHeaders, ImGuiTable::LastFirstRowHeight, ImRect::Max, ImGuiTableColumn::MaxX, ImRect::Min, ImGuiTableColumn::NextEnabledColumn, ImGuiTable::OuterRect, ImGuiTable::OuterWindow, ImRect::Overlaps(), ImDrawList::PopClipRect(), ImDrawList::PushClipRect(), ImGuiTable::ResizedColumn, ImGuiTable::RowPosY2, ImDrawListSplitter::SetCurrentChannel(), TABLE_BORDER_SIZE, TABLE_DRAW_CHANNEL_BG0, ImGuiTable::WorkRect, ImVec2::x, and ImVec2::y.

Referenced by EndTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableDrawContextMenu()

void ImGui::TableDrawContextMenu ( ImGuiTable table)
3006{
3007 ImGuiContext& g = *GImGui;
3008 ImGuiWindow* window = g.CurrentWindow;
3009 if (window->SkipItems)
3010 return;
3011
3012 bool want_separator = false;
3013 const int column_n = (table->ContextPopupColumn >= 0 && table->ContextPopupColumn < table->ColumnsCount) ? table->ContextPopupColumn : -1;
3014 ImGuiTableColumn* column = (column_n != -1) ? &table->Columns[column_n] : NULL;
3015
3016 // Sizing
3017 if (table->Flags & ImGuiTableFlags_Resizable)
3018 {
3019 if (column != NULL)
3020 {
3021 const bool can_resize = !(column->Flags & ImGuiTableColumnFlags_NoResize) && column->IsEnabled;
3022 if (MenuItem("Size column to fit###SizeOne", NULL, false, can_resize))
3023 TableSetColumnWidthAutoSingle(table, column_n);
3024 }
3025
3026 const char* size_all_desc;
3028 size_all_desc = "Size all columns to fit###SizeAll"; // All fixed
3029 else
3030 size_all_desc = "Size all columns to default###SizeAll"; // All stretch or mixed
3031 if (MenuItem(size_all_desc, NULL))
3032 TableSetColumnWidthAutoAll(table);
3033 want_separator = true;
3034 }
3035
3036 // Ordering
3038 {
3039 if (MenuItem("Reset order", NULL, false, !table->IsDefaultDisplayOrder))
3040 table->IsResetDisplayOrderRequest = true;
3041 want_separator = true;
3042 }
3043
3044 // Reset all (should work but seems unnecessary/noisy to expose?)
3045 //if (MenuItem("Reset all"))
3046 // table->IsResetAllRequest = true;
3047
3048 // Sorting
3049 // (modify TableOpenContextMenu() to add _Sortable flag if enabling this)
3050#if 0
3051 if ((table->Flags & ImGuiTableFlags_Sortable) && column != NULL && (column->Flags & ImGuiTableColumnFlags_NoSort) == 0)
3052 {
3053 if (want_separator)
3054 Separator();
3055 want_separator = true;
3056
3057 bool append_to_sort_specs = g.IO.KeyShift;
3058 if (MenuItem("Sort in Ascending Order", NULL, column->SortOrder != -1 && column->SortDirection == ImGuiSortDirection_Ascending, (column->Flags & ImGuiTableColumnFlags_NoSortAscending) == 0))
3059 TableSetColumnSortDirection(table, column_n, ImGuiSortDirection_Ascending, append_to_sort_specs);
3060 if (MenuItem("Sort in Descending Order", NULL, column->SortOrder != -1 && column->SortDirection == ImGuiSortDirection_Descending, (column->Flags & ImGuiTableColumnFlags_NoSortDescending) == 0))
3061 TableSetColumnSortDirection(table, column_n, ImGuiSortDirection_Descending, append_to_sort_specs);
3062 }
3063#endif
3064
3065 // Hiding / Visibility
3066 if (table->Flags & ImGuiTableFlags_Hideable)
3067 {
3068 if (want_separator)
3069 Separator();
3070 want_separator = true;
3071
3073 for (int other_column_n = 0; other_column_n < table->ColumnsCount; other_column_n++)
3074 {
3075 ImGuiTableColumn* other_column = &table->Columns[other_column_n];
3076 const char* name = TableGetColumnName(table, other_column_n);
3077 if (name == NULL || name[0] == 0)
3078 name = "<Unknown>";
3079
3080 // Make sure we can't hide the last active column
3081 bool menu_item_active = (other_column->Flags & ImGuiTableColumnFlags_NoHide) ? false : true;
3082 if (other_column->IsEnabled && table->ColumnsEnabledCount <= 1)
3083 menu_item_active = false;
3084 if (MenuItem(name, NULL, other_column->IsEnabled, menu_item_active))
3085 other_column->IsEnabledNextFrame = !other_column->IsEnabled;
3086 }
3087 PopItemFlag();
3088 }
3089}
@ ImGuiTableColumnFlags_NoHide
Definition imgui.h:1173
@ ImGuiTableColumnFlags_NoSort
Definition imgui.h:1175
@ ImGuiTableColumnFlags_NoSortAscending
Definition imgui.h:1176
@ ImGuiTableColumnFlags_NoSortDescending
Definition imgui.h:1177
@ ImGuiTableFlags_Sortable
Definition imgui.h:1113
@ ImGuiTableFlags_Hideable
Definition imgui.h:1112
@ ImGuiTableFlags_Resizable
Definition imgui.h:1110
IMGUI_API void TableSetColumnSortDirection(int column_n, ImGuiSortDirection sort_direction, bool append_to_sort_specs)
Definition imgui_tables.cpp:2639
IMGUI_API void TableSetColumnWidthAutoSingle(ImGuiTable *table, int column_n)
Definition imgui_tables.cpp:2139
ImU8 SortDirection
Definition imgui_internal.h:2068
ImGuiTableColumnIdx SortOrder
Definition imgui_internal.h:2054
bool IsDefaultDisplayOrder
Definition imgui_internal.h:2191
ImGuiTableColumnIdx ColumnsEnabledFixedCount
Definition imgui_internal.h:2160

References ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTable::ColumnsEnabledCount, ImGuiTable::ColumnsEnabledFixedCount, ImGuiTable::ContextPopupColumn, ImGuiContext::CurrentWindow, ImGuiTableColumn::Flags, ImGuiTable::Flags, GImGui, ImGuiItemFlags_SelectableDontClosePopup, ImGuiSortDirection_Ascending, ImGuiSortDirection_Descending, ImGuiTableColumnFlags_NoHide, ImGuiTableColumnFlags_NoResize, ImGuiTableColumnFlags_NoSort, ImGuiTableColumnFlags_NoSortAscending, ImGuiTableColumnFlags_NoSortDescending, ImGuiTableFlags_Hideable, ImGuiTableFlags_Reorderable, ImGuiTableFlags_Resizable, ImGuiTableFlags_SizingFixedSame, ImGuiTableFlags_SizingMask_, ImGuiTableFlags_Sortable, ImGuiContext::IO, ImGuiTable::IsDefaultDisplayOrder, ImGuiTableColumn::IsEnabled, ImGuiTableColumn::IsEnabledNextFrame, ImGuiTable::IsResetDisplayOrderRequest, ImGuiIO::KeyShift, MenuItem(), PopItemFlag(), PushItemFlag(), Separator(), ImGuiWindow::SkipItems, ImGuiTableColumn::SortDirection, ImGuiTableColumn::SortOrder, TableGetColumnName(), TableSetColumnSortDirection(), TableSetColumnWidthAutoAll(), and TableSetColumnWidthAutoSingle().

Referenced by TableUpdateLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableEndCell()

void ImGui::TableEndCell ( ImGuiTable table)
1977{
1978 ImGuiTableColumn* column = &table->Columns[table->CurrentColumn];
1979 ImGuiWindow* window = table->InnerWindow;
1980
1981 // Report maximum position so we can infer content size per column.
1982 float* p_max_pos_x;
1984 p_max_pos_x = &column->ContentMaxXHeadersUsed; // Useful in case user submit contents in header row that is not a TableHeader() call
1985 else
1986 p_max_pos_x = table->IsUnfrozenRows ? &column->ContentMaxXUnfrozen : &column->ContentMaxXFrozen;
1987 *p_max_pos_x = ImMax(*p_max_pos_x, window->DC.CursorMaxPos.x);
1988 table->RowPosY2 = ImMax(table->RowPosY2, window->DC.CursorMaxPos.y + table->CellPaddingY);
1989 column->ItemWidth = window->DC.ItemWidth;
1990
1991 // Propagate text baseline for the entire row
1992 // FIXME-TABLE: Here we propagate text baseline from the last line of the cell.. instead of the first one.
1994}
float ContentMaxXFrozen
Definition imgui_internal.h:2045
float ContentMaxXHeadersUsed
Definition imgui_internal.h:2047
float ContentMaxXUnfrozen
Definition imgui_internal.h:2046

References ImGuiTable::CellPaddingY, ImGuiTable::Columns, ImGuiTableColumn::ContentMaxXFrozen, ImGuiTableColumn::ContentMaxXHeadersUsed, ImGuiTableColumn::ContentMaxXUnfrozen, ImGuiTable::CurrentColumn, ImGuiWindowTempData::CursorMaxPos, ImGuiWindow::DC, ImGuiTableRowFlags_Headers, ImMax(), ImGuiTable::InnerWindow, ImGuiTable::IsUnfrozenRows, ImGuiWindowTempData::ItemWidth, ImGuiTableColumn::ItemWidth, ImGuiWindowTempData::PrevLineTextBaseOffset, ImGuiTable::RowFlags, ImGuiTable::RowPosY2, ImGuiTable::RowTextBaseline, ImVec2::x, and ImVec2::y.

Referenced by TableEndRow(), TableNextColumn(), and TableSetColumnIndex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableEndRow()

void ImGui::TableEndRow ( ImGuiTable table)
1716{
1717 ImGuiContext& g = *GImGui;
1718 ImGuiWindow* window = g.CurrentWindow;
1719 IM_ASSERT(window == table->InnerWindow);
1720 IM_ASSERT(table->IsInsideRow);
1721
1722 if (table->CurrentColumn != -1)
1723 TableEndCell(table);
1724
1725 // Logging
1726 if (g.LogEnabled)
1727 LogRenderedText(NULL, "|");
1728
1729 // Position cursor at the bottom of our row so it can be used for e.g. clipping calculation. However it is
1730 // likely that the next call to TableBeginCell() will reposition the cursor to take account of vertical padding.
1731 window->DC.CursorPos.y = table->RowPosY2;
1732
1733 // Row background fill
1734 const float bg_y1 = table->RowPosY1;
1735 const float bg_y2 = table->RowPosY2;
1736 const bool unfreeze_rows_actual = (table->CurrentRow + 1 == table->FreezeRowsCount);
1737 const bool unfreeze_rows_request = (table->CurrentRow + 1 == table->FreezeRowsRequest);
1738 if (table->CurrentRow == 0)
1739 table->LastFirstRowHeight = bg_y2 - bg_y1;
1740
1741 const bool is_visible = (bg_y2 >= table->InnerClipRect.Min.y && bg_y1 <= table->InnerClipRect.Max.y);
1742 if (is_visible)
1743 {
1744 // Decide of background color for the row
1745 ImU32 bg_col0 = 0;
1746 ImU32 bg_col1 = 0;
1747 if (table->RowBgColor[0] != IM_COL32_DISABLE)
1748 bg_col0 = table->RowBgColor[0];
1749 else if (table->Flags & ImGuiTableFlags_RowBg)
1751 if (table->RowBgColor[1] != IM_COL32_DISABLE)
1752 bg_col1 = table->RowBgColor[1];
1753
1754 // Decide of top border color
1755 ImU32 border_col = 0;
1756 const float border_size = TABLE_BORDER_SIZE;
1757 if (table->CurrentRow > 0 || table->InnerWindow == table->OuterWindow)
1759 border_col = (table->LastRowFlags & ImGuiTableRowFlags_Headers) ? table->BorderColorStrong : table->BorderColorLight;
1760
1761 const bool draw_cell_bg_color = table->RowCellDataCurrent >= 0;
1762 const bool draw_strong_bottom_border = unfreeze_rows_actual;
1763 if ((bg_col0 | bg_col1 | border_col) != 0 || draw_strong_bottom_border || draw_cell_bg_color)
1764 {
1765 // In theory we could call SetWindowClipRectBeforeSetChannel() but since we know TableEndRow() is
1766 // always followed by a change of clipping rectangle we perform the smallest overwrite possible here.
1767 if ((table->Flags & ImGuiTableFlags_NoClip) == 0)
1770 }
1771
1772 // Draw row background
1773 // We soft/cpu clip this so all backgrounds and borders can share the same clipping rectangle
1774 if (bg_col0 || bg_col1)
1775 {
1776 ImRect row_rect(table->WorkRect.Min.x, bg_y1, table->WorkRect.Max.x, bg_y2);
1777 row_rect.ClipWith(table->BgClipRect);
1778 if (bg_col0 != 0 && row_rect.Min.y < row_rect.Max.y)
1779 window->DrawList->AddRectFilled(row_rect.Min, row_rect.Max, bg_col0);
1780 if (bg_col1 != 0 && row_rect.Min.y < row_rect.Max.y)
1781 window->DrawList->AddRectFilled(row_rect.Min, row_rect.Max, bg_col1);
1782 }
1783
1784 // Draw cell background color
1785 if (draw_cell_bg_color)
1786 {
1787 ImGuiTableCellData* cell_data_end = &table->RowCellData[table->RowCellDataCurrent];
1788 for (ImGuiTableCellData* cell_data = &table->RowCellData[0]; cell_data <= cell_data_end; cell_data++)
1789 {
1790 const ImGuiTableColumn* column = &table->Columns[cell_data->Column];
1791 ImRect cell_bg_rect = TableGetCellBgRect(table, cell_data->Column);
1792 cell_bg_rect.ClipWith(table->BgClipRect);
1793 cell_bg_rect.Min.x = ImMax(cell_bg_rect.Min.x, column->ClipRect.Min.x); // So that first column after frozen one gets clipped
1794 cell_bg_rect.Max.x = ImMin(cell_bg_rect.Max.x, column->MaxX);
1795 window->DrawList->AddRectFilled(cell_bg_rect.Min, cell_bg_rect.Max, cell_data->BgColor);
1796 }
1797 }
1798
1799 // Draw top border
1800 if (border_col && bg_y1 >= table->BgClipRect.Min.y && bg_y1 < table->BgClipRect.Max.y)
1801 window->DrawList->AddLine(ImVec2(table->BorderX1, bg_y1), ImVec2(table->BorderX2, bg_y1), border_col, border_size);
1802
1803 // Draw bottom border at the row unfreezing mark (always strong)
1804 if (draw_strong_bottom_border && bg_y2 >= table->BgClipRect.Min.y && bg_y2 < table->BgClipRect.Max.y)
1805 window->DrawList->AddLine(ImVec2(table->BorderX1, bg_y2), ImVec2(table->BorderX2, bg_y2), table->BorderColorStrong, border_size);
1806 }
1807
1808 // End frozen rows (when we are past the last frozen row line, teleport cursor and alter clipping rectangle)
1809 // We need to do that in TableEndRow() instead of TableBeginRow() so the list clipper can mark end of row and
1810 // get the new cursor position.
1811 if (unfreeze_rows_request)
1812 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
1813 {
1814 ImGuiTableColumn* column = &table->Columns[column_n];
1815 column->NavLayerCurrent = (ImS8)((column_n < table->FreezeColumnsCount) ? ImGuiNavLayer_Menu : ImGuiNavLayer_Main);
1816 }
1817 if (unfreeze_rows_actual)
1818 {
1819 IM_ASSERT(table->IsUnfrozenRows == false);
1820 table->IsUnfrozenRows = true;
1821
1822 // BgClipRect starts as table->InnerClipRect, reduce it now and make BgClipRectForDrawCmd == BgClipRect
1823 float y0 = ImMax(table->RowPosY2 + 1, window->InnerClipRect.Min.y);
1824 table->BgClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y = ImMin(y0, window->InnerClipRect.Max.y);
1825 table->BgClipRect.Max.y = table->Bg2ClipRectForDrawCmd.Max.y = window->InnerClipRect.Max.y;
1828
1829 float row_height = table->RowPosY2 - table->RowPosY1;
1830 table->RowPosY2 = window->DC.CursorPos.y = table->WorkRect.Min.y + table->RowPosY2 - table->OuterRect.Min.y;
1831 table->RowPosY1 = table->RowPosY2 - row_height;
1832 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
1833 {
1834 ImGuiTableColumn* column = &table->Columns[column_n];
1835 column->DrawChannelCurrent = column->DrawChannelUnfrozen;
1836 column->ClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y;
1837 }
1838
1839 // Update cliprect ahead of TableBeginCell() so clipper can access to new ClipRect->Min.y
1840 SetWindowClipRectBeforeSetChannel(window, table->Columns[0].ClipRect);
1841 table->DrawSplitter->SetCurrentChannel(window->DrawList, table->Columns[0].DrawChannelCurrent);
1842 }
1843
1844 if (!(table->RowFlags & ImGuiTableRowFlags_Headers))
1845 table->RowBgColorCounter++;
1846 table->IsInsideRow = false;
1847}
@ ImGuiTableFlags_RowBg
Definition imgui.h:1117
IMGUI_API ImRect TableGetCellBgRect(const ImGuiTable *table, int column_n)
Definition imgui_tables.cpp:1565
IMGUI_API void TableEndCell(ImGuiTable *table)
Definition imgui_tables.cpp:1976
ImGuiTableDrawChannelIdx DrawChannelUnfrozen
Definition imgui_internal.h:2057
ImRect Bg2ClipRectForDrawCmd
Definition imgui_internal.h:2150
ImGuiTableDrawChannelIdx Bg2DrawChannelCurrent
Definition imgui_internal.h:2181
ImGuiTableDrawChannelIdx Bg2DrawChannelUnfrozen
Definition imgui_internal.h:2182

References ImDrawList::_CmdHeader, ImDrawList::AddLine(), ImDrawList::AddRectFilled(), ImGuiTable::Bg0ClipRectForDrawCmd, ImGuiTable::Bg2ClipRectForDrawCmd, ImGuiTable::Bg2DrawChannelCurrent, ImGuiTable::Bg2DrawChannelUnfrozen, ImGuiTable::BgClipRect, ImGuiTable::BorderColorLight, ImGuiTable::BorderColorStrong, ImGuiTable::BorderX1, ImGuiTable::BorderX2, ImDrawCmdHeader::ClipRect, ImGuiTableColumn::ClipRect, ImRect::ClipWith(), ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTable::CurrentColumn, ImGuiTable::CurrentRow, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiTableColumn::DrawChannelCurrent, ImGuiTableColumn::DrawChannelUnfrozen, ImGuiWindow::DrawList, ImGuiTable::DrawSplitter, ImGuiTable::Flags, ImGuiTable::FreezeRowsCount, ImGuiTable::FreezeRowsRequest, GetColorU32(), GImGui, IM_ASSERT, IM_COL32_DISABLE, ImGuiCol_TableRowBg, ImGuiCol_TableRowBgAlt, ImGuiNavLayer_Main, ImGuiNavLayer_Menu, ImGuiTableFlags_BordersInnerH, ImGuiTableFlags_NoClip, ImGuiTableFlags_RowBg, ImGuiTableRowFlags_Headers, ImMax(), ImMin(), ImGuiWindow::InnerClipRect, ImGuiTable::InnerClipRect, ImGuiTable::InnerWindow, ImGuiTable::IsInsideRow, ImGuiTable::IsUnfrozenRows, ImGuiTable::LastFirstRowHeight, ImGuiTable::LastRowFlags, ImGuiContext::LogEnabled, LogRenderedText(), ImRect::Max, ImGuiTableColumn::MaxX, ImRect::Min, ImGuiTableColumn::NavLayerCurrent, ImGuiTable::OuterRect, ImGuiTable::OuterWindow, ImGuiTable::RowBgColor, ImGuiTable::RowBgColorCounter, ImGuiTable::RowCellData, ImGuiTable::RowCellDataCurrent, ImGuiTable::RowFlags, ImGuiTable::RowPosY1, ImGuiTable::RowPosY2, ImDrawListSplitter::SetCurrentChannel(), SetWindowClipRectBeforeSetChannel(), TABLE_BORDER_SIZE, TABLE_DRAW_CHANNEL_BG0, TableEndCell(), TableGetCellBgRect(), ImRect::ToVec4(), ImGuiTable::WorkRect, ImVec2::x, and ImVec2::y.

Referenced by ImGuiListClipper::Begin(), EndTable(), SetCursorPosYAndSetupForPrevLine(), ImGuiListClipper::Step(), and TableNextRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableFindByID()

ImGuiTable * ImGui::TableFindByID ( ImGuiID  id)
303{
304 ImGuiContext& g = *GImGui;
305 return g.Tables.GetByKey(id);
306}
T * GetByKey(ImGuiID key)
Definition imgui_internal.h:615

References ImPool< T >::GetByKey(), GImGui, and ImGuiContext::Tables.

+ Here is the call graph for this function:

◆ TableFixColumnSortDirection()

void ImGui::TableFixColumnSortDirection ( ImGuiTable table,
ImGuiTableColumn column 
)
2614{
2615 if (column->SortOrder == -1 || (column->SortDirectionsAvailMask & (1 << column->SortDirection)) != 0)
2616 return;
2618 table->IsSortSpecsDirty = true;
2619}
static ImGuiSortDirection TableGetColumnAvailSortDirection(ImGuiTableColumn *column, int n)
Definition imgui_tables.cpp:2606
ImU8 SortDirectionsAvailMask
Definition imgui_internal.h:2070

References ImGuiTable::IsSortSpecsDirty, ImGuiTableColumn::SortDirection, ImGuiTableColumn::SortDirectionsAvailMask, ImGuiTableColumn::SortOrder, and TableGetColumnAvailSortDirection().

Referenced by TableSetColumnSortDirection(), and TableSetupColumnFlags().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableGcCompactSettings()

void ImGui::TableGcCompactSettings ( )
3462{
3463 ImGuiContext& g = *GImGui;
3464 int required_memory = 0;
3465 for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings))
3466 if (settings->ID != 0)
3467 required_memory += (int)TableSettingsCalcChunkSize(settings->ColumnsCount);
3468 if (required_memory == g.SettingsTables.Buf.Size)
3469 return;
3470 ImChunkStream<ImGuiTableSettings> new_chunk_stream;
3471 new_chunk_stream.Buf.reserve(required_memory);
3472 for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings))
3473 if (settings->ID != 0)
3474 memcpy(new_chunk_stream.alloc_chunk(TableSettingsCalcChunkSize(settings->ColumnsCount)), settings, TableSettingsCalcChunkSize(settings->ColumnsCount));
3475 g.SettingsTables.swap(new_chunk_stream);
3476}
static size_t TableSettingsCalcChunkSize(int columns_count)
Definition imgui_tables.cpp:3130
Definition imgui_internal.h:635
ImVector< char > Buf
Definition imgui_internal.h:636
void swap(ImChunkStream< T > &rhs)
Definition imgui_internal.h:648

References ImChunkStream< T >::alloc_chunk(), ImChunkStream< T >::begin(), ImChunkStream< T >::Buf, GImGui, ImChunkStream< T >::next_chunk(), ImVector< T >::reserve(), ImGuiContext::SettingsTables, ImVector< T >::Size, ImChunkStream< T >::swap(), and TableSettingsCalcChunkSize().

Referenced by GcCompactTransientMiscBuffers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableGcCompactTransientBuffers() [1/2]

void ImGui::TableGcCompactTransientBuffers ( ImGuiTable table)
3440{
3441 //IMGUI_DEBUG_LOG("TableGcCompactTransientBuffers() id=0x%08X\n", table->ID);
3442 ImGuiContext& g = *GImGui;
3443 IM_ASSERT(table->MemoryCompacted == false);
3444 table->SortSpecs.Specs = NULL;
3445 table->IsSortSpecsDirty = true;
3446 table->ColumnsNames.clear();
3447 table->MemoryCompacted = true;
3448 for (int n = 0; n < table->ColumnsCount; n++)
3449 table->Columns[n].NameOffset = -1;
3450 g.TablesLastTimeActive[g.Tables.GetIndex(table)] = -1.0f;
3451}
ImGuiTableSortSpecs SortSpecs
Definition imgui_internal.h:2157
const ImGuiTableColumnSortSpecs * Specs
Definition imgui.h:1994

References ImGuiTextBuffer::clear(), ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTable::ColumnsNames, ImPool< T >::GetIndex(), GImGui, IM_ASSERT, ImGuiTable::IsSortSpecsDirty, ImGuiTable::MemoryCompacted, ImGuiTable::SortSpecs, ImGuiTableSortSpecs::Specs, ImGuiContext::Tables, and ImGuiContext::TablesLastTimeActive.

Referenced by NewFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableGcCompactTransientBuffers() [2/2]

void ImGui::TableGcCompactTransientBuffers ( ImGuiTableTempData table)
3454{
3455 temp_data->DrawSplitter.ClearFreeMemory();
3456 temp_data->SortSpecsMulti.clear();
3457 temp_data->LastTimeActive = -1.0f;
3458}

References ImVector< T >::clear(), ImDrawListSplitter::ClearFreeMemory(), ImGuiTableTempData::DrawSplitter, ImGuiTableTempData::LastTimeActive, and ImGuiTableTempData::SortSpecsMulti.

+ Here is the call graph for this function:

◆ TableGetBoundSettings()

ImGuiTableSettings * ImGui::TableGetBoundSettings ( ImGuiTable table)
3156{
3157 if (table->SettingsOffset != -1)
3158 {
3159 ImGuiContext& g = *GImGui;
3161 IM_ASSERT(settings->ID == table->ID);
3162 if (settings->ColumnsCountMax >= table->ColumnsCount)
3163 return settings; // OK
3164 settings->ID = 0; // Invalidate storage, we won't fit because of a count change
3165 }
3166 return NULL;
3167}
T * ptr_from_offset(int off)
Definition imgui_internal.h:647

References ImGuiTable::ColumnsCount, ImGuiTableSettings::ColumnsCountMax, GImGui, ImGuiTable::ID, ImGuiTableSettings::ID, IM_ASSERT, ImChunkStream< T >::ptr_from_offset(), ImGuiTable::SettingsOffset, and ImGuiContext::SettingsTables.

Referenced by DebugNodeTable(), TableLoadSettings(), and TableSaveSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableGetCellBgRect()

ImRect ImGui::TableGetCellBgRect ( const ImGuiTable table,
int  column_n 
)
1566{
1567 const ImGuiTableColumn* column = &table->Columns[column_n];
1568 float x1 = column->MinX;
1569 float x2 = column->MaxX;
1570 if (column->PrevEnabledColumn == -1)
1571 x1 -= table->CellSpacingX1;
1572 if (column->NextEnabledColumn == -1)
1573 x2 += table->CellSpacingX2;
1574 return ImRect(x1, table->RowPosY1, x2, table->RowPosY2);
1575}

References ImGuiTable::CellSpacingX1, ImGuiTable::CellSpacingX2, ImGuiTable::Columns, ImGuiTableColumn::MaxX, ImGuiTableColumn::MinX, ImGuiTableColumn::NextEnabledColumn, ImGuiTableColumn::PrevEnabledColumn, ImGuiTable::RowPosY1, and ImGuiTable::RowPosY2.

Referenced by TableEndRow(), and TableHeader().

+ Here is the caller graph for this function:

◆ TableGetColumnCount()

int ImGui::TableGetColumnCount ( )
1501{
1502 ImGuiContext& g = *GImGui;
1503 ImGuiTable* table = g.CurrentTable;
1504 return table ? table->ColumnsCount : 0;
1505}

References ImGuiTable::ColumnsCount, ImGuiContext::CurrentTable, and GImGui.

Referenced by TableGetHeaderRowHeight(), and TableHeadersRow().

+ Here is the caller graph for this function:

◆ TableGetColumnFlags()

ImGuiTableColumnFlags ImGui::TableGetColumnFlags ( int  column_n = -1)
1548{
1549 ImGuiContext& g = *GImGui;
1550 ImGuiTable* table = g.CurrentTable;
1551 if (!table)
1553 if (column_n < 0)
1554 column_n = table->CurrentColumn;
1555 if (column_n == table->ColumnsCount)
1557 return table->Columns[column_n].Flags;
1558}
@ ImGuiTableColumnFlags_IsHovered
Definition imgui.h:1188
@ ImGuiTableColumnFlags_None
Definition imgui.h:1166

References ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTable::CurrentColumn, ImGuiContext::CurrentTable, GImGui, ImGuiTable::HoveredColumnBody, ImGuiTableColumnFlags_IsHovered, and ImGuiTableColumnFlags_None.

Referenced by ShowDemoWindowTables(), and TableGetHeaderRowHeight().

+ Here is the caller graph for this function:

◆ TableGetColumnIndex()

int ImGui::TableGetColumnIndex ( )
1860{
1861 ImGuiContext& g = *GImGui;
1862 ImGuiTable* table = g.CurrentTable;
1863 if (!table)
1864 return 0;
1865 return table->CurrentColumn;
1866}

References ImGuiTable::CurrentColumn, ImGuiContext::CurrentTable, and GImGui.

Referenced by ShowDemoWindowTables().

+ Here is the caller graph for this function:

◆ TableGetColumnName() [1/2]

const char * ImGui::TableGetColumnName ( const ImGuiTable table,
int  column_n 
)
1519{
1520 if (table->IsLayoutLocked == false && column_n >= table->DeclColumnsCount)
1521 return ""; // NameOffset is invalid at this point
1522 const ImGuiTableColumn* column = &table->Columns[column_n];
1523 if (column->NameOffset == -1)
1524 return "";
1525 return &table->ColumnsNames.Buf[column->NameOffset];
1526}
ImS16 NameOffset
Definition imgui_internal.h:2049

References ImGuiTextBuffer::Buf, ImGuiTable::Columns, ImGuiTable::ColumnsNames, ImGuiTable::DeclColumnsCount, ImGuiTable::IsLayoutLocked, and ImGuiTableColumn::NameOffset.

◆ TableGetColumnName() [2/2]

const char * ImGui::TableGetColumnName ( int  column_n = -1)
1508{
1509 ImGuiContext& g = *GImGui;
1510 ImGuiTable* table = g.CurrentTable;
1511 if (!table)
1512 return NULL;
1513 if (column_n < 0)
1514 column_n = table->CurrentColumn;
1515 return TableGetColumnName(table, column_n);
1516}

References ImGuiTable::CurrentColumn, ImGuiContext::CurrentTable, GImGui, and TableGetColumnName().

Referenced by DebugNodeTable(), ShowDemoWindowTables(), TableDrawContextMenu(), TableGetColumnName(), TableGetHeaderRowHeight(), and TableHeadersRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableGetColumnNextSortDirection()

ImGuiSortDirection ImGui::TableGetColumnNextSortDirection ( ImGuiTableColumn column)
2626{
2628 if (column->SortOrder == -1)
2629 return TableGetColumnAvailSortDirection(column, 0);
2630 for (int n = 0; n < 3; n++)
2631 if (column->SortDirection == TableGetColumnAvailSortDirection(column, n))
2632 return TableGetColumnAvailSortDirection(column, (n + 1) % column->SortDirectionsAvailCount);
2633 IM_ASSERT(0);
2635}
ImU8 SortDirectionsAvailCount
Definition imgui_internal.h:2069

References IM_ASSERT, ImGuiSortDirection_None, ImGuiTableColumn::SortDirection, ImGuiTableColumn::SortDirectionsAvailCount, ImGuiTableColumn::SortOrder, and TableGetColumnAvailSortDirection().

Referenced by TableHeader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableGetColumnResizeID()

ImGuiID ImGui::TableGetColumnResizeID ( const ImGuiTable table,
int  column_n,
int  instance_no = 0 
)
1579{
1580 IM_ASSERT(column_n >= 0 && column_n < table->ColumnsCount);
1581 ImGuiID id = table->ID + 1 + (instance_no * table->ColumnsCount) + column_n;
1582 return id;
1583}

References ImGuiTable::ColumnsCount, ImGuiTable::ID, and IM_ASSERT.

Referenced by TableUpdateBorders().

+ Here is the caller graph for this function:

◆ TableGetColumnWidthAuto()

float ImGui::TableGetColumnWidthAuto ( ImGuiTable table,
ImGuiTableColumn column 
)
2040{
2041 const float content_width_body = ImMax(column->ContentMaxXFrozen, column->ContentMaxXUnfrozen) - column->WorkMinX;
2042 const float content_width_headers = column->ContentMaxXHeadersIdeal - column->WorkMinX;
2043 float width_auto = content_width_body;
2045 width_auto = ImMax(width_auto, content_width_headers);
2046
2047 // Non-resizable fixed columns preserve their requested width
2048 if ((column->Flags & ImGuiTableColumnFlags_WidthFixed) && column->InitStretchWeightOrWidth > 0.0f)
2050 width_auto = column->InitStretchWeightOrWidth;
2051
2052 return ImMax(width_auto, table->MinColumnWidth);
2053}
@ ImGuiTableColumnFlags_NoHeaderWidth
Definition imgui.h:1178
float ContentMaxXHeadersIdeal
Definition imgui_internal.h:2048
float InitStretchWeightOrWidth
Definition imgui_internal.h:2039

References ImGuiTableColumn::ContentMaxXFrozen, ImGuiTableColumn::ContentMaxXHeadersIdeal, ImGuiTableColumn::ContentMaxXUnfrozen, ImGuiTableColumn::Flags, ImGuiTable::Flags, ImGuiTableColumnFlags_NoHeaderWidth, ImGuiTableColumnFlags_NoResize, ImGuiTableColumnFlags_WidthFixed, ImGuiTableFlags_Resizable, ImMax(), ImGuiTableColumn::InitStretchWeightOrWidth, ImGuiTable::MinColumnWidth, and ImGuiTableColumn::WorkMinX.

Referenced by EndTable(), and TableUpdateLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableGetHeaderRowHeight()

float ImGui::TableGetHeaderRowHeight ( )
2775{
2776 // Caring for a minor edge case:
2777 // Calculate row height, for the unlikely case that some labels may be taller than others.
2778 // If we didn't do that, uneven header height would highlight but smaller one before the tallest wouldn't catch input for all height.
2779 // In your custom header row you may omit this all together and just call TableNextRow() without a height...
2780 float row_height = GetTextLineHeight();
2781 int columns_count = TableGetColumnCount();
2782 for (int column_n = 0; column_n < columns_count; column_n++)
2784 row_height = ImMax(row_height, CalcTextSize(TableGetColumnName(column_n)).y);
2785 row_height += GetStyle().CellPadding.y * 2.0f;
2786 return row_height;
2787}
@ ImGuiTableColumnFlags_IsEnabled
Definition imgui.h:1185
IMGUI_API ImGuiTableColumnFlags TableGetColumnFlags(int column_n=-1)
Definition imgui_tables.cpp:1547
IMGUI_API int TableGetColumnCount()
Definition imgui_tables.cpp:1500

References CalcTextSize(), ImGuiStyle::CellPadding, GetStyle(), GetTextLineHeight(), ImGuiTableColumnFlags_IsEnabled, ImMax(), TableGetColumnCount(), TableGetColumnFlags(), TableGetColumnName(), and ImVec2::y.

Referenced by TableHeadersRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableGetHoveredColumn()

int ImGui::TableGetHoveredColumn ( )
1587{
1588 ImGuiContext& g = *GImGui;
1589 ImGuiTable* table = g.CurrentTable;
1590 if (!table)
1591 return -1;
1592 return (int)table->HoveredColumnBody;
1593}

References ImGuiContext::CurrentTable, GImGui, and ImGuiTable::HoveredColumnBody.

Referenced by TableHeadersRow().

+ Here is the caller graph for this function:

◆ TableGetMaxColumnWidth()

float ImGui::TableGetMaxColumnWidth ( const ImGuiTable table,
int  column_n 
)
2009{
2010 const ImGuiTableColumn* column = &table->Columns[column_n];
2011 float max_width = FLT_MAX;
2012 const float min_column_distance = table->MinColumnWidth + table->CellPaddingX * 2.0f + table->CellSpacingX1 + table->CellSpacingX2;
2013 if (table->Flags & ImGuiTableFlags_ScrollX)
2014 {
2015 // Frozen columns can't reach beyond visible width else scrolling will naturally break.
2016 if (column->DisplayOrder < table->FreezeColumnsRequest)
2017 {
2018 max_width = (table->InnerClipRect.Max.x - (table->FreezeColumnsRequest - column->DisplayOrder) * min_column_distance) - column->MinX;
2019 max_width = max_width - table->OuterPaddingX - table->CellPaddingX - table->CellSpacingX2;
2020 }
2021 }
2022 else if ((table->Flags & ImGuiTableFlags_NoKeepColumnsVisible) == 0)
2023 {
2024 // If horizontal scrolling if disabled, we apply a final lossless shrinking of columns in order to make
2025 // sure they are all visible. Because of this we also know that all of the columns will always fit in
2026 // table->WorkRect and therefore in table->InnerRect (because ScrollX is off)
2027 // FIXME-TABLE: This is solved incorrectly but also quite a difficult problem to fix as we also want ClipRect width to match.
2028 // See "table_width_distrib" and "table_width_keep_visible" tests
2029 max_width = table->WorkRect.Max.x - (table->ColumnsEnabledCount - column->IndexWithinEnabledSet - 1) * min_column_distance - column->MinX;
2030 //max_width -= table->CellSpacingX1;
2031 max_width -= table->CellSpacingX2;
2032 max_width -= table->CellPaddingX * 2.0f;
2033 max_width -= table->OuterPaddingX;
2034 }
2035 return max_width;
2036}
@ ImGuiTableFlags_NoKeepColumnsVisible
Definition imgui.h:1137
ImGuiTableColumnIdx IndexWithinEnabledSet
Definition imgui_internal.h:2051

References ImGuiTable::CellPaddingX, ImGuiTable::CellSpacingX1, ImGuiTable::CellSpacingX2, ImGuiTable::Columns, ImGuiTable::ColumnsEnabledCount, ImGuiTableColumn::DisplayOrder, ImGuiTable::Flags, ImGuiTable::FreezeColumnsRequest, ImGuiTableFlags_NoKeepColumnsVisible, ImGuiTableFlags_ScrollX, ImGuiTableColumn::IndexWithinEnabledSet, ImGuiTable::InnerClipRect, ImRect::Max, ImGuiTable::MinColumnWidth, ImGuiTableColumn::MinX, ImGuiTable::OuterPaddingX, ImGuiTable::WorkRect, and ImVec2::x.

Referenced by TableSetColumnWidth(), and TableUpdateLayout().

+ Here is the caller graph for this function:

◆ TableGetRowIndex()

int ImGui::TableGetRowIndex ( )
1648{
1649 ImGuiContext& g = *GImGui;
1650 ImGuiTable* table = g.CurrentTable;
1651 if (!table)
1652 return 0;
1653 return table->CurrentRow;
1654}

References ImGuiTable::CurrentRow, ImGuiContext::CurrentTable, and GImGui.

Referenced by ShowDemoWindowTables().

+ Here is the caller graph for this function:

◆ TableGetSortSpecs()

ImGuiTableSortSpecs * ImGui::TableGetSortSpecs ( )
2588{
2589 ImGuiContext& g = *GImGui;
2590 ImGuiTable* table = g.CurrentTable;
2591 IM_ASSERT(table != NULL);
2592
2593 if (!(table->Flags & ImGuiTableFlags_Sortable))
2594 return NULL;
2595
2596 // Require layout (in case TableHeadersRow() hasn't been called) as it may alter IsSortSpecsDirty in some paths.
2597 if (!table->IsLayoutLocked)
2598 TableUpdateLayout(table);
2599
2600 if (table->IsSortSpecsDirty)
2601 TableSortSpecsBuild(table);
2602
2603 return &table->SortSpecs;
2604}
IMGUI_API void TableSortSpecsBuild(ImGuiTable *table)
Definition imgui_tables.cpp:2738

References ImGuiContext::CurrentTable, ImGuiTable::Flags, GImGui, IM_ASSERT, ImGuiTableFlags_Sortable, ImGuiTable::IsLayoutLocked, ImGuiTable::IsSortSpecsDirty, ImGuiTable::SortSpecs, TableSortSpecsBuild(), and TableUpdateLayout().

Referenced by ShowDemoWindowTables().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableHeader()

void ImGui::TableHeader ( const char *  label)
2838{
2839 ImGuiContext& g = *GImGui;
2840 ImGuiWindow* window = g.CurrentWindow;
2841 if (window->SkipItems)
2842 return;
2843
2844 ImGuiTable* table = g.CurrentTable;
2845 IM_ASSERT(table != NULL && "Need to call TableHeader() after BeginTable()!");
2846 IM_ASSERT(table->CurrentColumn != -1);
2847 const int column_n = table->CurrentColumn;
2848 ImGuiTableColumn* column = &table->Columns[column_n];
2849
2850 // Label
2851 if (label == NULL)
2852 label = "";
2853 const char* label_end = FindRenderedTextEnd(label);
2854 ImVec2 label_size = CalcTextSize(label, label_end, true);
2855 ImVec2 label_pos = window->DC.CursorPos;
2856
2857 // If we already got a row height, there's use that.
2858 // FIXME-TABLE: Padding problem if the correct outer-padding CellBgRect strays off our ClipRect?
2859 ImRect cell_r = TableGetCellBgRect(table, column_n);
2860 float label_height = ImMax(label_size.y, table->RowMinHeight - table->CellPaddingY * 2.0f);
2861
2862 // Calculate ideal size for sort order arrow
2863 float w_arrow = 0.0f;
2864 float w_sort_text = 0.0f;
2865 char sort_order_suf[4] = "";
2866 const float ARROW_SCALE = 0.65f;
2868 {
2869 w_arrow = ImFloor(g.FontSize * ARROW_SCALE + g.Style.FramePadding.x);
2870 if (column->SortOrder > 0)
2871 {
2872 ImFormatString(sort_order_suf, IM_ARRAYSIZE(sort_order_suf), "%d", column->SortOrder + 1);
2873 w_sort_text = g.Style.ItemInnerSpacing.x + CalcTextSize(sort_order_suf).x;
2874 }
2875 }
2876
2877 // We feed our unclipped width to the column without writing on CursorMaxPos, so that column is still considering for merging.
2878 float max_pos_x = label_pos.x + label_size.x + w_sort_text + w_arrow;
2879 column->ContentMaxXHeadersUsed = ImMax(column->ContentMaxXHeadersUsed, column->WorkMaxX);
2880 column->ContentMaxXHeadersIdeal = ImMax(column->ContentMaxXHeadersIdeal, max_pos_x);
2881
2882 // Keep header highlighted when context menu is open.
2883 const bool selected = (table->IsContextPopupOpen && table->ContextPopupColumn == column_n && table->InstanceInteracted == table->InstanceCurrent);
2884 ImGuiID id = window->GetID(label);
2885 ImRect bb(cell_r.Min.x, cell_r.Min.y, cell_r.Max.x, ImMax(cell_r.Max.y, cell_r.Min.y + label_height + g.Style.CellPadding.y * 2.0f));
2886 ItemSize(ImVec2(0.0f, label_height)); // Don't declare unclipped width, it'll be fed ContentMaxPosHeadersIdeal
2887 if (!ItemAdd(bb, id))
2888 return;
2889
2890 //GetForegroundDrawList()->AddRect(cell_r.Min, cell_r.Max, IM_COL32(255, 0, 0, 255)); // [DEBUG]
2891 //GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(255, 0, 0, 255)); // [DEBUG]
2892
2893 // Using AllowItemOverlap mode because we cover the whole cell, and we want user to be able to submit subsequent items.
2894 bool hovered, held;
2895 bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_AllowItemOverlap);
2896 if (g.ActiveId != id)
2898 if (held || hovered || selected)
2899 {
2901 //RenderFrame(bb.Min, bb.Max, col, false, 0.0f);
2904 }
2905 else
2906 {
2907 // Submit single cell bg color in the case we didn't submit a full header row
2908 if ((table->RowFlags & ImGuiTableRowFlags_Headers) == 0)
2910 }
2911 if (held)
2912 table->HeldHeaderColumn = (ImGuiTableColumnIdx)column_n;
2913 window->DC.CursorPos.y -= g.Style.ItemSpacing.y * 0.5f;
2914
2915 // Drag and drop to re-order columns.
2916 // FIXME-TABLE: Scroll request while reordering a column and it lands out of the scrolling zone.
2917 if (held && (table->Flags & ImGuiTableFlags_Reorderable) && IsMouseDragging(0) && !g.DragDropActive)
2918 {
2919 // While moving a column it will jump on the other side of the mouse, so we also test for MouseDelta.x
2920 table->ReorderColumn = (ImGuiTableColumnIdx)column_n;
2921 table->InstanceInteracted = table->InstanceCurrent;
2922
2923 // We don't reorder: through the frozen<>unfrozen line, or through a column that is marked with ImGuiTableColumnFlags_NoReorder.
2924 if (g.IO.MouseDelta.x < 0.0f && g.IO.MousePos.x < cell_r.Min.x)
2925 if (ImGuiTableColumn* prev_column = (column->PrevEnabledColumn != -1) ? &table->Columns[column->PrevEnabledColumn] : NULL)
2926 if (!((column->Flags | prev_column->Flags) & ImGuiTableColumnFlags_NoReorder))
2927 if ((column->IndexWithinEnabledSet < table->FreezeColumnsRequest) == (prev_column->IndexWithinEnabledSet < table->FreezeColumnsRequest))
2928 table->ReorderColumnDir = -1;
2929 if (g.IO.MouseDelta.x > 0.0f && g.IO.MousePos.x > cell_r.Max.x)
2930 if (ImGuiTableColumn* next_column = (column->NextEnabledColumn != -1) ? &table->Columns[column->NextEnabledColumn] : NULL)
2931 if (!((column->Flags | next_column->Flags) & ImGuiTableColumnFlags_NoReorder))
2932 if ((column->IndexWithinEnabledSet < table->FreezeColumnsRequest) == (next_column->IndexWithinEnabledSet < table->FreezeColumnsRequest))
2933 table->ReorderColumnDir = +1;
2934 }
2935
2936 // Sort order arrow
2937 const float ellipsis_max = cell_r.Max.x - w_arrow - w_sort_text;
2939 {
2940 if (column->SortOrder != -1)
2941 {
2942 float x = ImMax(cell_r.Min.x, cell_r.Max.x - w_arrow - w_sort_text);
2943 float y = label_pos.y;
2944 if (column->SortOrder > 0)
2945 {
2947 RenderText(ImVec2(x + g.Style.ItemInnerSpacing.x, y), sort_order_suf);
2948 PopStyleColor();
2949 x += w_sort_text;
2950 }
2952 }
2953
2954 // Handle clicking on column header to adjust Sort Order
2955 if (pressed && table->ReorderColumn != column_n)
2956 {
2957 ImGuiSortDirection sort_direction = TableGetColumnNextSortDirection(column);
2958 TableSetColumnSortDirection(column_n, sort_direction, g.IO.KeyShift);
2959 }
2960 }
2961
2962 // Render clipped label. Clipping here ensure that in the majority of situations, all our header cells will
2963 // be merged into a single draw call.
2964 //window->DrawList->AddCircleFilled(ImVec2(ellipsis_max, label_pos.y), 40, IM_COL32_WHITE);
2965 RenderTextEllipsis(window->DrawList, label_pos, ImVec2(ellipsis_max, label_pos.y + label_height + g.Style.FramePadding.y), ellipsis_max, ellipsis_max, label, label_end, &label_size);
2966
2967 const bool text_clipped = label_size.x > (ellipsis_max - label_pos.x);
2968 if (text_clipped && hovered && g.HoveredIdNotActiveTimer > g.TooltipSlowDelay)
2969 SetTooltip("%.*s", (int)(label_end - label), label);
2970
2971 // We don't use BeginPopupContextItem() because we want the popup to stay up even after the column is hidden
2972 if (IsMouseReleased(1) && IsItemHovered())
2973 TableOpenContextMenu(column_n);
2974}
@ ImGuiTableColumnFlags_NoReorder
Definition imgui.h:1172
@ ImGuiTableBgTarget_CellBg
Definition imgui.h:1223
IMGUI_API ImGuiSortDirection TableGetColumnNextSortDirection(ImGuiTableColumn *column)
Definition imgui_tables.cpp:2625
bool IsContextPopupOpen
Definition imgui_internal.h:2188
float RowMinHeight
Definition imgui_internal.h:2118

References ImGuiContext::ActiveId, ButtonBehavior(), CalcTextSize(), ImGuiStyle::CellPadding, ImGuiTable::CellPaddingY, col(), ImGuiTable::Columns, ImGuiTableColumn::ContentMaxXHeadersIdeal, ImGuiTableColumn::ContentMaxXHeadersUsed, ImGuiTable::ContextPopupColumn, ImGuiTable::CurrentColumn, ImGuiContext::CurrentTable, ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiContext::DragDropActive, ImGuiWindow::DrawList, FindRenderedTextEnd(), ImGuiTableColumn::Flags, ImGuiTable::Flags, ImGuiContext::FontSize, ImGuiStyle::FramePadding, ImGuiTable::FreezeColumnsRequest, GetColorU32(), ImGuiWindow::GetID(), GImGui, ImGuiTable::HeldHeaderColumn, ImGuiContext::HoveredIdNotActiveTimer, IM_ARRAYSIZE, IM_ASSERT, ImFloor(), ImFormatString(), ImGuiButtonFlags_AllowItemOverlap, ImGuiCol_Header, ImGuiCol_HeaderActive, ImGuiCol_HeaderHovered, ImGuiCol_TableHeaderBg, ImGuiCol_Text, ImGuiDir_Down, ImGuiDir_Up, ImGuiNavHighlightFlags_NoRounding, ImGuiNavHighlightFlags_TypeThin, ImGuiSortDirection_Ascending, ImGuiTableBgTarget_CellBg, ImGuiTableColumnFlags_NoReorder, ImGuiTableColumnFlags_NoSort, ImGuiTableFlags_Reorderable, ImGuiTableFlags_Sortable, ImGuiTableRowFlags_Headers, ImMax(), ImGuiTableColumn::IndexWithinEnabledSet, ImGuiTable::InstanceCurrent, ImGuiTable::InstanceInteracted, ImGuiContext::IO, ImGuiTable::IsContextPopupOpen, IsItemHovered(), IsMouseDragging(), IsMouseReleased(), ItemAdd(), ImGuiStyle::ItemInnerSpacing, ItemSize(), ImGuiStyle::ItemSpacing, ImGuiIO::KeyShift, ImRect::Max, ImRect::Min, ImGuiIO::MouseDelta, ImGuiIO::MousePos, ImGuiTableColumn::NextEnabledColumn, PopStyleColor(), ImGuiTableColumn::PrevEnabledColumn, PushStyleColor(), RenderArrow(), RenderNavHighlight(), RenderText(), RenderTextEllipsis(), ImGuiTable::ReorderColumn, ImGuiTable::ReorderColumnDir, ImGuiTable::RowFlags, ImGuiTable::RowMinHeight, SetItemAllowOverlap(), SetTooltip(), ImGuiWindow::SkipItems, ImGuiTableColumn::SortDirection, ImGuiTableColumn::SortOrder, ImGuiContext::Style, TableGetCellBgRect(), TableGetColumnNextSortDirection(), TableOpenContextMenu(), TableSetBgColor(), TableSetColumnSortDirection(), ImGuiContext::TooltipSlowDelay, ImGuiTableColumn::WorkMaxX, ImVec2::x, and ImVec2::y.

Referenced by ShowDemoWindowTables(), and TableHeadersRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableHeadersRow()

void ImGui::TableHeadersRow ( )
2796{
2797 ImGuiContext& g = *GImGui;
2798 ImGuiTable* table = g.CurrentTable;
2799 IM_ASSERT(table != NULL && "Need to call TableHeadersRow() after BeginTable()!");
2800
2801 // Layout if not already done (this is automatically done by TableNextRow, we do it here solely to facilitate stepping in debugger as it is frequent to step in TableUpdateLayout)
2802 if (!table->IsLayoutLocked)
2803 TableUpdateLayout(table);
2804
2805 // Open row
2806 const float row_y1 = GetCursorScreenPos().y;
2807 const float row_height = TableGetHeaderRowHeight();
2809 if (table->HostSkipItems) // Merely an optimization, you may skip in your own code.
2810 return;
2811
2812 const int columns_count = TableGetColumnCount();
2813 for (int column_n = 0; column_n < columns_count; column_n++)
2814 {
2815 if (!TableSetColumnIndex(column_n))
2816 continue;
2817
2818 // Push an id to allow unnamed labels (generally accidental, but let's behave nicely with them)
2819 // - in your own code you may omit the PushID/PopID all-together, provided you know they won't collide
2820 // - table->InstanceCurrent is only >0 when we use multiple BeginTable/EndTable calls with same identifier.
2821 const char* name = TableGetColumnName(column_n);
2822 PushID(table->InstanceCurrent * table->ColumnsCount + column_n);
2823 TableHeader(name);
2824 PopID();
2825 }
2826
2827 // Allow opening popup from the right-most section after the last column.
2828 ImVec2 mouse_pos = ImGui::GetMousePos();
2829 if (IsMouseReleased(1) && TableGetHoveredColumn() == columns_count)
2830 if (mouse_pos.y >= row_y1 && mouse_pos.y < row_y1 + row_height)
2831 TableOpenContextMenu(-1); // Will open a non-column-specific popup.
2832}
IMGUI_API void TableNextRow(ImGuiTableRowFlags row_flags=0, float min_row_height=0.0f)
Definition imgui_tables.cpp:1657
IMGUI_API float TableGetHeaderRowHeight()
Definition imgui_tables.cpp:2774
IMGUI_API ImVec2 GetMousePos()
Definition imgui.cpp:4752
IMGUI_API bool TableSetColumnIndex(int column_n)
Definition imgui_tables.cpp:1869
IMGUI_API void TableHeader(const char *label)
Definition imgui_tables.cpp:2837

References ImGuiTable::ColumnsCount, ImGuiContext::CurrentTable, GetCursorScreenPos(), GetMousePos(), GImGui, ImGuiTable::HostSkipItems, IM_ASSERT, ImGuiTableRowFlags_Headers, ImGuiTable::InstanceCurrent, ImGuiTable::IsLayoutLocked, IsMouseReleased(), PopID(), PushID(), TableGetColumnCount(), TableGetColumnName(), TableGetHeaderRowHeight(), TableGetHoveredColumn(), TableHeader(), TableNextRow(), TableOpenContextMenu(), TableSetColumnIndex(), TableUpdateLayout(), and ImVec2::y.

Referenced by ShowDemoWindowTables().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableLoadSettings()

void ImGui::TableLoadSettings ( ImGuiTable table)
3234{
3235 ImGuiContext& g = *GImGui;
3236 table->IsSettingsRequestLoad = false;
3238 return;
3239
3240 // Bind settings
3241 ImGuiTableSettings* settings;
3242 if (table->SettingsOffset == -1)
3243 {
3244 settings = TableSettingsFindByID(table->ID);
3245 if (settings == NULL)
3246 return;
3247 if (settings->ColumnsCount != table->ColumnsCount) // Allow settings if columns count changed. We could otherwise decide to return...
3248 table->IsSettingsDirty = true;
3249 table->SettingsOffset = g.SettingsTables.offset_from_ptr(settings);
3250 }
3251 else
3252 {
3253 settings = TableGetBoundSettings(table);
3254 }
3255
3256 table->SettingsLoadedFlags = settings->SaveFlags;
3257 table->RefScale = settings->RefScale;
3258
3259 // Serialize ImGuiTableSettings/ImGuiTableColumnSettings into ImGuiTable/ImGuiTableColumn
3260 ImGuiTableColumnSettings* column_settings = settings->GetColumnSettings();
3261 ImU64 display_order_mask = 0;
3262 for (int data_n = 0; data_n < settings->ColumnsCount; data_n++, column_settings++)
3263 {
3264 int column_n = column_settings->Index;
3265 if (column_n < 0 || column_n >= table->ColumnsCount)
3266 continue;
3267
3268 ImGuiTableColumn* column = &table->Columns[column_n];
3269 if (settings->SaveFlags & ImGuiTableFlags_Resizable)
3270 {
3271 if (column_settings->IsStretch)
3272 column->StretchWeight = column_settings->WidthOrWeight;
3273 else
3274 column->WidthRequest = column_settings->WidthOrWeight;
3275 column->AutoFitQueue = 0x00;
3276 }
3277 if (settings->SaveFlags & ImGuiTableFlags_Reorderable)
3278 column->DisplayOrder = column_settings->DisplayOrder;
3279 else
3280 column->DisplayOrder = (ImGuiTableColumnIdx)column_n;
3281 display_order_mask |= (ImU64)1 << column->DisplayOrder;
3282 column->IsEnabled = column->IsEnabledNextFrame = column_settings->IsEnabled;
3283 column->SortOrder = column_settings->SortOrder;
3284 column->SortDirection = column_settings->SortDirection;
3285 }
3286
3287 // Validate and fix invalid display order data
3288 const ImU64 expected_display_order_mask = (settings->ColumnsCount == 64) ? ~0 : ((ImU64)1 << settings->ColumnsCount) - 1;
3289 if (display_order_mask != expected_display_order_mask)
3290 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
3291 table->Columns[column_n].DisplayOrder = (ImGuiTableColumnIdx)column_n;
3292
3293 // Rebuild index
3294 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
3295 table->DisplayOrderToIndex[table->Columns[column_n].DisplayOrder] = (ImGuiTableColumnIdx)column_n;
3296}
@ ImGuiTableFlags_NoSavedSettings
Definition imgui.h:1114
IMGUI_API ImGuiTableSettings * TableSettingsFindByID(ImGuiID id)
Definition imgui_tables.cpp:3144
int offset_from_ptr(const T *p)
Definition imgui_internal.h:646
ImU8 AutoFitQueue
Definition imgui_internal.h:2066
float StretchWeight
Definition imgui_internal.h:2038
ImU8 IsEnabled
Definition imgui_internal.h:2238
ImGuiTableColumnIdx Index
Definition imgui_internal.h:2234
ImU8 IsStretch
Definition imgui_internal.h:2239
float WidthOrWeight
Definition imgui_internal.h:2232
ImGuiTableFlags SettingsLoadedFlags
Definition imgui_internal.h:2108
float RefScale
Definition imgui_internal.h:2258

References ImGuiTableColumn::AutoFitQueue, ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTableSettings::ColumnsCount, ImGuiTableColumn::DisplayOrder, ImGuiTableColumnSettings::DisplayOrder, ImGuiTable::DisplayOrderToIndex, ImGuiTable::Flags, ImGuiTableSettings::GetColumnSettings(), GImGui, ImGuiTable::ID, ImGuiTableFlags_NoSavedSettings, ImGuiTableFlags_Reorderable, ImGuiTableFlags_Resizable, ImGuiTableColumnSettings::Index, ImGuiTableColumn::IsEnabled, ImGuiTableColumnSettings::IsEnabled, ImGuiTableColumn::IsEnabledNextFrame, ImGuiTable::IsSettingsDirty, ImGuiTable::IsSettingsRequestLoad, ImGuiTableColumnSettings::IsStretch, ImChunkStream< T >::offset_from_ptr(), ImGuiTable::RefScale, ImGuiTableSettings::RefScale, ImGuiTableSettings::SaveFlags, ImGuiTable::SettingsLoadedFlags, ImGuiTable::SettingsOffset, ImGuiContext::SettingsTables, ImGuiTableColumn::SortDirection, ImGuiTableColumnSettings::SortDirection, ImGuiTableColumn::SortOrder, ImGuiTableColumnSettings::SortOrder, ImGuiTableColumn::StretchWeight, TableGetBoundSettings(), TableSettingsFindByID(), ImGuiTableColumnSettings::WidthOrWeight, and ImGuiTableColumn::WidthRequest.

Referenced by BeginTableEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableMergeDrawChannels()

void ImGui::TableMergeDrawChannels ( ImGuiTable table)
2311{
2312 ImGuiContext& g = *GImGui;
2313 ImDrawListSplitter* splitter = table->DrawSplitter;
2314 const bool has_freeze_v = (table->FreezeRowsCount > 0);
2315 const bool has_freeze_h = (table->FreezeColumnsCount > 0);
2316 IM_ASSERT(splitter->_Current == 0);
2317
2318 // Track which groups we are going to attempt to merge, and which channels goes into each group.
2319 struct MergeGroup
2320 {
2321 ImRect ClipRect;
2322 int ChannelsCount;
2324
2325 MergeGroup() { ChannelsCount = 0; }
2326 };
2327 int merge_group_mask = 0x00;
2328 MergeGroup merge_groups[4];
2329
2330 // 1. Scan channels and take note of those which can be merged
2331 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
2332 {
2333 if ((table->VisibleMaskByIndex & ((ImU64)1 << column_n)) == 0)
2334 continue;
2335 ImGuiTableColumn* column = &table->Columns[column_n];
2336
2337 const int merge_group_sub_count = has_freeze_v ? 2 : 1;
2338 for (int merge_group_sub_n = 0; merge_group_sub_n < merge_group_sub_count; merge_group_sub_n++)
2339 {
2340 const int channel_no = (merge_group_sub_n == 0) ? column->DrawChannelFrozen : column->DrawChannelUnfrozen;
2341
2342 // Don't attempt to merge if there are multiple draw calls within the column
2343 ImDrawChannel* src_channel = &splitter->_Channels[channel_no];
2344 if (src_channel->_CmdBuffer.Size > 0 && src_channel->_CmdBuffer.back().ElemCount == 0)
2345 src_channel->_CmdBuffer.pop_back();
2346 if (src_channel->_CmdBuffer.Size != 1)
2347 continue;
2348
2349 // Find out the width of this merge group and check if it will fit in our column
2350 // (note that we assume that rendering didn't stray on the left direction. we should need a CursorMinPos to detect it)
2351 if (!(column->Flags & ImGuiTableColumnFlags_NoClip))
2352 {
2353 float content_max_x;
2354 if (!has_freeze_v)
2355 content_max_x = ImMax(column->ContentMaxXUnfrozen, column->ContentMaxXHeadersUsed); // No row freeze
2356 else if (merge_group_sub_n == 0)
2357 content_max_x = ImMax(column->ContentMaxXFrozen, column->ContentMaxXHeadersUsed); // Row freeze: use width before freeze
2358 else
2359 content_max_x = column->ContentMaxXUnfrozen; // Row freeze: use width after freeze
2360 if (content_max_x > column->ClipRect.Max.x)
2361 continue;
2362 }
2363
2364 const int merge_group_n = (has_freeze_h && column_n < table->FreezeColumnsCount ? 0 : 1) + (has_freeze_v && merge_group_sub_n == 0 ? 0 : 2);
2366 MergeGroup* merge_group = &merge_groups[merge_group_n];
2367 if (merge_group->ChannelsCount == 0)
2368 merge_group->ClipRect = ImRect(+FLT_MAX, +FLT_MAX, -FLT_MAX, -FLT_MAX);
2369 merge_group->ChannelsMask.SetBit(channel_no);
2370 merge_group->ChannelsCount++;
2371 merge_group->ClipRect.Add(src_channel->_CmdBuffer[0].ClipRect);
2372 merge_group_mask |= (1 << merge_group_n);
2373 }
2374
2375 // Invalidate current draw channel
2376 // (we don't clear DrawChannelFrozen/DrawChannelUnfrozen solely to facilitate debugging/later inspection of data)
2378 }
2379
2380 // [DEBUG] Display merge groups
2381#if 0
2382 if (g.IO.KeyShift)
2383 for (int merge_group_n = 0; merge_group_n < IM_ARRAYSIZE(merge_groups); merge_group_n++)
2384 {
2385 MergeGroup* merge_group = &merge_groups[merge_group_n];
2386 if (merge_group->ChannelsCount == 0)
2387 continue;
2388 char buf[32];
2389 ImFormatString(buf, 32, "MG%d:%d", merge_group_n, merge_group->ChannelsCount);
2390 ImVec2 text_pos = merge_group->ClipRect.Min + ImVec2(4, 4);
2391 ImVec2 text_size = CalcTextSize(buf, NULL);
2392 GetForegroundDrawList()->AddRectFilled(text_pos, text_pos + text_size, IM_COL32(0, 0, 0, 255));
2393 GetForegroundDrawList()->AddText(text_pos, IM_COL32(255, 255, 0, 255), buf, NULL);
2394 GetForegroundDrawList()->AddRect(merge_group->ClipRect.Min, merge_group->ClipRect.Max, IM_COL32(255, 255, 0, 255));
2395 }
2396#endif
2397
2398 // 2. Rewrite channel list in our preferred order
2399 if (merge_group_mask != 0)
2400 {
2401 // We skip channel 0 (Bg0/Bg1) and 1 (Bg2 frozen) from the shuffling since they won't move - see channels allocation in TableSetupDrawChannels().
2402 const int LEADING_DRAW_CHANNELS = 2;
2403 g.DrawChannelsTempMergeBuffer.resize(splitter->_Count - LEADING_DRAW_CHANNELS); // Use shared temporary storage so the allocation gets amortized
2405 ImBitArray<IMGUI_TABLE_MAX_DRAW_CHANNELS> remaining_mask; // We need 132-bit of storage
2406 remaining_mask.SetBitRange(LEADING_DRAW_CHANNELS, splitter->_Count);
2407 remaining_mask.ClearBit(table->Bg2DrawChannelUnfrozen);
2408 IM_ASSERT(has_freeze_v == false || table->Bg2DrawChannelUnfrozen != TABLE_DRAW_CHANNEL_BG2_FROZEN);
2409 int remaining_count = splitter->_Count - (has_freeze_v ? LEADING_DRAW_CHANNELS + 1 : LEADING_DRAW_CHANNELS);
2410 //ImRect host_rect = (table->InnerWindow == table->OuterWindow) ? table->InnerClipRect : table->HostClipRect;
2411 ImRect host_rect = table->HostClipRect;
2412 for (int merge_group_n = 0; merge_group_n < IM_ARRAYSIZE(merge_groups); merge_group_n++)
2413 {
2414 if (int merge_channels_count = merge_groups[merge_group_n].ChannelsCount)
2415 {
2416 MergeGroup* merge_group = &merge_groups[merge_group_n];
2417 ImRect merge_clip_rect = merge_group->ClipRect;
2418
2419 // Extend outer-most clip limits to match those of host, so draw calls can be merged even if
2420 // outer-most columns have some outer padding offsetting them from their parent ClipRect.
2421 // The principal cases this is dealing with are:
2422 // - On a same-window table (not scrolling = single group), all fitting columns ClipRect -> will extend and match host ClipRect -> will merge
2423 // - Columns can use padding and have left-most ClipRect.Min.x and right-most ClipRect.Max.x != from host ClipRect -> will extend and match host ClipRect -> will merge
2424 // FIXME-TABLE FIXME-WORKRECT: We are wasting a merge opportunity on tables without scrolling if column doesn't fit
2425 // within host clip rect, solely because of the half-padding difference between window->WorkRect and window->InnerClipRect.
2426 if ((merge_group_n & 1) == 0 || !has_freeze_h)
2427 merge_clip_rect.Min.x = ImMin(merge_clip_rect.Min.x, host_rect.Min.x);
2428 if ((merge_group_n & 2) == 0 || !has_freeze_v)
2429 merge_clip_rect.Min.y = ImMin(merge_clip_rect.Min.y, host_rect.Min.y);
2430 if ((merge_group_n & 1) != 0)
2431 merge_clip_rect.Max.x = ImMax(merge_clip_rect.Max.x, host_rect.Max.x);
2432 if ((merge_group_n & 2) != 0 && (table->Flags & ImGuiTableFlags_NoHostExtendY) == 0)
2433 merge_clip_rect.Max.y = ImMax(merge_clip_rect.Max.y, host_rect.Max.y);
2434#if 0
2435 GetOverlayDrawList()->AddRect(merge_group->ClipRect.Min, merge_group->ClipRect.Max, IM_COL32(255, 0, 0, 200), 0.0f, 0, 1.0f);
2436 GetOverlayDrawList()->AddLine(merge_group->ClipRect.Min, merge_clip_rect.Min, IM_COL32(255, 100, 0, 200));
2437 GetOverlayDrawList()->AddLine(merge_group->ClipRect.Max, merge_clip_rect.Max, IM_COL32(255, 100, 0, 200));
2438#endif
2439 remaining_count -= merge_group->ChannelsCount;
2440 for (int n = 0; n < IM_ARRAYSIZE(remaining_mask.Storage); n++)
2441 remaining_mask.Storage[n] &= ~merge_group->ChannelsMask.Storage[n];
2442 for (int n = 0; n < splitter->_Count && merge_channels_count != 0; n++)
2443 {
2444 // Copy + overwrite new clip rect
2445 if (!merge_group->ChannelsMask.TestBit(n))
2446 continue;
2447 merge_group->ChannelsMask.ClearBit(n);
2448 merge_channels_count--;
2449
2450 ImDrawChannel* channel = &splitter->_Channels[n];
2451 IM_ASSERT(channel->_CmdBuffer.Size == 1 && merge_clip_rect.Contains(ImRect(channel->_CmdBuffer[0].ClipRect)));
2452 channel->_CmdBuffer[0].ClipRect = merge_clip_rect.ToVec4();
2453 memcpy(dst_tmp++, channel, sizeof(ImDrawChannel));
2454 }
2455 }
2456
2457 // Make sure Bg2DrawChannelUnfrozen appears in the middle of our groups (whereas Bg0/Bg1 and Bg2 frozen are fixed to 0 and 1)
2458 if (merge_group_n == 1 && has_freeze_v)
2459 memcpy(dst_tmp++, &splitter->_Channels[table->Bg2DrawChannelUnfrozen], sizeof(ImDrawChannel));
2460 }
2461
2462 // Append unmergeable channels that we didn't reorder at the end of the list
2463 for (int n = 0; n < splitter->_Count && remaining_count != 0; n++)
2464 {
2465 if (!remaining_mask.TestBit(n))
2466 continue;
2467 ImDrawChannel* channel = &splitter->_Channels[n];
2468 memcpy(dst_tmp++, channel, sizeof(ImDrawChannel));
2469 remaining_count--;
2470 }
2472 memcpy(splitter->_Channels.Data + LEADING_DRAW_CHANNELS, g.DrawChannelsTempMergeBuffer.Data, (splitter->_Count - LEADING_DRAW_CHANNELS) * sizeof(ImDrawChannel));
2473 }
2474}
@ ImGuiTableColumnFlags_NoClip
Definition imgui.h:1174
#define IMGUI_TABLE_MAX_DRAW_CHANNELS
Definition imgui_internal.h:2020
ImU8 ImGuiTableDrawChannelIdx
Definition imgui_internal.h:2024
static const int TABLE_DRAW_CHANNEL_BG2_FROZEN
Definition imgui_tables.cpp:257
Definition imgui_internal.h:528
ImU32 Storage[(BITCOUNT+31) > > 5]
Definition imgui_internal.h:529
bool TestBit(int n) const
Definition imgui_internal.h:533
void ClearBit(int n)
Definition imgui_internal.h:535
void SetBitRange(int n, int n2)
Definition imgui_internal.h:536
int _Current
Definition imgui.h:2294
int _Count
Definition imgui.h:2295
ImGuiTableDrawChannelIdx DrawChannelFrozen
Definition imgui_internal.h:2056
ImU64 VisibleMaskByIndex
Definition imgui_internal.h:2106

References ImDrawListSplitter::_Channels, ImDrawChannel::_CmdBuffer, ImDrawListSplitter::_Count, ImDrawListSplitter::_Current, ImDrawList::AddRect(), ImDrawList::AddRectFilled(), ImDrawList::AddText(), ImVector< T >::back(), ImGuiTable::Bg2DrawChannelUnfrozen, CalcTextSize(), ImBitArray< BITCOUNT >::ClearBit(), ImGuiTableColumn::ClipRect, ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImRect::Contains(), ImGuiTableColumn::ContentMaxXFrozen, ImGuiTableColumn::ContentMaxXHeadersUsed, ImGuiTableColumn::ContentMaxXUnfrozen, ImVector< T >::Data, ImGuiTableColumn::DrawChannelCurrent, ImGuiTableColumn::DrawChannelFrozen, ImGuiContext::DrawChannelsTempMergeBuffer, ImGuiTableColumn::DrawChannelUnfrozen, ImGuiTable::DrawSplitter, ImDrawCmd::ElemCount, ImGuiTableColumn::Flags, ImGuiTable::Flags, ImGuiTable::FreezeColumnsCount, ImGuiTable::FreezeRowsCount, GetForegroundDrawList(), GImGui, ImGuiTable::HostClipRect, IM_ARRAYSIZE, IM_ASSERT, IM_COL32, ImFormatString(), IMGUI_TABLE_MAX_DRAW_CHANNELS, ImGuiTableColumnFlags_NoClip, ImGuiTableFlags_NoHostExtendY, ImMax(), ImMin(), ImGuiContext::IO, ImGuiIO::KeyShift, ImRect::Max, ImRect::Min, ImVector< T >::pop_back(), ImVector< T >::resize(), ImBitArray< BITCOUNT >::SetBitRange(), ImVector< T >::Size, ImBitArray< BITCOUNT >::Storage, TABLE_DRAW_CHANNEL_BG2_FROZEN, ImBitArray< BITCOUNT >::TestBit(), ImRect::ToVec4(), ImGuiTable::VisibleMaskByIndex, ImVec2::x, and ImVec2::y.

Referenced by EndTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableNextColumn()

bool ImGui::TableNextColumn ( )
1891{
1892 ImGuiContext& g = *GImGui;
1893 ImGuiTable* table = g.CurrentTable;
1894 if (!table)
1895 return false;
1896
1897 if (table->IsInsideRow && table->CurrentColumn + 1 < table->ColumnsCount)
1898 {
1899 if (table->CurrentColumn != -1)
1900 TableEndCell(table);
1901 TableBeginCell(table, table->CurrentColumn + 1);
1902 }
1903 else
1904 {
1905 TableNextRow();
1906 TableBeginCell(table, 0);
1907 }
1908
1909 // Return whether the column is visible. User may choose to skip submitting items based on this return value,
1910 // however they shouldn't skip submitting for columns that may have the tallest contribution to row height.
1911 int column_n = table->CurrentColumn;
1912 return (table->RequestOutputMaskByIndex & ((ImU64)1 << column_n)) != 0;
1913}
IMGUI_API void TableBeginCell(ImGuiTable *table, int column_n)
Definition imgui_tables.cpp:1919
ImU64 RequestOutputMaskByIndex
Definition imgui_internal.h:2107

References ImGuiTable::ColumnsCount, ImGuiTable::CurrentColumn, ImGuiContext::CurrentTable, GImGui, ImGuiTable::IsInsideRow, ImGuiTable::RequestOutputMaskByIndex, TableBeginCell(), TableEndCell(), and TableNextRow().

Referenced by ShowDemoWindow(), ShowDemoWindowLayout(), ShowDemoWindowTables(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableNextRow()

void ImGui::TableNextRow ( ImGuiTableRowFlags  row_flags = 0,
float  min_row_height = 0.0f 
)
1658{
1659 ImGuiContext& g = *GImGui;
1660 ImGuiTable* table = g.CurrentTable;
1661
1662 if (!table->IsLayoutLocked)
1663 TableUpdateLayout(table);
1664 if (table->IsInsideRow)
1665 TableEndRow(table);
1666
1667 table->LastRowFlags = table->RowFlags;
1668 table->RowFlags = row_flags;
1669 table->RowMinHeight = row_min_height;
1670 TableBeginRow(table);
1671
1672 // We honor min_row_height requested by user, but cannot guarantee per-row maximum height,
1673 // because that would essentially require a unique clipping rectangle per-cell.
1674 table->RowPosY2 += table->CellPaddingY * 2.0f;
1675 table->RowPosY2 = ImMax(table->RowPosY2, table->RowPosY1 + row_min_height);
1676
1677 // Disable output until user calls TableNextColumn()
1678 table->InnerWindow->SkipItems = true;
1679}
IMGUI_API void TableBeginRow(ImGuiTable *table)
Definition imgui_tables.cpp:1682

References ImGuiTable::CellPaddingY, ImGuiContext::CurrentTable, GImGui, ImMax(), ImGuiTable::InnerWindow, ImGuiTable::IsInsideRow, ImGuiTable::IsLayoutLocked, ImGuiTable::LastRowFlags, ImGuiTable::RowFlags, ImGuiTable::RowMinHeight, ImGuiTable::RowPosY1, ImGuiTable::RowPosY2, ImGuiWindow::SkipItems, TableBeginRow(), TableEndRow(), and TableUpdateLayout().

Referenced by Slic3r::GUI::GLCanvas3D::_picking_pass(), Slic3r::GUI::add_row_to_table(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::GCodeViewer::render_legend(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowPlaceholderObject(), TableHeadersRow(), and TableNextColumn().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableOpenContextMenu()

void ImGui::TableOpenContextMenu ( int  column_n = -1)
2985{
2986 ImGuiContext& g = *GImGui;
2987 ImGuiTable* table = g.CurrentTable;
2988 if (column_n == -1 && table->CurrentColumn != -1) // When called within a column automatically use this one (for consistency)
2989 column_n = table->CurrentColumn;
2990 if (column_n == table->ColumnsCount) // To facilitate using with TableGetHoveredColumn()
2991 column_n = -1;
2992 IM_ASSERT(column_n >= -1 && column_n < table->ColumnsCount);
2994 {
2995 table->IsContextPopupOpen = true;
2996 table->ContextPopupColumn = (ImGuiTableColumnIdx)column_n;
2997 table->InstanceInteracted = table->InstanceCurrent;
2998 const ImGuiID context_menu_id = ImHashStr("##ContextMenu", 0, table->ID);
2999 OpenPopupEx(context_menu_id, ImGuiPopupFlags_None);
3000 }
3001}

References ImGuiTable::ColumnsCount, ImGuiTable::ContextPopupColumn, ImGuiTable::CurrentColumn, ImGuiContext::CurrentTable, ImGuiTable::Flags, GImGui, ImGuiTable::ID, IM_ASSERT, ImGuiPopupFlags_None, ImGuiTableFlags_Hideable, ImGuiTableFlags_Reorderable, ImGuiTableFlags_Resizable, ImHashStr(), ImGuiTable::InstanceCurrent, ImGuiTable::InstanceInteracted, ImGuiTable::IsContextPopupOpen, and OpenPopupEx().

Referenced by EndTable(), TableHeader(), and TableHeadersRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TablePopBackgroundChannel()

void ImGui::TablePopBackgroundChannel ( )
2215{
2216 ImGuiContext& g = *GImGui;
2217 ImGuiWindow* window = g.CurrentWindow;
2218 ImGuiTable* table = g.CurrentTable;
2219 ImGuiTableColumn* column = &table->Columns[table->CurrentColumn];
2220
2221 // Optimization: avoid PopClipRect() + SetCurrentChannel()
2224}
ImRect HostBackupInnerClipRect
Definition imgui_internal.h:2152

References ImGuiTable::Columns, ImGuiTable::CurrentColumn, ImGuiContext::CurrentTable, ImGuiContext::CurrentWindow, ImGuiTableColumn::DrawChannelCurrent, ImGuiWindow::DrawList, ImGuiTable::DrawSplitter, GImGui, ImGuiTable::HostBackupInnerClipRect, ImDrawListSplitter::SetCurrentChannel(), and SetWindowClipRectBeforeSetChannel().

Referenced by Slic3r::GUI::selectable(), and Selectable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TablePushBackgroundChannel()

void ImGui::TablePushBackgroundChannel ( )
2203{
2204 ImGuiContext& g = *GImGui;
2205 ImGuiWindow* window = g.CurrentWindow;
2206 ImGuiTable* table = g.CurrentTable;
2207
2208 // Optimization: avoid SetCurrentChannel() + PushClipRect()
2209 table->HostBackupInnerClipRect = window->ClipRect;
2212}

References ImGuiTable::Bg2ClipRectForDrawCmd, ImGuiTable::Bg2DrawChannelCurrent, ImGuiWindow::ClipRect, ImGuiContext::CurrentTable, ImGuiContext::CurrentWindow, ImGuiWindow::DrawList, ImGuiTable::DrawSplitter, GImGui, ImGuiTable::HostBackupInnerClipRect, ImDrawListSplitter::SetCurrentChannel(), and SetWindowClipRectBeforeSetChannel().

Referenced by Slic3r::GUI::selectable(), and Selectable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableRemove()

void ImGui::TableRemove ( ImGuiTable table)
3428{
3429 //IMGUI_DEBUG_LOG("TableRemove() id=0x%08X\n", table->ID);
3430 ImGuiContext& g = *GImGui;
3431 int table_idx = g.Tables.GetIndex(table);
3432 //memset(table->RawData.Data, 0, table->RawData.size_in_bytes());
3433 //memset(table, 0, sizeof(ImGuiTable));
3434 g.Tables.Remove(table->ID, table);
3435 g.TablesLastTimeActive[table_idx] = -1.0f;
3436}
void Remove(ImGuiID key, const T *p)
Definition imgui_internal.h:622

References ImPool< T >::GetIndex(), GImGui, ImGuiTable::ID, ImPool< T >::Remove(), ImGuiContext::Tables, and ImGuiContext::TablesLastTimeActive.

+ Here is the call graph for this function:

◆ TableResetSettings()

void ImGui::TableResetSettings ( ImGuiTable table)
3171{
3172 table->IsInitializing = table->IsSettingsDirty = true;
3173 table->IsResetAllRequest = false;
3174 table->IsSettingsRequestLoad = false; // Don't reload from ini
3175 table->SettingsLoadedFlags = ImGuiTableFlags_None; // Mark as nothing loaded so our initialized data becomes authoritative
3176}
@ ImGuiTableFlags_None
Definition imgui.h:1109

References ImGuiTableFlags_None, ImGuiTable::IsInitializing, ImGuiTable::IsResetAllRequest, ImGuiTable::IsSettingsDirty, ImGuiTable::IsSettingsRequestLoad, and ImGuiTable::SettingsLoadedFlags.

Referenced by BeginTableEx().

+ Here is the caller graph for this function:

◆ TableSaveSettings()

void ImGui::TableSaveSettings ( ImGuiTable table)
3179{
3180 table->IsSettingsDirty = false;
3182 return;
3183
3184 // Bind or create settings data
3185 ImGuiContext& g = *GImGui;
3186 ImGuiTableSettings* settings = TableGetBoundSettings(table);
3187 if (settings == NULL)
3188 {
3189 settings = TableSettingsCreate(table->ID, table->ColumnsCount);
3190 table->SettingsOffset = g.SettingsTables.offset_from_ptr(settings);
3191 }
3192 settings->ColumnsCount = (ImGuiTableColumnIdx)table->ColumnsCount;
3193
3194 // Serialize ImGuiTable/ImGuiTableColumn into ImGuiTableSettings/ImGuiTableColumnSettings
3195 IM_ASSERT(settings->ID == table->ID);
3196 IM_ASSERT(settings->ColumnsCount == table->ColumnsCount && settings->ColumnsCountMax >= settings->ColumnsCount);
3197 ImGuiTableColumn* column = table->Columns.Data;
3198 ImGuiTableColumnSettings* column_settings = settings->GetColumnSettings();
3199
3200 bool save_ref_scale = false;
3201 settings->SaveFlags = ImGuiTableFlags_None;
3202 for (int n = 0; n < table->ColumnsCount; n++, column++, column_settings++)
3203 {
3204 const float width_or_weight = (column->Flags & ImGuiTableColumnFlags_WidthStretch) ? column->StretchWeight : column->WidthRequest;
3205 column_settings->WidthOrWeight = width_or_weight;
3206 column_settings->Index = (ImGuiTableColumnIdx)n;
3207 column_settings->DisplayOrder = column->DisplayOrder;
3208 column_settings->SortOrder = column->SortOrder;
3209 column_settings->SortDirection = column->SortDirection;
3210 column_settings->IsEnabled = column->IsEnabled;
3211 column_settings->IsStretch = (column->Flags & ImGuiTableColumnFlags_WidthStretch) ? 1 : 0;
3212 if ((column->Flags & ImGuiTableColumnFlags_WidthStretch) == 0)
3213 save_ref_scale = true;
3214
3215 // We skip saving some data in the .ini file when they are unnecessary to restore our state.
3216 // Note that fixed width where initial width was derived from auto-fit will always be saved as InitStretchWeightOrWidth will be 0.0f.
3217 // FIXME-TABLE: We don't have logic to easily compare SortOrder to DefaultSortOrder yet so it's always saved when present.
3218 if (width_or_weight != column->InitStretchWeightOrWidth)
3220 if (column->DisplayOrder != n)
3222 if (column->SortOrder != -1)
3224 if (column->IsEnabled != ((column->Flags & ImGuiTableColumnFlags_DefaultHide) == 0))
3226 }
3227 settings->SaveFlags &= table->Flags;
3228 settings->RefScale = save_ref_scale ? table->RefScale : 0.0f;
3229
3231}
@ ImGuiTableColumnFlags_DefaultHide
Definition imgui.h:1167
IMGUI_API ImGuiTableSettings * TableSettingsCreate(ImGuiID id, int columns_count)
Definition imgui_tables.cpp:3135

References ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTableSettings::ColumnsCount, ImGuiTableSettings::ColumnsCountMax, ImSpan< T >::Data, ImGuiTableColumn::DisplayOrder, ImGuiTableColumnSettings::DisplayOrder, ImGuiTableColumn::Flags, ImGuiTable::Flags, ImGuiTableSettings::GetColumnSettings(), GImGui, ImGuiTable::ID, ImGuiTableSettings::ID, IM_ASSERT, ImGuiTableColumnFlags_DefaultHide, ImGuiTableColumnFlags_WidthStretch, ImGuiTableFlags_Hideable, ImGuiTableFlags_None, ImGuiTableFlags_NoSavedSettings, ImGuiTableFlags_Reorderable, ImGuiTableFlags_Resizable, ImGuiTableFlags_Sortable, ImGuiTableColumnSettings::Index, ImGuiTableColumn::InitStretchWeightOrWidth, ImGuiTableColumn::IsEnabled, ImGuiTableColumnSettings::IsEnabled, ImGuiTable::IsSettingsDirty, ImGuiTableColumnSettings::IsStretch, MarkIniSettingsDirty(), ImChunkStream< T >::offset_from_ptr(), ImGuiTable::RefScale, ImGuiTableSettings::RefScale, ImGuiTableSettings::SaveFlags, ImGuiTable::SettingsOffset, ImGuiContext::SettingsTables, ImGuiTableColumn::SortDirection, ImGuiTableColumnSettings::SortDirection, ImGuiTableColumn::SortOrder, ImGuiTableColumnSettings::SortOrder, ImGuiTableColumn::StretchWeight, TableGetBoundSettings(), TableSettingsCreate(), ImGuiTableColumnSettings::WidthOrWeight, and ImGuiTableColumn::WidthRequest.

Referenced by EndTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableSetBgColor()

void ImGui::TableSetBgColor ( ImGuiTableBgTarget  target,
ImU32  color,
int  column_n = -1 
)
1596{
1597 ImGuiContext& g = *GImGui;
1598 ImGuiTable* table = g.CurrentTable;
1600
1601 if (color == IM_COL32_DISABLE)
1602 color = 0;
1603
1604 // We cannot draw neither the cell or row background immediately as we don't know the row height at this point in time.
1605 switch (target)
1606 {
1608 {
1609 if (table->RowPosY1 > table->InnerClipRect.Max.y) // Discard
1610 return;
1611 if (column_n == -1)
1612 column_n = table->CurrentColumn;
1613 if ((table->VisibleMaskByIndex & ((ImU64)1 << column_n)) == 0)
1614 return;
1615 if (table->RowCellDataCurrent < 0 || table->RowCellData[table->RowCellDataCurrent].Column != column_n)
1616 table->RowCellDataCurrent++;
1617 ImGuiTableCellData* cell_data = &table->RowCellData[table->RowCellDataCurrent];
1618 cell_data->BgColor = color;
1619 cell_data->Column = (ImGuiTableColumnIdx)column_n;
1620 break;
1621 }
1624 {
1625 if (table->RowPosY1 > table->InnerClipRect.Max.y) // Discard
1626 return;
1627 IM_ASSERT(column_n == -1);
1628 int bg_idx = (target == ImGuiTableBgTarget_RowBg1) ? 1 : 0;
1629 table->RowBgColor[bg_idx] = color;
1630 break;
1631 }
1632 default:
1633 IM_ASSERT(0);
1634 }
1635}
@ ImGuiTableBgTarget_RowBg1
Definition imgui.h:1222
@ ImGuiTableBgTarget_None
Definition imgui.h:1220
ImU32 BgColor
Definition imgui_internal.h:2090
ImGuiTableColumnIdx Column
Definition imgui_internal.h:2091

References ImGuiTableCellData::BgColor, ImGuiTableCellData::Column, ImGuiTable::CurrentColumn, ImGuiContext::CurrentTable, GImGui, IM_ASSERT, IM_COL32_DISABLE, ImGuiTableBgTarget_CellBg, ImGuiTableBgTarget_None, ImGuiTableBgTarget_RowBg0, ImGuiTableBgTarget_RowBg1, ImGuiTable::InnerClipRect, ImRect::Max, ImGuiTable::RowBgColor, ImGuiTable::RowCellData, ImGuiTable::RowCellDataCurrent, ImGuiTable::RowPosY1, ImGuiTable::VisibleMaskByIndex, and ImVec2::y.

Referenced by ShowDemoWindowTables(), TableBeginRow(), and TableHeader().

+ Here is the caller graph for this function:

◆ TableSetColumnEnabled()

void ImGui::TableSetColumnEnabled ( int  column_n,
bool  v 
)
1533{
1534 ImGuiContext& g = *GImGui;
1535 ImGuiTable* table = g.CurrentTable;
1536 IM_ASSERT(table != NULL);
1537 if (!table)
1538 return;
1539 if (column_n < 0)
1540 column_n = table->CurrentColumn;
1541 IM_ASSERT(column_n >= 0 && column_n < table->ColumnsCount);
1542 ImGuiTableColumn* column = &table->Columns[column_n];
1543 column->IsEnabledNextFrame = enabled;
1544}

References ImGuiTable::Columns, ImGuiTable::CurrentColumn, ImGuiContext::CurrentTable, GImGui, IM_ASSERT, and ImGuiTableColumn::IsEnabledNextFrame.

◆ TableSetColumnIndex()

bool ImGui::TableSetColumnIndex ( int  column_n)
1870{
1871 ImGuiContext& g = *GImGui;
1872 ImGuiTable* table = g.CurrentTable;
1873 if (!table)
1874 return false;
1875
1876 if (table->CurrentColumn != column_n)
1877 {
1878 if (table->CurrentColumn != -1)
1879 TableEndCell(table);
1880 IM_ASSERT(column_n >= 0 && table->ColumnsCount);
1881 TableBeginCell(table, column_n);
1882 }
1883
1884 // Return whether the column is visible. User may choose to skip submitting items based on this return value,
1885 // however they shouldn't skip submitting for columns that may have the tallest contribution to row height.
1886 return (table->RequestOutputMaskByIndex & ((ImU64)1 << column_n)) != 0;
1887}

References ImGuiTable::ColumnsCount, ImGuiTable::CurrentColumn, ImGuiContext::CurrentTable, GImGui, IM_ASSERT, ImGuiTable::RequestOutputMaskByIndex, TableBeginCell(), and TableEndCell().

Referenced by Slic3r::GUI::GLCanvas3D::_picking_pass(), Slic3r::GUI::add_row_to_table(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::GCodeViewer::render_legend(), ShowDemoWindowTables(), ShowPlaceholderObject(), and TableHeadersRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableSetColumnSortDirection()

void ImGui::TableSetColumnSortDirection ( int  column_n,
ImGuiSortDirection  sort_direction,
bool  append_to_sort_specs 
)
2640{
2641 ImGuiContext& g = *GImGui;
2642 ImGuiTable* table = g.CurrentTable;
2643
2644 if (!(table->Flags & ImGuiTableFlags_SortMulti))
2645 append_to_sort_specs = false;
2646 if (!(table->Flags & ImGuiTableFlags_SortTristate))
2647 IM_ASSERT(sort_direction != ImGuiSortDirection_None);
2648
2649 ImGuiTableColumnIdx sort_order_max = 0;
2650 if (append_to_sort_specs)
2651 for (int other_column_n = 0; other_column_n < table->ColumnsCount; other_column_n++)
2652 sort_order_max = ImMax(sort_order_max, table->Columns[other_column_n].SortOrder);
2653
2654 ImGuiTableColumn* column = &table->Columns[column_n];
2655 column->SortDirection = (ImU8)sort_direction;
2657 column->SortOrder = -1;
2658 else if (column->SortOrder == -1 || !append_to_sort_specs)
2659 column->SortOrder = append_to_sort_specs ? sort_order_max + 1 : 0;
2660
2661 for (int other_column_n = 0; other_column_n < table->ColumnsCount; other_column_n++)
2662 {
2663 ImGuiTableColumn* other_column = &table->Columns[other_column_n];
2664 if (other_column != column && !append_to_sort_specs)
2665 other_column->SortOrder = -1;
2666 TableFixColumnSortDirection(table, other_column);
2667 }
2668 table->IsSettingsDirty = true;
2669 table->IsSortSpecsDirty = true;
2670}
@ ImGuiTableFlags_SortTristate
Definition imgui.h:1150
@ ImGuiTableFlags_SortMulti
Definition imgui.h:1149
IMGUI_API void TableFixColumnSortDirection(ImGuiTable *table, ImGuiTableColumn *column)
Definition imgui_tables.cpp:2613

References ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiContext::CurrentTable, ImGuiTable::Flags, GImGui, IM_ASSERT, ImGuiSortDirection_None, ImGuiTableFlags_SortMulti, ImGuiTableFlags_SortTristate, ImMax(), ImGuiTable::IsSettingsDirty, ImGuiTable::IsSortSpecsDirty, ImGuiTableColumn::SortDirection, ImGuiTableColumn::SortOrder, and TableFixColumnSortDirection().

Referenced by TableDrawContextMenu(), and TableHeader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableSetColumnWidth()

void ImGui::TableSetColumnWidth ( int  column_n,
float  width 
)
2057{
2058 ImGuiContext& g = *GImGui;
2059 ImGuiTable* table = g.CurrentTable;
2060 IM_ASSERT(table != NULL && table->IsLayoutLocked == false);
2061 IM_ASSERT(column_n >= 0 && column_n < table->ColumnsCount);
2062 ImGuiTableColumn* column_0 = &table->Columns[column_n];
2063 float column_0_width = width;
2064
2065 // Apply constraints early
2066 // Compare both requested and actual given width to avoid overwriting requested width when column is stuck (minimum size, bounded)
2067 IM_ASSERT(table->MinColumnWidth > 0.0f);
2068 const float min_width = table->MinColumnWidth;
2069 const float max_width = ImMax(min_width, TableGetMaxColumnWidth(table, column_n));
2070 column_0_width = ImClamp(column_0_width, min_width, max_width);
2071 if (column_0->WidthGiven == column_0_width || column_0->WidthRequest == column_0_width)
2072 return;
2073
2074 //IMGUI_DEBUG_LOG("TableSetColumnWidth(%d, %.1f->%.1f)\n", column_0_idx, column_0->WidthGiven, column_0_width);
2075 ImGuiTableColumn* column_1 = (column_0->NextEnabledColumn != -1) ? &table->Columns[column_0->NextEnabledColumn] : NULL;
2076
2077 // In this surprisingly not simple because of how we support mixing Fixed and multiple Stretch columns.
2078 // - All fixed: easy.
2079 // - All stretch: easy.
2080 // - One or more fixed + one stretch: easy.
2081 // - One or more fixed + more than one stretch: tricky.
2082 // Qt when manual resize is enabled only support a single _trailing_ stretch column.
2083
2084 // When forwarding resize from Wn| to Fn+1| we need to be considerate of the _NoResize flag on Fn+1.
2085 // FIXME-TABLE: Find a way to rewrite all of this so interactions feel more consistent for the user.
2086 // Scenarios:
2087 // - F1 F2 F3 resize from F1| or F2| --> ok: alter ->WidthRequested of Fixed column. Subsequent columns will be offset.
2088 // - F1 F2 F3 resize from F3| --> ok: alter ->WidthRequested of Fixed column. If active, ScrollX extent can be altered.
2089 // - F1 F2 W3 resize from F1| or F2| --> ok: alter ->WidthRequested of Fixed column. If active, ScrollX extent can be altered, but it doesn't make much sense as the Stretch column will always be minimal size.
2090 // - F1 F2 W3 resize from W3| --> ok: no-op (disabled by Resize Rule 1)
2091 // - W1 W2 W3 resize from W1| or W2| --> ok
2092 // - W1 W2 W3 resize from W3| --> ok: no-op (disabled by Resize Rule 1)
2093 // - W1 F2 F3 resize from F3| --> ok: no-op (disabled by Resize Rule 1)
2094 // - W1 F2 resize from F2| --> ok: no-op (disabled by Resize Rule 1)
2095 // - W1 W2 F3 resize from W1| or W2| --> ok
2096 // - W1 F2 W3 resize from W1| or F2| --> ok
2097 // - F1 W2 F3 resize from W2| --> ok
2098 // - F1 W3 F2 resize from W3| --> ok
2099 // - W1 F2 F3 resize from W1| --> ok: equivalent to resizing |F2. F3 will not move.
2100 // - W1 F2 F3 resize from F2| --> ok
2101 // All resizes from a Wx columns are locking other columns.
2102
2103 // Possible improvements:
2104 // - W1 W2 W3 resize W1| --> to not be stuck, both W2 and W3 would stretch down. Seems possible to fix. Would be most beneficial to simplify resize of all-weighted columns.
2105 // - W3 F1 F2 resize W3| --> to not be stuck past F1|, both F1 and F2 would need to stretch down, which would be lossy or ambiguous. Seems hard to fix.
2106
2107 // [Resize Rule 1] Can't resize from right of right-most visible column if there is any Stretch column. Implemented in TableUpdateLayout().
2108
2109 // If we have all Fixed columns OR resizing a Fixed column that doesn't come after a Stretch one, we can do an offsetting resize.
2110 // This is the preferred resize path
2112 if (!column_1 || table->LeftMostStretchedColumn == -1 || table->Columns[table->LeftMostStretchedColumn].DisplayOrder >= column_0->DisplayOrder)
2113 {
2114 column_0->WidthRequest = column_0_width;
2115 table->IsSettingsDirty = true;
2116 return;
2117 }
2118
2119 // We can also use previous column if there's no next one (this is used when doing an auto-fit on the right-most stretch column)
2120 if (column_1 == NULL)
2121 column_1 = (column_0->PrevEnabledColumn != -1) ? &table->Columns[column_0->PrevEnabledColumn] : NULL;
2122 if (column_1 == NULL)
2123 return;
2124
2125 // Resizing from right-side of a Stretch column before a Fixed column forward sizing to left-side of fixed column.
2126 // (old_a + old_b == new_a + new_b) --> (new_a == old_a + old_b - new_b)
2127 float column_1_width = ImMax(column_1->WidthRequest - (column_0_width - column_0->WidthRequest), min_width);
2128 column_0_width = column_0->WidthRequest + column_1->WidthRequest - column_1_width;
2129 IM_ASSERT(column_0_width > 0.0f && column_1_width > 0.0f);
2130 column_0->WidthRequest = column_0_width;
2131 column_1->WidthRequest = column_1_width;
2132 if ((column_0->Flags | column_1->Flags) & ImGuiTableColumnFlags_WidthStretch)
2133 TableUpdateColumnsWeightFromWidth(table);
2134 table->IsSettingsDirty = true;
2135}
IMGUI_API float TableGetMaxColumnWidth(const ImGuiTable *table, int column_n)
Definition imgui_tables.cpp:2008
float WidthGiven
Definition imgui_internal.h:2033
ImGuiTableColumnIdx LeftMostStretchedColumn
Definition imgui_internal.h:2172

References ImGuiTable::Columns, ImGuiContext::CurrentTable, ImGuiTableColumn::DisplayOrder, ImGuiTableColumn::Flags, GImGui, IM_ASSERT, ImClamp(), ImGuiTableColumnFlags_WidthFixed, ImGuiTableColumnFlags_WidthStretch, ImMax(), ImGuiTable::IsLayoutLocked, ImGuiTable::IsSettingsDirty, ImGuiTable::LeftMostStretchedColumn, ImGuiTable::MinColumnWidth, ImGuiTableColumn::NextEnabledColumn, ImGuiTableColumn::PrevEnabledColumn, TableGetMaxColumnWidth(), TableUpdateColumnsWeightFromWidth(), ImGuiTableColumn::WidthGiven, and ImGuiTableColumn::WidthRequest.

Referenced by TableBeginApplyRequests().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableSetColumnWidthAutoAll()

void ImGui::TableSetColumnWidthAutoAll ( ImGuiTable table)
2150{
2151 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
2152 {
2153 ImGuiTableColumn* column = &table->Columns[column_n];
2154 if (!column->IsEnabled && !(column->Flags & ImGuiTableColumnFlags_WidthStretch)) // Cannot reset weight of hidden stretch column
2155 continue;
2156 column->CannotSkipItemsQueue = (1 << 0);
2157 column->AutoFitQueue = (1 << 1);
2158 }
2159}
ImU8 CannotSkipItemsQueue
Definition imgui_internal.h:2067

References ImGuiTableColumn::AutoFitQueue, ImGuiTableColumn::CannotSkipItemsQueue, ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTableColumn::Flags, ImGuiTableColumnFlags_WidthStretch, and ImGuiTableColumn::IsEnabled.

Referenced by TableDrawContextMenu().

+ Here is the caller graph for this function:

◆ TableSetColumnWidthAutoSingle()

void ImGui::TableSetColumnWidthAutoSingle ( ImGuiTable table,
int  column_n 
)
2140{
2141 // Single auto width uses auto-fit
2142 ImGuiTableColumn* column = &table->Columns[column_n];
2143 if (!column->IsEnabled)
2144 return;
2145 column->CannotSkipItemsQueue = (1 << 0);
2146 table->AutoFitSingleColumn = (ImGuiTableColumnIdx)column_n;
2147}

References ImGuiTable::AutoFitSingleColumn, ImGuiTableColumn::CannotSkipItemsQueue, ImGuiTable::Columns, and ImGuiTableColumn::IsEnabled.

Referenced by TableDrawContextMenu(), and TableUpdateBorders().

+ Here is the caller graph for this function:

◆ TableSettingsCreate()

ImGuiTableSettings * ImGui::TableSettingsCreate ( ImGuiID  id,
int  columns_count 
)
3136{
3137 ImGuiContext& g = *GImGui;
3139 TableSettingsInit(settings, id, columns_count, columns_count);
3140 return settings;
3141}
static void TableSettingsInit(ImGuiTableSettings *settings, ImGuiID id, int columns_count, int columns_count_max)
Definition imgui_tables.cpp:3118

References ImChunkStream< T >::alloc_chunk(), GImGui, ImGuiContext::SettingsTables, TableSettingsCalcChunkSize(), and TableSettingsInit().

Referenced by TableSaveSettings(), and TableSettingsHandler_ReadOpen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableSettingsFindByID()

ImGuiTableSettings * ImGui::TableSettingsFindByID ( ImGuiID  id)
3145{
3146 // FIXME-OPT: Might want to store a lookup map for this?
3147 ImGuiContext& g = *GImGui;
3148 for (ImGuiTableSettings* settings = g.SettingsTables.begin(); settings != NULL; settings = g.SettingsTables.next_chunk(settings))
3149 if (settings->ID == id)
3150 return settings;
3151 return NULL;
3152}

References ImChunkStream< T >::begin(), GImGui, ImChunkStream< T >::next_chunk(), and ImGuiContext::SettingsTables.

Referenced by TableLoadSettings(), and TableSettingsHandler_ReadOpen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableSettingsInstallHandler()

void ImGui::TableSettingsInstallHandler ( ImGuiContext context)
3405{
3406 ImGuiContext& g = *context;
3407 ImGuiSettingsHandler ini_handler;
3408 ini_handler.TypeName = "Table";
3409 ini_handler.TypeHash = ImHashStr("Table");
3415 g.SettingsHandlers.push_back(ini_handler);
3416}
static void TableSettingsHandler_ClearAll(ImGuiContext *ctx, ImGuiSettingsHandler *)
Definition imgui_tables.cpp:3298
static void TableSettingsHandler_ReadLine(ImGuiContext *, ImGuiSettingsHandler *, void *entry, const char *line)
Definition imgui_tables.cpp:3337
static void TableSettingsHandler_WriteAll(ImGuiContext *ctx, ImGuiSettingsHandler *handler, ImGuiTextBuffer *buf)
Definition imgui_tables.cpp:3363
static void * TableSettingsHandler_ReadOpen(ImGuiContext *, ImGuiSettingsHandler *, const char *name)
Definition imgui_tables.cpp:3318
static void TableSettingsHandler_ApplyAll(ImGuiContext *ctx, ImGuiSettingsHandler *)
Definition imgui_tables.cpp:3307

References ImGuiSettingsHandler::ApplyAllFn, ImGuiSettingsHandler::ClearAllFn, ImHashStr(), ImVector< T >::push_back(), ImGuiSettingsHandler::ReadLineFn, ImGuiSettingsHandler::ReadOpenFn, ImGuiContext::SettingsHandlers, TableSettingsHandler_ApplyAll(), TableSettingsHandler_ClearAll(), TableSettingsHandler_ReadLine(), TableSettingsHandler_ReadOpen(), TableSettingsHandler_WriteAll(), ImGuiSettingsHandler::TypeHash, ImGuiSettingsHandler::TypeName, and ImGuiSettingsHandler::WriteAllFn.

Referenced by Initialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableSetupColumn()

void ImGui::TableSetupColumn ( const char *  label,
ImGuiTableColumnFlags  flags = 0,
float  init_width_or_weight = 0.0f,
ImGuiID  user_id = 0 
)
1403{
1404 ImGuiContext& g = *GImGui;
1405 ImGuiTable* table = g.CurrentTable;
1406 IM_ASSERT(table != NULL && "Need to call TableSetupColumn() after BeginTable()!");
1407 IM_ASSERT(table->IsLayoutLocked == false && "Need to call call TableSetupColumn() before first row!");
1408 IM_ASSERT((flags & ImGuiTableColumnFlags_StatusMask_) == 0 && "Illegal to pass StatusMask values to TableSetupColumn()");
1409 if (table->DeclColumnsCount >= table->ColumnsCount)
1410 {
1411 IM_ASSERT_USER_ERROR(table->DeclColumnsCount < table->ColumnsCount, "Called TableSetupColumn() too many times!");
1412 return;
1413 }
1414
1415 ImGuiTableColumn* column = &table->Columns[table->DeclColumnsCount];
1416 table->DeclColumnsCount++;
1417
1418 // Assert when passing a width or weight if policy is entirely left to default, to avoid storing width into weight and vice-versa.
1419 // Give a grace to users of ImGuiTableFlags_ScrollX.
1420 if (table->IsDefaultSizingPolicy && (flags & ImGuiTableColumnFlags_WidthMask_) == 0 && (flags & ImGuiTableFlags_ScrollX) == 0)
1421 IM_ASSERT(init_width_or_weight <= 0.0f && "Can only specify width/weight if sizing policy is set explicitly in either Table or Column.");
1422
1423 // When passing a width automatically enforce WidthFixed policy
1424 // (whereas TableSetupColumnFlags would default to WidthAuto if table is not Resizable)
1425 if ((flags & ImGuiTableColumnFlags_WidthMask_) == 0 && init_width_or_weight > 0.0f)
1428
1429 TableSetupColumnFlags(table, column, flags);
1430 column->UserID = user_id;
1431 flags = column->Flags;
1432
1433 // Initialize defaults
1434 column->InitStretchWeightOrWidth = init_width_or_weight;
1435 if (table->IsInitializing)
1436 {
1437 // Init width or weight
1438 if (column->WidthRequest < 0.0f && column->StretchWeight < 0.0f)
1439 {
1440 if ((flags & ImGuiTableColumnFlags_WidthFixed) && init_width_or_weight > 0.0f)
1441 column->WidthRequest = init_width_or_weight;
1443 column->StretchWeight = (init_width_or_weight > 0.0f) ? init_width_or_weight : -1.0f;
1444
1445 // Disable auto-fit if an explicit width/weight has been specified
1446 if (init_width_or_weight > 0.0f)
1447 column->AutoFitQueue = 0x00;
1448 }
1449
1450 // Init default visibility/sort state
1452 column->IsEnabled = column->IsEnabledNextFrame = false;
1454 {
1455 column->SortOrder = 0; // Multiple columns using _DefaultSort will be reassigned unique SortOrder values when building the sort specs.
1457 }
1458 }
1459
1460 // Store name (append with zero-terminator in contiguous buffer)
1461 column->NameOffset = -1;
1462 if (label != NULL && label[0] != 0)
1463 {
1464 column->NameOffset = (ImS16)table->ColumnsNames.size();
1465 table->ColumnsNames.append(label, label + strlen(label) + 1);
1466 }
1467}
@ ImGuiTableColumnFlags_StatusMask_
Definition imgui.h:1193
@ ImGuiTableColumnFlags_PreferSortDescending
Definition imgui.h:1180
@ ImGuiTableColumnFlags_WidthMask_
Definition imgui.h:1191
@ ImGuiTableColumnFlags_DefaultSort
Definition imgui.h:1168
@ ImGuiTableFlags_SizingFixedFit
Definition imgui.h:1130
static void TableSetupColumnFlags(ImGuiTable *table, ImGuiTableColumn *column, ImGuiTableColumnFlags flags_in)
Definition imgui_tables.cpp:660
ImGuiID UserID
Definition imgui_internal.h:2041

References ImGuiTextBuffer::append(), ImGuiTableColumn::AutoFitQueue, ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTable::ColumnsNames, ImGuiContext::CurrentTable, ImGuiTable::DeclColumnsCount, ImGuiTableColumn::Flags, ImGuiTable::Flags, GImGui, IM_ASSERT, IM_ASSERT_USER_ERROR, ImGuiSortDirection_Ascending, ImGuiSortDirection_Descending, ImGuiTableColumnFlags_DefaultHide, ImGuiTableColumnFlags_DefaultSort, ImGuiTableColumnFlags_PreferSortDescending, ImGuiTableColumnFlags_StatusMask_, ImGuiTableColumnFlags_WidthFixed, ImGuiTableColumnFlags_WidthMask_, ImGuiTableColumnFlags_WidthStretch, ImGuiTableFlags_Hideable, ImGuiTableFlags_ScrollX, ImGuiTableFlags_SizingFixedFit, ImGuiTableFlags_SizingFixedSame, ImGuiTableFlags_SizingMask_, ImGuiTableFlags_Sortable, ImGuiTableColumn::InitStretchWeightOrWidth, ImGuiTable::IsDefaultSizingPolicy, ImGuiTableColumn::IsEnabled, ImGuiTableColumn::IsEnabledNextFrame, ImGuiTable::IsInitializing, ImGuiTable::IsLayoutLocked, ImGuiTableColumn::NameOffset, ImGuiTable::SettingsLoadedFlags, ImGuiTextBuffer::size(), ImGuiTableColumn::SortDirection, ImGuiTableColumn::SortOrder, ImGuiTableColumn::StretchWeight, TableSetupColumnFlags(), ImGuiTableColumn::UserID, and ImGuiTableColumn::WidthRequest.

Referenced by ShowDemoWindowTables().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableSetupDrawChannels()

void ImGui::TableSetupDrawChannels ( ImGuiTable table)
2243{
2244 const int freeze_row_multiplier = (table->FreezeRowsCount > 0) ? 2 : 1;
2245 const int channels_for_row = (table->Flags & ImGuiTableFlags_NoClip) ? 1 : table->ColumnsEnabledCount;
2246 const int channels_for_bg = 1 + 1 * freeze_row_multiplier;
2247 const int channels_for_dummy = (table->ColumnsEnabledCount < table->ColumnsCount || table->VisibleMaskByIndex != table->EnabledMaskByIndex) ? +1 : 0;
2248 const int channels_total = channels_for_bg + (channels_for_row * freeze_row_multiplier) + channels_for_dummy;
2249 table->DrawSplitter->Split(table->InnerWindow->DrawList, channels_total);
2250 table->DummyDrawChannel = (ImGuiTableDrawChannelIdx)((channels_for_dummy > 0) ? channels_total - 1 : -1);
2252 table->Bg2DrawChannelUnfrozen = (ImGuiTableDrawChannelIdx)((table->FreezeRowsCount > 0) ? 2 + channels_for_row : TABLE_DRAW_CHANNEL_BG2_FROZEN);
2253
2254 int draw_channel_current = 2;
2255 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
2256 {
2257 ImGuiTableColumn* column = &table->Columns[column_n];
2258 if (column->IsVisibleX && column->IsVisibleY)
2259 {
2260 column->DrawChannelFrozen = (ImGuiTableDrawChannelIdx)(draw_channel_current);
2261 column->DrawChannelUnfrozen = (ImGuiTableDrawChannelIdx)(draw_channel_current + (table->FreezeRowsCount > 0 ? channels_for_row + 1 : 0));
2262 if (!(table->Flags & ImGuiTableFlags_NoClip))
2263 draw_channel_current++;
2264 }
2265 else
2266 {
2267 column->DrawChannelFrozen = column->DrawChannelUnfrozen = table->DummyDrawChannel;
2268 }
2269 column->DrawChannelCurrent = column->DrawChannelFrozen;
2270 }
2271
2272 // Initial draw cmd starts with a BgClipRect that matches the one of its host, to facilitate merge draw commands by default.
2273 // All our cell highlight are manually clipped with BgClipRect. When unfreezing it will be made smaller to fit scrolling rect.
2274 // (This technically isn't part of setting up draw channels, but is reasonably related to be done here)
2275 table->BgClipRect = table->InnerClipRect;
2277 table->Bg2ClipRectForDrawCmd = table->HostClipRect;
2278 IM_ASSERT(table->BgClipRect.Min.y <= table->BgClipRect.Max.y);
2279}
bool IsVisibleY
Definition imgui_internal.h:2061
bool IsVisibleX
Definition imgui_internal.h:2060

References ImGuiTable::Bg0ClipRectForDrawCmd, ImGuiTable::Bg2ClipRectForDrawCmd, ImGuiTable::Bg2DrawChannelCurrent, ImGuiTable::Bg2DrawChannelUnfrozen, ImGuiTable::BgClipRect, ImGuiWindow::ClipRect, ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTable::ColumnsEnabledCount, ImGuiTableColumn::DrawChannelCurrent, ImGuiTableColumn::DrawChannelFrozen, ImGuiTableColumn::DrawChannelUnfrozen, ImGuiWindow::DrawList, ImGuiTable::DrawSplitter, ImGuiTable::DummyDrawChannel, ImGuiTable::EnabledMaskByIndex, ImGuiTable::Flags, ImGuiTable::FreezeRowsCount, ImGuiTable::HostClipRect, IM_ASSERT, ImGuiTableFlags_NoClip, ImGuiTable::InnerClipRect, ImGuiTable::InnerWindow, ImGuiTableColumn::IsVisibleX, ImGuiTableColumn::IsVisibleY, ImRect::Max, ImRect::Min, ImGuiTable::OuterWindow, ImDrawListSplitter::Split(), TABLE_DRAW_CHANNEL_BG2_FROZEN, ImGuiTable::VisibleMaskByIndex, and ImVec2::y.

Referenced by TableUpdateLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableSetupScrollFreeze()

void ImGui::TableSetupScrollFreeze ( int  cols,
int  rows 
)
1471{
1472 ImGuiContext& g = *GImGui;
1473 ImGuiTable* table = g.CurrentTable;
1474 IM_ASSERT(table != NULL && "Need to call TableSetupColumn() after BeginTable()!");
1475 IM_ASSERT(table->IsLayoutLocked == false && "Need to call TableSetupColumn() before first row!");
1476 IM_ASSERT(columns >= 0 && columns < IMGUI_TABLE_MAX_COLUMNS);
1477 IM_ASSERT(rows >= 0 && rows < 128); // Arbitrary limit
1478
1479 table->FreezeColumnsRequest = (table->Flags & ImGuiTableFlags_ScrollX) ? (ImGuiTableColumnIdx)columns : 0;
1480 table->FreezeColumnsCount = (table->InnerWindow->Scroll.x != 0.0f) ? table->FreezeColumnsRequest : 0;
1482 table->FreezeRowsCount = (table->InnerWindow->Scroll.y != 0.0f) ? table->FreezeRowsRequest : 0;
1483 table->IsUnfrozenRows = (table->FreezeRowsCount == 0); // Make sure this is set before TableUpdateLayout() so ImGuiListClipper can benefit from it.b
1484}

References ImGuiContext::CurrentTable, ImGuiTable::Flags, ImGuiTable::FreezeColumnsCount, ImGuiTable::FreezeColumnsRequest, ImGuiTable::FreezeRowsCount, ImGuiTable::FreezeRowsRequest, GImGui, IM_ASSERT, IMGUI_TABLE_MAX_COLUMNS, ImGuiTableFlags_ScrollX, ImGuiTableFlags_ScrollY, ImGuiTable::InnerWindow, ImGuiTable::IsLayoutLocked, ImGuiTable::IsUnfrozenRows, ImGuiWindow::Scroll, ImVec2::x, and ImVec2::y.

Referenced by ShowDemoWindowTables().

+ Here is the caller graph for this function:

◆ TableSortSpecsBuild()

void ImGui::TableSortSpecsBuild ( ImGuiTable table)
2739{
2742
2743 // Write output
2744 ImGuiTableTempData* temp_data = table->TempData;
2745 temp_data->SortSpecsMulti.resize(table->SortSpecsCount <= 1 ? 0 : table->SortSpecsCount);
2746 ImGuiTableColumnSortSpecs* sort_specs = (table->SortSpecsCount == 0) ? NULL : (table->SortSpecsCount == 1) ? &temp_data->SortSpecsSingle : temp_data->SortSpecsMulti.Data;
2747 if (sort_specs != NULL)
2748 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
2749 {
2750 ImGuiTableColumn* column = &table->Columns[column_n];
2751 if (column->SortOrder == -1)
2752 continue;
2753 IM_ASSERT(column->SortOrder < table->SortSpecsCount);
2754 ImGuiTableColumnSortSpecs* sort_spec = &sort_specs[column->SortOrder];
2755 sort_spec->ColumnUserID = column->UserID;
2756 sort_spec->ColumnIndex = (ImGuiTableColumnIdx)column_n;
2757 sort_spec->SortOrder = (ImGuiTableColumnIdx)column->SortOrder;
2758 sort_spec->SortDirection = column->SortDirection;
2759 }
2760 table->SortSpecs.Specs = sort_specs;
2761 table->SortSpecs.SpecsCount = table->SortSpecsCount;
2762 table->SortSpecs.SpecsDirty = true; // Mark as dirty for user
2763 table->IsSortSpecsDirty = false; // Mark as not dirty for us
2764}
IMGUI_API void TableSortSpecsSanitize(ImGuiTable *table)
Definition imgui_tables.cpp:2672
Definition imgui.h:1979
ImS16 SortOrder
Definition imgui.h:1982
ImGuiID ColumnUserID
Definition imgui.h:1980
ImS16 ColumnIndex
Definition imgui.h:1981
ImGuiTableColumnIdx SortSpecsCount
Definition imgui_internal.h:2158
int SpecsCount
Definition imgui.h:1995
bool SpecsDirty
Definition imgui.h:1996
ImVector< ImGuiTableColumnSortSpecs > SortSpecsMulti
Definition imgui_internal.h:2215

References ImGuiTableColumnSortSpecs::ColumnIndex, ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTableColumnSortSpecs::ColumnUserID, ImVector< T >::Data, IM_ASSERT, ImGuiTable::IsSortSpecsDirty, ImVector< T >::resize(), ImGuiTableColumnSortSpecs::SortDirection, ImGuiTableColumn::SortDirection, ImGuiTableColumnSortSpecs::SortOrder, ImGuiTableColumn::SortOrder, ImGuiTable::SortSpecs, ImGuiTable::SortSpecsCount, ImGuiTableTempData::SortSpecsMulti, ImGuiTableTempData::SortSpecsSingle, ImGuiTableSortSpecs::Specs, ImGuiTableSortSpecs::SpecsCount, ImGuiTableSortSpecs::SpecsDirty, TableSortSpecsSanitize(), ImGuiTable::TempData, and ImGuiTableColumn::UserID.

Referenced by TableGetSortSpecs(), and TableUpdateLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableSortSpecsSanitize()

void ImGui::TableSortSpecsSanitize ( ImGuiTable table)
2673{
2675
2676 // Clear SortOrder from hidden column and verify that there's no gap or duplicate.
2677 int sort_order_count = 0;
2678 ImU64 sort_order_mask = 0x00;
2679 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
2680 {
2681 ImGuiTableColumn* column = &table->Columns[column_n];
2682 if (column->SortOrder != -1 && !column->IsEnabled)
2683 column->SortOrder = -1;
2684 if (column->SortOrder == -1)
2685 continue;
2686 sort_order_count++;
2687 sort_order_mask |= ((ImU64)1 << column->SortOrder);
2688 IM_ASSERT(sort_order_count < (int)sizeof(sort_order_mask) * 8);
2689 }
2690
2691 const bool need_fix_linearize = ((ImU64)1 << sort_order_count) != (sort_order_mask + 1);
2692 const bool need_fix_single_sort_order = (sort_order_count > 1) && !(table->Flags & ImGuiTableFlags_SortMulti);
2693 if (need_fix_linearize || need_fix_single_sort_order)
2694 {
2695 ImU64 fixed_mask = 0x00;
2696 for (int sort_n = 0; sort_n < sort_order_count; sort_n++)
2697 {
2698 // Fix: Rewrite sort order fields if needed so they have no gap or duplicate.
2699 // (e.g. SortOrder 0 disappeared, SortOrder 1..2 exists --> rewrite then as SortOrder 0..1)
2700 int column_with_smallest_sort_order = -1;
2701 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
2702 if ((fixed_mask & ((ImU64)1 << (ImU64)column_n)) == 0 && table->Columns[column_n].SortOrder != -1)
2703 if (column_with_smallest_sort_order == -1 || table->Columns[column_n].SortOrder < table->Columns[column_with_smallest_sort_order].SortOrder)
2704 column_with_smallest_sort_order = column_n;
2705 IM_ASSERT(column_with_smallest_sort_order != -1);
2706 fixed_mask |= ((ImU64)1 << column_with_smallest_sort_order);
2707 table->Columns[column_with_smallest_sort_order].SortOrder = (ImGuiTableColumnIdx)sort_n;
2708
2709 // Fix: Make sure only one column has a SortOrder if ImGuiTableFlags_MultiSortable is not set.
2710 if (need_fix_single_sort_order)
2711 {
2712 sort_order_count = 1;
2713 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
2714 if (column_n != column_with_smallest_sort_order)
2715 table->Columns[column_n].SortOrder = -1;
2716 break;
2717 }
2718 }
2719 }
2720
2721 // Fallback default sort order (if no column had the ImGuiTableColumnFlags_DefaultSort flag)
2722 if (sort_order_count == 0 && !(table->Flags & ImGuiTableFlags_SortTristate))
2723 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
2724 {
2725 ImGuiTableColumn* column = &table->Columns[column_n];
2726 if (column->IsEnabled && !(column->Flags & ImGuiTableColumnFlags_NoSort))
2727 {
2728 sort_order_count = 1;
2729 column->SortOrder = 0;
2731 break;
2732 }
2733 }
2734
2735 table->SortSpecsCount = (ImGuiTableColumnIdx)sort_order_count;
2736}

References ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTableColumn::Flags, ImGuiTable::Flags, IM_ASSERT, ImGuiTableColumnFlags_NoSort, ImGuiTableFlags_Sortable, ImGuiTableFlags_SortMulti, ImGuiTableFlags_SortTristate, ImGuiTableColumn::IsEnabled, ImGuiTableColumn::SortDirection, ImGuiTableColumn::SortOrder, ImGuiTable::SortSpecsCount, and TableGetColumnAvailSortDirection().

Referenced by TableSortSpecsBuild().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableUpdateBorders()

void ImGui::TableUpdateBorders ( ImGuiTable table)
1139{
1140 ImGuiContext& g = *GImGui;
1142
1143 // At this point OuterRect height may be zero or under actual final height, so we rely on temporal coherency and
1144 // use the final height from last frame. Because this is only affecting _interaction_ with columns, it is not
1145 // really problematic (whereas the actual visual will be displayed in EndTable() and using the current frame height).
1146 // Actual columns highlight/render will be performed in EndTable() and not be affected.
1147 const float hit_half_width = TABLE_RESIZE_SEPARATOR_HALF_THICKNESS;
1148 const float hit_y1 = table->OuterRect.Min.y;
1149 const float hit_y2_body = ImMax(table->OuterRect.Max.y, hit_y1 + table->LastOuterHeight);
1150 const float hit_y2_head = hit_y1 + table->LastFirstRowHeight;
1151
1152 for (int order_n = 0; order_n < table->ColumnsCount; order_n++)
1153 {
1154 if (!(table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n)))
1155 continue;
1156
1157 const int column_n = table->DisplayOrderToIndex[order_n];
1158 ImGuiTableColumn* column = &table->Columns[column_n];
1160 continue;
1161
1162 // ImGuiTableFlags_NoBordersInBodyUntilResize will be honored in TableDrawBorders()
1163 const float border_y2_hit = (table->Flags & ImGuiTableFlags_NoBordersInBody) ? hit_y2_head : hit_y2_body;
1164 if ((table->Flags & ImGuiTableFlags_NoBordersInBody) && table->IsUsingHeaders == false)
1165 continue;
1166
1167 if (table->FreezeColumnsCount > 0)
1168 if (column->MaxX < table->Columns[table->DisplayOrderToIndex[table->FreezeColumnsCount - 1]].MaxX)
1169 continue;
1170
1171 ImGuiID column_id = TableGetColumnResizeID(table, column_n, table->InstanceCurrent);
1172 ImRect hit_rect(column->MaxX - hit_half_width, hit_y1, column->MaxX + hit_half_width, border_y2_hit);
1173 //GetForegroundDrawList()->AddRect(hit_rect.Min, hit_rect.Max, IM_COL32(255, 0, 0, 100));
1174 KeepAliveID(column_id);
1175
1176 bool hovered = false, held = false;
1178 if (pressed && IsMouseDoubleClicked(0))
1179 {
1180 TableSetColumnWidthAutoSingle(table, column_n);
1181 ClearActiveID();
1182 held = hovered = false;
1183 }
1184 if (held)
1185 {
1186 if (table->LastResizedColumn == -1)
1187 table->ResizeLockMinContentsX2 = table->RightMostEnabledColumn != -1 ? table->Columns[table->RightMostEnabledColumn].MaxX : -FLT_MAX;
1188 table->ResizedColumn = (ImGuiTableColumnIdx)column_n;
1189 table->InstanceInteracted = table->InstanceCurrent;
1190 }
1191 if ((hovered && g.HoveredIdTimer > TABLE_RESIZE_SEPARATOR_FEEDBACK_TIMER) || held)
1192 {
1193 table->HoveredColumnBorder = (ImGuiTableColumnIdx)column_n;
1195 }
1196 }
1197}
static const float TABLE_RESIZE_SEPARATOR_FEEDBACK_TIMER
Definition imgui_tables.cpp:261
IMGUI_API bool IsMouseDoubleClicked(ImGuiMouseButton button)
Definition imgui.cpp:4725
IMGUI_API ImGuiID TableGetColumnResizeID(const ImGuiTable *table, int column_n, int instance_no=0)
Definition imgui_tables.cpp:1578

References ButtonBehavior(), ClearActiveID(), ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTable::DisplayOrderToIndex, ImGuiTable::EnabledMaskByDisplayOrder, ImGuiTableColumn::Flags, ImGuiTable::Flags, ImGuiTable::FreezeColumnsCount, GImGui, ImGuiTable::HoveredColumnBorder, ImGuiContext::HoveredIdTimer, IM_ASSERT, ImGuiButtonFlags_AllowItemOverlap, ImGuiButtonFlags_FlattenChildren, ImGuiButtonFlags_PressedOnClick, ImGuiButtonFlags_PressedOnDoubleClick, ImGuiMouseCursor_ResizeEW, ImGuiTableColumnFlags_NoDirectResize_, ImGuiTableColumnFlags_NoResize, ImGuiTableFlags_NoBordersInBody, ImGuiTableFlags_Resizable, ImMax(), ImGuiTable::InstanceCurrent, ImGuiTable::InstanceInteracted, IsMouseDoubleClicked(), ImGuiTable::IsUsingHeaders, KeepAliveID(), ImGuiTable::LastFirstRowHeight, ImGuiTable::LastOuterHeight, ImGuiTable::LastResizedColumn, ImRect::Max, ImGuiTableColumn::MaxX, ImRect::Min, ImGuiTable::OuterRect, ImGuiTable::ResizedColumn, ImGuiTable::ResizeLockMinContentsX2, ImGuiTable::RightMostEnabledColumn, SetMouseCursor(), TABLE_RESIZE_SEPARATOR_FEEDBACK_TIMER, TABLE_RESIZE_SEPARATOR_HALF_THICKNESS, TableGetColumnResizeID(), TableSetColumnWidthAutoSingle(), and ImVec2::y.

Referenced by TableUpdateLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TableUpdateColumnsWeightFromWidth()

void ImGui::TableUpdateColumnsWeightFromWidth ( ImGuiTable table)
2162{
2163 IM_ASSERT(table->LeftMostStretchedColumn != -1 && table->RightMostStretchedColumn != -1);
2164
2165 // Measure existing quantity
2166 float visible_weight = 0.0f;
2167 float visible_width = 0.0f;
2168 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
2169 {
2170 ImGuiTableColumn* column = &table->Columns[column_n];
2171 if (!column->IsEnabled || !(column->Flags & ImGuiTableColumnFlags_WidthStretch))
2172 continue;
2173 IM_ASSERT(column->StretchWeight > 0.0f);
2174 visible_weight += column->StretchWeight;
2175 visible_width += column->WidthRequest;
2176 }
2177 IM_ASSERT(visible_weight > 0.0f && visible_width > 0.0f);
2178
2179 // Apply new weights
2180 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
2181 {
2182 ImGuiTableColumn* column = &table->Columns[column_n];
2183 if (!column->IsEnabled || !(column->Flags & ImGuiTableColumnFlags_WidthStretch))
2184 continue;
2185 column->StretchWeight = (column->WidthRequest / visible_width) * visible_weight;
2186 IM_ASSERT(column->StretchWeight > 0.0f);
2187 }
2188}
ImGuiTableColumnIdx RightMostStretchedColumn
Definition imgui_internal.h:2173

References ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTableColumn::Flags, IM_ASSERT, ImGuiTableColumnFlags_WidthStretch, ImGuiTableColumn::IsEnabled, ImGuiTable::LeftMostStretchedColumn, ImGuiTable::RightMostStretchedColumn, ImGuiTableColumn::StretchWeight, and ImGuiTableColumn::WidthRequest.

Referenced by TableSetColumnWidth().

+ Here is the caller graph for this function:

◆ TableUpdateLayout()

void ImGui::TableUpdateLayout ( ImGuiTable table)
720{
721 ImGuiContext& g = *GImGui;
722 IM_ASSERT(table->IsLayoutLocked == false);
723
724 const ImGuiTableFlags table_sizing_policy = (table->Flags & ImGuiTableFlags_SizingMask_);
725 table->IsDefaultDisplayOrder = true;
726 table->ColumnsEnabledCount = 0;
727 table->EnabledMaskByIndex = 0x00;
728 table->EnabledMaskByDisplayOrder = 0x00;
729 table->LeftMostEnabledColumn = -1;
730 table->MinColumnWidth = ImMax(1.0f, g.Style.FramePadding.x * 1.0f); // g.Style.ColumnsMinSpacing; // FIXME-TABLE
731
732 // [Part 1] Apply/lock Enabled and Order states. Calculate auto/ideal width for columns. Count fixed/stretch columns.
733 // Process columns in their visible orders as we are building the Prev/Next indices.
734 int count_fixed = 0; // Number of columns that have fixed sizing policies
735 int count_stretch = 0; // Number of columns that have stretch sizing policies
736 int prev_visible_column_idx = -1;
737 bool has_auto_fit_request = false;
738 bool has_resizable = false;
739 float stretch_sum_width_auto = 0.0f;
740 float fixed_max_width_auto = 0.0f;
741 for (int order_n = 0; order_n < table->ColumnsCount; order_n++)
742 {
743 const int column_n = table->DisplayOrderToIndex[order_n];
744 if (column_n != order_n)
745 table->IsDefaultDisplayOrder = false;
746 ImGuiTableColumn* column = &table->Columns[column_n];
747
748 // Clear column setup if not submitted by user. Currently we make it mandatory to call TableSetupColumn() every frame.
749 // It would easily work without but we're not ready to guarantee it since e.g. names need resubmission anyway.
750 // We take a slight shortcut but in theory we could be calling TableSetupColumn() here with dummy values, it should yield the same effect.
751 if (table->DeclColumnsCount <= column_n)
752 {
754 column->NameOffset = -1;
755 column->UserID = 0;
756 column->InitStretchWeightOrWidth = -1.0f;
757 }
758
759 // Update Enabled state, mark settings/sortspecs dirty
761 column->IsEnabledNextFrame = true;
762 if (column->IsEnabled != column->IsEnabledNextFrame)
763 {
764 column->IsEnabled = column->IsEnabledNextFrame;
765 table->IsSettingsDirty = true;
766 if (!column->IsEnabled && column->SortOrder != -1)
767 table->IsSortSpecsDirty = true;
768 }
769 if (column->SortOrder > 0 && !(table->Flags & ImGuiTableFlags_SortMulti))
770 table->IsSortSpecsDirty = true;
771
772 // Auto-fit unsized columns
773 const bool start_auto_fit = (column->Flags & ImGuiTableColumnFlags_WidthFixed) ? (column->WidthRequest < 0.0f) : (column->StretchWeight < 0.0f);
774 if (start_auto_fit)
775 column->AutoFitQueue = column->CannotSkipItemsQueue = (1 << 3) - 1; // Fit for three frames
776
777 if (!column->IsEnabled)
778 {
779 column->IndexWithinEnabledSet = -1;
780 continue;
781 }
782
783 // Mark as enabled and link to previous/next enabled column
784 column->PrevEnabledColumn = (ImGuiTableColumnIdx)prev_visible_column_idx;
785 column->NextEnabledColumn = -1;
786 if (prev_visible_column_idx != -1)
787 table->Columns[prev_visible_column_idx].NextEnabledColumn = (ImGuiTableColumnIdx)column_n;
788 else
791 table->EnabledMaskByIndex |= (ImU64)1 << column_n;
792 table->EnabledMaskByDisplayOrder |= (ImU64)1 << column->DisplayOrder;
793 prev_visible_column_idx = column_n;
794 IM_ASSERT(column->IndexWithinEnabledSet <= column->DisplayOrder);
795
796 // Calculate ideal/auto column width (that's the width required for all contents to be visible without clipping)
797 // Combine width from regular rows + width from headers unless requested not to.
798 if (!column->IsPreserveWidthAuto)
799 column->WidthAuto = TableGetColumnWidthAuto(table, column);
800
801 // Non-resizable columns keep their requested width (apply user value regardless of IsPreserveWidthAuto)
802 const bool column_is_resizable = (column->Flags & ImGuiTableColumnFlags_NoResize) == 0;
803 if (column_is_resizable)
804 has_resizable = true;
805 if ((column->Flags & ImGuiTableColumnFlags_WidthFixed) && column->InitStretchWeightOrWidth > 0.0f && !column_is_resizable)
806 column->WidthAuto = column->InitStretchWeightOrWidth;
807
808 if (column->AutoFitQueue != 0x00)
809 has_auto_fit_request = true;
811 {
812 stretch_sum_width_auto += column->WidthAuto;
813 count_stretch++;
814 }
815 else
816 {
817 fixed_max_width_auto = ImMax(fixed_max_width_auto, column->WidthAuto);
818 count_fixed++;
819 }
820 }
821 if ((table->Flags & ImGuiTableFlags_Sortable) && table->SortSpecsCount == 0 && !(table->Flags & ImGuiTableFlags_SortTristate))
822 table->IsSortSpecsDirty = true;
823 table->RightMostEnabledColumn = (ImGuiTableColumnIdx)prev_visible_column_idx;
824 IM_ASSERT(table->LeftMostEnabledColumn >= 0 && table->RightMostEnabledColumn >= 0);
825
826 // [Part 2] Disable child window clipping while fitting columns. This is not strictly necessary but makes it possible
827 // to avoid the column fitting having to wait until the first visible frame of the child container (may or not be a good thing).
828 // FIXME-TABLE: for always auto-resizing columns may not want to do that all the time.
829 if (has_auto_fit_request && table->OuterWindow != table->InnerWindow)
830 table->InnerWindow->SkipItems = false;
831 if (has_auto_fit_request)
832 table->IsSettingsDirty = true;
833
834 // [Part 3] Fix column flags and record a few extra information.
835 float sum_width_requests = 0.0f; // Sum of all width for fixed and auto-resize columns, excluding width contributed by Stretch columns but including spacing/padding.
836 float stretch_sum_weights = 0.0f; // Sum of all weights for stretch columns.
838 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
839 {
840 if (!(table->EnabledMaskByIndex & ((ImU64)1 << column_n)))
841 continue;
842 ImGuiTableColumn* column = &table->Columns[column_n];
843
844 const bool column_is_resizable = (column->Flags & ImGuiTableColumnFlags_NoResize) == 0;
846 {
847 // Apply same widths policy
848 float width_auto = column->WidthAuto;
849 if (table_sizing_policy == ImGuiTableFlags_SizingFixedSame && (column->AutoFitQueue != 0x00 || !column_is_resizable))
850 width_auto = fixed_max_width_auto;
851
852 // Apply automatic width
853 // Latch initial size for fixed columns and update it constantly for auto-resizing column (unless clipped!)
854 if (column->AutoFitQueue != 0x00)
855 column->WidthRequest = width_auto;
856 else if ((column->Flags & ImGuiTableColumnFlags_WidthFixed) && !column_is_resizable && (table->RequestOutputMaskByIndex & ((ImU64)1 << column_n)))
857 column->WidthRequest = width_auto;
858
859 // FIXME-TABLE: Increase minimum size during init frame to avoid biasing auto-fitting widgets
860 // (e.g. TextWrapped) too much. Otherwise what tends to happen is that TextWrapped would output a very
861 // large height (= first frame scrollbar display very off + clipper would skip lots of items).
862 // This is merely making the side-effect less extreme, but doesn't properly fixes it.
863 // FIXME: Move this to ->WidthGiven to avoid temporary lossyless?
864 // FIXME: This break IsPreserveWidthAuto from not flickering if the stored WidthAuto was smaller.
865 if (column->AutoFitQueue > 0x01 && table->IsInitializing && !column->IsPreserveWidthAuto)
866 column->WidthRequest = ImMax(column->WidthRequest, table->MinColumnWidth * 4.0f); // FIXME-TABLE: Another constant/scale?
867 sum_width_requests += column->WidthRequest;
868 }
869 else
870 {
871 // Initialize stretch weight
872 if (column->AutoFitQueue != 0x00 || column->StretchWeight < 0.0f || !column_is_resizable)
873 {
874 if (column->InitStretchWeightOrWidth > 0.0f)
875 column->StretchWeight = column->InitStretchWeightOrWidth;
876 else if (table_sizing_policy == ImGuiTableFlags_SizingStretchProp)
877 column->StretchWeight = (column->WidthAuto / stretch_sum_width_auto) * count_stretch;
878 else
879 column->StretchWeight = 1.0f;
880 }
881
882 stretch_sum_weights += column->StretchWeight;
883 if (table->LeftMostStretchedColumn == -1 || table->Columns[table->LeftMostStretchedColumn].DisplayOrder > column->DisplayOrder)
885 if (table->RightMostStretchedColumn == -1 || table->Columns[table->RightMostStretchedColumn].DisplayOrder < column->DisplayOrder)
887 }
888 column->IsPreserveWidthAuto = false;
889 sum_width_requests += table->CellPaddingX * 2.0f;
890 }
891 table->ColumnsEnabledFixedCount = (ImGuiTableColumnIdx)count_fixed;
892
893 // [Part 4] Apply final widths based on requested widths
894 const ImRect work_rect = table->WorkRect;
895 const float width_spacings = (table->OuterPaddingX * 2.0f) + (table->CellSpacingX1 + table->CellSpacingX2) * (table->ColumnsEnabledCount - 1);
896 const float width_avail = ((table->Flags & ImGuiTableFlags_ScrollX) && table->InnerWidth == 0.0f) ? table->InnerClipRect.GetWidth() : work_rect.GetWidth();
897 const float width_avail_for_stretched_columns = width_avail - width_spacings - sum_width_requests;
898 float width_remaining_for_stretched_columns = width_avail_for_stretched_columns;
899 table->ColumnsGivenWidth = width_spacings + (table->CellPaddingX * 2.0f) * table->ColumnsEnabledCount;
900 for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
901 {
902 if (!(table->EnabledMaskByIndex & ((ImU64)1 << column_n)))
903 continue;
904 ImGuiTableColumn* column = &table->Columns[column_n];
905
906 // Allocate width for stretched/weighted columns (StretchWeight gets converted into WidthRequest)
908 {
909 float weight_ratio = column->StretchWeight / stretch_sum_weights;
910 column->WidthRequest = IM_FLOOR(ImMax(width_avail_for_stretched_columns * weight_ratio, table->MinColumnWidth) + 0.01f);
911 width_remaining_for_stretched_columns -= column->WidthRequest;
912 }
913
914 // [Resize Rule 1] The right-most Visible column is not resizable if there is at least one Stretch column
915 // See additional comments in TableSetColumnWidth().
916 if (column->NextEnabledColumn == -1 && table->LeftMostStretchedColumn != -1)
918
919 // Assign final width, record width in case we will need to shrink
920 column->WidthGiven = ImFloor(ImMax(column->WidthRequest, table->MinColumnWidth));
921 table->ColumnsGivenWidth += column->WidthGiven;
922 }
923
924 // [Part 5] Redistribute stretch remainder width due to rounding (remainder width is < 1.0f * number of Stretch column).
925 // Using right-to-left distribution (more likely to match resizing cursor).
926 if (width_remaining_for_stretched_columns >= 1.0f && !(table->Flags & ImGuiTableFlags_PreciseWidths))
927 for (int order_n = table->ColumnsCount - 1; stretch_sum_weights > 0.0f && width_remaining_for_stretched_columns >= 1.0f && order_n >= 0; order_n--)
928 {
929 if (!(table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n)))
930 continue;
931 ImGuiTableColumn* column = &table->Columns[table->DisplayOrderToIndex[order_n]];
933 continue;
934 column->WidthRequest += 1.0f;
935 column->WidthGiven += 1.0f;
936 width_remaining_for_stretched_columns -= 1.0f;
937 }
938
939 table->HoveredColumnBody = -1;
940 table->HoveredColumnBorder = -1;
941 const ImRect mouse_hit_rect(table->OuterRect.Min.x, table->OuterRect.Min.y, table->OuterRect.Max.x, ImMax(table->OuterRect.Max.y, table->OuterRect.Min.y + table->LastOuterHeight));
942 const bool is_hovering_table = ItemHoverable(mouse_hit_rect, 0);
943
944 // [Part 6] Setup final position, offset, skip/clip states and clipping rectangles, detect hovered column
945 // Process columns in their visible orders as we are comparing the visible order and adjusting host_clip_rect while looping.
946 int visible_n = 0;
947 bool offset_x_frozen = (table->FreezeColumnsCount > 0);
948 float offset_x = ((table->FreezeColumnsCount > 0) ? table->OuterRect.Min.x : work_rect.Min.x) + table->OuterPaddingX - table->CellSpacingX1;
949 ImRect host_clip_rect = table->InnerClipRect;
950 //host_clip_rect.Max.x += table->CellPaddingX + table->CellSpacingX2;
951 table->VisibleMaskByIndex = 0x00;
952 table->RequestOutputMaskByIndex = 0x00;
953 for (int order_n = 0; order_n < table->ColumnsCount; order_n++)
954 {
955 const int column_n = table->DisplayOrderToIndex[order_n];
956 ImGuiTableColumn* column = &table->Columns[column_n];
957
958 column->NavLayerCurrent = (ImS8)((table->FreezeRowsCount > 0 || column_n < table->FreezeColumnsCount) ? ImGuiNavLayer_Menu : ImGuiNavLayer_Main);
959
960 if (offset_x_frozen && table->FreezeColumnsCount == visible_n)
961 {
962 offset_x += work_rect.Min.x - table->OuterRect.Min.x;
963 offset_x_frozen = false;
964 }
965
966 // Clear status flags
967 column->Flags &= ~ImGuiTableColumnFlags_StatusMask_;
968
969 if ((table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n)) == 0)
970 {
971 // Hidden column: clear a few fields and we are done with it for the remainder of the function.
972 // We set a zero-width clip rect but set Min.y/Max.y properly to not interfere with the clipper.
973 column->MinX = column->MaxX = column->WorkMinX = column->ClipRect.Min.x = column->ClipRect.Max.x = offset_x;
974 column->WidthGiven = 0.0f;
975 column->ClipRect.Min.y = work_rect.Min.y;
976 column->ClipRect.Max.y = FLT_MAX;
977 column->ClipRect.ClipWithFull(host_clip_rect);
978 column->IsVisibleX = column->IsVisibleY = column->IsRequestOutput = false;
979 column->IsSkipItems = true;
980 column->ItemWidth = 1.0f;
981 continue;
982 }
983
984 // Detect hovered column
985 if (is_hovering_table && g.IO.MousePos.x >= column->ClipRect.Min.x && g.IO.MousePos.x < column->ClipRect.Max.x)
986 table->HoveredColumnBody = (ImGuiTableColumnIdx)column_n;
987
988 // Lock start position
989 column->MinX = offset_x;
990
991 // Lock width based on start position and minimum/maximum width for this position
992 float max_width = TableGetMaxColumnWidth(table, column_n);
993 column->WidthGiven = ImMin(column->WidthGiven, max_width);
994 column->WidthGiven = ImMax(column->WidthGiven, ImMin(column->WidthRequest, table->MinColumnWidth));
995 column->MaxX = offset_x + column->WidthGiven + table->CellSpacingX1 + table->CellSpacingX2 + table->CellPaddingX * 2.0f;
996
997 // Lock other positions
998 // - ClipRect.Min.x: Because merging draw commands doesn't compare min boundaries, we make ClipRect.Min.x match left bounds to be consistent regardless of merging.
999 // - ClipRect.Max.x: using WorkMaxX instead of MaxX (aka including padding) makes things more consistent when resizing down, tho slightly detrimental to visibility in very-small column.
1000 // - ClipRect.Max.x: using MaxX makes it easier for header to receive hover highlight with no discontinuity and display sorting arrow.
1001 // - FIXME-TABLE: We want equal width columns to have equal (ClipRect.Max.x - WorkMinX) width, which means ClipRect.max.x cannot stray off host_clip_rect.Max.x else right-most column may appear shorter.
1002 column->WorkMinX = column->MinX + table->CellPaddingX + table->CellSpacingX1;
1003 column->WorkMaxX = column->MaxX - table->CellPaddingX - table->CellSpacingX2; // Expected max
1004 column->ItemWidth = ImFloor(column->WidthGiven * 0.65f);
1005 column->ClipRect.Min.x = column->MinX;
1006 column->ClipRect.Min.y = work_rect.Min.y;
1007 column->ClipRect.Max.x = column->MaxX; //column->WorkMaxX;
1008 column->ClipRect.Max.y = FLT_MAX;
1009 column->ClipRect.ClipWithFull(host_clip_rect);
1010
1011 // Mark column as Clipped (not in sight)
1012 // Note that scrolling tables (where inner_window != outer_window) handle Y clipped earlier in BeginTable() so IsVisibleY really only applies to non-scrolling tables.
1013 // FIXME-TABLE: Because InnerClipRect.Max.y is conservatively ==outer_window->ClipRect.Max.y, we never can mark columns _Above_ the scroll line as not IsVisibleY.
1014 // Taking advantage of LastOuterHeight would yield good results there...
1015 // FIXME-TABLE: Y clipping is disabled because it effectively means not submitting will reduce contents width which is fed to outer_window->DC.CursorMaxPos.x,
1016 // and this may be used (e.g. typically by outer_window using AlwaysAutoResize or outer_window's horizontal scrollbar, but could be something else).
1017 // Possible solution to preserve last known content width for clipped column. Test 'table_reported_size' fails when enabling Y clipping and window is resized small.
1018 column->IsVisibleX = (column->ClipRect.Max.x > column->ClipRect.Min.x);
1019 column->IsVisibleY = true; // (column->ClipRect.Max.y > column->ClipRect.Min.y);
1020 const bool is_visible = column->IsVisibleX; //&& column->IsVisibleY;
1021 if (is_visible)
1022 table->VisibleMaskByIndex |= ((ImU64)1 << column_n);
1023
1024 // Mark column as requesting output from user. Note that fixed + non-resizable sets are auto-fitting at all times and therefore always request output.
1025 column->IsRequestOutput = is_visible || column->AutoFitQueue != 0 || column->CannotSkipItemsQueue != 0;
1026 if (column->IsRequestOutput)
1027 table->RequestOutputMaskByIndex |= ((ImU64)1 << column_n);
1028
1029 // Mark column as SkipItems (ignoring all items/layout)
1030 column->IsSkipItems = !column->IsEnabled || table->HostSkipItems;
1031 if (column->IsSkipItems)
1032 IM_ASSERT(!is_visible);
1033
1034 // Update status flags
1036 if (is_visible)
1038 if (column->SortOrder != -1)
1040 if (table->HoveredColumnBody == column_n)
1042
1043 // Alignment
1044 // FIXME-TABLE: This align based on the whole column width, not per-cell, and therefore isn't useful in
1045 // many cases (to be able to honor this we might be able to store a log of cells width, per row, for
1046 // visible rows, but nav/programmatic scroll would have visible artifacts.)
1047 //if (column->Flags & ImGuiTableColumnFlags_AlignRight)
1048 // column->WorkMinX = ImMax(column->WorkMinX, column->MaxX - column->ContentWidthRowsUnfrozen);
1049 //else if (column->Flags & ImGuiTableColumnFlags_AlignCenter)
1050 // column->WorkMinX = ImLerp(column->WorkMinX, ImMax(column->StartX, column->MaxX - column->ContentWidthRowsUnfrozen), 0.5f);
1051
1052 // Reset content width variables
1053 column->ContentMaxXFrozen = column->ContentMaxXUnfrozen = column->WorkMinX;
1054 column->ContentMaxXHeadersUsed = column->ContentMaxXHeadersIdeal = column->WorkMinX;
1055
1056 // Don't decrement auto-fit counters until container window got a chance to submit its items
1057 if (table->HostSkipItems == false)
1058 {
1059 column->AutoFitQueue >>= 1;
1060 column->CannotSkipItemsQueue >>= 1;
1061 }
1062
1063 if (visible_n < table->FreezeColumnsCount)
1064 host_clip_rect.Min.x = ImClamp(column->MaxX + TABLE_BORDER_SIZE, host_clip_rect.Min.x, host_clip_rect.Max.x);
1065
1066 offset_x += column->WidthGiven + table->CellSpacingX1 + table->CellSpacingX2 + table->CellPaddingX * 2.0f;
1067 visible_n++;
1068 }
1069
1070 // [Part 7] Detect/store when we are hovering the unused space after the right-most column (so e.g. context menus can react on it)
1071 // Clear Resizable flag if none of our column are actually resizable (either via an explicit _NoResize flag, either
1072 // because of using _WidthAuto/_WidthStretch). This will hide the resizing option from the context menu.
1073 const float unused_x1 = ImMax(table->WorkRect.Min.x, table->Columns[table->RightMostEnabledColumn].ClipRect.Max.x);
1074 if (is_hovering_table && table->HoveredColumnBody == -1)
1075 {
1076 if (g.IO.MousePos.x >= unused_x1)
1078 }
1079 if (has_resizable == false && (table->Flags & ImGuiTableFlags_Resizable))
1080 table->Flags &= ~ImGuiTableFlags_Resizable;
1081
1082 // [Part 8] Lock actual OuterRect/WorkRect right-most position.
1083 // This is done late to handle the case of fixed-columns tables not claiming more widths that they need.
1084 // Because of this we are careful with uses of WorkRect and InnerClipRect before this point.
1085 if (table->RightMostStretchedColumn != -1)
1086 table->Flags &= ~ImGuiTableFlags_NoHostExtendX;
1088 {
1089 table->OuterRect.Max.x = table->WorkRect.Max.x = unused_x1;
1090 table->InnerClipRect.Max.x = ImMin(table->InnerClipRect.Max.x, unused_x1);
1091 }
1092 table->InnerWindow->ParentWorkRect = table->WorkRect;
1093 table->BorderX1 = table->InnerClipRect.Min.x;// +((table->Flags & ImGuiTableFlags_BordersOuter) ? 0.0f : -1.0f);
1094 table->BorderX2 = table->InnerClipRect.Max.x;// +((table->Flags & ImGuiTableFlags_BordersOuter) ? 0.0f : +1.0f);
1095
1096 // [Part 9] Allocate draw channels and setup background cliprect
1098
1099 // [Part 10] Hit testing on borders
1100 if (table->Flags & ImGuiTableFlags_Resizable)
1101 TableUpdateBorders(table);
1102 table->LastFirstRowHeight = 0.0f;
1103 table->IsLayoutLocked = true;
1104 table->IsUsingHeaders = false;
1105
1106 // [Part 11] Context menu
1107 if (table->IsContextPopupOpen && table->InstanceCurrent == table->InstanceInteracted)
1108 {
1109 const ImGuiID context_menu_id = ImHashStr("##ContextMenu", 0, table->ID);
1111 {
1112 TableDrawContextMenu(table);
1113 EndPopup();
1114 }
1115 else
1116 {
1117 table->IsContextPopupOpen = false;
1118 }
1119 }
1120
1121 // [Part 13] Sanitize and build sort specs before we have a change to use them for display.
1122 // This path will only be exercised when sort specs are modified before header rows (e.g. init or visibility change)
1123 if (table->IsSortSpecsDirty && (table->Flags & ImGuiTableFlags_Sortable))
1124 TableSortSpecsBuild(table);
1125
1126 // Initial state
1127 ImGuiWindow* inner_window = table->InnerWindow;
1128 if (table->Flags & ImGuiTableFlags_NoClip)
1130 else
1131 inner_window->DrawList->PushClipRect(inner_window->ClipRect.Min, inner_window->ClipRect.Max, false);
1132}
@ ImGuiTableColumnFlags_IsVisible
Definition imgui.h:1186
@ ImGuiTableColumnFlags_IsSorted
Definition imgui.h:1187
@ ImGuiTableFlags_SizingStretchProp
Definition imgui.h:1132
@ ImGuiTableFlags_PreciseWidths
Definition imgui.h:1138
IMGUI_API void TableUpdateBorders(ImGuiTable *table)
Definition imgui_tables.cpp:1138
IMGUI_API void TableSetupDrawChannels(ImGuiTable *table)
Definition imgui_tables.cpp:2242
IMGUI_API void TableDrawContextMenu(ImGuiTable *table)
Definition imgui_tables.cpp:3005
bool IsRequestOutput
Definition imgui_internal.h:2062
ImGuiTableColumnIdx LeftMostEnabledColumn
Definition imgui_internal.h:2170

References ImGuiTableColumn::AutoFitQueue, BeginPopupEx(), ImGuiTable::BorderX1, ImGuiTable::BorderX2, ImGuiTableColumn::CannotSkipItemsQueue, ImGuiTable::CellPaddingX, ImGuiTable::CellSpacingX1, ImGuiTable::CellSpacingX2, ImGuiWindow::ClipRect, ImGuiTableColumn::ClipRect, ImRect::ClipWithFull(), ImGuiTable::Columns, ImGuiTable::ColumnsCount, ImGuiTable::ColumnsEnabledCount, ImGuiTable::ColumnsEnabledFixedCount, ImGuiTable::ColumnsGivenWidth, ImGuiTableColumn::ContentMaxXFrozen, ImGuiTableColumn::ContentMaxXHeadersIdeal, ImGuiTableColumn::ContentMaxXHeadersUsed, ImGuiTableColumn::ContentMaxXUnfrozen, ImGuiTable::DeclColumnsCount, ImGuiTableColumn::DisplayOrder, ImGuiTable::DisplayOrderToIndex, ImGuiWindow::DrawList, ImGuiTable::DrawSplitter, ImGuiTable::EnabledMaskByDisplayOrder, ImGuiTable::EnabledMaskByIndex, EndPopup(), ImGuiTableColumn::Flags, ImGuiTable::Flags, ImGuiStyle::FramePadding, ImGuiTable::FreezeColumnsCount, ImGuiTable::FreezeRowsCount, ImRect::GetWidth(), GImGui, ImGuiTable::HostSkipItems, ImGuiTable::HoveredColumnBody, ImGuiTable::HoveredColumnBorder, ImGuiTable::ID, IM_ASSERT, IM_FLOOR, ImClamp(), ImFloor(), ImGuiNavLayer_Main, ImGuiNavLayer_Menu, ImGuiTableColumnFlags_IsEnabled, ImGuiTableColumnFlags_IsHovered, ImGuiTableColumnFlags_IsSorted, ImGuiTableColumnFlags_IsVisible, ImGuiTableColumnFlags_NoDirectResize_, ImGuiTableColumnFlags_NoHide, ImGuiTableColumnFlags_None, ImGuiTableColumnFlags_NoResize, ImGuiTableColumnFlags_WidthFixed, ImGuiTableColumnFlags_WidthStretch, ImGuiTableFlags_Hideable, ImGuiTableFlags_NoClip, ImGuiTableFlags_NoHostExtendX, ImGuiTableFlags_PreciseWidths, ImGuiTableFlags_Resizable, ImGuiTableFlags_ScrollX, ImGuiTableFlags_SizingFixedSame, ImGuiTableFlags_SizingMask_, ImGuiTableFlags_SizingStretchProp, ImGuiTableFlags_Sortable, ImGuiTableFlags_SortMulti, ImGuiTableFlags_SortTristate, ImGuiWindowFlags_AlwaysAutoResize, ImGuiWindowFlags_NoSavedSettings, ImGuiWindowFlags_NoTitleBar, ImHashStr(), ImMax(), ImMin(), ImGuiTableColumn::IndexWithinEnabledSet, ImGuiTableColumn::InitStretchWeightOrWidth, ImGuiTable::InnerClipRect, ImGuiTable::InnerWidth, ImGuiTable::InnerWindow, ImGuiTable::InstanceCurrent, ImGuiTable::InstanceInteracted, ImGuiContext::IO, ImGuiTable::IsContextPopupOpen, ImGuiTable::IsDefaultDisplayOrder, ImGuiTableColumn::IsEnabled, ImGuiTableColumn::IsEnabledNextFrame, ImGuiTable::IsInitializing, ImGuiTable::IsLayoutLocked, ImGuiTableColumn::IsPreserveWidthAuto, ImGuiTableColumn::IsRequestOutput, ImGuiTable::IsSettingsDirty, ImGuiTableColumn::IsSkipItems, ImGuiTable::IsSortSpecsDirty, ImGuiTable::IsUsingHeaders, ImGuiTableColumn::IsVisibleX, ImGuiTableColumn::IsVisibleY, ItemHoverable(), ImGuiTableColumn::ItemWidth, ImGuiTable::LastFirstRowHeight, ImGuiTable::LastOuterHeight, ImGuiTable::LeftMostEnabledColumn, ImGuiTable::LeftMostStretchedColumn, ImRect::Max, ImGuiTableColumn::MaxX, ImRect::Min, ImGuiTable::MinColumnWidth, ImGuiTableColumn::MinX, ImGuiIO::MousePos, ImGuiTableColumn::NameOffset, ImGuiTableColumn::NavLayerCurrent, ImGuiTableColumn::NextEnabledColumn, ImGuiTable::OuterPaddingX, ImGuiTable::OuterRect, ImGuiTable::OuterWindow, ImGuiWindow::ParentWorkRect, ImGuiTableColumn::PrevEnabledColumn, ImDrawList::PushClipRect(), ImGuiTable::RequestOutputMaskByIndex, ImGuiTable::RightMostEnabledColumn, ImGuiTable::RightMostStretchedColumn, ImDrawListSplitter::SetCurrentChannel(), ImGuiWindow::SkipItems, ImGuiTableColumn::SortOrder, ImGuiTable::SortSpecsCount, ImGuiTableColumn::StretchWeight, ImGuiContext::Style, TABLE_BORDER_SIZE, TABLE_DRAW_CHANNEL_NOCLIP, TableDrawContextMenu(), TableGetColumnWidthAuto(), TableGetMaxColumnWidth(), TableSetupColumnFlags(), TableSetupDrawChannels(), TableSortSpecsBuild(), TableUpdateBorders(), ImGuiTableColumn::UserID, ImGuiTable::VisibleMaskByIndex, ImGuiTableColumn::WidthAuto, ImGuiTableColumn::WidthGiven, ImGuiTableColumn::WidthRequest, ImGuiTableColumn::WorkMaxX, ImGuiTableColumn::WorkMinX, ImGuiTable::WorkRect, ImVec2::x, and ImVec2::y.

Referenced by EndTable(), TableGetSortSpecs(), TableHeadersRow(), and TableNextRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TempInputIsActive()

bool ImGui::TempInputIsActive ( ImGuiID  id)
inline
2591{ ImGuiContext& g = *GImGui; return (g.ActiveId == id && g.TempInputId == id); }

References ImGuiContext::ActiveId, GImGui, and ImGuiContext::TempInputId.

Referenced by DragScalar(), and SliderScalar().

+ Here is the caller graph for this function:

◆ TempInputScalar()

bool ImGui::TempInputScalar ( const ImRect bb,
ImGuiID  id,
const char *  label,
ImGuiDataType  data_type,
void p_data,
const char *  format,
const void p_clamp_min = NULL,
const void p_clamp_max = NULL 
)
3303{
3304 ImGuiContext& g = *GImGui;
3305
3306 char fmt_buf[32];
3307 char data_buf[32];
3308 format = ImParseFormatTrimDecorations(format, fmt_buf, IM_ARRAYSIZE(fmt_buf));
3309 DataTypeFormatString(data_buf, IM_ARRAYSIZE(data_buf), data_type, p_data, format);
3310 ImStrTrimBlanks(data_buf);
3311
3314 bool value_changed = false;
3315 if (TempInputText(bb, id, label, data_buf, IM_ARRAYSIZE(data_buf), flags))
3316 {
3317 // Backup old value
3318 size_t data_type_size = DataTypeGetInfo(data_type)->Size;
3319 ImGuiDataTypeTempStorage data_backup;
3320 memcpy(&data_backup, p_data, data_type_size);
3321
3322 // Apply new value (or operations) then clamp
3323 DataTypeApplyOpFromText(data_buf, g.InputTextState.InitialTextA.Data, data_type, p_data, NULL);
3324 if (p_clamp_min || p_clamp_max)
3325 {
3326 if (p_clamp_min && p_clamp_max && DataTypeCompare(data_type, p_clamp_min, p_clamp_max) > 0)
3327 ImSwap(p_clamp_min, p_clamp_max);
3328 DataTypeClamp(data_type, p_data, p_clamp_min, p_clamp_max);
3329 }
3330
3331 // Only mark as edited if new value is different
3332 value_changed = memcmp(&data_backup, p_data, data_type_size) != 0;
3333 if (value_changed)
3334 MarkItemEdited(id);
3335 }
3336 return value_changed;
3337}
void ImStrTrimBlanks(char *buf)
Definition imgui.cpp:1395
const char * ImParseFormatTrimDecorations(const char *fmt, char *buf, size_t buf_size)
Definition imgui_widgets.cpp:3241
IMGUI_API bool DataTypeClamp(ImGuiDataType data_type, void *p_data, const void *p_min, const void *p_max)
Definition imgui_widgets.cpp:2050
IMGUI_API bool TempInputText(const ImRect &bb, ImGuiID id, const char *label, char *buf, int buf_size, ImGuiInputTextFlags flags)
Definition imgui_widgets.cpp:3279

References ImVector< T >::Data, DataTypeApplyOpFromText(), DataTypeClamp(), DataTypeCompare(), DataTypeFormatString(), DataTypeGetInfo(), GImGui, IM_ARRAYSIZE, ImGuiDataType_Double, ImGuiDataType_Float, ImGuiInputTextFlags_AutoSelectAll, ImGuiInputTextFlags_CharsDecimal, ImGuiInputTextFlags_CharsScientific, ImGuiInputTextFlags_NoMarkEdited, ImParseFormatTrimDecorations(), ImStrTrimBlanks(), ImSwap(), ImGuiInputTextState::InitialTextA, ImGuiContext::InputTextState, MarkItemEdited(), ImGuiDataTypeInfo::Size, and TempInputText().

Referenced by DragScalar(), and SliderScalar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TempInputText()

bool ImGui::TempInputText ( const ImRect bb,
ImGuiID  id,
const char *  label,
char *  buf,
int  buf_size,
ImGuiInputTextFlags  flags 
)
3280{
3281 // On the first frame, g.TempInputTextId == 0, then on subsequent frames it becomes == id.
3282 // We clear ActiveID on the first frame to allow the InputText() taking it back.
3283 ImGuiContext& g = *GImGui;
3284 const bool init = (g.TempInputId != id);
3285 if (init)
3286 ClearActiveID();
3287
3288 g.CurrentWindow->DC.CursorPos = bb.Min;
3289 bool value_changed = InputTextEx(label, NULL, buf, buf_size, bb.GetSize(), flags | ImGuiInputTextFlags_MergedItem);
3290 if (init)
3291 {
3292 // First frame we started displaying the InputText widget, we expect it to take the active id.
3293 IM_ASSERT(g.ActiveId == id);
3294 g.TempInputId = g.ActiveId;
3295 }
3296 return value_changed;
3297}

References ImGuiContext::ActiveId, ClearActiveID(), ImGuiContext::CurrentWindow, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImRect::GetSize(), GImGui, IM_ASSERT, ImGuiInputTextFlags_MergedItem, InputTextEx(), ImRect::Min, and ImGuiContext::TempInputId.

Referenced by TempInputScalar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Text()

void ImGui::Text ( const char *  fmt,
  ... 
)
261{
262 va_list args;
263 va_start(args, fmt);
264 TextV(fmt, args);
265 va_end(args);
266}

References TextV().

Referenced by ColorPicker4(), ColorTooltip(), DebugNodeTabBar(), DebugNodeWindowSettings(), DebugNodeWindowsList(), MyDocument::DisplayContents(), Slic3r::GUI::draw(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoEmboss::draw_model_type(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), Slic3r::GUI::GLGizmoEmboss::draw_style_rename_popup(), Slic3r::GUI::GLGizmoEmboss::draw_style_save_as_popup(), priv::draw_transparent_icon(), EditTableSizingFlags(), Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), Slic3r::GUI::render_extruders_combo(), ShowAboutWindow(), ShowDemoWindow(), ShowDemoWindowColumns(), ShowDemoWindowLayout(), ShowDemoWindowMisc(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppAutoResize(), ShowExampleAppConstrainedResize(), ShowExampleAppCustomRendering(), ShowExampleAppDocuments(), ShowExampleAppLayout(), ShowExampleAppLongText(), ShowExampleAppSimpleOverlay(), ShowExampleAppWindowTitles(), ShowExampleMenuFile(), ShowFont(), ShowMetricsWindow(), ShowPlaceholderObject(), ShowStyleEditor(), Slic3r::GUI::ImGuiWrapper::text(), UpdateDebugToolItemPicker(), Value(), Value(), Value(), and Value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TextColored()

void ImGui::TextColored ( const ImVec4 col,
const char *  fmt,
  ... 
)
280{
281 va_list args;
282 va_start(args, fmt);
283 TextColoredV(col, fmt, args);
284 va_end(args);
285}
IMGUI_API void TextColoredV(const ImVec4 &col, const char *fmt, va_list args) IM_FMTLIST(2)
Definition imgui_widgets.cpp:287

References col(), and TextColoredV().

Referenced by DebugNodeDrawList(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), ShowDemoWindowLayout(), ShowDemoWindowWidgets(), Slic3r::GUI::ImGuiWrapper::text_colored(), and UpdateDebugToolItemPicker().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TextColoredV()

void ImGui::TextColoredV ( const ImVec4 col,
const char *  fmt,
va_list  args 
)
288{
290 if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0)
291 TextEx(va_arg(args, const char*), NULL, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting
292 else
293 TextV(fmt, args);
295}
@ ImGuiTextFlags_NoWidthForLargeClippedText
Definition imgui_internal.h:835

References col(), ImGuiCol_Text, ImGuiTextFlags_NoWidthForLargeClippedText, PopStyleColor(), PushStyleColor(), TextEx(), and TextV().

Referenced by TextColored().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TextDisabled()

void ImGui::TextDisabled ( const char *  fmt,
  ... 
)
298{
299 va_list args;
300 va_start(args, fmt);
301 TextDisabledV(fmt, args);
302 va_end(args);
303}
IMGUI_API void TextDisabledV(const char *fmt, va_list args) IM_FMTLIST(1)
Definition imgui_widgets.cpp:305

References TextDisabledV().

Referenced by DebugNodeDrawList(), DebugNodeWindow(), EditTableSizingFlags(), HelpMarker(), MetricsHelpMarker(), ShowDemoWindowTables(), and ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TextDisabledV()

void ImGui::TextDisabledV ( const char *  fmt,
va_list  args 
)
306{
307 ImGuiContext& g = *GImGui;
309 if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0)
310 TextEx(va_arg(args, const char*), NULL, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting
311 else
312 TextV(fmt, args);
314}

References ImGuiStyle::Colors, GImGui, ImGuiCol_Text, ImGuiCol_TextDisabled, ImGuiTextFlags_NoWidthForLargeClippedText, PopStyleColor(), PushStyleColor(), ImGuiContext::Style, TextEx(), and TextV().

Referenced by TextDisabled().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TextEx()

void ImGui::TextEx ( const char *  text,
const char *  text_end = NULL,
ImGuiTextFlags  flags = 0 
)
153{
154 ImGuiWindow* window = GetCurrentWindow();
155 if (window->SkipItems)
156 return;
157
158 ImGuiContext& g = *GImGui;
159 IM_ASSERT(text != NULL);
160 const char* text_begin = text;
161 if (text_end == NULL)
162 text_end = text + strlen(text); // FIXME-OPT
163
164 const ImVec2 text_pos(window->DC.CursorPos.x, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset);
165 const float wrap_pos_x = window->DC.TextWrapPos;
166 const bool wrap_enabled = (wrap_pos_x >= 0.0f);
167 if (text_end - text > 2000 && !wrap_enabled)
168 {
169 // Long text!
170 // Perform manual coarse clipping to optimize for long multi-line text
171 // - From this point we will only compute the width of lines that are visible. Optimization only available when word-wrapping is disabled.
172 // - We also don't vertically center the text within the line full height, which is unlikely to matter because we are likely the biggest and only item on the line.
173 // - We use memchr(), pay attention that well optimized versions of those str/mem functions are much faster than a casually written loop.
174 const char* line = text;
175 const float line_height = GetTextLineHeight();
176 ImVec2 text_size(0, 0);
177
178 // Lines to skip (can't skip when logging text)
179 ImVec2 pos = text_pos;
180 if (!g.LogEnabled)
181 {
182 int lines_skippable = (int)((window->ClipRect.Min.y - text_pos.y) / line_height);
183 if (lines_skippable > 0)
184 {
185 int lines_skipped = 0;
186 while (line < text_end && lines_skipped < lines_skippable)
187 {
188 const char* line_end = (const char*)memchr(line, '\n', text_end - line);
189 if (!line_end)
190 line_end = text_end;
192 text_size.x = ImMax(text_size.x, CalcTextSize(line, line_end).x);
193 line = line_end + 1;
194 lines_skipped++;
195 }
196 pos.y += lines_skipped * line_height;
197 }
198 }
199
200 // Lines to render
201 if (line < text_end)
202 {
203 ImRect line_rect(pos, pos + ImVec2(FLT_MAX, line_height));
204 while (line < text_end)
205 {
206 if (IsClippedEx(line_rect, 0, false))
207 break;
208
209 const char* line_end = (const char*)memchr(line, '\n', text_end - line);
210 if (!line_end)
211 line_end = text_end;
212 text_size.x = ImMax(text_size.x, CalcTextSize(line, line_end).x);
213 RenderText(pos, line, line_end, false);
214 line = line_end + 1;
215 line_rect.Min.y += line_height;
216 line_rect.Max.y += line_height;
217 pos.y += line_height;
218 }
219
220 // Count remaining lines
221 int lines_skipped = 0;
222 while (line < text_end)
223 {
224 const char* line_end = (const char*)memchr(line, '\n', text_end - line);
225 if (!line_end)
226 line_end = text_end;
228 text_size.x = ImMax(text_size.x, CalcTextSize(line, line_end).x);
229 line = line_end + 1;
230 lines_skipped++;
231 }
232 pos.y += lines_skipped * line_height;
233 }
234 text_size.y = (pos - text_pos).y;
235
236 ImRect bb(text_pos, text_pos + text_size);
237 ItemSize(text_size, 0.0f);
238 ItemAdd(bb, 0);
239 }
240 else
241 {
242 const float wrap_width = wrap_enabled ? CalcWrapWidthForPos(window->DC.CursorPos, wrap_pos_x) : 0.0f;
243 const ImVec2 text_size = CalcTextSize(text_begin, text_end, false, wrap_width);
244
245 ImRect bb(text_pos, text_pos + text_size);
246 ItemSize(text_size, 0.0f);
247 if (!ItemAdd(bb, 0))
248 return;
249
250 // Render (we don't hide text after ## in this end-user function)
251 RenderTextWrapped(bb.Min, text_begin, text_end, wrap_width);
252 }
253}
IMGUI_API float CalcWrapWidthForPos(const ImVec2 &pos, float wrap_pos_x)
Definition imgui.cpp:3300
IMGUI_API void RenderTextWrapped(ImVec2 pos, const char *text, const char *text_end, float wrap_width)
Definition imgui.cpp:2691

References CalcTextSize(), CalcWrapWidthForPos(), ImGuiWindow::ClipRect, ImGuiWindowTempData::CurrLineTextBaseOffset, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetCurrentWindow(), GetTextLineHeight(), GImGui, IM_ASSERT, ImGuiTextFlags_NoWidthForLargeClippedText, ImMax(), IsClippedEx(), ItemAdd(), ItemSize(), ImGuiContext::LogEnabled, ImRect::Max, ImRect::Min, RenderText(), RenderTextWrapped(), ImGuiWindow::SkipItems, ImGuiWindowTempData::TextWrapPos, ImVec2::x, and ImVec2::y.

Referenced by ColorButton(), ColorEdit4(), ColorPicker4(), ColorTooltip(), DragFloatRange2(), DragIntRange2(), DragScalarN(), InputScalar(), InputScalarN(), SliderScalarN(), TextColoredV(), TextDisabledV(), TextUnformatted(), TextV(), and TextWrappedV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TextUnformatted()

void ImGui::TextUnformatted ( const char *  text,
const char *  text_end = NULL 
)
256{
258}

References ImGuiTextFlags_NoWidthForLargeClippedText, and TextEx().

Referenced by ExampleAppConsole::Draw(), ExampleAppLog::Draw(), EditTableSizingFlags(), HelpMarker(), MetricsHelpMarker(), Slic3r::GUI::GLCanvas3D::Tooltip::render(), Slic3r::GUI::GCodeViewer::render_legend(), Slic3r::GUI::GLCanvas3D::LayersEditing::render_overlay(), ShowDemoWindowLayout(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowExampleAppAutoResize(), ShowExampleAppLongText(), ShowMetricsWindow(), ShowStyleEditor(), and Slic3r::GUI::ImGuiWrapper::tooltip().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TextV()

void ImGui::TextV ( const char *  fmt,
va_list  args 
)
269{
270 ImGuiWindow* window = GetCurrentWindow();
271 if (window->SkipItems)
272 return;
273
274 ImGuiContext& g = *GImGui;
275 const char* text_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
277}

References GetCurrentWindow(), GImGui, IM_ARRAYSIZE, ImFormatStringV(), ImGuiTextFlags_NoWidthForLargeClippedText, ImGuiWindow::SkipItems, ImGuiContext::TempBuffer, and TextEx().

Referenced by SetTooltipV(), Text(), TextColoredV(), TextDisabledV(), and TextWrappedV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TextWrapped()

void ImGui::TextWrapped ( const char *  fmt,
  ... 
)
317{
318 va_list args;
319 va_start(args, fmt);
320 TextWrappedV(fmt, args);
321 va_end(args);
322}
IMGUI_API void TextWrappedV(const char *fmt, va_list args) IM_FMTLIST(1)
Definition imgui_widgets.cpp:324

References TextWrappedV().

Referenced by MyDocument::DisplayContents(), ExampleAppConsole::Draw(), ShowDemoWindowColumns(), ShowDemoWindowLayout(), ShowDemoWindowMisc(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), and ShowExampleAppLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TextWrappedV()

void ImGui::TextWrappedV ( const char *  fmt,
va_list  args 
)
325{
326 ImGuiContext& g = *GImGui;
327 bool need_backup = (g.CurrentWindow->DC.TextWrapPos < 0.0f); // Keep existing wrap position if one is already set
328 if (need_backup)
329 PushTextWrapPos(0.0f);
330 if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0)
331 TextEx(va_arg(args, const char*), NULL, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting
332 else
333 TextV(fmt, args);
334 if (need_backup)
336}
IMGUI_API void PopTextWrapPos()
Definition imgui.cpp:6599
IMGUI_API void PushTextWrapPos(float wrap_local_pos_x=0.0f)
Definition imgui.cpp:6592

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, ImGuiTextFlags_NoWidthForLargeClippedText, PopTextWrapPos(), PushTextWrapPos(), TextEx(), TextV(), and ImGuiWindowTempData::TextWrapPos.

Referenced by TextWrapped().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TreeAdvanceToLabelPos()

static void ImGui::TreeAdvanceToLabelPos ( )
inlinestatic
IMGUI_API float GetCursorPosX()
Definition imgui.cpp:7499
IMGUI_API void SetCursorPosX(float local_x)
Definition imgui.cpp:7518

References GetCursorPosX(), GetTreeNodeToLabelSpacing(), SetCursorPosX(), and TreeAdvanceToLabelPos().

Referenced by TreeAdvanceToLabelPos().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TreeNode() [1/3]

bool ImGui::TreeNode ( const char *  label)
5594{
5595 ImGuiWindow* window = GetCurrentWindow();
5596 if (window->SkipItems)
5597 return false;
5598 return TreeNodeBehavior(window->GetID(label), 0, label, NULL);
5599}

References GetCurrentWindow(), ImGuiWindow::GetID(), ImGuiWindow::SkipItems, and TreeNodeBehavior().

Referenced by DebugNodeColumns(), DebugNodeDrawList(), DebugNodeStorage(), DebugNodeTabBar(), DebugNodeTable(), DebugNodeTableSettings(), DebugNodeViewport(), DebugNodeWindow(), DebugNodeWindowsList(), Slic3r::GUI::GLGizmoEmboss::draw_window(), ShowDemoWindow(), ShowDemoWindowColumns(), ShowDemoWindowLayout(), ShowDemoWindowMisc(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowFont(), ShowFontAtlas(), ShowMetricsWindow(), and ShowPlaceholderObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TreeNode() [2/3]

bool ImGui::TreeNode ( const char *  str_id,
const char *  fmt,
  ... 
)
5576{
5577 va_list args;
5578 va_start(args, fmt);
5579 bool is_open = TreeNodeExV(str_id, 0, fmt, args);
5580 va_end(args);
5581 return is_open;
5582}
IMGUI_API bool TreeNodeExV(const char *str_id, ImGuiTreeNodeFlags flags, const char *fmt, va_list args) IM_FMTLIST(3)
Definition imgui_widgets.cpp:5638

References TreeNodeExV().

+ Here is the call graph for this function:

◆ TreeNode() [3/3]

bool ImGui::TreeNode ( const void ptr_id,
const char *  fmt,
  ... 
)
5585{
5586 va_list args;
5587 va_start(args, fmt);
5588 bool is_open = TreeNodeExV(ptr_id, 0, fmt, args);
5589 va_end(args);
5590 return is_open;
5591}

References TreeNodeExV().

+ Here is the call graph for this function:

◆ TreeNodeBehavior()

bool ImGui::TreeNodeBehavior ( ImGuiID  id,
ImGuiTreeNodeFlags  flags,
const char *  label,
const char *  label_end = NULL 
)
5707{
5708 ImGuiWindow* window = GetCurrentWindow();
5709 if (window->SkipItems)
5710 return false;
5711
5712 ImGuiContext& g = *GImGui;
5713 const ImGuiStyle& style = g.Style;
5714 const bool display_frame = (flags & ImGuiTreeNodeFlags_Framed) != 0;
5715 const ImVec2 padding = (display_frame || (flags & ImGuiTreeNodeFlags_FramePadding)) ? style.FramePadding : ImVec2(style.FramePadding.x, ImMin(window->DC.CurrLineTextBaseOffset, style.FramePadding.y));
5716
5717 if (!label_end)
5718 label_end = FindRenderedTextEnd(label);
5719 const ImVec2 label_size = CalcTextSize(label, label_end, false);
5720
5721 // We vertically grow up to current line height up the typical widget height.
5722 const float frame_height = ImMax(ImMin(window->DC.CurrLineSize.y, g.FontSize + style.FramePadding.y * 2), label_size.y + padding.y * 2);
5723 ImRect frame_bb;
5724 frame_bb.Min.x = (flags & ImGuiTreeNodeFlags_SpanFullWidth) ? window->WorkRect.Min.x : window->DC.CursorPos.x;
5725 frame_bb.Min.y = window->DC.CursorPos.y;
5726 frame_bb.Max.x = window->WorkRect.Max.x;
5727 frame_bb.Max.y = window->DC.CursorPos.y + frame_height;
5728 if (display_frame)
5729 {
5730 // Framed header expand a little outside the default padding, to the edge of InnerClipRect
5731 // (FIXME: May remove this at some point and make InnerClipRect align with WindowPadding.x instead of WindowPadding.x*0.5f)
5732 frame_bb.Min.x -= IM_FLOOR(window->WindowPadding.x * 0.5f - 1.0f);
5733 frame_bb.Max.x += IM_FLOOR(window->WindowPadding.x * 0.5f);
5734 }
5735
5736 const float text_offset_x = g.FontSize + (display_frame ? padding.x * 3 : padding.x * 2); // Collapser arrow width + Spacing
5737 const float text_offset_y = ImMax(padding.y, window->DC.CurrLineTextBaseOffset); // Latch before ItemSize changes it
5738 const float text_width = g.FontSize + (label_size.x > 0.0f ? label_size.x + padding.x * 2 : 0.0f); // Include collapser
5739 ImVec2 text_pos(window->DC.CursorPos.x + text_offset_x, window->DC.CursorPos.y + text_offset_y);
5740 ItemSize(ImVec2(text_width, frame_height), padding.y);
5741
5742 // For regular tree nodes, we arbitrary allow to click past 2 worth of ItemSpacing
5743 ImRect interact_bb = frame_bb;
5744 if (!display_frame && (flags & (ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_SpanFullWidth)) == 0)
5745 interact_bb.Max.x = frame_bb.Min.x + text_width + style.ItemSpacing.x * 2.0f;
5746
5747 // Store a flag for the current depth to tell if we will allow closing this node when navigating one of its child.
5748 // For this purpose we essentially compare if g.NavIdIsAlive went from 0 to 1 between TreeNode() and TreePop().
5749 // This is currently only support 32 level deep and we are fine with (1 << Depth) overflowing into a zero.
5750 const bool is_leaf = (flags & ImGuiTreeNodeFlags_Leaf) != 0;
5751 bool is_open = TreeNodeBehaviorIsOpen(id, flags);
5753 window->DC.TreeJumpToParentOnPopMask |= (1 << window->DC.TreeDepth);
5754
5755 bool item_add = ItemAdd(interact_bb, id);
5757 window->DC.LastItemDisplayRect = frame_bb;
5758
5759 if (!item_add)
5760 {
5761 if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
5762 TreePushOverrideID(id);
5763 IMGUI_TEST_ENGINE_ITEM_INFO(window->DC.LastItemId, label, window->DC.LastItemStatusFlags | (is_leaf ? 0 : ImGuiItemStatusFlags_Openable) | (is_open ? ImGuiItemStatusFlags_Opened : 0));
5764 return is_open;
5765 }
5766
5769 button_flags |= ImGuiButtonFlags_AllowItemOverlap;
5770 if (!is_leaf)
5772
5773 // We allow clicking on the arrow section with keyboard modifiers held, in order to easily
5774 // allow browsing a tree while preserving selection with code implementing multi-selection patterns.
5775 // When clicking on the rest of the tree node we always disallow keyboard modifiers.
5776 const float arrow_hit_x1 = (text_pos.x - text_offset_x) - style.TouchExtraPadding.x;
5777 const float arrow_hit_x2 = (text_pos.x - text_offset_x) + (g.FontSize + padding.x * 2.0f) + style.TouchExtraPadding.x;
5778 const bool is_mouse_x_over_arrow = (g.IO.MousePos.x >= arrow_hit_x1 && g.IO.MousePos.x < arrow_hit_x2);
5779 if (window != g.HoveredWindow || !is_mouse_x_over_arrow)
5780 button_flags |= ImGuiButtonFlags_NoKeyModifiers;
5781
5782 // Open behaviors can be altered with the _OpenOnArrow and _OnOnDoubleClick flags.
5783 // Some alteration have subtle effects (e.g. toggle on MouseUp vs MouseDown events) due to requirements for multi-selection and drag and drop support.
5784 // - Single-click on label = Toggle on MouseUp (default, when _OpenOnArrow=0)
5785 // - Single-click on arrow = Toggle on MouseDown (when _OpenOnArrow=0)
5786 // - Single-click on arrow = Toggle on MouseDown (when _OpenOnArrow=1)
5787 // - Double-click on label = Toggle on MouseDoubleClick (when _OpenOnDoubleClick=1)
5788 // - Double-click on arrow = Toggle on MouseDoubleClick (when _OpenOnDoubleClick=1 and _OpenOnArrow=0)
5789 // It is rather standard that arrow click react on Down rather than Up.
5790 // We set ImGuiButtonFlags_PressedOnClickRelease on OpenOnDoubleClick because we want the item to be active on the initial MouseDown in order for drag and drop to work.
5791 if (is_mouse_x_over_arrow)
5792 button_flags |= ImGuiButtonFlags_PressedOnClick;
5793 else if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)
5795 else
5797
5798 bool selected = (flags & ImGuiTreeNodeFlags_Selected) != 0;
5799 const bool was_selected = selected;
5800
5801 bool hovered, held;
5802 bool pressed = ButtonBehavior(interact_bb, id, &hovered, &held, button_flags);
5803 bool toggled = false;
5804 if (!is_leaf)
5805 {
5806 if (pressed && g.DragDropHoldJustPressedId != id)
5807 {
5809 toggled = true;
5811 toggled |= is_mouse_x_over_arrow && !g.NavDisableMouseHover; // Lightweight equivalent of IsMouseHoveringRect() since ButtonBehavior() already did the job
5813 toggled = true;
5814 }
5815 else if (pressed && g.DragDropHoldJustPressedId == id)
5816 {
5818 if (!is_open) // When using Drag and Drop "hold to open" we keep the node highlighted after opening, but never close it again.
5819 toggled = true;
5820 }
5821
5822 if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Left && is_open)
5823 {
5824 toggled = true;
5826 }
5827 if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Right && !is_open) // If there's something upcoming on the line we may want to give it the priority?
5828 {
5829 toggled = true;
5831 }
5832
5833 if (toggled)
5834 {
5835 is_open = !is_open;
5836 window->DC.StateStorage->SetInt(id, is_open);
5838 }
5839 }
5842
5843 // In this branch, TreeNodeBehavior() cannot toggle the selection so this will never trigger.
5844 if (selected != was_selected) //-V547
5846
5847 // Render
5848 const ImU32 text_col = GetColorU32(ImGuiCol_Text);
5850 if (display_frame)
5851 {
5852 // Framed type
5853 const ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
5854 RenderFrame(frame_bb.Min, frame_bb.Max, bg_col, true, style.FrameRounding);
5855 RenderNavHighlight(frame_bb, id, nav_highlight_flags);
5856 if (flags & ImGuiTreeNodeFlags_Bullet)
5857 RenderBullet(window->DrawList, ImVec2(text_pos.x - text_offset_x * 0.60f, text_pos.y + g.FontSize * 0.5f), text_col);
5858 else if (!is_leaf)
5859 RenderArrow(window->DrawList, ImVec2(text_pos.x - text_offset_x + padding.x, text_pos.y), text_col, is_open ? ImGuiDir_Down : ImGuiDir_Right, 1.0f);
5860 else // Leaf without bullet, left-adjusted text
5861 text_pos.x -= text_offset_x;
5863 frame_bb.Max.x -= g.FontSize + style.FramePadding.x;
5864
5865 if (g.LogEnabled)
5866 LogSetNextTextDecoration("###", "###");
5867 RenderTextClipped(text_pos, frame_bb.Max, label, label_end, &label_size);
5868 }
5869 else
5870 {
5871 // Unframed typed for tree nodes
5872 if (hovered || selected)
5873 {
5874 const ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
5875 RenderFrame(frame_bb.Min, frame_bb.Max, bg_col, false);
5876 RenderNavHighlight(frame_bb, id, nav_highlight_flags);
5877 }
5878 if (flags & ImGuiTreeNodeFlags_Bullet)
5879 RenderBullet(window->DrawList, ImVec2(text_pos.x - text_offset_x * 0.5f, text_pos.y + g.FontSize * 0.5f), text_col);
5880 else if (!is_leaf)
5881 RenderArrow(window->DrawList, ImVec2(text_pos.x - text_offset_x + padding.x, text_pos.y + g.FontSize * 0.15f), text_col, is_open ? ImGuiDir_Down : ImGuiDir_Right, 0.70f);
5882 if (g.LogEnabled)
5883 LogSetNextTextDecoration(">", NULL);
5884 RenderText(text_pos, label, label_end, false);
5885 }
5886
5887 if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))
5889 IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.LastItemStatusFlags | (is_leaf ? 0 : ImGuiItemStatusFlags_Openable) | (is_open ? ImGuiItemStatusFlags_Opened : 0));
5890 return is_open;
5891}
@ ImGuiTreeNodeFlags_OpenOnArrow
Definition imgui.h:994
@ ImGuiTreeNodeFlags_Leaf
Definition imgui.h:995
@ ImGuiTreeNodeFlags_FramePadding
Definition imgui.h:997
@ ImGuiTreeNodeFlags_NoTreePushOnOpen
Definition imgui.h:990
@ ImGuiTreeNodeFlags_Framed
Definition imgui.h:988
@ ImGuiTreeNodeFlags_SpanFullWidth
Definition imgui.h:999
@ ImGuiTreeNodeFlags_NavLeftJumpsBackHere
Definition imgui.h:1000
@ ImGuiTreeNodeFlags_OpenOnDoubleClick
Definition imgui.h:993
@ ImGuiTreeNodeFlags_Bullet
Definition imgui.h:996
@ ImGuiTreeNodeFlags_SpanAvailWidth
Definition imgui.h:998
int ImGuiNavHighlightFlags
Definition imgui_internal.h:146
IMGUI_API void TreePushOverrideID(ImGuiID id)
Definition imgui_widgets.cpp:5909
IMGUI_API void SetInt(ImGuiID key, int val)
Definition imgui.cpp:1975

References ButtonBehavior(), CalcTextSize(), ImGuiWindowTempData::CurrLineSize, ImGuiWindowTempData::CurrLineTextBaseOffset, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, ImGuiContext::DragDropHoldJustPressedId, ImGuiWindow::DrawList, FindRenderedTextEnd(), ImGuiContext::FontSize, GetColorU32(), GetCurrentWindow(), GImGui, ImGuiContext::HoveredWindow, IM_ASSERT, IM_FLOOR, IMGUI_TEST_ENGINE_ITEM_INFO, ImGuiButtonFlags_AllowItemOverlap, ImGuiButtonFlags_NoKeyModifiers, ImGuiButtonFlags_PressedOnClick, ImGuiButtonFlags_PressedOnClickRelease, ImGuiButtonFlags_PressedOnDoubleClick, ImGuiButtonFlags_PressedOnDragDropHold, ImGuiCol_Header, ImGuiCol_HeaderActive, ImGuiCol_HeaderHovered, ImGuiCol_Text, ImGuiDir_Down, ImGuiDir_Left, ImGuiDir_Right, ImGuiItemStatusFlags_HasDisplayRect, ImGuiItemStatusFlags_ToggledOpen, ImGuiItemStatusFlags_ToggledSelection, ImGuiNavHighlightFlags_TypeThin, ImGuiTreeNodeFlags_AllowItemOverlap, ImGuiTreeNodeFlags_Bullet, ImGuiTreeNodeFlags_ClipLabelForTrailingButton, ImGuiTreeNodeFlags_Framed, ImGuiTreeNodeFlags_FramePadding, ImGuiTreeNodeFlags_Leaf, ImGuiTreeNodeFlags_NavLeftJumpsBackHere, ImGuiTreeNodeFlags_None, ImGuiTreeNodeFlags_NoTreePushOnOpen, ImGuiTreeNodeFlags_OpenOnArrow, ImGuiTreeNodeFlags_OpenOnDoubleClick, ImGuiTreeNodeFlags_Selected, ImGuiTreeNodeFlags_SpanAvailWidth, ImGuiTreeNodeFlags_SpanFullWidth, ImMax(), ImMin(), ImGuiContext::IO, ItemAdd(), ItemSize(), ImGuiWindowTempData::LastItemDisplayRect, ImGuiWindowTempData::LastItemId, ImGuiWindowTempData::LastItemStatusFlags, ImGuiContext::LogEnabled, LogSetNextTextDecoration(), ImRect::Max, ImRect::Min, ImGuiIO::MouseDoubleClicked, ImGuiIO::MousePos, ImGuiContext::NavActivateId, ImGuiContext::NavDisableMouseHover, ImGuiContext::NavId, ImGuiContext::NavIdIsAlive, ImGuiContext::NavMoveDir, ImGuiContext::NavMoveRequest, NavMoveRequestCancel(), RenderArrow(), RenderBullet(), RenderFrame(), RenderNavHighlight(), RenderText(), RenderTextClipped(), ImGuiStorage::SetInt(), SetItemAllowOverlap(), ImGuiWindow::SkipItems, ImGuiWindowTempData::StateStorage, ImGuiContext::Style, style, ImGuiWindowTempData::TreeDepth, ImGuiWindowTempData::TreeJumpToParentOnPopMask, TreeNodeBehaviorIsOpen(), TreePushOverrideID(), ImGuiWindow::WindowPadding, ImGuiWindow::WorkRect, ImVec2::x, and ImVec2::y.

Referenced by CollapsingHeader(), CollapsingHeader(), TreeNode(), TreeNodeEx(), TreeNodeExV(), and TreeNodeExV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TreeNodeBehaviorIsOpen()

bool ImGui::TreeNodeBehaviorIsOpen ( ImGuiID  id,
ImGuiTreeNodeFlags  flags = 0 
)
5661{
5662 if (flags & ImGuiTreeNodeFlags_Leaf)
5663 return true;
5664
5665 // We only write to the tree storage if the user clicks (or explicitly use the SetNextItemOpen function)
5666 ImGuiContext& g = *GImGui;
5667 ImGuiWindow* window = g.CurrentWindow;
5668 ImGuiStorage* storage = window->DC.StateStorage;
5669
5670 bool is_open;
5672 {
5674 {
5675 is_open = g.NextItemData.OpenVal;
5676 storage->SetInt(id, is_open);
5677 }
5678 else
5679 {
5680 // We treat ImGuiCond_Once and ImGuiCond_FirstUseEver the same because tree node state are not saved persistently.
5681 const int stored_value = storage->GetInt(id, -1);
5682 if (stored_value == -1)
5683 {
5684 is_open = g.NextItemData.OpenVal;
5685 storage->SetInt(id, is_open);
5686 }
5687 else
5688 {
5689 is_open = stored_value != 0;
5690 }
5691 }
5692 }
5693 else
5694 {
5695 is_open = storage->GetInt(id, (flags & ImGuiTreeNodeFlags_DefaultOpen) ? 1 : 0) != 0;
5696 }
5697
5698 // When logging is enabled, we automatically expand tree nodes (but *NOT* collapsing headers.. seems like sensible behavior).
5699 // NB- If we are above max depth we still allow manually opened nodes to be logged.
5701 is_open = true;
5702
5703 return is_open;
5704}
@ ImGuiTreeNodeFlags_NoAutoOpenOnLog
Definition imgui.h:991
@ ImGuiTreeNodeFlags_DefaultOpen
Definition imgui.h:992
Definition imgui.h:2078
IMGUI_API int GetInt(ImGuiID key, int default_val=0) const
Definition imgui.cpp:1915

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, ImGuiNextItemData::Flags, ImGuiStorage::GetInt(), GImGui, ImGuiCond_Always, ImGuiNextItemDataFlags_HasOpen, ImGuiTreeNodeFlags_DefaultOpen, ImGuiTreeNodeFlags_Leaf, ImGuiTreeNodeFlags_NoAutoOpenOnLog, ImGuiContext::LogDepthRef, ImGuiContext::LogDepthToExpand, ImGuiContext::LogEnabled, ImGuiContext::NextItemData, ImGuiNextItemData::OpenCond, ImGuiNextItemData::OpenVal, ImGuiStorage::SetInt(), ImGuiWindowTempData::StateStorage, and ImGuiWindowTempData::TreeDepth.

Referenced by TreeNodeBehavior().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TreeNodeEx() [1/3]

bool ImGui::TreeNodeEx ( const char *  label,
ImGuiTreeNodeFlags  flags = 0 
)
5612{
5613 ImGuiWindow* window = GetCurrentWindow();
5614 if (window->SkipItems)
5615 return false;
5616
5617 return TreeNodeBehavior(window->GetID(label), flags, label, NULL);
5618}

References GetCurrentWindow(), ImGuiWindow::GetID(), ImGuiWindow::SkipItems, and TreeNodeBehavior().

Referenced by DebugNodeWindow(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), and ShowPlaceholderObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TreeNodeEx() [2/3]

bool ImGui::TreeNodeEx ( const char *  str_id,
ImGuiTreeNodeFlags  flags,
const char *  fmt,
  ... 
)
5621{
5622 va_list args;
5623 va_start(args, fmt);
5624 bool is_open = TreeNodeExV(str_id, flags, fmt, args);
5625 va_end(args);
5626 return is_open;
5627}

References TreeNodeExV().

+ Here is the call graph for this function:

◆ TreeNodeEx() [3/3]

bool ImGui::TreeNodeEx ( const void ptr_id,
ImGuiTreeNodeFlags  flags,
const char *  fmt,
  ... 
)
5630{
5631 va_list args;
5632 va_start(args, fmt);
5633 bool is_open = TreeNodeExV(ptr_id, flags, fmt, args);
5634 va_end(args);
5635 return is_open;
5636}

References TreeNodeExV().

+ Here is the call graph for this function:

◆ TreeNodeExV() [1/2]

bool ImGui::TreeNodeExV ( const char *  str_id,
ImGuiTreeNodeFlags  flags,
const char *  fmt,
va_list  args 
)
5639{
5640 ImGuiWindow* window = GetCurrentWindow();
5641 if (window->SkipItems)
5642 return false;
5643
5644 ImGuiContext& g = *GImGui;
5645 const char* label_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
5646 return TreeNodeBehavior(window->GetID(str_id), flags, g.TempBuffer, label_end);
5647}

References GetCurrentWindow(), ImGuiWindow::GetID(), GImGui, IM_ARRAYSIZE, ImFormatStringV(), ImGuiWindow::SkipItems, ImGuiContext::TempBuffer, and TreeNodeBehavior().

Referenced by TreeNode(), TreeNode(), TreeNodeEx(), TreeNodeEx(), TreeNodeV(), and TreeNodeV().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TreeNodeExV() [2/2]

bool ImGui::TreeNodeExV ( const void ptr_id,
ImGuiTreeNodeFlags  flags,
const char *  fmt,
va_list  args 
)
5650{
5651 ImGuiWindow* window = GetCurrentWindow();
5652 if (window->SkipItems)
5653 return false;
5654
5655 ImGuiContext& g = *GImGui;
5656 const char* label_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
5657 return TreeNodeBehavior(window->GetID(ptr_id), flags, g.TempBuffer, label_end);
5658}

References GetCurrentWindow(), ImGuiWindow::GetID(), GImGui, IM_ARRAYSIZE, ImFormatStringV(), ImGuiWindow::SkipItems, ImGuiContext::TempBuffer, and TreeNodeBehavior().

+ Here is the call graph for this function:

◆ TreeNodeV() [1/2]

bool ImGui::TreeNodeV ( const char *  str_id,
const char *  fmt,
va_list  args 
)
5602{
5603 return TreeNodeExV(str_id, 0, fmt, args);
5604}

References TreeNodeExV().

+ Here is the call graph for this function:

◆ TreeNodeV() [2/2]

bool ImGui::TreeNodeV ( const void ptr_id,
const char *  fmt,
va_list  args 
)
5607{
5608 return TreeNodeExV(ptr_id, 0, fmt, args);
5609}

References TreeNodeExV().

+ Here is the call graph for this function:

◆ TreePop()

void ImGui::TreePop ( )
5919{
5920 ImGuiContext& g = *GImGui;
5921 ImGuiWindow* window = g.CurrentWindow;
5922 Unindent();
5923
5924 window->DC.TreeDepth--;
5925 ImU32 tree_depth_mask = (1 << window->DC.TreeDepth);
5926
5927 // Handle Left arrow to move to parent tree node (when ImGuiTreeNodeFlags_NavLeftJumpsBackHere is enabled)
5929 if (g.NavIdIsAlive && (window->DC.TreeJumpToParentOnPopMask & tree_depth_mask))
5930 {
5931 SetNavID(window->IDStack.back(), g.NavLayer, 0, ImRect());
5933 }
5934 window->DC.TreeJumpToParentOnPopMask &= tree_depth_mask - 1;
5935
5936 IM_ASSERT(window->IDStack.Size > 1); // There should always be 1 element in the IDStack (pushed during window creation). If this triggers you called TreePop/PopID too much.
5937 PopID();
5938}

References ImVector< T >::back(), ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, ImGuiWindow::IDStack, IM_ASSERT, ImGuiDir_Left, ImGuiContext::NavIdIsAlive, ImGuiContext::NavLayer, ImGuiContext::NavMoveDir, NavMoveRequestButNoResultYet(), NavMoveRequestCancel(), ImGuiContext::NavWindow, PopID(), SetNavID(), ImVector< T >::Size, ImGuiWindowTempData::TreeDepth, ImGuiWindowTempData::TreeJumpToParentOnPopMask, and Unindent().

Referenced by DebugNodeColumns(), DebugNodeDrawList(), DebugNodeStorage(), DebugNodeTabBar(), DebugNodeTable(), DebugNodeTableSettings(), DebugNodeViewport(), DebugNodeWindow(), DebugNodeWindowsList(), Slic3r::GUI::GLGizmoEmboss::draw_window(), ErrorCheckEndFrameRecover(), ShowDemoWindow(), ShowDemoWindowColumns(), ShowDemoWindowLayout(), ShowDemoWindowMisc(), ShowDemoWindowPopups(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowFont(), ShowFontAtlas(), ShowMetricsWindow(), and ShowPlaceholderObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TreePush() [1/2]

void ImGui::TreePush ( const char *  str_id)
5894{
5895 ImGuiWindow* window = GetCurrentWindow();
5896 Indent();
5897 window->DC.TreeDepth++;
5898 PushID(str_id ? str_id : "#TreePush");
5899}

References ImGuiWindow::DC, GetCurrentWindow(), Indent(), PushID(), and ImGuiWindowTempData::TreeDepth.

+ Here is the call graph for this function:

◆ TreePush() [2/2]

void ImGui::TreePush ( const void ptr_id = NULL)
5902{
5903 ImGuiWindow* window = GetCurrentWindow();
5904 Indent();
5905 window->DC.TreeDepth++;
5906 PushID(ptr_id ? ptr_id : (const void*)"#TreePush");
5907}

References ImGuiWindow::DC, GetCurrentWindow(), Indent(), PushID(), and ImGuiWindowTempData::TreeDepth.

+ Here is the call graph for this function:

◆ TreePushOverrideID()

void ImGui::TreePushOverrideID ( ImGuiID  id)
5910{
5911 ImGuiContext& g = *GImGui;
5912 ImGuiWindow* window = g.CurrentWindow;
5913 Indent();
5914 window->DC.TreeDepth++;
5915 window->IDStack.push_back(id);
5916}

References ImGuiContext::CurrentWindow, ImGuiWindow::DC, GImGui, ImGuiWindow::IDStack, Indent(), ImVector< T >::push_back(), and ImGuiWindowTempData::TreeDepth.

Referenced by TreeNodeBehavior().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Unindent()

void ImGui::Unindent ( float  indent_w = 0.0f)
7547{
7548 ImGuiContext& g = *GImGui;
7549 ImGuiWindow* window = GetCurrentWindow();
7550 window->DC.Indent.x -= (indent_w != 0.0f) ? indent_w : g.Style.IndentSpacing;
7551 window->DC.CursorPos.x = window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x;
7552}

References ImGuiWindowTempData::ColumnsOffset, ImGuiWindowTempData::CursorPos, ImGuiWindow::DC, GetCurrentWindow(), GImGui, ImGuiWindowTempData::Indent, ImGuiStyle::IndentSpacing, ImGuiWindow::Pos, ImGuiContext::Style, ImVec2::x, and ImVec1::x.

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_window(), ShowDemoWindowLayout(), ShowDemoWindowTables(), ShowDemoWindowWidgets(), ShowExampleAppFullscreen(), ShowMetricsWindow(), ShowUserGuide(), and TreePop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateDebugToolItemPicker()

void ImGui::UpdateDebugToolItemPicker ( )
static
4103{
4104 ImGuiContext& g = *GImGui;
4107 {
4108 const ImGuiID hovered_id = g.HoveredIdPreviousFrame;
4111 g.DebugItemPickerActive = false;
4112 if (IsMouseClicked(0) && hovered_id)
4113 {
4114 g.DebugItemPickerBreakId = hovered_id;
4115 g.DebugItemPickerActive = false;
4116 }
4117 SetNextWindowBgAlpha(0.60f);
4118 BeginTooltip();
4119 Text("HoveredId: 0x%08X", hovered_id);
4120 Text("Press ESC to abort picking.");
4121 TextColored(GetStyleColorVec4(hovered_id ? ImGuiCol_Text : ImGuiCol_TextDisabled), "Click to break in debugger!");
4122 EndTooltip();
4123 }
4124}
@ ImGuiMouseCursor_Hand
Definition imgui.h:1604

References BeginTooltip(), ImGuiContext::DebugItemPickerActive, ImGuiContext::DebugItemPickerBreakId, EndTooltip(), GetStyleColorVec4(), GImGui, ImGuiContext::HoveredIdPreviousFrame, ImGuiCol_Text, ImGuiCol_TextDisabled, ImGuiKey_Escape, ImGuiMouseCursor_Hand, IsKeyPressedMap(), IsMouseClicked(), SetMouseCursor(), SetNextWindowBgAlpha(), Text(), and TextColored().

Referenced by NewFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateHoveredWindowAndCaptureFlags()

void ImGui::UpdateHoveredWindowAndCaptureFlags ( )
3827{
3828 ImGuiContext& g = *GImGui;
3830
3831 // Find the window hovered by mouse:
3832 // - Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow.
3833 // - When moving a window we can skip the search, which also conveniently bypasses the fact that window->WindowRectClipped is lagging as this point of the frame.
3834 // - We also support the moved window toggling the NoInputs flag after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms.
3835 bool clear_hovered_windows = false;
3837
3838 // Modal windows prevents mouse from hovering behind them.
3839 ImGuiWindow* modal_window = GetTopMostPopupModal();
3840 if (modal_window && g.HoveredWindow && !IsWindowChildOf(g.HoveredWindow->RootWindow, modal_window))
3841 clear_hovered_windows = true;
3842
3843 // Disabled mouse?
3845 clear_hovered_windows = true;
3846
3847 // We track click ownership. When clicked outside of a window the click is owned by the application and won't report hovering nor request capture even while dragging over our windows afterward.
3848 int mouse_earliest_button_down = -1;
3849 bool mouse_any_down = false;
3850 for (int i = 0; i < IM_ARRAYSIZE(g.IO.MouseDown); i++)
3851 {
3852 if (g.IO.MouseClicked[i])
3853 g.IO.MouseDownOwned[i] = (g.HoveredWindow != NULL) || (g.OpenPopupStack.Size > 0);
3854 mouse_any_down |= g.IO.MouseDown[i];
3855 if (g.IO.MouseDown[i])
3856 if (mouse_earliest_button_down == -1 || g.IO.MouseClickedTime[i] < g.IO.MouseClickedTime[mouse_earliest_button_down])
3857 mouse_earliest_button_down = i;
3858 }
3859 const bool mouse_avail_to_imgui = (mouse_earliest_button_down == -1) || g.IO.MouseDownOwned[mouse_earliest_button_down];
3860
3861 // If mouse was first clicked outside of ImGui bounds we also cancel out hovering.
3862 // FIXME: For patterns of drag and drop across OS windows, we may need to rework/remove this test (first committed 311c0ca9 on 2015/02)
3863 const bool mouse_dragging_extern_payload = g.DragDropActive && (g.DragDropSourceFlags & ImGuiDragDropFlags_SourceExtern) != 0;
3864 if (!mouse_avail_to_imgui && !mouse_dragging_extern_payload)
3865 clear_hovered_windows = true;
3866
3867 if (clear_hovered_windows)
3869
3870 // Update io.WantCaptureMouse for the user application (true = dispatch mouse info to imgui, false = dispatch mouse info to Dear ImGui + app)
3871 if (g.WantCaptureMouseNextFrame != -1)
3873 else
3874 g.IO.WantCaptureMouse = (mouse_avail_to_imgui && (g.HoveredWindow != NULL || mouse_any_down)) || (g.OpenPopupStack.Size > 0);
3875
3876 // Update io.WantCaptureKeyboard for the user application (true = dispatch keyboard info to imgui, false = dispatch keyboard info to Dear ImGui + app)
3877 if (g.WantCaptureKeyboardNextFrame != -1)
3879 else
3880 g.IO.WantCaptureKeyboard = (g.ActiveId != 0) || (modal_window != NULL);
3882 g.IO.WantCaptureKeyboard = true;
3883
3884 // Update io.WantTextInput flag, this is to allow systems without a keyboard (e.g. mobile, hand-held) to show a software keyboard if possible
3885 g.IO.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : false;
3886}
static const float WINDOWS_HOVER_PADDING
Definition imgui.cpp:867
static void FindHoveredWindow()
Definition imgui.cpp:4554
ImVec2 WindowsHoverPadding
Definition imgui_internal.h:1379
bool WantTextInput
Definition imgui.h:1862
bool WantCaptureKeyboard
Definition imgui.h:1861
bool MouseDownOwned[5]
Definition imgui.h:1886
bool WantCaptureMouse
Definition imgui.h:1860
double MouseClickedTime[5]
Definition imgui.h:1882

References ImGuiContext::ActiveId, ImGuiIO::ConfigFlags, ImGuiContext::DragDropActive, ImGuiContext::DragDropSourceFlags, FindHoveredWindow(), GetTopMostPopupModal(), GImGui, ImGuiContext::HoveredWindow, ImGuiContext::HoveredWindowUnderMovingWindow, IM_ARRAYSIZE, ImGuiConfigFlags_NavEnableKeyboard, ImGuiConfigFlags_NavNoCaptureKeyboard, ImGuiConfigFlags_NoMouse, ImGuiDragDropFlags_SourceExtern, ImMax(), ImGuiContext::IO, IsWindowChildOf(), ImGuiIO::MouseClicked, ImGuiIO::MouseClickedTime, ImGuiIO::MouseDown, ImGuiIO::MouseDownOwned, ImGuiIO::NavActive, ImGuiContext::OpenPopupStack, ImGuiWindow::RootWindow, ImVector< T >::Size, ImGuiContext::Style, ImGuiStyle::TouchExtraPadding, ImGuiIO::WantCaptureKeyboard, ImGuiContext::WantCaptureKeyboardNextFrame, ImGuiIO::WantCaptureMouse, ImGuiContext::WantCaptureMouseNextFrame, ImGuiIO::WantTextInput, ImGuiContext::WantTextInputNextFrame, WINDOWS_HOVER_PADDING, and ImGuiContext::WindowsHoverPadding.

Referenced by NewFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateMouseInputs()

static void ImGui::UpdateMouseInputs ( )
static
3636{
3637 ImGuiContext& g = *GImGui;
3638
3639 // Round mouse position to avoid spreading non-rounded position (e.g. UpdateManualResize doesn't support them well)
3640 if (IsMousePosValid(&g.IO.MousePos))
3642
3643 // If mouse just appeared or disappeared (usually denoted by -FLT_MAX components) we cancel out movement in MouseDelta
3646 else
3647 g.IO.MouseDelta = ImVec2(0.0f, 0.0f);
3648 if (g.IO.MouseDelta.x != 0.0f || g.IO.MouseDelta.y != 0.0f)
3649 g.NavDisableMouseHover = false;
3650
3651 g.IO.MousePosPrev = g.IO.MousePos;
3652 for (int i = 0; i < IM_ARRAYSIZE(g.IO.MouseDown); i++)
3653 {
3654 g.IO.MouseClicked[i] = g.IO.MouseDown[i] && g.IO.MouseDownDuration[i] < 0.0f;
3655 g.IO.MouseReleased[i] = !g.IO.MouseDown[i] && g.IO.MouseDownDuration[i] >= 0.0f;
3657 g.IO.MouseDownDuration[i] = g.IO.MouseDown[i] ? (g.IO.MouseDownDuration[i] < 0.0f ? 0.0f : g.IO.MouseDownDuration[i] + g.IO.DeltaTime) : -1.0f;
3658 g.IO.MouseDoubleClicked[i] = false;
3659 if (g.IO.MouseClicked[i])
3660 {
3661 if ((float)(g.Time - g.IO.MouseClickedTime[i]) < g.IO.MouseDoubleClickTime)
3662 {
3663 ImVec2 delta_from_click_pos = IsMousePosValid(&g.IO.MousePos) ? (g.IO.MousePos - g.IO.MouseClickedPos[i]) : ImVec2(0.0f, 0.0f);
3664 if (ImLengthSqr(delta_from_click_pos) < g.IO.MouseDoubleClickMaxDist * g.IO.MouseDoubleClickMaxDist)
3665 g.IO.MouseDoubleClicked[i] = true;
3666 g.IO.MouseClickedTime[i] = -g.IO.MouseDoubleClickTime * 2.0f; // Mark as "old enough" so the third click isn't turned into a double-click
3667 }
3668 else
3669 {
3670 g.IO.MouseClickedTime[i] = g.Time;
3671 }
3672 g.IO.MouseClickedPos[i] = g.IO.MousePos;
3674 g.IO.MouseDragMaxDistanceAbs[i] = ImVec2(0.0f, 0.0f);
3675 g.IO.MouseDragMaxDistanceSqr[i] = 0.0f;
3676 }
3677 else if (g.IO.MouseDown[i])
3678 {
3679 // Maintain the maximum distance we reaching from the initial click position, which is used with dragging threshold
3680 ImVec2 delta_from_click_pos = IsMousePosValid(&g.IO.MousePos) ? (g.IO.MousePos - g.IO.MouseClickedPos[i]) : ImVec2(0.0f, 0.0f);
3681 g.IO.MouseDragMaxDistanceSqr[i] = ImMax(g.IO.MouseDragMaxDistanceSqr[i], ImLengthSqr(delta_from_click_pos));
3682 g.IO.MouseDragMaxDistanceAbs[i].x = ImMax(g.IO.MouseDragMaxDistanceAbs[i].x, delta_from_click_pos.x < 0.0f ? -delta_from_click_pos.x : delta_from_click_pos.x);
3683 g.IO.MouseDragMaxDistanceAbs[i].y = ImMax(g.IO.MouseDragMaxDistanceAbs[i].y, delta_from_click_pos.y < 0.0f ? -delta_from_click_pos.y : delta_from_click_pos.y);
3684 }
3685 if (!g.IO.MouseDown[i] && !g.IO.MouseReleased[i])
3686 g.IO.MouseDownWasDoubleClick[i] = false;
3687 if (g.IO.MouseClicked[i]) // Clicking any mouse button reactivate mouse hovering which may have been deactivated by gamepad/keyboard navigation
3688 g.NavDisableMouseHover = false;
3689 }
3690}
float MouseDoubleClickMaxDist
Definition imgui.h:1788
ImVec2 MouseDragMaxDistanceAbs[5]
Definition imgui.h:1890
float MouseDoubleClickTime
Definition imgui.h:1787

References ImGuiIO::DeltaTime, GImGui, IM_ARRAYSIZE, ImFloor(), ImLengthSqr(), ImMax(), ImGuiContext::IO, IsMousePosValid(), ImGuiContext::LastValidMousePos, ImGuiIO::MouseClicked, ImGuiIO::MouseClickedPos, ImGuiIO::MouseClickedTime, ImGuiIO::MouseDelta, ImGuiIO::MouseDoubleClicked, ImGuiIO::MouseDoubleClickMaxDist, ImGuiIO::MouseDoubleClickTime, ImGuiIO::MouseDown, ImGuiIO::MouseDownDuration, ImGuiIO::MouseDownDurationPrev, ImGuiIO::MouseDownWasDoubleClick, ImGuiIO::MouseDragMaxDistanceAbs, ImGuiIO::MouseDragMaxDistanceSqr, ImGuiIO::MousePos, ImGuiIO::MousePosPrev, ImGuiIO::MouseReleased, ImGuiContext::NavDisableMouseHover, ImGuiContext::Time, ImVec2::x, and ImVec2::y.

Referenced by NewFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateMouseMovingWindowEndFrame()

void ImGui::UpdateMouseMovingWindowEndFrame ( )
3579{
3580 ImGuiContext& g = *GImGui;
3581 if (g.ActiveId != 0 || g.HoveredId != 0)
3582 return;
3583
3584 // Unless we just made a window/popup appear
3585 if (g.NavWindow && g.NavWindow->Appearing)
3586 return;
3587
3588 // Click on empty space to focus window and start moving
3589 // (after we're done with all our widgets)
3590 if (g.IO.MouseClicked[0])
3591 {
3592 // Handle the edge case of a popup being closed while clicking in its empty space.
3593 // If we try to focus it, FocusWindow() > ClosePopupsOverWindow() will accidentally close any parent popups because they are not linked together any more.
3594 ImGuiWindow* root_window = g.HoveredWindow ? g.HoveredWindow->RootWindow : NULL;
3595 const bool is_closed_popup = root_window && (root_window->Flags & ImGuiWindowFlags_Popup) && !IsPopupOpen(root_window->PopupId, ImGuiPopupFlags_AnyPopupLevel);
3596
3597 if (root_window != NULL && !is_closed_popup)
3598 {
3600
3601 // Cancel moving if clicked outside of title bar
3603 if (!root_window->TitleBarRect().Contains(g.IO.MouseClickedPos[0]))
3604 g.MovingWindow = NULL;
3605
3606 // Cancel moving if clicked over an item which was disabled or inhibited by popups (note that we know HoveredId == 0 already)
3607 if (g.HoveredIdDisabled)
3608 g.MovingWindow = NULL;
3609 }
3610 else if (root_window == NULL && g.NavWindow != NULL && GetTopMostPopupModal() == NULL)
3611 {
3612 // Clicking on void disable focus
3613 FocusWindow(NULL);
3614 }
3615 }
3616
3617 // With right mouse button we close popups without changing focus based on where the mouse is aimed
3618 // Instead, focus will be restored to the window under the bottom-most closed popup.
3619 // (The left mouse button path calls FocusWindow on the hovered window, which will lead NewFrame->ClosePopupsOverWindow to trigger)
3620 if (g.IO.MouseClicked[1])
3621 {
3622 // Find the top-most window between HoveredWindow and the top-most Modal Window.
3623 // This is where we can trim the popup stack.
3625 bool hovered_window_above_modal = g.HoveredWindow && IsWindowAbove(g.HoveredWindow, modal);
3626 ClosePopupsOverWindow(hovered_window_above_modal ? g.HoveredWindow : modal, true);
3627 }
3628}
IMGUI_API bool IsWindowAbove(ImGuiWindow *potential_above, ImGuiWindow *potential_below)
Definition imgui.cpp:6619

References ImGuiContext::ActiveId, ImGuiWindow::Appearing, ClosePopupsOverWindow(), ImGuiIO::ConfigWindowsMoveFromTitleBarOnly, ImRect::Contains(), ImGuiWindow::Flags, FocusWindow(), GetTopMostPopupModal(), GImGui, ImGuiContext::HoveredId, ImGuiContext::HoveredIdDisabled, ImGuiContext::HoveredWindow, ImGuiPopupFlags_AnyPopupLevel, ImGuiWindowFlags_NoTitleBar, ImGuiWindowFlags_Popup, ImGuiContext::IO, IsPopupOpen(), IsWindowAbove(), ImGuiIO::MouseClicked, ImGuiIO::MouseClickedPos, ImGuiContext::MovingWindow, ImGuiContext::NavWindow, ImGuiWindow::PopupId, ImGuiWindow::RootWindow, StartMouseMovingWindow(), and ImGuiWindow::TitleBarRect().

Referenced by EndFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateMouseMovingWindowNewFrame()

void ImGui::UpdateMouseMovingWindowNewFrame ( )
3539{
3540 ImGuiContext& g = *GImGui;
3541 if (g.MovingWindow != NULL)
3542 {
3543 // We actually want to move the root window. g.MovingWindow == window we clicked on (could be a child window).
3544 // We track it to preserve Focus and so that generally ActiveIdWindow == MovingWindow and ActiveId == MovingWindow->MoveId for consistency.
3547 ImGuiWindow* moving_window = g.MovingWindow->RootWindow;
3548 if (g.IO.MouseDown[0] && IsMousePosValid(&g.IO.MousePos))
3549 {
3551 if (moving_window->Pos.x != pos.x || moving_window->Pos.y != pos.y)
3552 {
3553 MarkIniSettingsDirty(moving_window);
3554 SetWindowPos(moving_window, pos, ImGuiCond_Always);
3555 }
3556 FocusWindow(g.MovingWindow);
3557 }
3558 else
3559 {
3560 ClearActiveID();
3561 g.MovingWindow = NULL;
3562 }
3563 }
3564 else
3565 {
3566 // When clicking/dragging from a window that has the _NoMove flag, we still set the ActiveId in order to prevent hovering others.
3568 {
3570 if (!g.IO.MouseDown[0])
3571 ClearActiveID();
3572 }
3573 }
3574}

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdClickOffset, ImGuiContext::ActiveIdWindow, ClearActiveID(), FocusWindow(), GImGui, IM_ASSERT, ImGuiCond_Always, ImGuiContext::IO, IsMousePosValid(), KeepAliveID(), MarkIniSettingsDirty(), ImGuiIO::MouseDown, ImGuiIO::MousePos, ImGuiWindow::MoveId, ImGuiContext::MovingWindow, ImGuiWindow::Pos, ImGuiWindow::RootWindow, SetWindowPos(), ImVec2::x, and ImVec2::y.

Referenced by NewFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateMouseWheel()

void ImGui::UpdateMouseWheel ( )
static
3703{
3704 ImGuiContext& g = *GImGui;
3705
3706 // Reset the locked window if we move the mouse or after the timer elapses
3707 if (g.WheelingWindow != NULL)
3708 {
3711 g.WheelingWindowTimer = 0.0f;
3712 if (g.WheelingWindowTimer <= 0.0f)
3713 {
3714 g.WheelingWindow = NULL;
3715 g.WheelingWindowTimer = 0.0f;
3716 }
3717 }
3718
3719 if (g.IO.MouseWheel == 0.0f && g.IO.MouseWheelH == 0.0f)
3720 return;
3721
3723 return;
3724
3726 if (!window || window->Collapsed)
3727 return;
3728
3729 // Zoom / Scale window
3730 // FIXME-OBSOLETE: This is an old feature, it still works but pretty much nobody is using it and may be best redesigned.
3731 if (g.IO.MouseWheel != 0.0f && g.IO.KeyCtrl && g.IO.FontAllowUserScaling)
3732 {
3734 const float new_font_scale = ImClamp(window->FontWindowScale + g.IO.MouseWheel * 0.10f, 0.50f, 2.50f);
3735 const float scale = new_font_scale / window->FontWindowScale;
3736 window->FontWindowScale = new_font_scale;
3737 if (window == window->RootWindow)
3738 {
3739 const ImVec2 offset = window->Size * (1.0f - scale) * (g.IO.MousePos - window->Pos) / window->Size;
3740 SetWindowPos(window, window->Pos + offset, 0);
3741 window->Size = ImFloor(window->Size * scale);
3742 window->SizeFull = ImFloor(window->SizeFull * scale);
3743 }
3744 return;
3745 }
3746
3747 // Mouse wheel scrolling
3748 // If a child window has the ImGuiWindowFlags_NoScrollWithMouse flag, we give a chance to scroll its parent
3749 if (g.IO.KeyCtrl)
3750 return;
3751
3752 // As a standard behavior holding SHIFT while using Vertical Mouse Wheel triggers Horizontal scroll instead
3753 // (we avoid doing it on OSX as it the OS input layer handles this already)
3754 const bool swap_axis = g.IO.KeyShift && !g.IO.ConfigMacOSXBehaviors;
3755 const float wheel_y = swap_axis ? 0.0f : g.IO.MouseWheel;
3756 const float wheel_x = swap_axis ? g.IO.MouseWheel : g.IO.MouseWheelH;
3757
3758 // Vertical Mouse Wheel scrolling
3759 if (wheel_y != 0.0f)
3760 {
3762 while ((window->Flags & ImGuiWindowFlags_ChildWindow) && ((window->ScrollMax.y == 0.0f) || ((window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs))))
3763 window = window->ParentWindow;
3765 {
3766 float max_step = window->InnerRect.GetHeight() * 0.67f;
3767 float scroll_step = ImFloor(ImMin(5 * window->CalcFontSize(), max_step));
3768 SetScrollY(window, window->Scroll.y - wheel_y * scroll_step);
3769 }
3770 }
3771
3772 // Horizontal Mouse Wheel scrolling, or Vertical Mouse Wheel w/ Shift held
3773 if (wheel_x != 0.0f)
3774 {
3776 while ((window->Flags & ImGuiWindowFlags_ChildWindow) && ((window->ScrollMax.x == 0.0f) || ((window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs))))
3777 window = window->ParentWindow;
3779 {
3780 float max_step = window->InnerRect.GetWidth() * 0.67f;
3781 float scroll_step = ImFloor(ImMin(2 * window->CalcFontSize(), max_step));
3782 SetScrollX(window, window->Scroll.x - wheel_x * scroll_step);
3783 }
3784 }
3785}
static void StartLockWheelingWindow(ImGuiWindow *window)
Definition imgui.cpp:3692
@ ImGuiWindowFlags_NoScrollWithMouse
Definition imgui.h:920
void offset(Slic3r::ExPolygon &sh, coord_t distance, const PolygonTag &)
Definition geometries.hpp:132
ImGuiWindow * WheelingWindow
Definition imgui_internal.h:1384
float WheelingWindowTimer
Definition imgui_internal.h:1386
ImVec2 WheelingWindowRefMousePos
Definition imgui_internal.h:1385

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdUsingMouseWheel, ImGuiWindow::CalcFontSize(), ImGuiWindow::Collapsed, ImGuiIO::ConfigMacOSXBehaviors, ImGuiIO::DeltaTime, ImGuiWindow::Flags, ImGuiIO::FontAllowUserScaling, ImGuiWindow::FontWindowScale, ImRect::GetHeight(), ImRect::GetWidth(), GImGui, ImGuiContext::HoveredIdPreviousFrame, ImGuiContext::HoveredIdPreviousFrameUsingMouseWheel, ImGuiContext::HoveredWindow, ImClamp(), ImFloor(), ImGuiWindowFlags_ChildWindow, ImGuiWindowFlags_NoMouseInputs, ImGuiWindowFlags_NoScrollWithMouse, ImLengthSqr(), ImMin(), ImGuiWindow::InnerRect, ImGuiContext::IO, IsMousePosValid(), ImGuiIO::KeyCtrl, ImGuiIO::KeyShift, ImGuiIO::MouseDragThreshold, ImGuiIO::MousePos, ImGuiIO::MouseWheel, ImGuiIO::MouseWheelH, ImGuiWindow::ParentWindow, ImGuiWindow::Pos, ImGuiWindow::RootWindow, scale(), ImGuiWindow::Scroll, ImGuiWindow::ScrollMax, SetScrollX(), SetScrollY(), SetWindowPos(), ImGuiWindow::Size, ImGuiWindow::SizeFull, StartLockWheelingWindow(), ImGuiContext::WheelingWindow, ImGuiContext::WheelingWindowRefMousePos, ImGuiContext::WheelingWindowTimer, ImVec2::x, and ImVec2::y.

Referenced by NewFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateSettings()

void ImGui::UpdateSettings ( )
static
10332{
10333 // Load settings on first frame (if not explicitly loaded manually before)
10334 ImGuiContext& g = *GImGui;
10335 if (!g.SettingsLoaded)
10336 {
10338 if (g.IO.IniFilename)
10340 g.SettingsLoaded = true;
10341 }
10342
10343 // Save settings (with a delay after the last modification, so we don't spam disk too much)
10344 if (g.SettingsDirtyTimer > 0.0f)
10345 {
10347 if (g.SettingsDirtyTimer <= 0.0f)
10348 {
10349 if (g.IO.IniFilename != NULL)
10350 SaveIniSettingsToDisk(g.IO.IniFilename);
10351 else
10352 g.IO.WantSaveIniSettings = true; // Let user know they can call SaveIniSettingsToMemory(). user will need to clear io.WantSaveIniSettings themselves.
10353 g.SettingsDirtyTimer = 0.0f;
10354 }
10355 }
10356}
IMGUI_API void LoadIniSettingsFromDisk(const char *ini_filename)
Definition imgui.cpp:10430
bool empty() const
Definition imgui_internal.h:639
bool WantSaveIniSettings
Definition imgui.h:1864

References ImGuiIO::DeltaTime, ImChunkStream< T >::empty(), GImGui, IM_ASSERT, ImGuiIO::IniFilename, ImGuiContext::IO, LoadIniSettingsFromDisk(), SaveIniSettingsToDisk(), ImGuiContext::SettingsDirtyTimer, ImGuiContext::SettingsLoaded, ImGuiContext::SettingsWindows, and ImGuiIO::WantSaveIniSettings.

Referenced by NewFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateTabFocus()

void ImGui::UpdateTabFocus ( )
static
3788{
3789 ImGuiContext& g = *GImGui;
3790
3791 // Pressing TAB activate widget focus
3793 if (g.ActiveId == 0 && g.TabFocusPressed)
3794 {
3795 // - This path is only taken when no widget are active/tabbed-into yet.
3796 // Subsequent tabbing will be processed by FocusableItemRegister()
3797 // - Note that SetKeyboardFocusHere() sets the Next fields mid-frame. To be consistent we also
3798 // manipulate the Next fields here even though they will be turned into Curr fields below.
3801 if (g.NavId != 0 && g.NavIdTabCounter != INT_MAX)
3803 else
3805 }
3806
3807 // Turn queued focus request into current one
3810 if (g.TabFocusRequestNextWindow != NULL)
3811 {
3813 g.TabFocusRequestCurrWindow = window;
3814 if (g.TabFocusRequestNextCounterRegular != INT_MAX && window->DC.FocusCounterRegular != -1)
3816 if (g.TabFocusRequestNextCounterTabStop != INT_MAX && window->DC.FocusCounterTabStop != -1)
3820 }
3821
3822 g.NavIdTabCounter = INT_MAX;
3823}
static int ImModPositive(int a, int b)
Definition imgui_internal.h:430

References ImGuiWindow::Active, ImGuiContext::ActiveId, ImGuiWindow::DC, ImGuiWindow::Flags, ImGuiWindowTempData::FocusCounterRegular, ImGuiWindowTempData::FocusCounterTabStop, GImGui, ImGuiKey_Tab, ImGuiWindowFlags_NoNavInputs, ImModPositive(), ImGuiContext::IO, IsKeyPressedMap(), ImGuiIO::KeyCtrl, ImGuiIO::KeyShift, ImGuiContext::NavId, ImGuiContext::NavIdTabCounter, ImGuiContext::NavWindow, ImGuiContext::TabFocusPressed, ImGuiContext::TabFocusRequestCurrCounterRegular, ImGuiContext::TabFocusRequestCurrCounterTabStop, ImGuiContext::TabFocusRequestCurrWindow, ImGuiContext::TabFocusRequestNextCounterRegular, ImGuiContext::TabFocusRequestNextCounterTabStop, and ImGuiContext::TabFocusRequestNextWindow.

Referenced by NewFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateViewportsNewFrame()

static void ImGui::UpdateViewportsNewFrame ( )
static
10638{
10639 ImGuiContext& g = *GImGui;
10640 IM_ASSERT(g.Viewports.Size == 1);
10641
10642 // Update main viewport with current platform position.
10643 // FIXME-VIEWPORT: Size is driven by backend/user code for backward-compatibility but we should aim to make this more consistent.
10644 ImGuiViewportP* main_viewport = g.Viewports[0];
10646 main_viewport->Pos = ImVec2(0.0f, 0.0f);
10647 main_viewport->Size = g.IO.DisplaySize;
10648
10649 for (int n = 0; n < g.Viewports.Size; n++)
10650 {
10651 ImGuiViewportP* viewport = g.Viewports[n];
10652
10653 // Lock down space taken by menu bars and status bars, reset the offset for fucntions like BeginMainMenuBar() to alter them again.
10654 viewport->WorkOffsetMin = viewport->BuildWorkOffsetMin;
10655 viewport->WorkOffsetMax = viewport->BuildWorkOffsetMax;
10656 viewport->BuildWorkOffsetMin = viewport->BuildWorkOffsetMax = ImVec2(0.0f, 0.0f);
10657 viewport->UpdateWorkRect();
10658 }
10659}
void UpdateWorkRect()
Definition imgui_internal.h:1245

References ImGuiViewportP::BuildWorkOffsetMax, ImGuiViewportP::BuildWorkOffsetMin, ImGuiIO::DisplaySize, ImGuiViewport::Flags, GImGui, IM_ASSERT, ImGuiViewportFlags_IsPlatformWindow, ImGuiViewportFlags_OwnedByApp, ImGuiContext::IO, ImGuiViewport::Pos, ImVector< T >::Size, ImGuiViewport::Size, ImGuiViewportP::UpdateWorkRect(), ImGuiContext::Viewports, ImGuiViewportP::WorkOffsetMax, and ImGuiViewportP::WorkOffsetMin.

Referenced by NewFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateWindowManualResize()

static bool ImGui::UpdateWindowManualResize ( ImGuiWindow window,
const ImVec2 size_auto_fit,
int *  border_held,
int  resize_grip_count,
ImU32  resize_grip_col[4],
const ImRect visibility_rect 
)
static
5369{
5370 ImGuiContext& g = *GImGui;
5371 ImGuiWindowFlags flags = window->Flags;
5372
5373 if ((flags & ImGuiWindowFlags_NoResize) || (flags & ImGuiWindowFlags_AlwaysAutoResize) || window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0)
5374 return false;
5375 if (window->WasActive == false) // Early out to avoid running this code for e.g. an hidden implicit/fallback Debug window.
5376 return false;
5377
5378 bool ret_auto_fit = false;
5379 const int resize_border_count = g.IO.ConfigWindowsResizeFromEdges ? 4 : 0;
5380 const float grip_draw_size = IM_FLOOR(ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f));
5381 const float grip_hover_inner_size = IM_FLOOR(grip_draw_size * 0.75f);
5382 const float grip_hover_outer_size = g.IO.ConfigWindowsResizeFromEdges ? WINDOWS_HOVER_PADDING : 0.0f;
5383
5384 ImVec2 pos_target(FLT_MAX, FLT_MAX);
5385 ImVec2 size_target(FLT_MAX, FLT_MAX);
5386
5387 // Resize grips and borders are on layer 1
5389
5390 // Manual resize grips
5391 PushID("#RESIZE");
5392 for (int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++)
5393 {
5394 const ImGuiResizeGripDef& def = resize_grip_def[resize_grip_n];
5395 const ImVec2 corner = ImLerp(window->Pos, window->Pos + window->Size, def.CornerPosN);
5396
5397 // Using the FlattenChilds button flag we make the resize button accessible even if we are hovering over a child window
5398 bool hovered, held;
5399 ImRect resize_rect(corner - def.InnerDir * grip_hover_outer_size, corner + def.InnerDir * grip_hover_inner_size);
5400 if (resize_rect.Min.x > resize_rect.Max.x) ImSwap(resize_rect.Min.x, resize_rect.Max.x);
5401 if (resize_rect.Min.y > resize_rect.Max.y) ImSwap(resize_rect.Min.y, resize_rect.Max.y);
5402 ImGuiID resize_grip_id = window->GetID(resize_grip_n); // == GetWindowResizeCornerID()
5403 ButtonBehavior(resize_rect, resize_grip_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus);
5404 //GetForegroundDrawList(window)->AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255));
5405 if (hovered || held)
5407
5408 if (held && g.IO.MouseDoubleClicked[0] && resize_grip_n == 0)
5409 {
5410 // Manual auto-fit when double-clicking
5411 size_target = CalcWindowSizeAfterConstraint(window, size_auto_fit);
5412 ret_auto_fit = true;
5413 ClearActiveID();
5414 }
5415 else if (held)
5416 {
5417 // Resize from any of the four corners
5418 // We don't use an incremental MouseDelta but rather compute an absolute target size based on mouse position
5419 ImVec2 clamp_min = ImVec2(def.CornerPosN.x == 1.0f ? visibility_rect.Min.x : -FLT_MAX, def.CornerPosN.y == 1.0f ? visibility_rect.Min.y : -FLT_MAX);
5420 ImVec2 clamp_max = ImVec2(def.CornerPosN.x == 0.0f ? visibility_rect.Max.x : +FLT_MAX, def.CornerPosN.y == 0.0f ? visibility_rect.Max.y : +FLT_MAX);
5421 ImVec2 corner_target = g.IO.MousePos - g.ActiveIdClickOffset + ImLerp(def.InnerDir * grip_hover_outer_size, def.InnerDir * -grip_hover_inner_size, def.CornerPosN); // Corner of the window corresponding to our corner grip
5422 corner_target = ImClamp(corner_target, clamp_min, clamp_max);
5423 CalcResizePosSizeFromAnyCorner(window, corner_target, def.CornerPosN, &pos_target, &size_target);
5424 }
5425
5426 // Only lower-left grip is visible before hovering/activating
5427 if (resize_grip_n == 0 || held || hovered)
5429 }
5430 for (int border_n = 0; border_n < resize_border_count; border_n++)
5431 {
5432 const ImGuiResizeBorderDef& def = resize_border_def[border_n];
5433 const ImGuiAxis axis = (border_n == ImGuiDir_Left || border_n == ImGuiDir_Right) ? ImGuiAxis_X : ImGuiAxis_Y;
5434
5435 bool hovered, held;
5436 ImRect border_rect = GetResizeBorderRect(window, border_n, grip_hover_inner_size, WINDOWS_HOVER_PADDING);
5437 ImGuiID border_id = window->GetID(border_n + 4); // == GetWindowResizeBorderID()
5438 ButtonBehavior(border_rect, border_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren);
5439 //GetForegroundDrawLists(window)->AddRect(border_rect.Min, border_rect.Max, IM_COL32(255, 255, 0, 255));
5440 if ((hovered && g.HoveredIdTimer > WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER) || held)
5441 {
5443 if (held)
5444 *border_held = border_n;
5445 }
5446 if (held)
5447 {
5448 ImVec2 clamp_min(border_n == ImGuiDir_Right ? visibility_rect.Min.x : -FLT_MAX, border_n == ImGuiDir_Down ? visibility_rect.Min.y : -FLT_MAX);
5449 ImVec2 clamp_max(border_n == ImGuiDir_Left ? visibility_rect.Max.x : +FLT_MAX, border_n == ImGuiDir_Up ? visibility_rect.Max.y : +FLT_MAX);
5450 ImVec2 border_target = window->Pos;
5451 border_target[axis] = g.IO.MousePos[axis] - g.ActiveIdClickOffset[axis] + WINDOWS_HOVER_PADDING;
5452 border_target = ImClamp(border_target, clamp_min, clamp_max);
5453 CalcResizePosSizeFromAnyCorner(window, border_target, ImMin(def.SegmentN1, def.SegmentN2), &pos_target, &size_target);
5454 }
5455 }
5456 PopID();
5457
5458 // Restore nav layer
5460
5461 // Navigation resize (keyboard/gamepad)
5462 if (g.NavWindowingTarget && g.NavWindowingTarget->RootWindow == window)
5463 {
5464 ImVec2 nav_resize_delta;
5469 if (nav_resize_delta.x != 0.0f || nav_resize_delta.y != 0.0f)
5470 {
5471 const float NAV_RESIZE_SPEED = 600.0f;
5472 nav_resize_delta *= ImFloor(NAV_RESIZE_SPEED * g.IO.DeltaTime * ImMin(g.IO.DisplayFramebufferScale.x, g.IO.DisplayFramebufferScale.y));
5473 nav_resize_delta = ImMax(nav_resize_delta, visibility_rect.Min - window->Pos - window->Size);
5474 g.NavWindowingToggleLayer = false;
5475 g.NavDisableMouseHover = true;
5476 resize_grip_col[0] = GetColorU32(ImGuiCol_ResizeGripActive);
5477 // FIXME-NAV: Should store and accumulate into a separate size buffer to handle sizing constraints properly, right now a constraint will make us stuck.
5478 size_target = CalcWindowSizeAfterConstraint(window, window->SizeFull + nav_resize_delta);
5479 }
5480 }
5481
5482 // Apply back modified position/size to window
5483 if (size_target.x != FLT_MAX)
5484 {
5485 window->SizeFull = size_target;
5486 MarkIniSettingsDirty(window);
5487 }
5488 if (pos_target.x != FLT_MAX)
5489 {
5490 window->Pos = ImFloor(pos_target);
5491 MarkIniSettingsDirty(window);
5492 }
5493
5494 window->Size = window->SizeFull;
5495 return ret_auto_fit;
5496}
static const float WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER
Definition imgui.cpp:868
static void CalcResizePosSizeFromAnyCorner(ImGuiWindow *window, const ImVec2 &corner_target, const ImVec2 &corner_norm, ImVec2 *out_pos, ImVec2 *out_size)
Definition imgui.cpp:5288
@ ImGuiMouseCursor_ResizeNWSE
Definition imgui.h:1603
@ ImGuiMouseCursor_ResizeNESW
Definition imgui.h:1602

References ImGuiContext::ActiveIdClickOffset, ImGuiWindow::AutoFitFramesX, ImGuiWindow::AutoFitFramesY, ButtonBehavior(), CalcResizePosSizeFromAnyCorner(), CalcWindowSizeAfterConstraint(), ClearActiveID(), ImGuiIO::ConfigWindowsResizeFromEdges, ImGuiResizeGripDef::CornerPosN, ImGuiWindow::DC, ImGuiIO::DeltaTime, ImGuiIO::DisplayFramebufferScale, ImGuiWindow::Flags, ImGuiContext::FontSize, GetColorU32(), ImGuiWindow::GetID(), GetNavInputAmount2d(), GetResizeBorderRect(), GImGui, ImGuiContext::HoveredIdTimer, IM_FLOOR, ImClamp(), ImFloor(), ImGuiAxis_X, ImGuiAxis_Y, ImGuiButtonFlags_FlattenChildren, ImGuiButtonFlags_NoNavFocus, ImGuiCol_ResizeGrip, ImGuiCol_ResizeGripActive, ImGuiCol_ResizeGripHovered, ImGuiDir_Down, ImGuiDir_Left, ImGuiDir_Right, ImGuiDir_Up, ImGuiInputReadMode_Down, ImGuiInputSource_Gamepad, ImGuiInputSource_Keyboard, ImGuiMouseCursor_ResizeEW, ImGuiMouseCursor_ResizeNESW, ImGuiMouseCursor_ResizeNS, ImGuiMouseCursor_ResizeNWSE, ImGuiNavDirSourceFlags_Keyboard, ImGuiNavDirSourceFlags_PadDPad, ImGuiNavLayer_Main, ImGuiNavLayer_Menu, ImGuiWindowFlags_AlwaysAutoResize, ImGuiWindowFlags_NoResize, ImLerp(), ImMax(), ImMin(), ImSwap(), ImGuiResizeGripDef::InnerDir, ImGuiContext::IO, ImGuiIO::KeyShift, MarkIniSettingsDirty(), ImRect::Max, ImRect::Min, ImGuiContext::MouseCursor, ImGuiIO::MouseDoubleClicked, ImGuiIO::MousePos, ImGuiContext::NavDisableMouseHover, ImGuiContext::NavInputSource, ImGuiWindowTempData::NavLayerCurrent, ImGuiContext::NavWindowingTarget, ImGuiContext::NavWindowingToggleLayer, PopID(), ImGuiWindow::Pos, PushID(), resize_border_def, resize_grip_def, ImGuiWindow::RootWindow, ImGuiResizeBorderDef::SegmentN1, ImGuiResizeBorderDef::SegmentN2, ImGuiWindow::Size, ImGuiWindow::SizeFull, ImGuiWindow::WasActive, ImGuiWindow::WindowRounding, WINDOWS_HOVER_PADDING, WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER, ImVec2::x, and ImVec2::y.

Referenced by Begin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateWindowParentAndRootLinks()

void ImGui::UpdateWindowParentAndRootLinks ( ImGuiWindow window,
ImGuiWindowFlags  flags,
ImGuiWindow parent_window 
)
5701{
5702 window->ParentWindow = parent_window;
5703 window->RootWindow = window->RootWindowForTitleBarHighlight = window->RootWindowForNav = window;
5704 if (parent_window && (flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Tooltip))
5705 window->RootWindow = parent_window->RootWindow;
5706 if (parent_window && !(flags & ImGuiWindowFlags_Modal) && (flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))
5709 {
5710 IM_ASSERT(window->RootWindowForNav->ParentWindow != NULL);
5712 }
5713}

References ImGuiWindow::Flags, IM_ASSERT, ImGuiWindowFlags_ChildWindow, ImGuiWindowFlags_Modal, ImGuiWindowFlags_NavFlattened, ImGuiWindowFlags_Popup, ImGuiWindowFlags_Tooltip, ImGuiWindow::ParentWindow, ImGuiWindow::RootWindow, ImGuiWindow::RootWindowForNav, and ImGuiWindow::RootWindowForTitleBarHighlight.

Referenced by Begin().

+ Here is the caller graph for this function:

◆ Value() [1/4]

void ImGui::Value ( const char *  prefix,
bool  b 
)
6471{
6472 Text("%s: %s", prefix, (b ? "true" : "false"));
6473}

References Text().

+ Here is the call graph for this function:

◆ Value() [2/4]

void ImGui::Value ( const char *  prefix,
float  v,
const char *  float_format = NULL 
)
6486{
6487 if (float_format)
6488 {
6489 char fmt[64];
6490 ImFormatString(fmt, IM_ARRAYSIZE(fmt), "%%s: %s", float_format);
6491 Text(fmt, prefix, v);
6492 }
6493 else
6494 {
6495 Text("%s: %.3f", prefix, v);
6496 }
6497}

References IM_ARRAYSIZE, ImFormatString(), and Text().

+ Here is the call graph for this function:

◆ Value() [3/4]

void ImGui::Value ( const char *  prefix,
int  v 
)
6476{
6477 Text("%s: %d", prefix, v);
6478}

References Text().

+ Here is the call graph for this function:

◆ Value() [4/4]

void ImGui::Value ( const char *  prefix,
unsigned int  v 
)
6481{
6482 Text("%s: %d", prefix, v);
6483}

References Text().

+ Here is the call graph for this function:

◆ VSliderFloat()

bool ImGui::VSliderFloat ( const char *  label,
const ImVec2 size,
float *  v,
float  v_min,
float  v_max,
const char *  format = "%.3f",
ImGuiSliderFlags  flags = 0 
)
3148{
3149 return VSliderScalar(label, size, ImGuiDataType_Float, v, &v_min, &v_max, format, flags);
3150}
IMGUI_API bool VSliderScalar(const char *label, const ImVec2 &size, ImGuiDataType data_type, void *p_data, const void *p_min, const void *p_max, const char *format=NULL, ImGuiSliderFlags flags=0)
Definition imgui_widgets.cpp:3088

References ImGuiDataType_Float, and VSliderScalar().

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ VSliderInt()

bool ImGui::VSliderInt ( const char *  label,
const ImVec2 size,
int *  v,
int  v_min,
int  v_max,
const char *  format = "%d",
ImGuiSliderFlags  flags = 0 
)
3153{
3154 return VSliderScalar(label, size, ImGuiDataType_S32, v, &v_min, &v_max, format, flags);
3155}

References ImGuiDataType_S32, and VSliderScalar().

Referenced by ShowDemoWindowWidgets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ VSliderScalar()

bool ImGui::VSliderScalar ( const char *  label,
const ImVec2 size,
ImGuiDataType  data_type,
void p_data,
const void p_min,
const void p_max,
const char *  format = NULL,
ImGuiSliderFlags  flags = 0 
)
3089{
3090 ImGuiWindow* window = GetCurrentWindow();
3091 if (window->SkipItems)
3092 return false;
3093
3094 ImGuiContext& g = *GImGui;
3095 const ImGuiStyle& style = g.Style;
3096 const ImGuiID id = window->GetID(label);
3097
3098 const ImVec2 label_size = CalcTextSize(label, NULL, true);
3099 const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size);
3100 const ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
3101
3102 ItemSize(bb, style.FramePadding.y);
3103 if (!ItemAdd(frame_bb, id))
3104 return false;
3105
3106 // Default format string when passing NULL
3107 if (format == NULL)
3108 format = DataTypeGetInfo(data_type)->PrintFmt;
3109 else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) // (FIXME-LEGACY: Patch old "%.0f" format string to use "%d", read function more details.)
3110 format = PatchFormatStringFloatToInt(format);
3111
3112 const bool hovered = ItemHoverable(frame_bb, id);
3113 if ((hovered && g.IO.MouseClicked[0]) || g.NavActivateId == id || g.NavInputId == id)
3114 {
3115 SetActiveID(id, window);
3116 SetFocusID(id, window);
3117 FocusWindow(window);
3119 }
3120
3121 // Draw frame
3122 const ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : g.HoveredId == id ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);
3123 RenderNavHighlight(frame_bb, id);
3124 RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, g.Style.FrameRounding);
3125
3126 // Slider behavior
3127 ImRect grab_bb;
3128 const bool value_changed = SliderBehavior(frame_bb, id, data_type, p_data, p_min, p_max, format, flags | ImGuiSliderFlags_Vertical, &grab_bb);
3129 if (value_changed)
3130 MarkItemEdited(id);
3131
3132 // Render grab
3133 if (grab_bb.Max.y > grab_bb.Min.y)
3134 window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding);
3135
3136 // Display value using user-provided display format so user can add prefix/suffix/decorations to the value.
3137 // For the vertical slider we allow centered text to overlap the frame padding
3138 char value_buf[64];
3139 const char* value_buf_end = value_buf + DataTypeFormatString(value_buf, IM_ARRAYSIZE(value_buf), data_type, p_data, format);
3140 RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f, 0.0f));
3141 if (label_size.x > 0.0f)
3142 RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
3143
3144 return value_changed;
3145}
@ ImGuiSliderFlags_Vertical
Definition imgui_internal.h:801

References ImGuiContext::ActiveId, ImGuiContext::ActiveIdUsingNavDirMask, ImDrawList::AddRectFilled(), CalcTextSize(), ImGuiWindowTempData::CursorPos, DataTypeFormatString(), DataTypeGetInfo(), ImGuiWindow::DC, ImGuiWindow::DrawList, FocusWindow(), ImGuiStyle::FrameRounding, GetColorU32(), GetCurrentWindow(), ImGuiWindow::GetID(), GImGui, ImGuiContext::HoveredId, IM_ARRAYSIZE, ImGuiCol_FrameBg, ImGuiCol_FrameBgActive, ImGuiCol_FrameBgHovered, ImGuiCol_SliderGrab, ImGuiCol_SliderGrabActive, ImGuiDataType_S32, ImGuiDir_Down, ImGuiDir_Up, ImGuiSliderFlags_Vertical, ImGuiContext::IO, ItemAdd(), ItemHoverable(), ItemSize(), MarkItemEdited(), ImRect::Max, ImRect::Min, ImGuiIO::MouseClicked, ImGuiContext::NavActivateId, ImGuiContext::NavInputId, PatchFormatStringFloatToInt(), ImGuiDataTypeInfo::PrintFmt, RenderFrame(), RenderNavHighlight(), RenderText(), RenderTextClipped(), SetActiveID(), SetFocusID(), ImGuiWindow::SkipItems, SliderBehavior(), ImGuiContext::Style, style, ImVec2::x, and ImVec2::y.

Referenced by VSliderFloat(), and VSliderInt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ CancelButton

◆ CancelHoverButton

◆ ClipboardBtnIcon

const wchar_t ImGui::ClipboardBtnIcon = 0x2606

◆ ClippyMarker

const wchar_t ImGui::ClippyMarker = 0x2602

◆ CloseNotifButton

◆ CloseNotifHoverButton

◆ CollapseBtn

const wchar_t ImGui::CollapseBtn = 0x2715

◆ ColorMarkerEnd

◆ ColorMarkerHovered

const char ImGui::ColorMarkerHovered = 0x1

◆ ColorMarkerStart

◆ DocumentationButton

const wchar_t ImGui::DocumentationButton = 0x2600

◆ DocumentationHoverButton

const wchar_t ImGui::DocumentationHoverButton = 0x2601

◆ DowelMarker

const wchar_t ImGui::DowelMarker = 0x1D

◆ EjectButton

◆ EjectHoverButton

◆ ErrorMarker

◆ ExpandBtn

const wchar_t ImGui::ExpandBtn = 0x2714

◆ FilamentIconMarker

const wchar_t ImGui::FilamentIconMarker = 0x7

◆ InfoMarker

const wchar_t ImGui::InfoMarker = 0x2603

◆ InfoMarkerSmall

const wchar_t ImGui::InfoMarkerSmall = 0x2716

◆ LegendCOG

const wchar_t ImGui::LegendCOG = 0x2710

◆ LegendColorChanges

const wchar_t ImGui::LegendColorChanges = 0x2707

◆ LegendCustomGCodes

const wchar_t ImGui::LegendCustomGCodes = 0x2709

◆ LegendDeretract

const wchar_t ImGui::LegendDeretract = 0x2704

◆ LegendPausePrints

const wchar_t ImGui::LegendPausePrints = 0x2708

◆ LegendRetract

const wchar_t ImGui::LegendRetract = 0x2703

◆ LegendSeams

const wchar_t ImGui::LegendSeams = 0x2705

◆ LegendShells

const wchar_t ImGui::LegendShells = 0x2711

◆ LegendToolChanges

const wchar_t ImGui::LegendToolChanges = 0x2706

◆ LegendToolMarker

const wchar_t ImGui::LegendToolMarker = 0x2712

◆ LegendTravel

const wchar_t ImGui::LegendTravel = 0x2701

◆ LegendWipe

const wchar_t ImGui::LegendWipe = 0x2702

◆ MaterialIconMarker

const wchar_t ImGui::MaterialIconMarker = 0x8

◆ MinimalizeButton

const wchar_t ImGui::MinimalizeButton = 0xE

◆ MinimalizeHoverButton

const wchar_t ImGui::MinimalizeHoverButton = 0xF

◆ OpenButton

◆ OpenHoverButton

◆ PauseButton

◆ PauseHoverButton

◆ PlayButton

◆ PlayHoverButton

◆ PlugMarker

const wchar_t ImGui::PlugMarker = 0x1C

◆ PreferencesButton

◆ PreferencesHoverButton

const wchar_t ImGui::PreferencesHoverButton = 0x1B

◆ PrinterIconMarker

const wchar_t ImGui::PrinterIconMarker = 0x5

◆ PrinterSlaIconMarker

const wchar_t ImGui::PrinterSlaIconMarker = 0x6

◆ PrintIconMarker

const wchar_t ImGui::PrintIconMarker = 0x4

◆ RevertButton

const wchar_t ImGui::RevertButton = 0x16

◆ RightArrowButton

const wchar_t ImGui::RightArrowButton = 0x18

◆ RightArrowHoverButton

const wchar_t ImGui::RightArrowHoverButton = 0x19

◆ SlaViewOriginal

const wchar_t ImGui::SlaViewOriginal = 0x261E

◆ SlaViewProcessed

const wchar_t ImGui::SlaViewProcessed = 0x261F

◆ SliderFloatEditBtnIcon

◆ SliderFloatEditBtnPressedIcon

const wchar_t ImGui::SliderFloatEditBtnPressedIcon = 0x2605

◆ vector_getter

auto ImGui::vector_getter
static
Initial value:
= [](void* vec, int idx, const char** out_text)
{
auto& vector = *static_cast<std::vector<std::string>*>(vec);
if (idx < 0 || idx >= static_cast<int>(vector.size())) { return false; }
*out_text = vector.at(idx).c_str();
return true;
}

Referenced by Combo(), and ListBox().

◆ WarningMarker

◆ WarningMarkerSmall

const wchar_t ImGui::WarningMarkerSmall = 0x2713