]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/clipbrd.h
More Motif changes (colour/font stuff)
[wxWidgets.git] / include / wx / motif / clipbrd.h
CommitLineData
9b6dbb09
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: clipbrd.h
3// Purpose: Clipboard functionality.
4// Note: this functionality is under review, and
5// is derived from wxWindows 1.xx code. Please contact
6// the wxWindows developers for further information.
7// Author: Julian Smart
8// Modified by:
9// Created: 17/09/98
10// RCS-ID: $Id$
11// Copyright: (c) Julian Smart
12// Licence: wxWindows licence
13/////////////////////////////////////////////////////////////////////////////
14
15#ifndef _WX_CLIPBRD_H_
16#define _WX_CLIPBRD_H_
17
18#ifdef __GNUG__
19#pragma interface "clipbrd.h"
20#endif
21
22#include "wx/defs.h"
23#include "wx/setup.h"
24
25#include "wx/list.h"
26
27bool WXDLLEXPORT wxOpenClipboard();
28bool WXDLLEXPORT wxClipboardOpen();
29bool WXDLLEXPORT wxCloseClipboard();
30bool WXDLLEXPORT wxEmptyClipboard();
31bool WXDLLEXPORT wxIsClipboardFormatAvailable(int dataFormat);
32bool WXDLLEXPORT wxSetClipboardData(int dataFormat, wxObject *obj, int width = 0, int height = 0);
33wxObject* WXDLLEXPORT wxGetClipboardData(int dataFormat, long *len = NULL);
34int WXDLLEXPORT wxEnumClipboardFormats(int dataFormat);
35int WXDLLEXPORT wxRegisterClipboardFormat(char *formatName);
36bool WXDLLEXPORT wxGetClipboardFormatName(int dataFormat, char *formatName, int maxCount);
37
38/* A clipboard client holds data belonging to the clipboard.
39 For plain text, a client is not necessary. */
40class WXDLLEXPORT wxClipboardClient : public wxObject
41{
42 DECLARE_ABSTRACT_CLASS(wxClipboardClient)
43
44 public:
45 /* This list should be filled in with strings indicating the formats
46 this client can provide. Almost all clients will provide "TEXT".
47 Format names should be 4 characters long, so things will work
48 out on the Macintosh */
49 wxStringList formats;
50
51 /* This method is called when the client is losing the selection. */
52 virtual void BeingReplaced() = 0;
53
54 /* This method is called when someone wants the data this client is
55 supplying to the clipboard. "format" is a string indicating the
56 format of the data - one of the strings from the "formats"
57 list. "*size" should be filled with the size of the resulting
58 data. In the case of text, "*size" does not count the
59 NULL terminator. */
60 virtual char *GetData(char *format, long *size) = 0;
61};
62
63/* ONE instance of this class: */
64class WXDLLEXPORT wxClipboard : public wxObject
65{
66 DECLARE_DYNAMIC_CLASS(wxClipboard)
67
68 public:
69 wxClipboardClient *clipOwner;
70 char *cbString, *sentString, *receivedString;
71 void *receivedTargets;
72 long receivedLength;
73
74 wxClipboard();
75 ~wxClipboard();
76
77 /* Set the clipboard data owner. "time" comes from the event record. */
78 void SetClipboardClient(wxClipboardClient *, long time);
79
80 /* Set the clipboard string; does not require a client. */
81 void SetClipboardString(char *, long time);
82
83 /* Get data from the clipboard in the format "TEXT". */
84 char *GetClipboardString(long time);
85
86 /* Get data from the clipboard */
87 char *GetClipboardData(char *format, long *length, long time);
88
89 /* Get the clipboard client directly. Will be NULL if clipboard data
90 is a string, or if some other application owns the clipboard.
91 This can be useful for shortcutting data translation, if the
92 clipboard user can check for a specific client. (This is used
93 by the wxMediaEdit class.) */
94 wxClipboardClient *GetClipboardClient();
95};
96
97/* Initialize wxTheClipboard. Can be called repeatedly */
98void WXDLLEXPORT wxInitClipboard();
99
100/* The clipboard */
101WXDLLEXPORT_DATA(extern wxClipboard*) wxTheClipboard;
102
103#endif
104 // _WX_CLIPBRD_H_