Loading...
Searching...
No Matches

Give access to the system clipboard. More...

#include <SFML/Window/Clipboard.hpp>

Static Public Member Functions

static String getString ()
 Get the content of the clipboard as string data.
static void setString (const String &text)
 Set the content of the clipboard as string data.

Detailed Description

Give access to the system clipboard.

sf::Clipboard provides an interface for getting and setting the contents of the system clipboard.

Usage example:

// get the clipboard content as a string
// or use it in the event loop
sf::Event event;
while(window.pollEvent(event))
{
if(event.type == sf::Event::Closed)
window.close();
{
// Using Ctrl + V to paste a string into SFML
if(event.key.control && event.key.code == sf::Keyboard::V)
}
}
// set the clipboard to a string
sf::Clipboard::setString("Hello World!");
static void setString(const String &text)
Set the content of the clipboard as string data.
static String getString()
Get the content of the clipboard as string data.
Defines a system event and its parameters.
Definition Event.hpp:45
KeyEvent key
Key event parameters (Event::KeyPressed, Event::KeyReleased).
Definition Event.hpp:224
EventType type
Type of the event.
Definition Event.hpp:219
@ Closed
The window requested to be closed (no data).
Definition Event.hpp:189
@ KeyPressed
A key was pressed (data in event.key).
Definition Event.hpp:194
@ V
The V key.
Definition Keyboard.hpp:72
Utility string class that automatically handles conversions between types and encodings.
Definition String.hpp:46
Keyboard::Key code
Code of the key that has been pressed.
Definition Event.hpp:64
bool control
Is the Control key pressed?
Definition Event.hpp:66
See also
sf::String, sf::Event

Definition at line 41 of file Clipboard.hpp.

Member Function Documentation

◆ getString()

String sf::Clipboard::getString ( )
static

Get the content of the clipboard as string data.

This function returns the content of the clipboard as a string. If the clipboard does not contain string it returns an empty sf::String object.

Returns
Clipboard contents as sf::String object

◆ setString()

void sf::Clipboard::setString ( const String & text)
static

Set the content of the clipboard as string data.

This function sets the content of the clipboard as a string.

Parameters
textsf::String containing the data to be sent to the clipboard

The documentation for this class was generated from the following file: