michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* vim:expandtab:shiftwidth=4:tabstop=4: michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef __nsClipboard_h_ michael@0: #define __nsClipboard_h_ michael@0: michael@0: #include "nsIClipboard.h" michael@0: #include "nsClipboardPrivacyHandler.h" michael@0: #include "nsAutoPtr.h" michael@0: #include michael@0: michael@0: class nsClipboard : public nsIClipboard, michael@0: public nsIObserver michael@0: { michael@0: public: michael@0: nsClipboard(); michael@0: virtual ~nsClipboard(); michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: NS_DECL_NSICLIPBOARD michael@0: NS_DECL_NSIOBSERVER michael@0: michael@0: // Make sure we are initialized, called from the factory michael@0: // constructor michael@0: nsresult Init (void); michael@0: michael@0: // Someone requested the selection michael@0: void SelectionGetEvent (GtkClipboard *aGtkClipboard, michael@0: GtkSelectionData *aSelectionData); michael@0: void SelectionClearEvent (GtkClipboard *aGtkClipboard); michael@0: michael@0: private: michael@0: // Utility methods michael@0: static GdkAtom GetSelectionAtom (int32_t aWhichClipboard); michael@0: static GtkSelectionData *GetTargets (GdkAtom aWhichClipboard); michael@0: michael@0: // Save global clipboard content to gtk michael@0: nsresult Store (void); michael@0: michael@0: // Get our hands on the correct transferable, given a specific michael@0: // clipboard michael@0: nsITransferable *GetTransferable (int32_t aWhichClipboard); michael@0: michael@0: // Hang on to our owners and transferables so we can transfer data michael@0: // when asked. michael@0: nsCOMPtr mSelectionOwner; michael@0: nsCOMPtr mGlobalOwner; michael@0: nsCOMPtr mSelectionTransferable; michael@0: nsCOMPtr mGlobalTransferable; michael@0: nsRefPtr mPrivacyHandler; michael@0: michael@0: }; michael@0: michael@0: #endif /* __nsClipboard_h_ */