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"
|
2014-07-14 12:35:30 -07:00
|
|
|
#include "nsIObserver.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();
|
|
|
|
|
|
|
|
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:
|
2014-06-24 09:36:44 -07:00
|
|
|
virtual ~nsClipboard();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// Utility methods
|
2012-08-22 08:56:38 -07:00
|
|
|
static GdkAtom GetSelectionAtom (int32_t aWhichClipboard);
|
2007-03-22 10:30:00 -07:00
|
|
|
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
|
2012-08-22 08:56:38 -07:00
|
|
|
nsITransferable *GetTransferable (int32_t aWhichClipboard);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __nsClipboard_h_ */
|