Now performed in ItemAdd(). It can't be trivially moved above clipping effectively because it would require us to scroll to be useful, meaning we'd be better off locking the bounding box a frame earlier. Still wip.
As-is this commit has no value for end-user, but it's a reengineering that moves us closer to the solution. + Internals: moved internal flags.
// Tab stop handling (previously was using internal ItemFocusable() api)
// 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)
if(flags&ImGuiItemAddFlags_Focusable)
ItemFocusable(window,id);
// We need to calculate this now to take account of the current clipping rectangle (as items like Selectable may change them)
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
IMGUI_APIvoidPushStyleVar(ImGuiStyleVaridx,floatval);// modify a style float variable. always use this if you modify the style after NewFrame().
IMGUI_APIvoidPushStyleVar(ImGuiStyleVaridx,constImVec2&val);// modify a style ImVec2 variable. always use this if you modify the style after NewFrame().
IMGUI_APIvoidPopStyleVar(intcount=1);
IMGUI_APIvoidPushAllowKeyboardFocus(boolallow_keyboard_focus);// allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets
IMGUI_APIvoidPushAllowKeyboardFocus(boolallow_keyboard_focus);// == tab stop enable. Allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets
IMGUI_APIvoidPopAllowKeyboardFocus();
IMGUI_APIvoidPushButtonRepeat(boolrepeat);// in 'repeat' mode, Button*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting). Note that you can call IsItemActive() after any Button() to tell if the button is held in the current frame.
IMGUI_APIvoidPopButtonRepeat();
@ -961,10 +961,7 @@ enum ImGuiInputTextFlags_
ImGuiInputTextFlags_NoUndoRedo=1<<16,// Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().
ImGuiInputTextFlags_CallbackResize=1<<18,// Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this)
ImGuiInputTextFlags_CallbackEdit=1<<19,// Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active)
// [Internal]
ImGuiInputTextFlags_Multiline=1<<20,// For internal use by InputTextMultiline()
ImGuiInputTextFlags_NoMarkEdited=1<<21// For internal use by functions using InputText() before reformatting data
ImGuiInputTextFlags_CallbackEdit=1<<19// Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active)
@ -133,6 +133,7 @@ struct ImGuiWindowSettings; // Storage for a window .ini settings (we ke
// Use your programming IDE "Go to definition" facility on the names of the center columns to find the actual flags/enum lists.
typedefintImGuiLayoutType;// -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical
typedefintImGuiItemFlags;// -> enum ImGuiItemFlags_ // Flags: for PushItemFlag()
typedefintImGuiItemAddFlags;// -> enum ImGuiItemAddFlags_ // Flags: for ItemAdd()
typedefintImGuiItemStatusFlags;// -> enum ImGuiItemStatusFlags_ // Flags: for DC.LastItemStatusFlags
typedefintImGuiOldColumnFlags;// -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns()
typedefintImGuiNavHighlightFlags;// -> enum ImGuiNavHighlightFlags_ // Flags: for RenderNavHighlight()
@ -710,6 +711,14 @@ enum ImGuiItemFlags_
ImGuiItemFlags_ReadOnly=1<<7// false // [ALPHA] Allow hovering interactions but underlying value is not changed.
};
// Flags for ItemAdd()
// FIXME-NAV: _Focusable is _ALMOST_ what you would expect to be called '_TabStop' but because SetKeyboardFocusHere() works on items with no TabStop we distinguish Focusable from TabStop.
enumImGuiItemAddFlags_
{
ImGuiItemAddFlags_None=0,
ImGuiItemAddFlags_Focusable=1<<0// FIXME-NAV: In current/legacy scheme, Focusable+TabStop support are opt-in by widgets. We will transition it toward being opt-out, so this flag is expected to eventually disappear.
};
// Storage for LastItem data
enumImGuiItemStatusFlags_
{
@ -721,7 +730,10 @@ enum ImGuiItemStatusFlags_
ImGuiItemStatusFlags_ToggledOpen=1<<4,// Set when TreeNode() reports toggling their open state.
ImGuiItemStatusFlags_HasDeactivated=1<<5,// Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
ImGuiItemStatusFlags_Deactivated=1<<6,// Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
ImGuiItemStatusFlags_HoveredWindow=1<<7// Override the HoveredWindow test to allow cross-window hover testing.
ImGuiItemStatusFlags_HoveredWindow=1<<7,// Override the HoveredWindow test to allow cross-window hover testing.
ImGuiItemStatusFlags_FocusedByCode=1<<8,// Set when the Focusable item just got focused from code.
ImGuiItemStatusFlags_FocusedByTabbing=1<<9,// Set when the Focusable item just got focused by Tabbing.
// If you have old/custom copy-and-pasted widgets that used FocusableItemRegister():
// (Old) IMGUI_VERSION_NUM < 18209: using 'ItemAdd(....)' and 'bool focused = FocusableItemRegister(...)'
// (New) IMGUI_VERSION_NUM >= 18209: using 'ItemAdd(..., ImGuiItemAddFlags_Focusable)' and 'bool focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_Focused) != 0'
// Widget code are simplified as there's no need to call FocusableItemUnregister() while managing the transition from regular widget to TempInputText()
inlineboolFocusableItemRegister(ImGuiWindow*window,ImGuiIDid){IM_ASSERT(0);IM_UNUSED(window);IM_UNUSED(id);returnfalse;}// -> pass ImGuiItemAddFlags_Focusable flag to ItemAdd()
IMGUI_APIvoidLogBegin(ImGuiLogTypetype,intauto_open_depth);// -> BeginCapture() when we design v2 api, for now stay under the radar by using the old name.
IMGUI_APIvoidLogToBuffer(intauto_open_depth=-1);// Start logging/capturing to internal buffer
// Experimental: simple click (without moving) turns Drag into an InputText
// FIXME: Currently polling ImGuiConfigFlags_IsTouchScreen, may either poll an hypothetical ImGuiBackendFlags_HasKeyboard and/or an explicit drag settings.