Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions dearpygui/_dearpygui.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions dearpygui/_dearpygui_RTD.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions dearpygui/dearpygui.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions src/mvAppItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ CanItemTypeBeVisible(mvAppItemType type)
case mvAppItemType::mvTable:
case mvAppItemType::mvTableColumn:
case mvAppItemType::mvTableRow:
case mvAppItemType::mvSyncedTables:
case mvAppItemType::mvButton: return true;
default: return false;
}
Expand Down Expand Up @@ -1008,6 +1009,7 @@ DearPyGui::GetEntityDesciptionFlags(mvAppItemType type)
case mvAppItemType::mvTable:
case mvAppItemType::mvTableCell:
case mvAppItemType::mvTableRow:
case mvAppItemType::mvSyncedTables:
case mvAppItemType::mv2dHistogramSeries:
case mvAppItemType::mvAreaSeries:
case mvAppItemType::mvBarSeries:
Expand Down Expand Up @@ -3350,6 +3352,24 @@ DearPyGui::GetEntityParser(mvAppItemType type)
setup.createContextManager = true;
break;
}
case mvAppItemType::mvSyncedTables:
{
AddCommonArgs(args, (CommonParserArgs)(
MV_PARSER_ARG_ID |
MV_PARSER_ARG_PARENT |
MV_PARSER_ARG_BEFORE |
MV_PARSER_ARG_FILTER |
MV_PARSER_ARG_SHOW)
);

setup.about =
"Links all tables that are immediate children of this container so that they share "
"their state (mostly column sizes). Other children are rendered as is. This is "
"an experimental feature, use with caution.";
setup.category = { "Tables", "Containers", "Widgets" };
setup.createContextManager = true;
break;
}
case mvAppItemType::mvDrawLine:
{
AddCommonArgs(args, (CommonParserArgs)(
Expand Down
1 change: 1 addition & 0 deletions src/mvAppItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ GetEntityCommand(mvAppItemType type)
case mvAppItemType::mvTable: return "add_table";
case mvAppItemType::mvTableColumn: return "add_table_column";
case mvAppItemType::mvTableRow: return "add_table_row";
case mvAppItemType::mvSyncedTables: return "add_synced_tables";
case mvAppItemType::mvDrawLine: return "draw_line";
case mvAppItemType::mvDrawArrow: return "draw_arrow";
case mvAppItemType::mvDrawTriangle: return "draw_triangle";
Expand Down
1 change: 1 addition & 0 deletions src/mvAppItemTypes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
X( mvTable ) \
X( mvTableColumn ) \
X( mvTableRow ) \
X( mvSyncedTables ) \
X( mvDrawLine ) \
X( mvDrawArrow ) \
X( mvDrawTriangle ) \
Expand Down
59 changes: 56 additions & 3 deletions src/mvTables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ void mvTable::draw(ImDrawList* drawlist, float x, float y)
apply_local_theming(this);

{
ScopedID id(uuid);

auto row_renderer = [&](mvAppItem* row, mvAppItem* prev_visible_row=nullptr)
{
//TableNextRow() ends the previous row, if any, and determines background color for it.
Expand Down Expand Up @@ -228,7 +226,14 @@ void mvTable::draw(ImDrawList* drawlist, float x, float y)

handleImmediateScroll();

if (ImGui::BeginTable(info.internalLabel.c_str(), _columns, _flags,
const char* table_id = info.internalLabel.c_str();
// If this table is a part of a synced group, use that group's internalLabel
// instead. In most cases, it will contain UUID so that all groups are distinct
// but tables within the group are synced.
if (info.parentPtr && info.parentPtr->type == mvAppItemType::mvSyncedTables)
table_id = info.parentPtr->info.internalLabel.c_str();

if (ImGui::BeginTable(table_id, _columns, _flags,
ImVec2((float)config.width, (float)config.height), (float)_inner_width))
{
state.lastFrameUpdate = GContext->frame;
Expand Down Expand Up @@ -638,3 +643,51 @@ void mvTable::setPyValue(PyObject* value)
_imguiFilter.InputBuf[i] = 0;
_imguiFilter.Build();
}

void mvSyncedTables::draw(ImDrawList* drawlist, float x, float y)
{
//-----------------------------------------------------------------------------
// pre draw
//-----------------------------------------------------------------------------

// show/hide
if (!config.show)
return;

// push font if a font object is attached
if (font)
{
ImFont* fontptr = static_cast<mvFont*>(font.get())->getFontPtr();
ImGui::PushFont(fontptr);
}

// themes
apply_local_theming(this);

//-----------------------------------------------------------------------------
// draw
//-----------------------------------------------------------------------------
{
ScopedID id(uuid);

for (auto& child : childslots[1])
{
child->draw(drawlist, ImGui::GetCursorPosX(), ImGui::GetCursorPosY());
}
UpdateAppItemState(state);
}

//-----------------------------------------------------------------------------
// post draw
//-----------------------------------------------------------------------------

// handle popping themes
cleanup_local_theming(this);

// pop font off stack
if (font)
ImGui::PopFont();

if (handlerRegistry)
handlerRegistry->checkEvents(&state);
}
9 changes: 8 additions & 1 deletion src/mvTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,11 @@ class mvTable : public mvAppItem
int direction;
};

};
};

class mvSyncedTables : public mvAppItem
{
public:
explicit mvSyncedTables(mvUUID uuid) : mvAppItem(uuid) {}
void draw(ImDrawList* drawlist, float x, float y) override;
};
Loading