• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 Luca Bruno <lethalman88@gmail.com>
3  * Copyright (C) 2009 Holger Hans Peter Freyther
4  * Copyright (C) 2010 Martin Robinson <mrobinson@webkit.org>
5  * Copyright (C) 2010 Igalia S.L.
6  * All rights reserved.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public License
19  * along with this library; see the file COPYING.LIB.  If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  *
23  */
24 
25 #ifndef PasteboardHelper_h
26 #define PasteboardHelper_h
27 
28 /*
29  * FIXME: this is for WebCore support and must be removed once
30  * a better solution is found
31  */
32 
33 #include "Frame.h"
34 
35 namespace WebCore {
36 
37 class DataObjectGtk;
38 
39 class PasteboardHelper {
40 public:
41     PasteboardHelper();
42     virtual ~PasteboardHelper();
43 
44     GtkClipboard* getCurrentClipboard(Frame*);
45     GtkClipboard* getClipboard(Frame*) const;
46     GtkClipboard* getPrimarySelectionClipboard(Frame*) const;
47     GtkTargetList* targetList() const;
48     GtkTargetList* targetListForDataObject(DataObjectGtk*);
49     void fillSelectionData(GtkSelectionData*, guint, DataObjectGtk*);
50     void fillDataObjectFromDropData(GtkSelectionData*, guint, DataObjectGtk*);
51     Vector<GdkAtom> dropAtomsForContext(GtkWidget*, GdkDragContext*);
52     void writeClipboardContents(GtkClipboard*, GClosure* closure = 0);
53     void getClipboardContents(GtkClipboard*);
54 
55     enum PasteboardTargetType { TargetTypeText, TargetTypeMarkup, TargetTypeURIList, TargetTypeNetscapeURL, TargetTypeImage, TargetTypeUnknown };
56     virtual guint getIdForTargetType(PasteboardTargetType) = 0;
57 
58 protected:
59     void initializeTargetList();
60     virtual bool usePrimarySelectionClipboard(GtkWidget*) = 0;
61 
62 private:
63     GtkTargetList* m_targetList;
64 };
65 
66 }
67 
68 #endif // PasteboardHelper_h
69