The Battle for Wesnoth  1.17.0-dev
lua_widget.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 - 2021
3  by Guillaume Melquiond <guillaume.melquiond@gmail.com>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
18 #include <string>
19 
20 #include "scripting/lua_ptr.hpp"
22 
23 namespace gui2 {
24  class widget;
25  class window;
26 }
27 struct lua_State;
28 
29 namespace lua_widget {
31 }
32 
34 bool luaW_iswidget(lua_State* L, int idx);
37 
38 
39 
40 /** [-0, +1, -] */
42 /** [-0, +0, -] */
44 /** [-0, +1, -] */
46 /** returns true if a callback already existed. [-1, +0, -] */
47 bool luaW_setwidgetcallback(lua_State* L, gui2::widget* wg, gui2::window* owner, std::string_view name);
48 /** pushed ther callback function onoto the stack [-0, +1, -] */
49 void luaW_getwidgetcallback(lua_State* L, gui2::widget* wg, gui2::window* owner, std::string_view name);
50 /** callas a widgets callback [-0, +0, e] */
51 void luaW_callwidgetcallback(lua_State* L, gui2::widget* wg, gui2::window* owner, std::string_view name);
Tmust inherit enable_lua_ptr<T>
Definition: lua_ptr.hpp:19
Base class for all widgets.
Definition: widget.hpp:49
void luaW_pushwindowtable(lua_State *L, gui2::window *owner)
[-0, +1, -]
Definition: lua_widget.cpp:82
void luaW_pushwidget(lua_State *L, gui2::widget &w)
Definition: lua_widget.cpp:36
lua_ptr< gui2::widget > & luaW_checkwidget_ptr(lua_State *L, int idx)
Definition: lua_widget.cpp:52
Generic file dialog.
Definition: field-fwd.hpp:23
void luaW_getwidgetcallback(lua_State *L, gui2::widget *wg, gui2::window *owner, std::string_view name)
pushed ther callback function onoto the stack [-0, +1, -]
Definition: lua_widget.cpp:163
void luaW_callwidgetcallback(lua_State *L, gui2::widget *wg, gui2::window *owner, std::string_view name)
callas a widgets callback [-0, +0, e]
Definition: lua_widget.cpp:175
bool luaW_setwidgetcallback(lua_State *L, gui2::widget *wg, gui2::window *owner, std::string_view name)
returns true if a callback already existed.
Definition: lua_widget.cpp:141
bool luaW_iswidget(lua_State *L, int idx)
Definition: lua_widget.cpp:63
void luaW_pushwidgettable(lua_State *L, gui2::widget *wg, gui2::window *owner)
[-0, +1, -]
Definition: lua_widget.cpp:114
int w
gui2::widget & luaW_checkwidget(lua_State *L, int idx)
Definition: lua_widget.cpp:42
void register_metatable(lua_State *L)
base class of top level items, the only item which needs to store the final canvases to draw on...
Definition: window.hpp:65
void luaW_clearwindowtable(lua_State *L, gui2::window *owner)
[-0, +0, -]
Definition: lua_widget.cpp:104