Skip to content

Commit

Permalink
Added ImGuiTreeNodeFlags_OpenOnDoubleClick (#581, #516, #190)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed May 1, 2016
1 parent a38fd2e commit 4c880b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5682,7 +5682,8 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
return opened;
}

bool hovered, held, pressed = ButtonBehavior(interact_bb, id, &hovered, &held, ImGuiButtonFlags_NoKeyModifiers | ((flags & ImGuiTreeNodeFlags_AllowOverlapMode) ? ImGuiButtonFlags_AllowOverlapMode : 0));
ImGuiButtonFlags button_flags = ImGuiButtonFlags_NoKeyModifiers | ((flags & ImGuiTreeNodeFlags_AllowOverlapMode) ? ImGuiButtonFlags_AllowOverlapMode : 0) | ((flags & ImGuiTreeNodeFlags_OpenOnDoubleClick) ? ImGuiButtonFlags_PressedOnDoubleClick : 0);
bool hovered, held, pressed = ButtonBehavior(interact_bb, id, &hovered, &held, button_flags);
if (pressed)
{
opened = !opened;
Expand Down
5 changes: 5 additions & 0 deletions imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,11 @@ enum ImGuiTreeNodeFlags_
ImGuiTreeNodeFlags_NoTreePushOnOpen = 1 << 3, // Don't do a TreePush() when opened (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack
ImGuiTreeNodeFlags_NoAutoOpenOnLog = 1 << 4, // Don't automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes).
ImGuiTreeNodeFlags_DefaultOpen = 1 << 5, // Default node to be opened
ImGuiTreeNodeFlags_OpenOnDoubleClick = 1 << 6, // Double-click to open node
//ImGuiTreeNodeFlags_OpenOnArrowOnly = 1 << 7, // FIXME: TODO: Can only click by
//ImGuiTreeNodeFlags_UnindentArrow = 1 << 8, // FIXME: TODO
//ImGuITreeNodeFlags_SpanAllAvailWidth = 1 << 9, // FIXME: TODO: Extend hit box horizontally even if not framed
//ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 10, // FIXME: TODO: Automatically scroll on TreePop() if node got just opened and contents is not visible
ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoAutoOpenOnLog
};

Expand Down

0 comments on commit 4c880b7

Please sign in to comment.