FrameBorderSize=0.0f;// Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested.
FrameBorderSize=0.0f;// Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested.
ItemSpacing=ImVec2(8,4);// Horizontal and vertical spacing between widgets/lines
ItemSpacing=ImVec2(8,4);// Horizontal and vertical spacing between widgets/lines
ItemInnerSpacing=ImVec2(4,4);// Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
ItemInnerSpacing=ImVec2(4,4);// Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
CellPadding=ImVec2(4,2);// Padding within a table cell
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).
window->DC.CursorPosPrevLine.y=window->DC.CursorPos.y-line_height;// Setting those fields so that SetScrollHereY() can properly function after the end of our clipper usage.
window->DC.CursorPosPrevLine.y=window->DC.CursorPos.y-line_height;// Setting those fields so that SetScrollHereY() can properly function after the end of our clipper usage.
window->DC.PrevLineSize.y=(line_height-g.Style.ItemSpacing.y);// If we end up needing more accurate data (to e.g. use SameLine) we may as well make the clipper have a fourth step to let user process and display the last item in their list.
window->DC.PrevLineSize.y=(line_height-g.Style.ItemSpacing.y);// If we end up needing more accurate data (to e.g. use SameLine) we may as well make the clipper have a fourth step to let user process and display the last item in their list.
elseif(rect_type==TRT_ColumnsContentHeadersUsed){ImGuiTableColumn*c=&table->Columns[n];returnImRect(c->MinX,table->InnerClipRect.Min.y,c->MinX+c->ContentWidthHeadersUsed,table->InnerClipRect.Min.y+table->LastFirstRowHeight);}// Note: y1/y2 not always accurate
// Draw List API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData)
// Draw List API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData)
// Font API (ImFontConfig, ImFontGlyph, ImFontGlyphRangesBuilder, ImFontAtlasFlags, ImFontAtlas, ImFont)
// Font API (ImFontConfig, ImFontGlyph, ImFontGlyphRangesBuilder, ImFontAtlasFlags, ImFontAtlas, ImFont)
// FIXME-TABLE: Add ImGuiTableSortSpecsColumn and ImGuiTableSortSpecs in "Misc data structures" section above (we don't do it right now to facilitate merging various branches)
*/
*/
#pragma once
#pragma once
@ -136,6 +138,8 @@ struct ImGuiPayload; // User data payload for drag and drop opera
structImGuiSizeCallbackData;// Callback data when using SetNextWindowSizeConstraints() (rare/advanced use)
structImGuiSizeCallbackData;// Callback data when using SetNextWindowSizeConstraints() (rare/advanced use)
structImGuiStorage;// Helper for key->value storage
structImGuiStorage;// Helper for key->value storage
structImGuiStyle;// Runtime data for styling/colors
structImGuiStyle;// Runtime data for styling/colors
structImGuiTableSortSpecs;// Sorting specifications for a table (often handling sort specs for a single column, occasionally more)
structImGuiTableSortSpecsColumn;// Sorting specification for one column of a table
structImGuiTextBuffer;// Helper to hold and append into a text buffer (~string builder)
structImGuiTextBuffer;// Helper to hold and append into a text buffer (~string builder)
structImGuiTextFilter;// Helper to parse and apply text filters (e.g. "aaaaa[,bbbbb][,ccccc]")
structImGuiTextFilter;// Helper to parse and apply text filters (e.g. "aaaaa[,bbbbb][,ccccc]")
@ -151,6 +155,7 @@ typedef int ImGuiKey; // -> enum ImGuiKey_ // Enum: A
typedefintImGuiNavInput;// -> enum ImGuiNavInput_ // Enum: An input identifier for navigation
typedefintImGuiNavInput;// -> enum ImGuiNavInput_ // Enum: An input identifier for navigation
typedefintImGuiMouseCursor;// -> enum ImGuiMouseCursor_ // Enum: A mouse cursor identifier
typedefintImGuiMouseCursor;// -> enum ImGuiMouseCursor_ // Enum: A mouse cursor identifier
typedefintImGuiSortDirection;// -> enum ImGuiSortDirection_ // Enum: A sorting direction (ascending or descending)
typedefintImGuiStyleVar;// -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling
typedefintImGuiStyleVar;// -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling
typedefintImDrawCornerFlags;// -> enum ImDrawCornerFlags_ // Flags: for ImDrawList::AddRect(), AddRectFilled() etc.
typedefintImDrawCornerFlags;// -> enum ImDrawCornerFlags_ // Flags: for ImDrawList::AddRect(), AddRectFilled() etc.
typedefintImDrawListFlags;// -> enum ImDrawListFlags_ // Flags: for ImDrawList
typedefintImDrawListFlags;// -> enum ImDrawListFlags_ // Flags: for ImDrawList
@ -170,6 +175,9 @@ typedef int ImGuiSelectableFlags; // -> enum ImGuiSelectableFlags_ // Flags: f
typedefintImGuiSliderFlags;// -> enum ImGuiSliderFlags_ // Flags: for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc.
typedefintImGuiSliderFlags;// -> enum ImGuiSliderFlags_ // Flags: for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc.
typedefintImGuiTabBarFlags;// -> enum ImGuiTabBarFlags_ // Flags: for BeginTabBar()
typedefintImGuiTabBarFlags;// -> enum ImGuiTabBarFlags_ // Flags: for BeginTabBar()
typedefintImGuiTabItemFlags;// -> enum ImGuiTabItemFlags_ // Flags: for BeginTabItem()
typedefintImGuiTabItemFlags;// -> enum ImGuiTabItemFlags_ // Flags: for BeginTabItem()
typedefintImGuiTableFlags;// -> enum ImGuiTableFlags_ // Flags: For BeginTable()
typedefintImGuiTableColumnFlags;// -> enum ImGuiTableColumnFlags_// Flags: For TableSetupColumn()
typedefintImGuiTableRowFlags;// -> enum ImGuiTableRowFlags_ // Flags: For TableNextRow()
typedefintImGuiTreeNodeFlags;// -> enum ImGuiTreeNodeFlags_ // Flags: for TreeNode(), TreeNodeEx(), CollapsingHeader()
typedefintImGuiTreeNodeFlags;// -> enum ImGuiTreeNodeFlags_ // Flags: for TreeNode(), TreeNodeEx(), CollapsingHeader()
typedefintImGuiWindowFlags;// -> enum ImGuiWindowFlags_ // Flags: for Begin(), BeginChild()
typedefintImGuiWindowFlags;// -> enum ImGuiWindowFlags_ // Flags: for Begin(), BeginChild()
@ -657,6 +665,35 @@ namespace ImGui
IMGUI_APIvoidSetColumnOffset(intcolumn_index,floatoffset_x);// set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column
IMGUI_APIvoidSetColumnOffset(intcolumn_index,floatoffset_x);// set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column
IMGUI_APIintGetColumnsCount();
IMGUI_APIintGetColumnsCount();
// Tables
// [ALPHA API] API will evolve! (FIXME-TABLE)
// - Full-featured replacement for old Columns API
// - In most situations you can use TableNextRow() + TableSetColumnIndex() to populate a table.
// - If you are using tables as a sort of grid, populating every columns with the same type of contents,
// you may prefer using TableNextCell() instead of TableNextRow() + TableSetColumnIndex().
IMGUI_APIvoidEndTable();// only call EndTable() if BeginTable() returns true!
IMGUI_APIvoidTableNextRow(ImGuiTableRowFlagsrow_flags=0,floatmin_row_height=0.0f);// append into the first cell of a new row.
IMGUI_APIboolTableNextCell();// append into the next column (next column, or next row if currently in last column). Return true if column is visible.
IMGUI_APIboolTableSetColumnIndex(intcolumn_n);// append into the specified column. Return true if column is visible.
IMGUI_APIintTableGetColumnIndex();// return current column index.
IMGUI_APIconstchar*TableGetColumnName(intcolumn_n=-1);// return NULL if column didn't have a name declared by TableSetupColumn(). Use pass -1 to use current column.
IMGUI_APIboolTableGetColumnIsVisible(intcolumn_n=-1);// return true if column is visible. Same value is also returned by TableNextCell() and TableSetColumnIndex(). Use pass -1 to use current column.
IMGUI_APIboolTableGetColumnIsSorted(intcolumn_n=-1);// return true if column is included in the sort specs. Rarely used, can be useful to tell if a data change should trigger resort. Equivalent to test ImGuiTableSortSpecs's ->ColumnsMask & (1 << column_n). Use pass -1 to use current column.
// Tables: Headers & Columns declaration
// - Use TableSetupColumn() to specify resizing policy, default width, name, id, specific flags etc.
// - The name passed to TableSetupColumn() is used by TableAutoHeaders() and by the context-menu
// - Use TableAutoHeaders() to submit the whole header row, otherwise you may treat the header row as a regular row, manually call TableHeader() and other widgets.
// - Headers are required to perform some interactions: reordering, sorting, context menu // FIXME-TABLES: remove context from this list!
ImGuiTableFlags_Reorderable=1<<1,// Allow reordering columns (need calling TableSetupColumn() + TableAutoHeaders() or TableHeaders() to display headers)
ImGuiTableFlags_Hideable=1<<2,// Allow hiding columns (with right-click on header) (FIXME-TABLE: allow without headers).
ImGuiTableFlags_Sortable=1<<3,// Allow sorting on one column (sort_specs_count will always be == 1). Call TableGetSortSpecs() to obtain sort specs.
ImGuiTableFlags_MultiSortable=1<<4,// Allow sorting on multiple columns by holding Shift (sort_specs_count may be > 1). Call TableGetSortSpecs() to obtain sort specs.
ImGuiTableFlags_NoSavedSettings=1<<5,// Disable persisting columns order, width and sort settings in the .ini file.
// Decoration
ImGuiTableFlags_RowBg=1<<6,// Use ImGuiCol_TableRowBg and ImGuiCol_TableRowBgAlt colors behind each rows.
ImGuiTableFlags_NoClipX=1<<12,// Disable pushing clipping rectangle for every individual columns (reduce draw command count, items with be able to overflow)
ImGuiTableFlags_SizingPolicyStretchX=1<<13,// (Default if ScrollX is off) Columns will default to use ImGuiTableColumnFlags_WidthStretch. Fit all columns within available width. Fixed and Weighted columns allowed.
ImGuiTableFlags_SizingPolicyFixedX=1<<14,// (Default if ScrollX is on) Columns will default to use ImGuiTableColumnFlags_WidthFixed or WidthAuto. Enlarge as needed: enable scrollbar if ScrollX is enabled, otherwise extend parent window's contents rect. Only Fixed columns allowed. Weighted columns will calculate their width assuming no scrolling.
ImGuiTableFlags_NoHeadersWidth=1<<15,// Disable header width contribute to automatic width calculation for every columns.
ImGuiTableFlags_NoHostExtendY=1<<16,// (FIXME-TABLE: Reword as SizingPolicy?) Disable extending past the limit set by outer_size.y, only meaningful when neither of ScrollX|ScrollY are set (data below the limit will be clipped and not visible)
// Scrolling
ImGuiTableFlags_ScrollX=1<<17,// Enable horizontal scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. Because this create a child window, ScrollY is currently generally recommended when using ScrollX.
ImGuiTableFlags_ScrollY=1<<18,// Enable vertical scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size.
// FIXME-TABLE: Rename to ImGuiColumns_*, stick old columns api flags in there under an obsolete api block
enumImGuiTableColumnFlags_
{
ImGuiTableColumnFlags_None=0,
ImGuiTableColumnFlags_DefaultHide=1<<0,// Default as a hidden column.
ImGuiTableColumnFlags_DefaultSort=1<<1,// Default as a sorting column.
ImGuiTableColumnFlags_WidthFixed=1<<2,// Column will keep a fixed size, preferable with horizontal scrolling enabled (default if table sizing policy is SizingPolicyFixedX).
ImGuiTableColumnFlags_WidthStretch=1<<3,// Column will stretch, preferable with horizontal scrolling disabled (default if table sizing policy is SizingPolicyStretchX).
ImGuiTableColumnFlags_WidthAlwaysAutoResize=1<<4,// Column will keep resizing based on submitted contents (with a one frame delay) == Fixed with auto resize
ImGuiTableColumnFlags_NoDirectResize_=1<<20// [Internal] Disable user resizing this column directly (it may however we resized indirectly from its left edge)
floatFrameBorderSize;// Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).
floatFrameBorderSize;// Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).
ImVec2ItemSpacing;// Horizontal and vertical spacing between widgets/lines.
ImVec2ItemSpacing;// Horizontal and vertical spacing between widgets/lines.
ImVec2ItemInnerSpacing;// Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label).
ImVec2ItemInnerSpacing;// Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label).
ImVec2CellPadding;// Padding within a table cell
ImVec2TouchExtraPadding;// 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!
ImVec2TouchExtraPadding;// 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!
floatIndentSpacing;// Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).
floatIndentSpacing;// Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).
floatColumnsMinSpacing;// Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).
floatColumnsMinSpacing;// Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1).
@ -1700,6 +1829,30 @@ struct ImGuiPayload
boolIsDelivery()const{returnDelivery;}
boolIsDelivery()const{returnDelivery;}
};
};
// Sorting specification for one column of a table (sizeof == 8 bytes)
structImGuiTableSortSpecsColumn
{
ImGuiIDColumnUserID;// User id of the column (if specified by a TableSetupColumn() call)
ImU8ColumnIndex;// Index of the column
ImU8SortOrder;// Index within parent ImGuiTableSortSpecs (always stored in order starting from 0, tables sorted on a single criteria will always have a 0 here)
ImS8SortSign;// +1 or -1 (you can use this or SortDirection, whichever is more convenient for your sort function)
ImS8SortDirection;// ImGuiSortDirection_Ascending or ImGuiSortDirection_Descending (you can use this or SortSign, whichever is more convenient for your sort function)
ImGuiStorage*StateStorage;// Current persistent per-window storage (store e.g. tree node open/close state)
ImGuiStorage*StateStorage;// Current persistent per-window storage (store e.g. tree node open/close state)
ImGuiOldColumns*CurrentColumns;// Current columns set
ImGuiOldColumns*CurrentColumns;// Current columns set
ImGuiTable*CurrentTable;// Current table set
ImGuiLayoutTypeLayoutType;
ImGuiLayoutTypeLayoutType;
ImGuiLayoutTypeParentLayoutType;// Layout type of parent window at the time of Begin()
ImGuiLayoutTypeParentLayoutType;// Layout type of parent window at the time of Begin()
intFocusCounterRegular;// (Legacy Focus/Tabbing system) Sequential counter, start at -1 and increase as assigned via FocusableItemRegister() (FIXME-NAV: Needs redesign)
intFocusCounterRegular;// (Legacy Focus/Tabbing system) Sequential counter, start at -1 and increase as assigned via FocusableItemRegister() (FIXME-NAV: Needs redesign)
#define IM_COL32_DISABLE IM_COL32(0,0,0,1) // Special sentinel code
#define IMGUI_TABLE_MAX_COLUMNS 64 // sizeof(ImU64) * 8. This is solely because we frequently encode columns set in a ImU64.
// [Internal] sizeof() ~ 96
structImGuiTableColumn
{
ImGuiIDUserID;// Optional, value passed to TableSetupColumn()
ImGuiTableColumnFlagsFlagsIn;// Flags as input by user. See ImGuiTableColumnFlags_
ImGuiTableColumnFlagsFlags;// Effective flags. See ImGuiTableColumnFlags_
floatResizeWeight;// ~1.0f. Master width data when (Flags & _WidthStretch)
floatMinX;// Absolute positions
floatMaxX;
floatWidthRequested;// Master width data when !(Flags & _WidthStretch)
floatWidthGiven;// == (MaxX - MinX). FIXME-TABLE: Store all persistent width in multiple of FontSize?
floatStartXRows;// Start position for the frame, currently ~(MinX + CellPaddingX)
floatStartXHeaders;
ImS16ContentWidthRowsFrozen;// Contents width. Because freezing is non correlated from headers we need all 4 variants (ImDrawCmd merging uses different data than alignment code).
ImS16ContentWidthRowsUnfrozen;// (encoded as ImS16 because we actually rarely use those width)
floatContentMaxPosRowsFrozen;// Submitted contents absolute maximum position, from which we can infer width.
floatContentMaxPosRowsUnfrozen;// (kept as float because we need to manipulate those between each cell change)
floatContentMaxPosHeadersUsed;
floatContentMaxPosHeadersDesired;
ImRectClipRect;
ImS16NameOffset;// Offset into parent ColumnsName[]
boolIsActive;// Is the column not marked Hidden by the user (regardless of clipping). We're not calling this "Visible" here because visibility also depends on clipping.
boolNextIsActive;
ImS8IndexDisplayOrder;// Index within DisplayOrder[] (column may be reordered by users)
ImS8IndexWithinActiveSet;// Index within active set (<= IndexOrder)
ImS8DrawChannelCurrent;// Index within DrawSplitter.Channels[]
ImS8DrawChannelRowsBeforeFreeze;
ImS8DrawChannelRowsAfterFreeze;
ImS8PrevActiveColumn;// Index of prev active column within Columns[], -1 if first active column
ImS8NextActiveColumn;// Index of next active column within Columns[], -1 if last active column
// FIXME-OPT: Since CountColumns is invariant, we could use a single alloc for ImGuiTable + the three vectors it is carrying.
structImGuiTable
{
ImGuiIDID;
ImGuiTableFlagsFlags;
ImVector<ImGuiTableColumn>Columns;
ImVector<ImU8>DisplayOrder;// Store display order of columns (when not reordered, the values are 0...Count-1)
ImU64ActiveMaskByIndex;// Column Index -> IsActive map (Active == not hidden by user/api) in a format adequate for iterating column without touching cold data
ImGuiTableFlagsSettingsSaveFlags;// Pre-compute which data we are going to save into the .ini file (e.g. when order is not altered we won't save order)
intSettingsOffset;// Offset in g.SettingsTables
intLastFrameActive;
intColumnsCount;// Number of columns declared in BeginTable()
intColumnsActiveCount;// Number of non-hidden columns (<= ColumnsCount)
intCurrentColumn;
intCurrentRow;
floatRowPosY1;
floatRowPosY2;
floatRowTextBaseline;
ImGuiTableRowFlagsRowFlags:16;// Current row flags, see ImGuiTableRowFlags_
ImGuiTableRowFlagsLastRowFlags:16;
intRowBgColorCounter;// Counter for alternating background colors (can be fast-forwarded by e.g clipper)
ImU32RowBgColor;// Request for current row background color
ImU32BorderOuterColor;
ImU32BorderInnerColor;
floatBorderX1;
floatBorderX2;
floatCellPaddingX1;// Padding from each borders
floatCellPaddingX2;
floatCellPaddingY;
floatCellSpacingX;// Spacing between non-bordered cells
floatLastOuterHeight;// Outer height from last frame
floatLastFirstRowHeight;// Height of first row from last frame
floatColumnsTotalWidth;
floatInnerWidth;
ImRectOuterRect;// Note: OuterRect.Max.y is often FLT_MAX until EndTable(), unless a height has been specified in BeginTable().
ImRectWorkRect;
ImRectHostClipRect;// This is used to check if we can eventually merge our columns draw calls into the current draw call of the current window.
ImRectInnerClipRect;
ImRectBackgroundClipRect;// We use this to cpu-clip cell background color fill
ImGuiWindow*OuterWindow;// Parent window for the table
ImGuiWindow*InnerWindow;// Window holding the table data (== OuterWindow or a child window)
ImS8FreezeColumnsCount;// Actual frozen columns count (== FreezeColumnsRequest, or == 0 when no scrolling offset)
boolIsLayoutLocked;// Set by TableUpdateLayout() which is called when beginning the first row.
boolIsInsideRow;// Set if inside TableBeginRow()/TableEndRow().
boolIsFirstFrame;
boolIsSortSpecsDirty;
boolIsUsingHeaders;// Set if the first row had the ImGuiTableRowFlags_Headers flag.
boolIsContextPopupOpen;
boolIsSettingsRequestLoad;
boolIsSettingsLoaded;
boolIsSettingsDirty;// Set when table settings have changed and needs to be reported into ImGuiTableSetttings data.
boolIsDefaultDisplayOrder;// Set when display order is unchanged from default (DisplayOrder contains 0...Count-1)
boolIsResetDisplayOrderRequest;
boolIsFreezeRowsPassed;// Set when we got past the frozen row (the first one).
boolBackupSkipItems;// Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis
ImRectBackupWorkRect;// Backup of InnerWindow->WorkRect at the end of BeginTable()
ImVec2BackupCursorMaxPos;// Backup of InnerWindow->DC.CursorMaxPos at the end of BeginTable()
ImGuiTable()
{
memset(this,0,sizeof(*this));
SettingsOffset=-1;
LastFrameActive=-1;
LastResizedColumn=-1;
ContextPopupColumn=-1;
ReorderColumn=-1;
}
};
// sizeof() ~ 12
structImGuiTableColumnSettings
{
floatWidthOrWeight;
ImGuiIDUserID;
ImS8Index;
ImS8DisplayOrder;
ImS8SortOrder;
ImS8SortDirection:7;
ImU8Visible:1;// This is called Active in ImGuiTableColumn, in .ini file we call it Visible.
ImGuiTableColumnSettings()
{
WidthOrWeight=0.0f;
UserID=0;
Index=-1;
DisplayOrder=SortOrder=-1;
SortDirection=ImGuiSortDirection_None;
Visible=1;
}
};
// This is designed to be stored in a single ImChunkStream (1 header followed by N ImGuiTableColumnSettings, etc.)
structImGuiTableSettings
{
ImGuiIDID;// Set to 0 to invalidate/delete the setting