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

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

synergy v1.3.1 sources (zip).

File size: 2.4 KB
Line 
1/*
2 * synergy -- mouse and keyboard sharing utility
3 * Copyright (C) 2004 Chris Schoeneman
4 *
5 * This package is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * found in the file COPYING that should have accompanied this file.
8 *
9 * This package is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef COSXCLIPBOARD_H
16#define COSXCLIPBOARD_H
17
18#include "IClipboard.h"
19#include <vector>
20#include <Carbon/Carbon.h>
21
22class IOSXClipboardConverter;
23
24//! OS X clipboard implementation
25class COSXClipboard : public IClipboard {
26public:
27 COSXClipboard();
28 virtual ~COSXClipboard();
29
30 //! Test if clipboard is owned by synergy
31 static bool isOwnedBySynergy();
32
33 // IClipboard overrides
34 virtual bool empty();
35 virtual void add(EFormat, const CString& data);
36 virtual bool open(Time) const;
37 virtual void close() const;
38 virtual Time getTime() const;
39 virtual bool has(EFormat) const;
40 virtual CString get(EFormat) const;
41
42private:
43 void clearConverters();
44 static ScrapFlavorType
45 getOwnershipFlavor();
46
47private:
48 typedef std::vector<IOSXClipboardConverter*> ConverterList;
49
50 mutable Time m_time;
51 ConverterList m_converters;
52 mutable ScrapRef m_scrap;
53};
54
55//! Clipboard format converter interface
56/*!
57This interface defines the methods common to all Scrap book format
58*/
59class IOSXClipboardConverter : public IInterface {
60public:
61 //! @name accessors
62 //@{
63
64 //! Get clipboard format
65 /*!
66 Return the clipboard format this object converts from/to.
67 */
68 virtual IClipboard::EFormat
69 getFormat() const = 0;
70
71 //! returns the scrap flavor type that this object converts from/to
72 virtual ScrapFlavorType
73 getOSXFormat() const = 0;
74
75 //! Convert from IClipboard format
76 /*!
77 Convert from the IClipboard format to the Carbon scrap format.
78 The input data must be in the IClipboard format returned by
79 getFormat(). The return data will be in the scrap
80 format returned by getOSXFormat().
81 */
82 virtual CString fromIClipboard(const CString&) const = 0;
83
84 //! Convert to IClipboard format
85 /*!
86 Convert from the carbon scrap format to the IClipboard format
87 (i.e., the reverse of fromIClipboard()).
88 */
89 virtual CString toIClipboard(const CString&) const = 0;
90
91 //@}
92};
93
94#endif
Note: See TracBrowser for help on using the repository browser.