SpiecsEngine
 
Loading...
Searching...
No Matches

◆ DrawTreeTitle()

void Spices::ImGuiH::DrawTreeTitle ( const std::string & treeName,
std::function< void()> optionFunc,
std::function< void()> treeFunc )
static

Draw a stylized tree title bar.

Parameters
[in]treeName.
[in]optionFuncFunction of draw option.
[in]treeFuncFunction of draw tree.

Definition at line 367 of file ImguiHelper.cpp.

372 {
374
375 constexpr ImGuiTreeNodeFlags treeNodeFlags =
376 ImGuiTreeNodeFlags_DefaultOpen |
377 ImGuiTreeNodeFlags_AllowItemOverlap |
378 ImGuiTreeNodeFlags_Framed |
379 ImGuiTreeNodeFlags_FramePadding ;
380
381 ImGui::PushStyleColor(ImGuiCol_Header , ImVec4(0.196f, 0.204f, 0.2f, 1.0f));
382 ImGui::PushStyleColor(ImGuiCol_HeaderHovered , ImVec4(0.164f, 0.18f, 0.184f, 1.0f));
383 ImGui::PushStyleColor(ImGuiCol_HeaderActive , ImVec4(0.164f, 0.18f, 0.184f, 1.0f));
384 ImGui::PushStyleColor(ImGuiCol_WindowBg , ImVec4(0.196f, 0.204f, 0.2f, 1.0f));
385
386 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding , ImVec2(2.0f, 6.0f));
387 const bool open = ImGui::TreeNodeEx(treeName.c_str(), treeNodeFlags, treeName.c_str());
388 ImGui::SameLine(ImGui::GetContentRegionAvail().x - ImGuiH::GetLineItemSize().x);
389 ImGui::PushStyleColor(ImGuiCol_Button , ImVec4(0.16f, 0.16f, 0.16f, 1.0f));
390 ImGui::PushStyleColor(ImGuiCol_ButtonHovered , ImVec4(0.608f, 0.608f, 0.608f, 1.0f));
391 ImGui::PushStyleColor(ImGuiCol_ButtonActive , ImVec4(0.396f, 0.439f, 0.168f, 1.0f));
392 if (ImGui::Button(ICON_MD_FILTER_VINTAGE, ImGuiH::GetLineItemSize()))
393 {
394 ImGui::OpenPopup(treeName.c_str());
395 }
396 ImGui::PopStyleColor(3);
397 ImGui::PopStyleVar();
398 if (ImGui::BeginPopup(treeName.c_str()))
399 {
400 if (optionFunc)
401 {
402 optionFunc();
403 }
404 ImGui::EndPopup();
405 }
406 if (open)
407 {
408 if (treeFunc)
409 {
410 treeFunc();
411 }
412 ImGui::TreePop();
413 }
414
415 ImGui::PopStyleColor(4);
416 }
#define SPICES_PROFILE_ZONE
static ImVec2 GetLineItemSize()
Get Line Width's Square Size.

Referenced by Spices::ImguiProperty::DrawComponent(), Spices::ImguiMaterialPanel::OnRender(), Spices::ImguiPostProcessing::OnRender(), and Spices::ImguiVideoMemoryRuntimeHUD::OnRender().