mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-23 23:31:08 +01:00
Assert that ImScoped::TreeNodeEx() is called without ImGuyTreeNodeFlags_NoTreePushOnOpen
This commit is contained in:
parent
027861074c
commit
0a25a49e94
@ -216,18 +216,22 @@ header_file.each_line do |line|
|
||||
end.join('')
|
||||
|
||||
args = m[:args].map { |argparts| argparts.join('') }.join(',')
|
||||
print "#{INDENT * 2}#{current_class.class_name}(#{args})#{attrs} { "
|
||||
print "#{INDENT * 2}#{current_class.class_name}(#{args})#{attrs} {"
|
||||
|
||||
use_varargs = false
|
||||
if m[:argnames].last == '...'
|
||||
m[:argnames][-1] = 'ap'
|
||||
use_varargs = true
|
||||
print "va_list ap; va_start(ap, fmt); "
|
||||
print " va_list ap; va_start(ap, fmt);"
|
||||
end
|
||||
|
||||
print "#{current_class.state_var} = " if current_class.state_var
|
||||
if m[:name] =~ /^TreeNodeEx/ && m[:argnames].include?('flags')
|
||||
print " IM_ASSERT(!(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen));"
|
||||
end
|
||||
|
||||
print "ImGui::#{m[:name]}"
|
||||
print " #{current_class.state_var} =" if current_class.state_var
|
||||
|
||||
print " ImGui::#{m[:name]}"
|
||||
print 'V' if use_varargs
|
||||
print "(#{m[:argnames].join(', ')}); "
|
||||
print 'va_end(ap); ' if use_varargs
|
||||
|
@ -155,9 +155,9 @@ namespace ImScoped
|
||||
{
|
||||
bool IsOpen;
|
||||
|
||||
TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags = 0) { IsOpen = ImGui::TreeNodeEx(label, flags); }
|
||||
TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(4) { va_list ap; va_start(ap, fmt); IsOpen = ImGui::TreeNodeExV(str_id, flags, fmt, ap); va_end(ap); }
|
||||
TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(4) { va_list ap; va_start(ap, fmt); IsOpen = ImGui::TreeNodeExV(ptr_id, flags, fmt, ap); va_end(ap); }
|
||||
TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags = 0) { IM_ASSERT(!(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen)); IsOpen = ImGui::TreeNodeEx(label, flags); }
|
||||
TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(4) { va_list ap; va_start(ap, fmt); IM_ASSERT(!(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen)); IsOpen = ImGui::TreeNodeExV(str_id, flags, fmt, ap); va_end(ap); }
|
||||
TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(4) { va_list ap; va_start(ap, fmt); IM_ASSERT(!(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen)); IsOpen = ImGui::TreeNodeExV(ptr_id, flags, fmt, ap); va_end(ap); }
|
||||
~TreeNodeEx() { if (IsOpen) ImGui::TreePop(); }
|
||||
|
||||
explicit operator bool() const { return IsOpen; }
|
||||
@ -169,8 +169,8 @@ namespace ImScoped
|
||||
{
|
||||
bool IsOpen;
|
||||
|
||||
TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(4) { IsOpen = ImGui::TreeNodeExV(str_id, flags, fmt, args); }
|
||||
TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(4) { IsOpen = ImGui::TreeNodeExV(ptr_id, flags, fmt, args); }
|
||||
TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(4) { IM_ASSERT(!(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen)); IsOpen = ImGui::TreeNodeExV(str_id, flags, fmt, args); }
|
||||
TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(4) { IM_ASSERT(!(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen)); IsOpen = ImGui::TreeNodeExV(ptr_id, flags, fmt, args); }
|
||||
~TreeNodeExV() { if (IsOpen) ImGui::TreePop(); }
|
||||
|
||||
explicit operator bool() const { return IsOpen; }
|
||||
|
Loading…
Reference in New Issue
Block a user