:type: dictionary {:ref:`keycode<keyboard-keys>`::ref:`status<input-status>`, ...}
+
+ .. function:: getClipboard()
+
+ Gets the clipboard text.
+
+ :rtype: string
+
+ .. function:: setClipboard(text)
+
+ Sets the clipboard text.
+
+ :arg text: New clipboard text
+ :type text: string
+
.. class:: SCA_PythonMouse(PyObjectPlus)
The current mouse.
#include "SCA_PythonKeyboard.h"
#include "SCA_IInputDevice.h"
+#include "GHOST_C-api.h"
+
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
+/* clipboard */
+static PyObject* gPyGetClipboard(PyObject* args, PyObject* kwds)
+{
+ char *buf = (char *)GHOST_getClipboard(0);
+ return PyUnicode_FromString(buf?buf:"");
+}
+
+static PyObject* gPySetClipboard(PyObject* args, PyObject* value)
+{
+ char* buf;
+ if (!PyArg_ParseTuple(value,"s:setClipboard",&buf))
+ Py_RETURN_NONE;
+
+ GHOST_putClipboard((GHOST_TInt8 *)buf, 0);
+ Py_RETURN_NONE;
+}
+
/* Integration hooks ------------------------------------------------------- */
PyTypeObject SCA_PythonKeyboard::Type = {
PyVarObject_HEAD_INIT(NULL, 0)
};
PyMethodDef SCA_PythonKeyboard::Methods[] = {
+ {"getClipboard", (PyCFunction) gPyGetClipboard, METH_VARARGS, "getCliboard doc"},
+ {"setClipboard", (PyCFunction) gPySetClipboard, METH_VARARGS, "setCliboard doc"},
{NULL,NULL} //Sentinel
};
sources = env.Glob('*.cpp') + env.Glob('Joystick/*.cpp')
-incs = '. #/intern/string #intern/container'
+incs = '. #/intern/string #intern/container #intern/ghost'
incs += ' #/source/gameengine/Expressions #/intern/moto/include'
incs += ' #/source/gameengine/Rasterizer #/source/gameengine/SceneGraph'
incs += ' #/source/blender/blenlib'