The Battle for Wesnoth  1.15.9+dev
clipboard.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2018 by David White <dave@whitevine.net>
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
17 #include <string>
18 
19 union SDL_Event;
20 
21 namespace desktop {
22 
23 namespace clipboard {
24 
25 /**
26  * Copies text to the clipboard.
27  *
28  * @param text The text to copy.
29  * @param mouse Is the selection done by the mouse? On UNIX systems there
30  * are multiple clipboards and the mouse selection uses a
31  * different clipboard. Ignored on other systems.
32  */
33 void copy_to_clipboard(const std::string& text, const bool mouse);
34 
35 /**
36  * Copies text from the clipboard.
37  *
38  * @param mouse Is the pasting done by the mouse?
39  *
40  * @returns String on clipbaord.
41  */
42 std::string copy_from_clipboard(const bool mouse);
43 
44 void handle_system_event(const SDL_Event& ev);
45 
46 /**
47  * Whether wesnoth was compiled with support for a clipboard.
48  */
49 bool available();
50 
51 } // end namespace clipboard
52 
53 } // end namespace desktop
bool available()
Whether wesnoth was compiled with support for a clipboard.
Definition: clipboard.cpp:54
std::string copy_from_clipboard(const bool)
Copies text from the clipboard.
Definition: clipboard.cpp:38
void handle_system_event(const SDL_Event &)
Definition: clipboard.cpp:50
void copy_to_clipboard(const std::string &text, const bool)
Copies text to the clipboard.
Definition: clipboard.cpp:33