2007-04-30 14:50:15 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2007, Haiku Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Author:
|
|
|
|
* Gabe Yoder, gyoder@stny.rr.com
|
|
|
|
*/
|
2002-10-22 04:06:13 +04:00
|
|
|
#ifndef _CLIPBOARD_H
|
|
|
|
#define _CLIPBOARD_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <BeBuild.h>
|
|
|
|
#include <Locker.h>
|
2007-04-30 14:50:15 +04:00
|
|
|
#include <Messenger.h>
|
2002-10-22 04:06:13 +04:00
|
|
|
|
|
|
|
class BMessage;
|
|
|
|
|
2007-04-30 14:50:15 +04:00
|
|
|
|
2002-10-22 04:06:13 +04:00
|
|
|
enum {
|
|
|
|
B_CLIPBOARD_CHANGED = 'CLCH'
|
|
|
|
};
|
|
|
|
|
|
|
|
class BClipboard {
|
2007-04-30 14:50:15 +04:00
|
|
|
public:
|
|
|
|
BClipboard(const char* name, bool transient = false);
|
|
|
|
virtual ~BClipboard();
|
2002-10-22 04:06:13 +04:00
|
|
|
|
2007-04-30 14:50:15 +04:00
|
|
|
const char* Name() const;
|
2002-10-22 04:06:13 +04:00
|
|
|
|
|
|
|
uint32 LocalCount() const;
|
|
|
|
uint32 SystemCount() const;
|
|
|
|
status_t StartWatching(BMessenger target);
|
|
|
|
status_t StopWatching(BMessenger target);
|
|
|
|
|
|
|
|
bool Lock();
|
|
|
|
void Unlock();
|
|
|
|
bool IsLocked() const;
|
2007-04-30 14:50:15 +04:00
|
|
|
|
2002-10-22 04:06:13 +04:00
|
|
|
status_t Clear();
|
|
|
|
status_t Commit();
|
2007-04-30 14:50:15 +04:00
|
|
|
status_t Commit(bool failIfChanged);
|
2002-10-22 04:06:13 +04:00
|
|
|
status_t Revert();
|
|
|
|
|
|
|
|
BMessenger DataSource() const;
|
2007-04-30 14:50:15 +04:00
|
|
|
BMessage* Data() const;
|
2002-10-22 04:06:13 +04:00
|
|
|
|
2007-04-30 14:50:15 +04:00
|
|
|
private:
|
|
|
|
BClipboard(const BClipboard &);
|
2002-10-22 04:06:13 +04:00
|
|
|
BClipboard &operator=(const BClipboard &);
|
|
|
|
|
2007-04-30 14:50:15 +04:00
|
|
|
virtual void _ReservedClipboard1();
|
|
|
|
virtual void _ReservedClipboard2();
|
|
|
|
virtual void _ReservedClipboard3();
|
2002-10-22 04:06:13 +04:00
|
|
|
|
2007-04-30 14:50:15 +04:00
|
|
|
bool _AssertLocked() const;
|
|
|
|
status_t _DownloadFromSystem(bool force = false);
|
|
|
|
status_t _UploadToSystem();
|
2002-10-22 04:06:13 +04:00
|
|
|
|
2005-01-13 03:54:00 +03:00
|
|
|
uint32 _reserved0;
|
2007-04-30 14:50:15 +04:00
|
|
|
BMessage* fData;
|
2002-10-22 04:06:13 +04:00
|
|
|
BLocker fLock;
|
|
|
|
BMessenger fClipHandler;
|
|
|
|
BMessenger fDataSource;
|
2005-01-13 03:54:00 +03:00
|
|
|
uint32 fCount;
|
2007-04-30 14:50:15 +04:00
|
|
|
char* fName;
|
2002-10-22 04:06:13 +04:00
|
|
|
uint32 _reserved[4];
|
|
|
|
};
|
|
|
|
|
2007-04-30 14:50:15 +04:00
|
|
|
extern BClipboard* be_clipboard;
|
2002-10-22 04:06:13 +04:00
|
|
|
|
|
|
|
#endif // _CLIPBOARD_H
|