@ -70,6 +70,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- widgets: selectable: a way to visualize partial/mixed selection (e.g. parent tree node has children with mixed selection)
- widgets: selectable: a way to visualize partial/mixed selection (e.g. parent tree node has children with mixed selection)
- widgets: checkbox: checkbox with custom glyph inside frame.
- widgets: checkbox: checkbox with custom glyph inside frame.
- widgets: coloredit: keep reporting as active when picker is on?
- widgets: coloredit: keep reporting as active when picker is on?
- widgets: group/scalarn functions: expose more per-component information. e.g. store NextItemData.ComponentIdx set by scalarn function, groups can expose them back somehow.
- input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now and super fragile.
- input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now and super fragile.
@ -258,6 +259,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps to other settings? avoid implementing duplicate helpers such as SmallCheckbox(), etc.
- style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps to other settings? avoid implementing duplicate helpers such as SmallCheckbox(), etc.
- style: try to make PushStyleVar() more robust to incorrect parameters (to be more friendly to edit & continues situation).
- style: try to make PushStyleVar() more robust to incorrect parameters (to be more friendly to edit & continues situation).
- style: global scale setting.
- style: global scale setting.
- style: FramePadding could be different for up vs down (#584)
- style: WindowPadding needs to be EVEN as the 0.5 multiplier used on this value probably have a subtle effect on clip rectangle
- style: WindowPadding needs to be EVEN as the 0.5 multiplier used on this value probably have a subtle effect on clip rectangle
- style: have a more global HSV setter (e.g. alter hue on all elements). consider replacing active/hovered by offset in HSV space? (#438, #707, #1223)
- style: have a more global HSV setter (e.g. alter hue on all elements). consider replacing active/hovered by offset in HSV space? (#438, #707, #1223)
- style: gradients fill (#1223) ~ 2 bg colors for each fill? tricky with rounded shapes and using textures for corners.
- style: gradients fill (#1223) ~ 2 bg colors for each fill? tricky with rounded shapes and using textures for corners.
TouchExtraPadding=ImVec2(0,0);// Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
TouchExtraPadding=ImVec2(0,0);// Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
IndentSpacing=21.0f;// Horizontal spacing when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).
IndentSpacing=21.0f;// Horizontal spacing when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).
ColumnsMinSpacing=6.0f;// Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).
ColumnsMinSpacing=6.0f;// Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).
ScrollbarSize=16.0f;// Width of the vertical scrollbar, Height of the horizontal scrollbar
ScrollbarSize=14.0f;// Width of the vertical scrollbar, Height of the horizontal scrollbar
ScrollbarRounding=9.0f;// Radius of grab corners rounding for scrollbar
ScrollbarRounding=9.0f;// Radius of grab corners rounding for scrollbar
GrabMinSize=10.0f;// Minimum width/height of a grab box for slider/scrollbar
GrabMinSize=10.0f;// Minimum width/height of a grab box for slider/scrollbar
GrabRounding=0.0f;// Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
GrabRounding=0.0f;// Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
// Auto-fit may only grow window during the first few frames
// Auto-fit may only grow window during the first few frames
// We still process initial auto-fit on collapsed windows to get a window width, but otherwise don't honor ImGuiWindowFlags_AlwaysAutoResize when collapsed.
// We still process initial auto-fit on collapsed windows to get a window width, but otherwise don't honor ImGuiWindowFlags_AlwaysAutoResize when collapsed.
// (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.)
// (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.)
window->DC.CursorMaxPos.x+=window->Scroll.x;// SizeContents is generally computed based on CursorMaxPos which is affected by scroll position, so we need to apply our change to it.
window->DC.CursorMaxPos.y+=window->Scroll.y;// SizeContents is generally computed based on CursorMaxPos which is affected by scroll position, so we need to apply our change to it.
window->DC.CursorPos+=(window->Pos-old_pos);// 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
ImVec2offset=window->Pos-old_pos;
window->DC.CursorMaxPos+=(window->Pos-old_pos);// And more importantly we need to adjust this so size calculation doesn't get affected.
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
window->DC.CursorMaxPos+=offset;// And more importantly we need to offset CursorMaxPos/CursorStartPos this so ContentSize calculation doesn't get affected.
g.NextWindowData.ContentSizeVal=size;// In Begin() we will add the size of window decorations (title bar, menu etc.) to that to form a SizeContents value.
IMGUI_APIvoidSetNextWindowPos(constImVec2&pos,ImGuiCondcond=0,constImVec2&pivot=ImVec2(0,0));// set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc.
IMGUI_APIvoidSetNextWindowPos(constImVec2&pos,ImGuiCondcond=0,constImVec2&pivot=ImVec2(0,0));// set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc.
IMGUI_APIvoidSetNextWindowSize(constImVec2&size,ImGuiCondcond=0);// set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin()
IMGUI_APIvoidSetNextWindowSize(constImVec2&size,ImGuiCondcond=0);// set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin()
IMGUI_APIvoidSetNextWindowSizeConstraints(constImVec2&size_min,constImVec2&size_max,ImGuiSizeCallbackcustom_callback=NULL,void*custom_callback_data=NULL);// set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down. Use callback to apply non-trivial programmatic constraints.
IMGUI_APIvoidSetNextWindowSizeConstraints(constImVec2&size_min,constImVec2&size_max,ImGuiSizeCallbackcustom_callback=NULL,void*custom_callback_data=NULL);// set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down. Use callback to apply non-trivial programmatic constraints.
IMGUI_APIvoidSetNextWindowContentSize(constImVec2&size);// set next window content size (~ enforce the range of scrollbars). not including window decorations (title bar, menu bar, etc.). set an axis to 0.0f to leave it automatic. call before Begin()
IMGUI_APIvoidSetNextWindowContentSize(constImVec2&size);// set next window content size (~ scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. set an axis to 0.0f to leave it automatic. call before Begin()
IMGUI_APIvoidSetNextWindowCollapsed(boolcollapsed,ImGuiCondcond=0);// set next window collapsed state. call before Begin()
IMGUI_APIvoidSetNextWindowCollapsed(boolcollapsed,ImGuiCondcond=0);// set next window collapsed state. call before Begin()
IMGUI_APIvoidSetNextWindowFocus();// set next window to be focused / front-most. call before Begin()
IMGUI_APIvoidSetNextWindowFocus();// set next window to be focused / front-most. call before Begin()
IMGUI_APIvoidSetNextWindowBgAlpha(floatalpha);// set next window background color alpha. helper to easily modify ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground.
IMGUI_APIvoidSetNextWindowBgAlpha(floatalpha);// set next window background color alpha. helper to easily modify ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground.
,ImGuiColorEditFlags_RGB=ImGuiColorEditFlags_DisplayRGB,ImGuiColorEditFlags_HSV=ImGuiColorEditFlags_DisplayHSV,ImGuiColorEditFlags_HEX=ImGuiColorEditFlags_DisplayHex// [renamed in 1.69]
#endif
#endif
};
};
@ -1244,7 +1245,7 @@ enum ImGuiMouseCursor_
// Obsolete names (will be removed)
// Obsolete names (will be removed)
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
,ImGuiMouseCursor_Count_=ImGuiMouseCursor_COUNT
,ImGuiMouseCursor_Count_=ImGuiMouseCursor_COUNT// [renamed in 1.60]
,ImGuiSetCond_Always=ImGuiCond_Always,ImGuiSetCond_Once=ImGuiCond_Once,ImGuiSetCond_FirstUseEver=ImGuiCond_FirstUseEver,ImGuiSetCond_Appearing=ImGuiCond_Appearing// [renamed in 1.51]
// In this demo code, we frequently we use 'static' variables inside functions. A static variable persist across calls, so it is
// In this demo code, we frequently we use 'static' variables inside functions. A static variable persist across calls, so it is
// essentially like a global variable but declared inside the scope of the function. We do this as a way to gather code and data
// essentially like a global variable but declared inside the scope of the function. We do this as a way to gather code and data
// in the same place, to make the demo source code faster to read, faster to write, and smaller in size.
// in the same place, to make the demo source code faster to read, faster to write, and smaller in size.
// It also happens to be a convenient way of storing simple UI related information as long as your function doesn't need to be reentrant
// It also happens to be a convenient way of storing simple UI related information as long as your function doesn't need to be
// or used in threads. This might be a pattern you will want to use in your code, but most of the real data you would be editing is
// reentrant or used in multiple threads. This might be a pattern you will want to use in your code, but most of the real data
// likely going to be stored outside your functions.
// you would be editing is likely going to be stored outside your functions.
// The Demo code is this file is designed to be easy to copy-and-paste in into your application!
// Because of this:
// - We never omit the ImGui:: namespace when calling functions, even though most of our code is already in the same namespace.
// - We try to declare static variables in the local scope, as close as possible to the code using them.
// - We never use any of the helpers/facilities used internally by dear imgui, unless it has been exposed in the public API (imgui.h).
// - We never use maths operators on ImVec2/ImVec4. For other imgui sources files, they are provided by imgui_internal.h w/ IMGUI_DEFINE_MATH_OPERATORS,
// for your own sources file they are optional and require you either enable those, either provide your own via IM_VEC2_CLASS_EXTRA in imconfig.h.
// Because we don't want to assume anything about your support of maths operators, we don't use them in imgui_demo.cpp.
HelpMarker("Test of different widgets react and impact the work rectangle growing when horizontal scrolling is enabled.\n\nUse 'Metrics->Tools->Show windows rectangles' to visualize rectangles.");
ImGui::Checkbox("H-scrollbar",&show_h_scrollbar);
ImGui::Checkbox("Button",&show_button);// Will grow contents size (unless explicitly overwritten)
ImGui::Checkbox("Tree nodes",&show_tree_nodes);// Will grow contents size and display highlight over full width
ImGui::Checkbox("Text wrapped",&show_text_wrapped);// Will grow and use contents size
ImGui::Checkbox("Columns",&show_columns);// Will use contents size
ImGui::Checkbox("Tab bar",&show_tab_bar);// Will use contents size
ImGui::Checkbox("Child",&show_child);// Will grow and use contents size
ImVec2CursorStartPos;// Initial position in client area with padding
ImVec2CursorStartPos;// Initial position in client area with padding
ImVec2CursorMaxPos;// Used to implicitly calculate the size of our contents, always growing during the frame. Turned into window->SizeContents at the beginning of next frame
ImVec2CursorMaxPos;// Used to implicitly calculate the size of our contents, always growing during the frame. Used to calculate window->ContentSize at the beginning of next frame
ImVec2CurrLineSize;
ImVec2CurrLineSize;
ImVec2PrevLineSize;
ImVec2PrevLineSize;
floatCurrLineTextBaseOffset;
floatCurrLineTextBaseOffset;
@ -1415,9 +1415,8 @@ struct IMGUI_API ImGuiWindow
ImVec2Pos;// Position (always rounded-up to nearest pixel)
ImVec2Pos;// Position (always rounded-up to nearest pixel)
ImVec2Size;// Current size (==SizeFull or collapsed title bar size)
ImVec2Size;// Current size (==SizeFull or collapsed title bar size)
ImVec2SizeFull;// Size when non collapsed
ImVec2SizeFull;// Size when non collapsed
ImVec2SizeFullAtLastBegin;// Copy of SizeFull at the end of Begin. This is the reference value we'll use on the next frame to decide if we need scrollbars.
ImVec2ContentSize;// Size of contents/scrollable client area (calculated from the extents reach of the cursor) from previous frame. Does not include window decoration or window padding.
ImVec2SizeContents;// Size of contents (== extents reach of the drawing cursor) from previous frame. FIXME: Include decoration, window title, border, menu, etc. Ideally should remove them from this value?
ImVec2ContentSizeExplicit;// Size of contents/scrollable client area explicitly request by the user via SetNextWindowContentSize().
ImVec2SizeContentsExplicit;// Size of contents explicitly set by the user via SetNextWindowContentSize(). EXCLUDE decorations. Making this not consistent with the above!
ImVec2WindowPadding;// Window padding at the time of begin.
ImVec2WindowPadding;// Window padding at the time of begin.
floatWindowRounding;// Window rounding at the time of begin.
floatWindowRounding;// Window rounding at the time of begin.
floatWindowBorderSize;// Window border size at the time of begin.
floatWindowBorderSize;// Window border size at the time of begin.
@ -1425,6 +1424,7 @@ struct IMGUI_API ImGuiWindow
ImGuiIDMoveId;// == window->GetID("#MOVE")
ImGuiIDMoveId;// == window->GetID("#MOVE")
ImGuiIDChildId;// ID of corresponding item in parent window (for navigation to return from child window to parent window)
ImGuiIDChildId;// ID of corresponding item in parent window (for navigation to return from child window to parent window)
ImVec2Scroll;
ImVec2Scroll;
ImVec2ScrollMax;
ImVec2ScrollTarget;// target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change)
ImVec2ScrollTarget;// target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change)
ImVec2ScrollTargetCenterRatio;// 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered
ImVec2ScrollTargetCenterRatio;// 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered
ImVec2ScrollbarSizes;// Size taken by scrollbars on each axis
ImVec2ScrollbarSizes;// Size taken by scrollbars on each axis
ImGuiWindowTempDataDC;// Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the "DC" variable name.
ImGuiWindowTempDataDC;// Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the "DC" variable name.
ImVector<ImGuiID>IDStack;// ID stack. ID are hashes seeded with the value at the top of the stack
ImVector<ImGuiID>IDStack;// ID stack. ID are hashes seeded with the value at the top of the stack
ImRectOuterRectClipped;// == WindowRect just after setup in Begin(). == window->Rect() for root window.
// The best way to understand what those rectangles are is to use the 'Metrics -> Tools -> Show windows rectangles' viewer.
ImRectInnerRect;// Inner rectangle
// The main 'OuterRect', omitted as a field, is window->Rect().
ImRectInnerClipRect;// == InnerRect minus WindowPadding.x, clipped within viewport or parent clip rect.
ImRectOuterRectClipped;// == Window->Rect() just after setup in Begin(). == window->Rect() for root window.
ImRectWorkRect;// == InnerRect minus WindowPadding.x
ImRectInnerRect;// Inner rectangle (omit title bar, menu bar)
ImRectContentsRegionRect;// FIXME: This is currently confusing/misleading. Maximum visible content position ~~ Pos + (SizeContentsExplicit ? SizeContentsExplicit : Size - ScrollbarSizes) - CursorStartPos, per axis
ImRectInnerClipRect;// == InnerRect shrunk by WindowPadding*0.5f on each side, clipped within viewport or parent clip rect.
ImRectWorkRect;// Cover the whole scrolling region, shrunk by WindowPadding*1.0f on each side. This is meant to replace ContentsRegionRect over time (from 1.71+ onward).
ImRectClipRect;// Current clipping/scissoring rectangle, evolve as we are using PushClipRect(), etc. == DrawList->clip_rect_stack.back().
ImRectContentsRegionRect;// FIXME: This is currently confusing/misleading. It is essentially WorkRect but not handling of scrolling. We currently rely on it as right/bottom aligned sizing operation need some size to rely on.
ImVec2ihHitTestHoleSize,HitTestHoleOffset;
ImVec2ihHitTestHoleSize,HitTestHoleOffset;
intLastFrameActive;// Last frame number the window was Active.
intLastFrameActive;// Last frame number the window was Active.
intLastFrameJustFocused;// Last frame number the window was made Focused.
intLastFrameJustFocused;// Last frame number the window was made Focused.
// It is ok to modify Scroll here because we are being called in Begin() after the calculation of SizeContents and before setting up our starting position
// 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