1 module bindbc.cimgui.overloads;
2 
3 import bindbc.cimgui.funcs;
4 import bindbc.cimgui.types;
5 
6 import core.stdc.stdarg;
7 static template overload(Funcs...)
8 {
9     import std.traits : Parameters;
10     static foreach(f; Funcs)
11         auto overload(Parameters!f params){
12             return f(params);}
13 }
14 ImColor* newImColor(){return ImColor_ImColorNil();}
15 ImColor* newImColor(int r,int g,int b,int a){return ImColor_ImColorInt(r,g,b,a);}
16 ImColor* newImColor(ImU32 rgba){return ImColor_ImColorU32(rgba);}
17 ImColor* newImColor(float r,float g,float b,float a){return ImColor_ImColorFloat(r,g,b,a);}
18 ImColor* newImColor(const ImVec4 col){return ImColor_ImColorVec4(col);}
19 void AddText(ImDrawList* self,const ImVec2 pos,ImU32 col,const (char)* text_begin,const (char)* text_end){ImDrawList_AddTextVec2(self,pos,col,text_begin,text_end);}
20 void AddText(ImDrawList* self,const ImFont* font,float font_size,const ImVec2 pos,ImU32 col,const (char)* text_begin,const (char)* text_end,float wrap_width,const ImVec4* cpu_fine_clip_rect){ImDrawList_AddTextFontPtr(self,font,font_size,pos,col,text_begin,text_end,wrap_width,cpu_fine_clip_rect);}
21 ImGuiPtrOrIndex* newImGuiPtrOrIndex(void* ptr){return ImGuiPtrOrIndex_ImGuiPtrOrIndexPtr(ptr);}
22 ImGuiPtrOrIndex* newImGuiPtrOrIndex(int index){return ImGuiPtrOrIndex_ImGuiPtrOrIndexInt(index);}
23 ImGuiStoragePair* newImGuiStoragePair(ImGuiID _key,int _val_i){return ImGuiStoragePair_ImGuiStoragePairInt(_key,_val_i);}
24 ImGuiStoragePair* newImGuiStoragePair(ImGuiID _key,float _val_f){return ImGuiStoragePair_ImGuiStoragePairFloat(_key,_val_f);}
25 ImGuiStoragePair* newImGuiStoragePair(ImGuiID _key,void* _val_p){return ImGuiStoragePair_ImGuiStoragePairPtr(_key,_val_p);}
26 ImGuiStyleMod* newImGuiStyleMod(ImGuiStyleVar idx,int v){return ImGuiStyleMod_ImGuiStyleModInt(idx,v);}
27 ImGuiStyleMod* newImGuiStyleMod(ImGuiStyleVar idx,float v){return ImGuiStyleMod_ImGuiStyleModFloat(idx,v);}
28 ImGuiStyleMod* newImGuiStyleMod(ImGuiStyleVar idx,ImVec2 v){return ImGuiStyleMod_ImGuiStyleModVec2(idx,v);}
29 ImGuiTextRange* newImGuiTextRange(){return ImGuiTextRange_ImGuiTextRangeNil();}
30 ImGuiTextRange* newImGuiTextRange(const (char)* _b,const (char)* _e){return ImGuiTextRange_ImGuiTextRangeStr(_b,_e);}
31 ImGuiID GetID(ImGuiWindow* self,const (char)* str,const (char)* str_end){return ImGuiWindow_GetIDStr(self,str,str_end);}
32 ImGuiID GetID(ImGuiWindow* self,const void* ptr){return ImGuiWindow_GetIDPtr(self,ptr);}
33 ImGuiID GetID(ImGuiWindow* self,int n){return ImGuiWindow_GetIDInt(self,n);}
34 ImGuiID GetIDNoKeepAlive(ImGuiWindow* self,const (char)* str,const (char)* str_end){return ImGuiWindow_GetIDNoKeepAliveStr(self,str,str_end);}
35 ImGuiID GetIDNoKeepAlive(ImGuiWindow* self,const void* ptr){return ImGuiWindow_GetIDNoKeepAlivePtr(self,ptr);}
36 ImGuiID GetIDNoKeepAlive(ImGuiWindow* self,int n){return ImGuiWindow_GetIDNoKeepAliveInt(self,n);}
37 void Add(ImRect* self,const ImVec2 p){ImRect_AddVec2(self,p);}
38 void Add(ImRect* self,const ImRect r){ImRect_AddRect(self,r);}
39 bool Contains(ImRect* self,const ImVec2 p){return ImRect_ContainsVec2(self,p);}
40 bool Contains(ImRect* self,const ImRect r){return ImRect_ContainsRect(self,r);}
41 void Expand(ImRect* self,const float amount){ImRect_ExpandFloat(self,amount);}
42 void Expand(ImRect* self,const ImVec2 amount){ImRect_ExpandVec2(self,amount);}
43 ImRect* newImRect(){return ImRect_ImRectNil();}
44 ImRect* newImRect(const ImVec2 min,const ImVec2 max){return ImRect_ImRectVec2(min,max);}
45 ImRect* newImRect(const ImVec4 v){return ImRect_ImRectVec4(v);}
46 ImRect* newImRect(float x1,float y1,float x2,float y2){return ImRect_ImRectFloat(x1,y1,x2,y2);}
47 ImVec1* newImVec1(){return ImVec1_ImVec1Nil();}
48 ImVec1* newImVec1(float _x){return ImVec1_ImVec1Float(_x);}
49 ImVec2* newImVec2(){return ImVec2_ImVec2Nil();}
50 ImVec2* newImVec2(float _x,float _y){return ImVec2_ImVec2Float(_x,_y);}
51 ImVec2ih* newImVec2ih(){return ImVec2ih_ImVec2ihNil();}
52 ImVec2ih* newImVec2ih(short _x,short _y){return ImVec2ih_ImVec2ihshort(_x,_y);}
53 ImVec2ih* newImVec2ih(const ImVec2 rhs){return ImVec2ih_ImVec2ihVec2(rhs);}
54 ImVec4* newImVec4(){return ImVec4_ImVec4Nil();}
55 ImVec4* newImVec4(float _x,float _y,float _z,float _w){return ImVec4_ImVec4Float(_x,_y,_z,_w);}
56 bool igBeginChild(const (char)* str_id,const ImVec2 size,bool border,ImGuiWindowFlags flags){return igBeginChildStr(str_id,size,border,flags);}
57 bool igBeginChild(ImGuiID id,const ImVec2 size,bool border,ImGuiWindowFlags flags){return igBeginChildID(id,size,border,flags);}
58 bool igCollapsingHeader(const (char)* label,ImGuiTreeNodeFlags flags){return igCollapsingHeaderTreeNodeFlags(label,flags);}
59 bool igCollapsingHeader(const (char)* label,bool* p_open,ImGuiTreeNodeFlags flags){return igCollapsingHeaderBoolPtr(label,p_open,flags);}
60 bool igCombo(const (char)* label,int* current_item,const (char)* * items,int items_count,int popup_max_height_in_items){return igComboStr_arr(label,current_item,items,items_count,popup_max_height_in_items);}
61 bool igCombo(const (char)* label,int* current_item,const (char)* items_separated_by_zeros,int popup_max_height_in_items){return igComboStr(label,current_item,items_separated_by_zeros,popup_max_height_in_items);}
62 bool igCombo(const (char)* label,int* current_item,bool function(void* data,int idx,const (char)** out_text) items_getter,void* data,int items_count,int popup_max_height_in_items){return igComboFnBoolPtr(label,current_item,items_getter,data,items_count,popup_max_height_in_items);}
63 ImDrawList* igGetBackgroundDrawList(){return igGetBackgroundDrawListNil();}
64 ImDrawList* igGetBackgroundDrawList(ImGuiViewport* viewport){return igGetBackgroundDrawListViewportPtr(viewport);}
65 ImU32 igGetColorU32(ImGuiCol idx,float alpha_mul){return igGetColorU32Col(idx,alpha_mul);}
66 ImU32 igGetColorU32(const ImVec4 col){return igGetColorU32Vec4(col);}
67 ImU32 igGetColorU32(ImU32 col){return igGetColorU32U32(col);}
68 ImDrawList* igGetForegroundDrawList(){return igGetForegroundDrawListNil();}
69 ImDrawList* igGetForegroundDrawList(ImGuiViewport* viewport){return igGetForegroundDrawListViewportPtr(viewport);}
70 ImDrawList* igGetForegroundDrawList(ImGuiWindow* window){return igGetForegroundDrawListWindowPtr(window);}
71 ImGuiID igGetID(const (char)* str_id){return igGetIDStr(str_id);}
72 ImGuiID igGetID(const (char)* str_id_begin,const (char)* str_id_end){return igGetIDStrStr(str_id_begin,str_id_end);}
73 ImGuiID igGetID(const void* ptr_id){return igGetIDPtr(ptr_id);}
74 float igImAbs(float x){return igImAbsFloat(x);}
75 double igImAbs(double x){return igImAbsdouble(x);}
76 float igImFloor(float f){return igImFloorFloat(f);}
77 ImVec2 igImFloor(const ImVec2 v){ImVec2 pOut;	igImFloorVec2(&pOut,v);	 return pOut;}
78 float igImLengthSqr(const ImVec2 lhs){return igImLengthSqrVec2(lhs);}
79 float igImLengthSqr(const ImVec4 lhs){return igImLengthSqrVec4(lhs);}
80 ImVec2 igImLerp(const ImVec2 a,const ImVec2 b,float t){ImVec2 pOut;	igImLerpVec2Float(&pOut,a,b,t);	 return pOut;}
81 ImVec2 igImLerp(const ImVec2 a,const ImVec2 b,const ImVec2 t){ImVec2 pOut;	igImLerpVec2Vec2(&pOut,a,b,t);	 return pOut;}
82 ImVec4 igImLerp(const ImVec4 a,const ImVec4 b,float t){ImVec4 pOut;	igImLerpVec4(&pOut,a,b,t);	 return pOut;}
83 float igImLog(float x){return igImLogFloat(x);}
84 double igImLog(double x){return igImLogdouble(x);}
85 float igImPow(float x,float y){return igImPowFloat(x,y);}
86 double igImPow(double x,double y){return igImPowdouble(x,y);}
87 float igImSign(float x){return igImSignFloat(x);}
88 double igImSign(double x){return igImSigndouble(x);}
89 bool igIsPopupOpen(const (char)* str_id,ImGuiPopupFlags flags){return igIsPopupOpenStr(str_id,flags);}
90 bool igIsPopupOpen(ImGuiID id,ImGuiPopupFlags popup_flags){return igIsPopupOpenID(id,popup_flags);}
91 bool igIsRectVisible(const ImVec2 size){return igIsRectVisibleNil(size);}
92 bool igIsRectVisible(const ImVec2 rect_min,const ImVec2 rect_max){return igIsRectVisibleVec2(rect_min,rect_max);}
93 void igItemSize(const ImVec2 size,float text_baseline_y){igItemSizeVec2(size,text_baseline_y);}
94 void igItemSize(const ImRect bb,float text_baseline_y){igItemSizeRect(bb,text_baseline_y);}
95 bool igListBox(const (char)* label,int* current_item,const (char)* * items,int items_count,int height_in_items){return igListBoxStr_arr(label,current_item,items,items_count,height_in_items);}
96 bool igListBox(const (char)* label,int* current_item,bool function(void* data,int idx,const (char)** out_text) items_getter,void* data,int items_count,int height_in_items){return igListBoxFnBoolPtr(label,current_item,items_getter,data,items_count,height_in_items);}
97 bool igListBoxHeader(const (char)* label,const ImVec2 size){return igListBoxHeaderVec2(label,size);}
98 bool igListBoxHeader(const (char)* label,int items_count,int height_in_items){return igListBoxHeaderInt(label,items_count,height_in_items);}
99 void igMarkIniSettingsDirty(){igMarkIniSettingsDirtyNil();}
100 void igMarkIniSettingsDirty(ImGuiWindow* window){igMarkIniSettingsDirtyWindowPtr(window);}
101 bool igMenuItem(const (char)* label,const (char)* shortcut,bool selected,bool enabled){return igMenuItemBool(label,shortcut,selected,enabled);}
102 bool igMenuItem(const (char)* label,const (char)* shortcut,bool* p_selected,bool enabled){return igMenuItemBoolPtr(label,shortcut,p_selected,enabled);}
103 void igPlotHistogram(const (char)* label,const float* values,int values_count,int values_offset,const (char)* overlay_text,float scale_min,float scale_max,ImVec2 graph_size,int stride){igPlotHistogramFloatPtr(label,values,values_count,values_offset,overlay_text,scale_min,scale_max,graph_size,stride);}
104 void igPlotHistogram(const (char)* label,float function(void* data,int idx) values_getter,void* data,int values_count,int values_offset,const (char)* overlay_text,float scale_min,float scale_max,ImVec2 graph_size){igPlotHistogramFnFloatPtr(label,values_getter,data,values_count,values_offset,overlay_text,scale_min,scale_max,graph_size);}
105 void igPlotLines(const (char)* label,const float* values,int values_count,int values_offset,const (char)* overlay_text,float scale_min,float scale_max,ImVec2 graph_size,int stride){igPlotLinesFloatPtr(label,values,values_count,values_offset,overlay_text,scale_min,scale_max,graph_size,stride);}
106 void igPlotLines(const (char)* label,float function(void* data,int idx) values_getter,void* data,int values_count,int values_offset,const (char)* overlay_text,float scale_min,float scale_max,ImVec2 graph_size){igPlotLinesFnFloatPtr(label,values_getter,data,values_count,values_offset,overlay_text,scale_min,scale_max,graph_size);}
107 void igPushID(const (char)* str_id){igPushIDStr(str_id);}
108 void igPushID(const (char)* str_id_begin,const (char)* str_id_end){igPushIDStrStr(str_id_begin,str_id_end);}
109 void igPushID(const void* ptr_id){igPushIDPtr(ptr_id);}
110 void igPushID(int int_id){igPushIDInt(int_id);}
111 void igPushStyleColor(ImGuiCol idx,ImU32 col){igPushStyleColorU32(idx,col);}
112 void igPushStyleColor(ImGuiCol idx,const ImVec4 col){igPushStyleColorVec4(idx,col);}
113 void igPushStyleVar(ImGuiStyleVar idx,float val){igPushStyleVarFloat(idx,val);}
114 void igPushStyleVar(ImGuiStyleVar idx,const ImVec2 val){igPushStyleVarVec2(idx,val);}
115 bool igRadioButton(const (char)* label,bool active){return igRadioButtonBool(label,active);}
116 bool igRadioButton(const (char)* label,int* v,int v_button){return igRadioButtonIntPtr(label,v,v_button);}
117 bool igSelectable(const (char)* label,bool selected,ImGuiSelectableFlags flags,const ImVec2 size){return igSelectableBool(label,selected,flags,size);}
118 bool igSelectable(const (char)* label,bool* p_selected,ImGuiSelectableFlags flags,const ImVec2 size){return igSelectableBoolPtr(label,p_selected,flags,size);}
119 void igSetScrollFromPosX(float local_x,float center_x_ratio){igSetScrollFromPosXFloat(local_x,center_x_ratio);}
120 void igSetScrollFromPosX(ImGuiWindow* window,float local_x,float center_x_ratio){igSetScrollFromPosXWindowPtr(window,local_x,center_x_ratio);}
121 void igSetScrollFromPosY(float local_y,float center_y_ratio){igSetScrollFromPosYFloat(local_y,center_y_ratio);}
122 void igSetScrollFromPosY(ImGuiWindow* window,float local_y,float center_y_ratio){igSetScrollFromPosYWindowPtr(window,local_y,center_y_ratio);}
123 void igSetScrollX(float scroll_x){igSetScrollXFloat(scroll_x);}
124 void igSetScrollX(ImGuiWindow* window,float scroll_x){igSetScrollXWindowPtr(window,scroll_x);}
125 void igSetScrollY(float scroll_y){igSetScrollYFloat(scroll_y);}
126 void igSetScrollY(ImGuiWindow* window,float scroll_y){igSetScrollYWindowPtr(window,scroll_y);}
127 void igSetWindowCollapsed(bool collapsed,ImGuiCond cond){igSetWindowCollapsedBool(collapsed,cond);}
128 void igSetWindowCollapsed(const (char)* name,bool collapsed,ImGuiCond cond){igSetWindowCollapsedStr(name,collapsed,cond);}
129 void igSetWindowCollapsed(ImGuiWindow* window,bool collapsed,ImGuiCond cond){igSetWindowCollapsedWindowPtr(window,collapsed,cond);}
130 void igSetWindowFocus(){igSetWindowFocusNil();}
131 void igSetWindowFocus(const (char)* name){igSetWindowFocusStr(name);}
132 void igSetWindowPos(const ImVec2 pos,ImGuiCond cond){igSetWindowPosVec2(pos,cond);}
133 void igSetWindowPos(const (char)* name,const ImVec2 pos,ImGuiCond cond){igSetWindowPosStr(name,pos,cond);}
134 void igSetWindowPos(ImGuiWindow* window,const ImVec2 pos,ImGuiCond cond){igSetWindowPosWindowPtr(window,pos,cond);}
135 void igSetWindowSize(const ImVec2 size,ImGuiCond cond){igSetWindowSizeVec2(size,cond);}
136 void igSetWindowSize(const (char)* name,const ImVec2 size,ImGuiCond cond){igSetWindowSizeStr(name,size,cond);}
137 void igSetWindowSize(ImGuiWindow* window,const ImVec2 size,ImGuiCond cond){igSetWindowSizeWindowPtr(window,size,cond);}
138 /**
139 *	bool igTreeNode(const (char)* label)
140 *	bool igTreeNode(const (char)* str_id,const (char)* fmt,...)
141 *	bool igTreeNode(const void* ptr_id,const (char)* fmt,...)
142 */
143 alias igTreeNode= overload!(igTreeNodeStr,igTreeNodeStrStr,igTreeNodePtr);
144 /**
145 *	bool igTreeNodeEx(const (char)* label,ImGuiTreeNodeFlags flags)
146 *	bool igTreeNodeEx(const (char)* str_id,ImGuiTreeNodeFlags flags,const (char)* fmt,...)
147 *	bool igTreeNodeEx(const void* ptr_id,ImGuiTreeNodeFlags flags,const (char)* fmt,...)
148 */
149 alias igTreeNodeEx= overload!(igTreeNodeExStr,igTreeNodeExStrStr,igTreeNodeExPtr);
150 bool igTreeNodeExV(const (char)* str_id,ImGuiTreeNodeFlags flags,const (char)* fmt,va_list args){return igTreeNodeExVStr(str_id,flags,fmt,args);}
151 bool igTreeNodeExV(const void* ptr_id,ImGuiTreeNodeFlags flags,const (char)* fmt,va_list args){return igTreeNodeExVPtr(ptr_id,flags,fmt,args);}
152 bool igTreeNodeV(const (char)* str_id,const (char)* fmt,va_list args){return igTreeNodeVStr(str_id,fmt,args);}
153 bool igTreeNodeV(const void* ptr_id,const (char)* fmt,va_list args){return igTreeNodeVPtr(ptr_id,fmt,args);}
154 void igTreePush(const (char)* str_id){igTreePushStr(str_id);}
155 void igTreePush(const void* ptr_id){igTreePushPtr(ptr_id);}
156 void igValue(const (char)* prefix,bool b){igValueBool(prefix,b);}
157 void igValue(const (char)* prefix,int v){igValueInt(prefix,v);}
158 void igValue(const (char)* prefix,uint v){igValueUint(prefix,v);}
159 void igValue(const (char)* prefix,float v,const (char)* float_format){igValueFloat(prefix,v,float_format);}