add clipboard lua binds
This commit is contained in:
parent
5499b04e9f
commit
c6a2f4fa7d
@ -21,6 +21,7 @@
|
|||||||
#include "StarInterfaceLuaBindings.hpp"
|
#include "StarInterfaceLuaBindings.hpp"
|
||||||
#include "StarInputLuaBindings.hpp"
|
#include "StarInputLuaBindings.hpp"
|
||||||
#include "StarVoiceLuaBindings.hpp"
|
#include "StarVoiceLuaBindings.hpp"
|
||||||
|
#include "StarClipboardLuaBindings.hpp"
|
||||||
|
|
||||||
#if defined STAR_SYSTEM_WINDOWS
|
#if defined STAR_SYSTEM_WINDOWS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -516,6 +517,8 @@ void ClientApplication::changeState(MainAppState newState) {
|
|||||||
|
|
||||||
m_universeClient->setLuaCallbacks("input", LuaBindings::makeInputCallbacks());
|
m_universeClient->setLuaCallbacks("input", LuaBindings::makeInputCallbacks());
|
||||||
m_universeClient->setLuaCallbacks("voice", LuaBindings::makeVoiceCallbacks());
|
m_universeClient->setLuaCallbacks("voice", LuaBindings::makeVoiceCallbacks());
|
||||||
|
if(!m_root->configuration()->get("safeScripts").toBool())
|
||||||
|
m_universeClient->setLuaCallbacks("clipboard", LuaBindings::makeClipboardCallbacks(appController()));
|
||||||
|
|
||||||
auto heldScriptPanes = make_shared<List<MainInterface::ScriptPaneInfo>>();
|
auto heldScriptPanes = make_shared<List<MainInterface::ScriptPaneInfo>>();
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ SET (star_frontend_HEADERS
|
|||||||
StarChatBubbleManager.hpp
|
StarChatBubbleManager.hpp
|
||||||
StarCinematic.hpp
|
StarCinematic.hpp
|
||||||
StarClientCommandProcessor.hpp
|
StarClientCommandProcessor.hpp
|
||||||
|
StarClipboardLuaBindings.hpp
|
||||||
StarCodexInterface.hpp
|
StarCodexInterface.hpp
|
||||||
StarConfirmationDialog.hpp
|
StarConfirmationDialog.hpp
|
||||||
StarContainerInterface.hpp
|
StarContainerInterface.hpp
|
||||||
@ -74,6 +75,7 @@ SET (star_frontend_SOURCES
|
|||||||
StarChatBubbleManager.cpp
|
StarChatBubbleManager.cpp
|
||||||
StarCinematic.cpp
|
StarCinematic.cpp
|
||||||
StarClientCommandProcessor.cpp
|
StarClientCommandProcessor.cpp
|
||||||
|
StarClipboardLuaBindings.cpp
|
||||||
StarCodexInterface.cpp
|
StarCodexInterface.cpp
|
||||||
StarConfirmationDialog.cpp
|
StarConfirmationDialog.cpp
|
||||||
StarContainerInterface.cpp
|
StarContainerInterface.cpp
|
||||||
|
24
source/frontend/StarClipboardLuaBindings.cpp
Normal file
24
source/frontend/StarClipboardLuaBindings.cpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include "StarClipboardLuaBindings.hpp"
|
||||||
|
#include "StarLuaConverters.hpp"
|
||||||
|
|
||||||
|
#include "SDL2/SDL.h"
|
||||||
|
|
||||||
|
namespace Star {
|
||||||
|
|
||||||
|
LuaCallbacks LuaBindings::makeClipboardCallbacks(ApplicationControllerPtr appController) {
|
||||||
|
LuaCallbacks callbacks;
|
||||||
|
|
||||||
|
callbacks.registerCallback("hasText", []() -> bool { return SDL_HasClipboardText() == SDL_TRUE;});
|
||||||
|
|
||||||
|
callbacks.registerCallback("getText", [appController]() -> Maybe<String> {
|
||||||
|
return appController->getClipboard();
|
||||||
|
});
|
||||||
|
|
||||||
|
callbacks.registerCallback("setText", [appController](String const& text) {
|
||||||
|
appController->setClipboard(text);
|
||||||
|
});
|
||||||
|
|
||||||
|
return callbacks;
|
||||||
|
};
|
||||||
|
|
||||||
|
}// namespace Star
|
12
source/frontend/StarClipboardLuaBindings.hpp
Normal file
12
source/frontend/StarClipboardLuaBindings.hpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "StarLua.hpp"
|
||||||
|
#include "StarApplicationController.hpp"
|
||||||
|
|
||||||
|
namespace Star {
|
||||||
|
|
||||||
|
namespace LuaBindings {
|
||||||
|
LuaCallbacks makeClipboardCallbacks(ApplicationControllerPtr appController);
|
||||||
|
}
|
||||||
|
|
||||||
|
}// namespace Star
|
Loading…
Reference in New Issue
Block a user