summaryrefslogtreecommitdiffstats
path: root/src/st/st-clipboard.h
blob: 022b8323d3cf6743430156cf7a9fbced6271a1d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
 * st-clipboard.h: clipboard object
 *
 * Copyright 2009 Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU Lesser General Public License,
 * version 2.1, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
 * more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#if !defined(ST_H_INSIDE) && !defined(ST_COMPILATION)
#error "Only <st/st.h> can be included directly.h"
#endif

#ifndef _ST_CLIPBOARD_H
#define _ST_CLIPBOARD_H

#include <glib-object.h>
#include <meta/meta-selection.h>

G_BEGIN_DECLS

#define ST_TYPE_CLIPBOARD st_clipboard_get_type()
G_DECLARE_FINAL_TYPE (StClipboard, st_clipboard, ST, CLIPBOARD, GObject)

typedef struct _StClipboard StClipboard;

/**
 * StClipboard:
 *
 * The contents of this structure is private and should only be accessed using
 * the provided API.
 */
struct _StClipboard
{
  /*< private >*/
  GObject parent;
};

typedef enum {
  ST_CLIPBOARD_TYPE_PRIMARY,
  ST_CLIPBOARD_TYPE_CLIPBOARD
} StClipboardType;

/**
 * StClipboardCallbackFunc:
 * @clipboard: A #StClipboard
 * @text: text from the clipboard
 * @user_data: user data
 *
 * Callback function called when text is retrieved from the clipboard.
 */
typedef void (*StClipboardCallbackFunc) (StClipboard *clipboard,
                                         const gchar *text,
                                         gpointer     user_data);

/**
 * StClipboardContentCallbackFunc:
 * @clipboard: A #StClipboard
 * @bytes: content from the clipboard
 * @user_data: user data
 *
 * Callback function called when content is retrieved from the clipboard.
 */
typedef void (*StClipboardContentCallbackFunc) (StClipboard *clipboard,
                                                GBytes      *bytes,
                                                gpointer     user_data);

StClipboard* st_clipboard_get_default (void);

GList * st_clipboard_get_mimetypes (StClipboard             *clipboard,
                                    StClipboardType          type);

void st_clipboard_get_text (StClipboard             *clipboard,
                            StClipboardType          type,
                            StClipboardCallbackFunc  callback,
                            gpointer                 user_data);
void st_clipboard_set_text (StClipboard             *clipboard,
                            StClipboardType          type,
                            const gchar             *text);

void st_clipboard_set_content (StClipboard          *clipboard,
                               StClipboardType       type,
                               const gchar          *mimetype,
                               GBytes               *bytes);
void st_clipboard_get_content (StClipboard                    *clipboard,
                               StClipboardType                 type,
                               const gchar                    *mimetype,
                               StClipboardContentCallbackFunc  callback,
                               gpointer                        user_data);

void st_clipboard_set_selection (MetaSelection *selection);

G_END_DECLS

#endif /* _ST_CLIPBOARD_H */