#include "gui/core/canvas.hpp"
#include "gui/dialogs/drop_down_menu.hpp"
#include "gui/auxiliary/iterator/iterator.hpp"
#include "gui/widgets/clickable_item.hpp"
#include "gui/widgets/styled_widget.hpp"
#include "gui/widgets/listbox.hpp"
#include "gui/widgets/multi_page.hpp"
#include "gui/widgets/multimenu_button.hpp"
#include "gui/widgets/progress_bar.hpp"
#include "gui/widgets/selectable_item.hpp"
#include "gui/widgets/slider.hpp"
#include "gui/widgets/stacked_widget.hpp"
#include "gui/widgets/text_box.hpp"
#include "gui/widgets/tree_view.hpp"
#include "gui/widgets/tree_view_node.hpp"
#include "gui/widgets/unit_preview_pane.hpp"
#include "gui/widgets/widget.hpp"
#include "gui/widgets/window.hpp"
#include "config.hpp"
#include "log.hpp"
#include "scripting/lua_common.hpp"
#include "scripting/lua_cpp_function.hpp"
#include "scripting/lua_kernel_base.hpp"
#include "scripting/lua_unit.hpp"
#include "scripting/lua_unit_type.hpp"
#include "scripting/push_check.hpp"
#include "scripting/lua_widget.hpp"
#include "scripting/lua_widget_attributes.hpp"
#include "serialization/string_utils.hpp"
#include "tstring.hpp"
#include "game_data.hpp"
#include "game_state.hpp"
#include <functional>
#include <boost/preprocessor/cat.hpp>
#include <map>
#include <utility>
#include <vector>
#include "lua/lauxlib.h"
Go to the source code of this file.
Classes | |
struct | widget_getter< widget_type, value_type > |
struct | widget_setter< widget_type, value_type > |
Namespaces | |
lua_widget | |
Macros | |
#define | ERR_LUA LOG_STREAM(err, log_scripting_lua) |
#define | WIDGET_GETTER4(name, value_type, widgt_type, id) |
#define | WIDGET_SETTER4(name, value_type, widgt_type, id) |
#define | WIDGET_GETTER(name, value_type, widgt_type) WIDGET_GETTER4(name, value_type, widgt_type, __LINE__) |
#define | WIDGET_SETTER(name, value_type, widgt_type) WIDGET_SETTER4(name, value_type, widgt_type, __LINE__) |
Typedefs | |
using | tgetters = std::map< std::string, std::vector< std::function< bool(lua_State *, gui2::widget &, bool)> >> |
using | tsetters = std::map< std::string, std::vector< std::function< bool(lua_State *, int, gui2::widget &, bool)> >> |
Functions | |
static gui2::widget * | find_child_by_index (gui2::widget &w, int i) |
static gui2::widget * | find_child_by_name (gui2::widget &w, const std::string &m) |
template<typename widget_type , typename value_type , typename action_type , bool setter> | |
void | register_widget_attribute (const char *name) |
WIDGET_GETTER ("value_compat,selected_index", int, gui2::listbox) | |
CLASSIC. More... | |
WIDGET_SETTER ("value_compat,selected_index", int, gui2::listbox) | |
WIDGET_GETTER ("value_compat,selected_index", int, gui2::multi_page) | |
WIDGET_SETTER ("value_compat,selected_index", int, gui2::multi_page) | |
WIDGET_GETTER ("value_compat,selected_index", int, gui2::stacked_widget) | |
WIDGET_SETTER ("value_compat,selected_index", int, gui2::stacked_widget) | |
WIDGET_GETTER ("selected_index", int, gui2::selectable_item) | |
WIDGET_SETTER ("selected_index", int, gui2::selectable_item) | |
WIDGET_GETTER ("value_compat,selected", bool, gui2::selectable_item) | |
WIDGET_SETTER ("value_compat,selected", bool, gui2::selectable_item) | |
WIDGET_GETTER ("value_compat,text", std::string, gui2::text_box) | |
WIDGET_SETTER ("value_compat,text", std::string, gui2::text_box) | |
WIDGET_GETTER ("value_compat,value", int, gui2::slider) | |
WIDGET_SETTER ("value_compat,value", int, gui2::slider) | |
WIDGET_GETTER ("max_value", int, gui2::slider) | |
WIDGET_SETTER ("max_value", int, gui2::slider) | |
WIDGET_GETTER ("min_value", int, gui2::slider) | |
WIDGET_SETTER ("min_value", int, gui2::slider) | |
WIDGET_GETTER ("value_compat,percentage", int, gui2::progress_bar) | |
WIDGET_SETTER ("value_compat,percentage", int, gui2::progress_bar) | |
WIDGET_GETTER ("value_compat,selected_item_path", std::vector< int >, gui2::tree_view) | |
WIDGET_GETTER ("path", std::vector< int >, gui2::tree_view_node) | |
WIDGET_SETTER ("value_compat,unfolded", bool, gui2::tree_view_node) | |
WIDGET_SETTER ("value_compat,unit", lua_index_raw, gui2::unit_preview_pane) | |
WIDGET_GETTER ("item_count", int, gui2::multi_page) | |
WIDGET_GETTER ("item_count", int, gui2::listbox) | |
WIDGET_SETTER ("use_markup", bool, gui2::styled_widget) | |
WIDGET_SETTER ("marked_up_text", t_string, gui2::styled_widget) | |
WIDGET_SETTER ("enabled", bool, gui2::styled_widget) | |
WIDGET_SETTER ("tooltip", t_string, gui2::styled_widget) | |
WIDGET_SETTER ("callback", lua_index_raw, gui2::widget) | |
WIDGET_SETTER ("visible", lua_index_raw, gui2::styled_widget) | |
WIDGET_SETTER ("value_compat,label", t_string, gui2::styled_widget) | |
WIDGET_GETTER ("type", std::string, gui2::widget) | |
int | lua_widget::impl_widget_get (lua_State *L) |
int | lua_widget::impl_widget_set (lua_State *L) |
int | lua_widget::impl_widget_dir (lua_State *L) |
Variables | |
static lg::log_domain | log_scripting_lua ("scripting/lua") |
static tgetters | getters |
static tsetters | setters |
#define ERR_LUA LOG_STREAM(err, log_scripting_lua) |
Definition at line 61 of file lua_widget_attributes.cpp.
#define WIDGET_GETTER | ( | name, | |
value_type, | |||
widgt_type | |||
) | WIDGET_GETTER4(name, value_type, widgt_type, __LINE__) |
name | string comma seperated list |
value_type | the type of the attribute, for example int or std::string |
widgt_type | the type of the widget, for example gui2::listbox |
Definition at line 196 of file lua_widget_attributes.cpp.
#define WIDGET_GETTER4 | ( | name, | |
value_type, | |||
widgt_type, | |||
id | |||
) |
Definition at line 163 of file lua_widget_attributes.cpp.
#define WIDGET_SETTER | ( | name, | |
value_type, | |||
widgt_type | |||
) | WIDGET_SETTER4(name, value_type, widgt_type, __LINE__) |
Definition at line 198 of file lua_widget_attributes.cpp.
#define WIDGET_SETTER4 | ( | name, | |
value_type, | |||
widgt_type, | |||
id | |||
) |
Definition at line 177 of file lua_widget_attributes.cpp.
using tgetters = std::map<std::string, std::vector<std::function<bool(lua_State*, gui2::widget&, bool)> >> |
Definition at line 110 of file lua_widget_attributes.cpp.
using tsetters = std::map<std::string, std::vector<std::function<bool(lua_State*, int, gui2::widget&, bool)> >> |
Definition at line 113 of file lua_widget_attributes.cpp.
|
static |
Definition at line 63 of file lua_widget_attributes.cpp.
References gui2::tree_view_node::count_children(), gui2::tree_view_node::get_child_at(), i, n, and w.
Referenced by lua_widget::impl_widget_get().
|
static |
Definition at line 105 of file lua_widget_attributes.cpp.
References w.
Referenced by lua_widget::impl_widget_get().
void register_widget_attribute | ( | const char * | name | ) |
Definition at line 131 of file lua_widget_attributes.cpp.
References getters, lua_push(), setters, utils::split_foreach(), and w.
WIDGET_GETTER | ( | "item_count" | , |
int | , | ||
gui2::listbox | |||
) |
Definition at line 348 of file lua_widget_attributes.cpp.
References w.
WIDGET_GETTER | ( | "item_count" | , |
int | , | ||
gui2::multi_page | |||
) |
Definition at line 343 of file lua_widget_attributes.cpp.
References w.
WIDGET_GETTER | ( | "max_value" | , |
int | , | ||
gui2::slider | |||
) |
Definition at line 279 of file lua_widget_attributes.cpp.
References w.
WIDGET_GETTER | ( | "min_value" | , |
int | , | ||
gui2::slider | |||
) |
Definition at line 289 of file lua_widget_attributes.cpp.
References w.
WIDGET_GETTER | ( | "path" | , |
std::vector< int > | , | ||
gui2::tree_view_node | |||
) |
Definition at line 316 of file lua_widget_attributes.cpp.
WIDGET_GETTER | ( | "selected_index" | , |
int | , | ||
gui2::selectable_item | |||
) |
Definition at line 233 of file lua_widget_attributes.cpp.
References w.
WIDGET_GETTER | ( | "type" | , |
std::string | , | ||
gui2::widget | |||
) |
Definition at line 442 of file lua_widget_attributes.cpp.
WIDGET_GETTER | ( | " | value_compat, |
percentage" | , | ||
int | , | ||
gui2::progress_bar | |||
) |
Definition at line 299 of file lua_widget_attributes.cpp.
References w.
WIDGET_GETTER | ( | " | value_compat, |
selected" | , | ||
bool | , | ||
gui2::selectable_item | |||
) |
Definition at line 246 of file lua_widget_attributes.cpp.
References w.
WIDGET_GETTER | ( | " | value_compat, |
selected_index" | , | ||
int | , | ||
gui2::listbox | |||
) |
WIDGET_GETTER | ( | " | value_compat, |
selected_index" | , | ||
int | , | ||
gui2::multi_page | |||
) |
Definition at line 213 of file lua_widget_attributes.cpp.
References w.
WIDGET_GETTER | ( | " | value_compat, |
selected_index" | , | ||
int | , | ||
gui2::stacked_widget | |||
) |
Definition at line 223 of file lua_widget_attributes.cpp.
References w.
WIDGET_GETTER | ( | " | value_compat, |
selected_item_path" | , | ||
std::vector< int > | , | ||
gui2::tree_view | |||
) |
Definition at line 309 of file lua_widget_attributes.cpp.
WIDGET_GETTER | ( | " | value_compat, |
text" | , | ||
std::string | , | ||
gui2::text_box | |||
) |
Definition at line 259 of file lua_widget_attributes.cpp.
References w.
WIDGET_GETTER | ( | " | value_compat, |
value" | , | ||
int | , | ||
gui2::slider | |||
) |
Definition at line 269 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | "callback" | , |
lua_index_raw | , | ||
gui2::widget | |||
) |
Definition at line 379 of file lua_widget_attributes.cpp.
References ERR_LUA, luaW_getglobal(), luaW_pushwidget(), and w.
WIDGET_SETTER | ( | "enabled" | , |
bool | , | ||
gui2::styled_widget | |||
) |
Definition at line 368 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | "marked_up_text" | , |
t_string | , | ||
gui2::styled_widget | |||
) |
Definition at line 362 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | "max_value" | , |
int | , | ||
gui2::slider | |||
) |
Definition at line 284 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | "min_value" | , |
int | , | ||
gui2::slider | |||
) |
Definition at line 294 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | "selected_index" | , |
int | , | ||
gui2::selectable_item | |||
) |
Definition at line 238 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | "tooltip" | , |
t_string | , | ||
gui2::styled_widget | |||
) |
Definition at line 373 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | "use_markup" | , |
bool | , | ||
gui2::styled_widget | |||
) |
Definition at line 353 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | " | value_compat, |
label" | , | ||
t_string | , | ||
gui2::styled_widget | |||
) |
Definition at line 433 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | " | value_compat, |
percentage" | , | ||
int | , | ||
gui2::progress_bar | |||
) |
Definition at line 304 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | " | value_compat, |
selected" | , | ||
bool | , | ||
gui2::selectable_item | |||
) |
Definition at line 254 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | " | value_compat, |
selected_index" | , | ||
int | , | ||
gui2::listbox | |||
) |
Definition at line 208 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | " | value_compat, |
selected_index" | , | ||
int | , | ||
gui2::multi_page | |||
) |
Definition at line 218 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | " | value_compat, |
selected_index" | , | ||
int | , | ||
gui2::stacked_widget | |||
) |
Definition at line 228 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | " | value_compat, |
text" | , | ||
std::string | , | ||
gui2::text_box | |||
) |
Definition at line 264 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | " | value_compat, |
unfolded" | , | ||
bool | , | ||
gui2::tree_view_node | |||
) |
Definition at line 323 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | " | value_compat, |
unit" | , | ||
lua_index_raw | , | ||
gui2::unit_preview_pane | |||
) |
Definition at line 332 of file lua_widget_attributes.cpp.
References luaW_tounit(), luaW_tounittype(), luaW_type_error(), and w.
WIDGET_SETTER | ( | " | value_compat, |
value" | , | ||
int | , | ||
gui2::slider | |||
) |
Definition at line 274 of file lua_widget_attributes.cpp.
References w.
WIDGET_SETTER | ( | "visible" | , |
lua_index_raw | , | ||
gui2::styled_widget | |||
) |
Definition at line 389 of file lua_widget_attributes.cpp.
References game_config::images::flag, luaW_toboolean(), luaW_type_error(), and w.
|
static |
Definition at line 111 of file lua_widget_attributes.cpp.
Referenced by lua_widget::impl_widget_dir(), lua_widget::impl_widget_get(), and register_widget_attribute().
|
static |
|
static |
Definition at line 114 of file lua_widget_attributes.cpp.
Referenced by lua_widget::impl_widget_dir(), lua_widget::impl_widget_set(), and register_widget_attribute().