Skip to content
Merged
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
30 changes: 12 additions & 18 deletions src/mvThemes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ void mvTheme::push_theme_components()
}

}
if (comp->_specificType != _specificType)
else
{
if (_specificEnabled == comp->_specificEnabled)
{
comp->_oldComponent = *comp->_specificComponentPtr;
comp->_oldComponent = std::move(*comp->_specificComponentPtr);
*comp->_specificComponentPtr = *(std::shared_ptr<mvThemeComponent>*) & child;
}
else
{
comp->_oldComponent = *comp->_specificDisabledComponentPtr;
comp->_oldComponent = std::move(*comp->_specificDisabledComponentPtr);
*comp->_specificDisabledComponentPtr = *(std::shared_ptr<mvThemeComponent>*) & child;
}
}
Expand All @@ -86,27 +86,30 @@ void mvTheme::push_theme_components()
void mvTheme::pop_theme_components()
{

for (auto& child : childslots[1])
for (auto it = childslots[1].rbegin(); it != childslots[1].rend(); it++)
{
auto comp = static_cast<mvThemeComponent*>(child.get());
auto comp = static_cast<mvThemeComponent*>(it->get());
if (comp->_specificType == (int)mvAppItemType::All || comp->_specificType == _specificType)
{
if (_specificEnabled == comp->_specificEnabled)
{
comp->pop_theme_items();
}
}
if (comp->_specificType != _specificType)
else
{
// Below, we move from comp->_oldComponent to avoid mvThemeComponent
// hanging around even after being deleted from the widget tree.
if (_specificEnabled == comp->_specificEnabled)
{
*comp->_specificComponentPtr = comp->_oldComponent;
*comp->_specificComponentPtr = std::move(comp->_oldComponent);
}
else
{
*comp->_specificDisabledComponentPtr = comp->_oldComponent;
*comp->_specificDisabledComponentPtr = std::move(comp->_oldComponent);
}

// Just in case anyone wants to reuse it
comp->_oldComponent = nullptr;
}
}
}
Expand Down Expand Up @@ -303,8 +306,6 @@ void mvThemeComponent::pop_theme_items()

void mvThemeComponent::handleSpecificPositionalArgs(PyObject* dict)
{
static std::shared_ptr<mvThemeComponent> all_item_theme_component = nullptr;

if (!VerifyPositionalArguments(GetParsers()[GetEntityCommand(type)], dict))
return;

Expand All @@ -318,13 +319,6 @@ void mvThemeComponent::handleSpecificPositionalArgs(PyObject* dict)
_specificType = ToInt(item);
_specificComponentPtr = &DearPyGui::GetClassThemeComponent((mvAppItemType)_specificType);
_specificDisabledComponentPtr = &DearPyGui::GetDisabledClassThemeComponent((mvAppItemType)_specificType);

if (_specificType == (int)mvAppItemType::All)
{
_specificComponentPtr = &all_item_theme_component;
_specificDisabledComponentPtr = &all_item_theme_component;
}

break;
}
default:
Expand Down
Loading