Skip to content

Commit

Permalink
Add method reset_style()
Browse files Browse the repository at this point in the history
  • Loading branch information
u546342 committed Dec 28, 2023
1 parent f121d9c commit 114676c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions imgui/api/imgui.script_api
Original file line number Diff line number Diff line change
Expand Up @@ -1727,6 +1727,11 @@
- name: scale
type: number

#*****************************************************************************************************

- name: reset_style
type: function

#*****************************************************************************************************
#***** ITEM WIDTH ************************************************************************************
#*****************************************************************************************************
Expand Down
14 changes: 14 additions & 0 deletions imgui/src/extension_imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1800,20 +1800,23 @@ static int imgui_SetStyleWindowRounding(lua_State* L)
style.WindowRounding = luaL_checknumber(L, 1);
return 0;
}

static int imgui_SetStyleFrameRounding(lua_State* L)
{
DM_LUA_STACK_CHECK(L, 0);
ImGuiStyle& style = ImGui::GetStyle();
style.FrameRounding = luaL_checknumber(L, 1);
return 0;
}

static int imgui_SetStyleTabRounding(lua_State* L)
{
DM_LUA_STACK_CHECK(L, 0);
ImGuiStyle& style = ImGui::GetStyle();
style.TabRounding = luaL_checknumber(L, 1);
return 0;
}

static int imgui_SetStyleScrollbarRounding(lua_State* L)
{
DM_LUA_STACK_CHECK(L, 0);
Expand Down Expand Up @@ -1865,6 +1868,7 @@ static int imgui_SetStyleColor(lua_State* L)
style.Colors[luaL_checkinteger(L, 1)] = ImVec4(r, g, b, a);
return 0;
}

static int imgui_PushStyleColor(lua_State* L)
{
DM_LUA_STACK_CHECK(L, 0);
Expand All @@ -1876,6 +1880,7 @@ static int imgui_PushStyleColor(lua_State* L)
ImGui::PushStyleColor(col, ImVec4(r, g, b, a));
return 0;
}

static int imgui_PopStyleColor(lua_State* L)
{
DM_LUA_STACK_CHECK(L, 0);
Expand All @@ -1887,6 +1892,7 @@ static int imgui_PopStyleColor(lua_State* L)
ImGui::PopStyleColor(count);
return 0;
}

static int imgui_GetStyleItemSpacing(lua_State* L)
{
DM_LUA_STACK_CHECK(L, 2);
Expand All @@ -1896,6 +1902,7 @@ static int imgui_GetStyleItemSpacing(lua_State* L)
lua_pushnumber(L, spacing.y);
return 2;
}

static int imgui_SetWindowFontScale(lua_State *L)
{
DM_LUA_STACK_CHECK(L, 0);
Expand All @@ -1922,6 +1929,12 @@ static int imgui_ScaleAllSizes(lua_State *L)
return 0;
}

static int imgui_ResetStyle(lua_State *L)
{
DM_LUA_STACK_CHECK(L, 0);
ImGui::GetStyle() = ImGuiStyle();
return 0;
}

static int imgui_SetCursorPos(lua_State *L)
{
Expand Down Expand Up @@ -2496,6 +2509,7 @@ static const luaL_reg Module_methods[] =
{"set_window_font_scale", imgui_SetWindowFontScale},
{"set_global_font_scale", imgui_SetGlobalFontScale},
{"scale_all_sizes", imgui_ScaleAllSizes},
{"reset_style", imgui_ResetStyle},

{"get_frame_height", imgui_GetFrameHeight},

Expand Down

0 comments on commit 114676c

Please sign in to comment.