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