The Battle for Wesnoth  1.19.5+dev
Functions
lua_gui2 Namespace Reference

Functions

int show_message_dialog (lua_State *L)
 Displays a message window. More...
 
int show_popup_dialog (lua_State *L)
 Displays a popup message. More...
 
int show_story (lua_State *L)
 Displays a story screen. More...
 
int switch_theme (lua_State *L)
 Changes the current ui(gui2) theme. More...
 
int show_menu (lua_State *L)
 Displays a popup menu at the current mouse position Best used from a [set_menu_item], to show a submenu. More...
 
int show_message_box (lua_State *L)
 Displays a simple message box. More...
 
int show_lua_console (lua_State *, lua_kernel_base *lk)
 
int show_gamestate_inspector (const std::string &name, const game_data &data, const game_state &state)
 
static int show_help (lua_State *L)
 
int intf_add_widget_definition (lua_State *L)
 
int luaW_open (lua_State *L)
 

Function Documentation

◆ intf_add_widget_definition()

int lua_gui2::intf_add_widget_definition ( lua_State *  L)
  • Arg 1: string, widget type
  • Arg 3: string, id
  • Arg 3: config,

Definition at line 269 of file lua_gui2.cpp.

References gui2::add_single_widget_definition(), e, and luaW_checkconfig().

Referenced by luaW_open().

◆ luaW_open()

int lua_gui2::luaW_open ( lua_State *  L)

◆ show_gamestate_inspector()

int lua_gui2::show_gamestate_inspector ( const std::string &  name,
const game_data data,
const game_state state 
)

◆ show_help()

static int lua_gui2::show_help ( lua_State *  L)
static

Definition at line 257 of file lua_gui2.cpp.

References help::show_help().

Referenced by luaW_open().

◆ show_lua_console()

int lua_gui2::show_lua_console ( lua_State *  ,
lua_kernel_base lk 
)

◆ show_menu()

int lua_gui2::show_menu ( lua_State *  L)

Displays a popup menu at the current mouse position Best used from a [set_menu_item], to show a submenu.

  • Arg 1: Configs defining each item, with keys icon, image/label, second_label, tooltip
  • Args 2, 3: Initial selection (integer); whether to parse markup (boolean)

Definition at line 188 of file lua_gui2.cpp.

References sdl::get_mouse_location(), luaW_toboolean(), gui2::dialogs::drop_down_menu::selected_item(), and gui2::dialogs::modal_dialog::show().

Referenced by luaW_open(), and play_controller::hotkey_handler::show_menu().

◆ show_message_box()

int lua_gui2::show_message_box ( lua_State *  L)

Displays a simple message box.

Definition at line 213 of file lua_gui2.cpp.

References c, luaW_checktstring(), luaW_toboolean(), gui2::OK, and gui2::show_message().

Referenced by luaW_open().

◆ show_message_dialog()

int lua_gui2::show_message_dialog ( lua_State *  L)

Displays a message window.

  • Arg 1: Table describing the window
  • Arg 2: List of options (nil or empty table - no options)
  • Arg 3: Text input specifications (nil or empty table - no text input)
  • Ret 1: option chosen (if no options: 0 if there's text input, -2 if escape pressed, else -1)
  • Ret 2: string entered (empty if none, nil if no text input)

Definition at line 62 of file lua_gui2.cpp.

References gui2::dialogs::wml_message_input::caption, config::empty(), config::has_attribute(), i, luaW_checkconfig(), luaW_toconfig(), luaW_totstring(), gui2::dialogs::wml_message_input::maximum_length, n, gui2::dialogs::show_wml_message(), gui2::dialogs::wml_message_input::text, and gui2::dialogs::wml_message_input::text_input_was_specified.

Referenced by luaW_open().

◆ show_popup_dialog()

int lua_gui2::show_popup_dialog ( lua_State *  L)

Displays a popup message.

  • Arg 1: Title (allows Pango markup)
  • Arg 2: Message (allows Pango markup)
  • Arg 3: Image (optional)

Definition at line 151 of file lua_gui2.cpp.

References luaW_checktstring(), wfl::msg(), and gui2::show_transient_message().

Referenced by luaW_open().

◆ show_story()

int lua_gui2::show_story ( lua_State *  L)

Displays a story screen.

  • Arg 1: The story config
  • Arg 2: The default title

Definition at line 165 of file lua_gui2.cpp.

References gui2::dialogs::story_viewer::display(), luaW_checkconfig(), and luaW_checktstring().

Referenced by luaW_open().

◆ switch_theme()

int lua_gui2::switch_theme ( lua_State *  L)

Changes the current ui(gui2) theme.

  • Arg 1: The id of the theme to switch to

Definition at line 176 of file lua_gui2.cpp.

References gui2::switch_theme().

Referenced by luaW_open().