3 #include <app/Clipboard.h>
9 \brief Server-side representation of a clipboard.
13 /*! \brief Creates and initializes a Clipboard.
14 \param name The name of the clipboard.
16 Clipboard::Clipboard(const char *name
)
26 /*! \brief Frees all resources associate with this object.
28 Clipboard::~Clipboard()
33 /*! \brief Sets the clipboard's data.
35 Also notifies all watchers that the clipboard data have changed.
37 \param data The new clipboard data.
38 \param dataSource The clipboards new data source.
41 Clipboard::SetData(const BMessage
*data
, BMessenger dataSource
)
44 fDataSource
= dataSource
;
50 /*! \brief Returns the clipboard's data.
51 \return The clipboard's data.
54 Clipboard::Data() const
60 /*! \brief Returns the clipboard's data source.
61 \return The clipboard's data source.
64 Clipboard::DataSource() const
71 Clipboard::Count() const
78 /*! \brief Adds a new watcher for this clipboard.
79 \param watcher The messenger referring to the new watcher.
80 \return \c true, if the watcher could be added successfully,
84 Clipboard::AddWatcher(BMessenger watcher
)
86 return fWatchingService
.AddWatcher(watcher
);
90 /*! \brief Removes a watcher from this clipboard.
91 \param watcher The watcher to be removed.
92 \return \c true, if the supplied watcher was watching the clipboard,
96 Clipboard::RemoveWatcher(BMessenger watcher
)
98 return fWatchingService
.RemoveWatcher(watcher
);
102 /*! \brief Sends a notification message that the clipboard data have changed
103 to all associated watchers.
106 Clipboard::NotifyWatchers()
108 BMessage
message(B_CLIPBOARD_CHANGED
);
109 fWatchingService
.NotifyWatchers(&message
, NULL
);