diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/window/Window.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/window/Window.cpp b/src/window/Window.cpp index 5174504..ec187e3 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -10,6 +10,11 @@ extern "C" { } namespace mgl { + static bool clipboard_callback_interface(const unsigned char *data, size_t size, mgl_clipboard_type clipboard_type, void *userdata) { + ClipboardCallback *clipboard_callback = (ClipboardCallback*)userdata; + return (*clipboard_callback)(data, size, clipboard_type); + } + Window::Window() { window.window = 0; } @@ -138,11 +143,15 @@ namespace mgl { mgl_window_set_clipboard(&window, str.c_str(), str.size()); } - std::string Window::get_clipboard() { + bool Window::get_clipboard(ClipboardCallback callback) { + return mgl_window_get_clipboard(&window, clipboard_callback_interface, &callback); + } + + std::string Window::get_clipboard_string() { std::string result; char *str = nullptr; size_t size = 0; - if(mgl_window_get_clipboard(&window, &str, &size)) { + if(mgl_window_get_clipboard_string(&window, &str, &size)) { result.assign(str, size); free(str); } |