source: trunk/synergy/lib/platform/CPMClipboard.h

Last change on this file was 2774, checked in by bird, 19 years ago

fixed a couple of clipboard issues. seems to work now.

File size: 3.1 KB
Line 
1/*
2 * synergy -- mouse and keyboard sharing utility
3 * Copyright (C) 2002 Chris Schoeneman
4 * Copyright (C) 2006 Knut St. Osmundsen
5 *
6 * This package is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * found in the file COPYING that should have accompanied this file.
9 *
10 * This package is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef CPMCLIPBOARD_H
17#define CPMCLIPBOARD_H
18
19#include "IClipboard.h"
20#include "stdvector.h"
21#define INCL_ERRORS
22#define INCL_BASE
23#define INCL_PM
24#include <os2.h>
25
26class IPMClipboardConverter;
27
28//! Microsoft windows clipboard implementation
29class CPMClipboard : public IClipboard {
30public:
31 CPMClipboard(HWND window);
32 virtual ~CPMClipboard();
33
34 //! Test if clipboard is owned by synergy
35 static bool isOwnedBySynergy();
36
37 // IClipboard overrides
38 virtual bool empty();
39 virtual void add(EFormat, const CString& data);
40 virtual bool open(Time) const;
41 virtual void close() const;
42 virtual Time getTime() const;
43 virtual bool has(EFormat) const;
44 virtual CString get(EFormat) const;
45
46private:
47 void clearConverters();
48
49 ULONG convertFormatToPM(EFormat) const;
50 ULONG convertTextToPM(const CString& data) const;
51 CString convertTextFromPM(ULONG) const;
52
53 static ATOM getOwnershipFormat();
54
55private:
56 typedef std::vector<IPMClipboardConverter*> ConverterList;
57
58 HWND m_window;
59 mutable Time m_time;
60 ConverterList m_converters;
61 static ATOM s_ownershipFormat;
62};
63
64//! Clipboard format converter interface
65/*!
66This interface defines the methods common to all win32 clipboard format
67converters.
68*/
69class IPMClipboardConverter : public IInterface {
70public:
71 // accessors
72
73 // return the clipboard format this object converts from/to
74 virtual IClipboard::EFormat
75 getFormat() const = 0;
76
77 // return the atom representing the PM clipboard format that
78 // this object converts from/to
79 virtual ULONG getPMFormat() const = 0;
80
81 // return the format info flags for the PM clipboard format
82 // this object converts from/to
83 virtual ULONG getPMFormatInfo() const = 0;
84
85 // convert from the IClipboard format to the PM clipboard format.
86 // the input data must be in the IClipboard format returned by
87 // getFormat(). the return data will be in the PM clipboard
88 // format returned by getPMFormat().
89 virtual ULONG fromIClipboard(const CString&) const = 0;
90
91 // free PM clipboard data (failure case).
92 virtual void freePMData(ULONG) const = 0;
93
94 // convert from the win32 clipboard format to the IClipboard format
95 // (i.e., the reverse of fromIClipboard()).
96 virtual CString toIClipboard(ULONG data) const = 0;
97};
98
99#endif
Note: See TracBrowser for help on using the repository browser.