blob: 5423f81d323257741e6e4c700afd98ef42d5f6ef (
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
|
/*
* Copyright (C) 2009, Martin Robinson
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that 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 library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DataObjectGtk_h
#define DataObjectGtk_h
#include "FileList.h"
#include <GRefPtr.h>
#include "KURL.h"
#include "Range.h"
#include <wtf/RefCounted.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringHash.h>
namespace WebCore {
class DataObjectGtk : public RefCounted<DataObjectGtk> {
public:
static PassRefPtr<DataObjectGtk> create()
{
return adoptRef(new DataObjectGtk());
}
const KURL& url() { return m_url; }
const String& uriList() { return m_uriList; }
const Vector<String>& filenames() { return m_filenames; }
GdkPixbuf* image() { return m_image.get(); }
void setRange(PassRefPtr<Range> newRange) { m_range = newRange; }
void setImage(GdkPixbuf* newImage) { m_image = newImage; }
void setDragContext(GdkDragContext* newDragContext) { m_dragContext = newDragContext; }
void setURL(const KURL&, const String&);
bool hasText() { return m_range || !m_text.isEmpty(); }
bool hasMarkup() { return m_range || !m_markup.isEmpty(); }
bool hasURIList() { return !m_uriList.isEmpty(); }
bool hasURL() { return !m_url.isEmpty() && m_url.isValid(); }
bool hasFilenames() { return !m_filenames.isEmpty(); }
bool hasImage() { return m_image; }
void clearURIList() { m_uriList = ""; }
void clearURL() { m_url = KURL(); }
void clearImage() { m_image = 0; }
GdkDragContext* dragContext() { return m_dragContext.get(); }
String text();
String markup();
void setText(const String&);
void setMarkup(const String&);
void setURIList(const String&);
String urlLabel();
void clear();
void clearText();
void clearMarkup();
static DataObjectGtk* forClipboard(GtkClipboard*);
private:
String m_text;
String m_markup;
KURL m_url;
String m_uriList;
Vector<String> m_filenames;
GRefPtr<GdkPixbuf> m_image;
GRefPtr<GdkDragContext> m_dragContext;
RefPtr<Range> m_range;
};
}
#endif // DataObjectGtk_h
|