Eclipse SUMO - Simulation of Urban MObility
GUIUserIO.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Some OS-dependant functions to ease cliboard manipulation
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
24 #include "GUIUserIO.h"
25 
26 
27 // ===========================================================================
28 // static member definitions
29 // ===========================================================================
30 std::string GUIUserIO::clipped = "";
31 
32 
33 // ===========================================================================
34 // method definitions
35 // ===========================================================================
36 void
37 GUIUserIO::copyToClipboard(const FXApp& app, const std::string& text) {
38  FXDragType types[] = {FXWindow::stringType, FXWindow::textType};
39  if (app.getActiveWindow()->acquireClipboard(types, 2)) {
40  clipped = text;
41  }
42 }
43 
44 std::string
45 GUIUserIO::copyFromClipboard(const FXApp& app) {
46  FXString string;
47  if (app.getActiveWindow()->getDNDData(FROM_CLIPBOARD, FXWindow::utf8Type, string)) {
48  return string.text();
49  };
50  return string.text();
51 }
52 
53 /****************************************************************************/
54 
GUIUserIO::copyToClipboard
static void copyToClipboard(const FXApp &app, const std::string &text)
Copies the given text to clipboard.
Definition: GUIUserIO.cpp:37
GUIUserIO::clipped
static std::string clipped
Definition: GUIUserIO.h:60
GUIUserIO.h
config.h
GUIUserIO::copyFromClipboard
static std::string copyFromClipboard(const FXApp &app)
Copies text from the clipboard.
Definition: GUIUserIO.cpp:45