Skip to content

Commit

Permalink
GUI2 stacked_widget - add length operator
Browse files Browse the repository at this point in the history
  • Loading branch information
white-haired-uncle authored and Vultraz committed Nov 6, 2024
1 parent 82cc6d9 commit 05bf146
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/scripting/lua_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "gui/widgets/listbox.hpp"
#include "gui/widgets/multi_page.hpp"
#include "gui/widgets/stacked_widget.hpp"
#include "gui/widgets/tree_view.hpp"
#include "gui/widgets/tree_view_node.hpp"
#include "gui/widgets/widget.hpp"
Expand Down Expand Up @@ -194,6 +195,8 @@ static int impl_widget_length(lua_State* L)
lua_pushinteger(L, list->get_item_count());
} else if(gui2::multi_page* multi_page = dynamic_cast<gui2::multi_page*>(&w)) {
lua_pushinteger(L, multi_page->get_page_count());
} else if(gui2::stacked_widget* stacked_widget = dynamic_cast<gui2::stacked_widget*>(&w)) {
lua_pushinteger(L, stacked_widget->get_layer_count());
} else if(gui2::tree_view* tree_view = dynamic_cast<gui2::tree_view*>(&w)) {
lua_pushinteger(L, tree_view->get_root_node().count_children());
} else if(gui2::tree_view_node* tree_view_node = dynamic_cast<gui2::tree_view_node*>(&w)) {
Expand Down

0 comments on commit 05bf146

Please sign in to comment.