FlightGear next
ClipboardFallback.cxx
Go to the documentation of this file.
1// Fallback implementation of clipboard access for Nasal. Copy and edit for
2// implementing support of other platforms
3//
4// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
5//
6// This program is free software; you can redistribute it and/or
7// modify it under the terms of the GNU General Public License as
8// published by the Free Software Foundation; either version 2 of the
9// License, or (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful, but
12// WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with this program; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20#include "NasalClipboard.hxx"
21
22#include <simgear/debug/logstream.hxx>
23
24
30 public NasalClipboard
31{
32 public:
33
37 virtual std::string getText(Type type)
38 {
39 return type == CLIPBOARD ? _clipboard : _selection;
40 }
41
45 virtual bool setText(const std::string& text, Type type)
46 {
47 if( type == CLIPBOARD )
48 _clipboard = text;
49 else
50 _selection = text;
51 return true;
52 }
53
54 protected:
55
56 std::string _clipboard,
58};
59
60//------------------------------------------------------------------------------
Provide a basic clipboard whose contents are only available to FlightGear itself.
virtual std::string getText(Type type)
Get clipboard contents as text.
virtual bool setText(const std::string &text, Type type)
Set clipboard contents as text.
static Ptr create()
Implementation supplied by actual platform implementation.
@ CLIPBOARD
Standard clipboard as supported by nearly all operating systems.
std::shared_ptr< NasalClipboard > Ptr