gecko-dev/layout/generic/nsAutoCopyListener.h

46 строки
1.0 KiB
C
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2012-05-21 15:12:37 +04: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/. */
2000-04-14 10:18:36 +04:00
#ifndef nsAutoCopyListener_h_
#define nsAutoCopyListener_h_
2000-04-14 10:18:36 +04:00
#include "nsISelectionListener.h"
#include "nsISelectionPrivate.h"
#include "mozilla/Attributes.h"
2000-04-14 10:18:36 +04:00
class nsAutoCopyListener MOZ_FINAL : public nsISelectionListener
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISELECTIONLISTENER
2000-04-14 10:18:36 +04:00
void Listen(nsISelectionPrivate *aSelection)
{
NS_ASSERTION(aSelection, "Null selection passed to Listen()");
aSelection->AddSelectionListener(this);
}
2000-04-14 10:18:36 +04:00
static nsAutoCopyListener* GetInstance()
{
if (!sInstance) {
sInstance = new nsAutoCopyListener();
2000-04-14 10:18:36 +04:00
NS_ADDREF(sInstance);
}
2000-04-14 10:18:36 +04:00
return sInstance;
}
2000-04-14 10:18:36 +04:00
static void Shutdown()
{
NS_IF_RELEASE(sInstance);
}
2000-04-14 10:18:36 +04:00
private:
static nsAutoCopyListener* sInstance;
2000-04-14 10:18:36 +04:00
};
#endif