Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
scripting_mainmenu.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#include "cpp_api/s_base.h"
10#include "cpp_api/s_async.h"
11
12/*****************************************************************************/
13/* Scripting <-> Main Menu Interface */
14/*****************************************************************************/
15
17 : virtual public ScriptApiBase,
18 public ScriptApiMainMenu,
20{
21public:
22 MainMenuScripting(GUIEngine* guiengine);
23
24 // Global step handler to pass back async events
25 void step();
26
27 // Calls core.on_before_close()
28 void beforeClose();
29
30 // Pass async events from engine to async threads
31 u32 queueAsync(std::string &&serialized_func,
32 std::string &&serialized_param);
33
34 // Is the main menu allowed writeable access to this path?
35 static bool mayModifyPath(const std::string &path);
36
37 // (public implementation so it can be used from AsyncEngine)
38 static bool checkPathAccess(const std::string &abs_path, bool write_required,
39 bool *write_allowed);
40
41protected:
42 bool checkPathInternal(const std::string &abs_path, bool write_required,
43 bool *write_allowed) override {
44 return checkPathAccess(abs_path, write_required, write_allowed);
45 }
46
47private:
48 void initializeModApi(lua_State *L, int top);
49 static void registerLuaClasses(lua_State *L, int top);
50
52};
Definition s_async.h:67
implementation of main menu based uppon formspecs
Definition guiEngine.h:113
Definition scripting_mainmenu.h:20
static bool mayModifyPath(const std::string &path)
Definition scripting_mainmenu.cpp:77
void step()
Definition scripting_mainmenu.cpp:127
AsyncEngine asyncEngine
Definition scripting_mainmenu.h:51
void beforeClose()
Definition scripting_mainmenu.cpp:113
MainMenuScripting(GUIEngine *guiengine)
Definition scripting_mainmenu.cpp:25
static bool checkPathAccess(const std::string &abs_path, bool write_required, bool *write_allowed)
Definition scripting_mainmenu.cpp:101
void initializeModApi(lua_State *L, int top)
Definition scripting_mainmenu.cpp:51
static void registerLuaClasses(lua_State *L, int top)
Definition scripting_mainmenu.cpp:71
bool checkPathInternal(const std::string &abs_path, bool write_required, bool *write_allowed) override
Should check if the given path may be accessed.
Definition scripting_mainmenu.h:42
u32 queueAsync(std::string &&serialized_func, std::string &&serialized_param)
Definition scripting_mainmenu.cpp:132
Definition s_base.h:64
Definition s_mainmenu.h:11
Definition s_security.h:28