Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / eail / eail_clipboard.c
1 #include <glib.h>
2 #include <glib/gprintf.h>
3 #include <stdio.h>
4 #include "eail_clipboard.h"
5
6 /*
7  * Copyright (c) 2013 Samsung Electronics Co., Ltd.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this library; see the file COPYING.LIB.  If not, write to
21  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  */
24
25 /**
26  * @file eail_clipboard.c
27  *
28  * @brief EailClipboard implementation
29  *
30  * Widget that is being used to store clipboard data for ATK widgets
31  */
32
33 /**
34  * @brief Holds copied/cut text
35  */
36 static char *clipboard;
37
38 /**
39  * @brief Gets clipboard text
40  * @returns clipboard text
41  */
42 const char *eail_clipboard_get_text(void)
43 {
44    return clipboard;
45 }
46
47 /**
48  * @brief Sets clipboard text
49  * @param text new clipboard text
50  */
51 void eail_clipboard_set_text(const char *text)
52 {
53    if (clipboard) g_free(clipboard);
54    clipboard = g_strdup(text);
55 }
56
57 /**
58  * @brief Frees memory allocated by clipboard
59  */
60 void eail_clipboard_free(void)
61 {
62    if (clipboard) g_free(clipboard);
63 }