2001-09-25 05:32:19 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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-01-26 13:06:30 +03:00
|
|
|
|
|
|
|
#ifndef nsXBLEventHandler_h__
|
|
|
|
#define nsXBLEventHandler_h__
|
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2002-01-09 05:16:17 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2003-09-11 16:25:06 +04:00
|
|
|
#include "nsIDOMEventListener.h"
|
2009-03-20 11:15:35 +03:00
|
|
|
#include "nsTArray.h"
|
2000-01-26 13:06:30 +03:00
|
|
|
|
2000-01-26 13:25:55 +03:00
|
|
|
class nsIAtom;
|
2008-04-15 08:16:24 +04:00
|
|
|
class nsIDOMKeyEvent;
|
2003-09-11 16:25:06 +04:00
|
|
|
class nsXBLPrototypeHandler;
|
2000-01-26 13:06:30 +03:00
|
|
|
|
2003-09-11 16:25:06 +04:00
|
|
|
class nsXBLEventHandler : public nsIDOMEventListener
|
2000-01-26 13:06:30 +03:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 03:48:51 +04:00
|
|
|
nsXBLEventHandler(nsXBLPrototypeHandler* aHandler);
|
2003-09-11 16:25:06 +04:00
|
|
|
|
2000-01-26 13:06:30 +03:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2003-09-11 16:25:06 +04:00
|
|
|
NS_DECL_NSIDOMEVENTLISTENER
|
2000-06-22 04:36:19 +04:00
|
|
|
|
2003-09-11 16:25:06 +04:00
|
|
|
protected:
|
2014-06-23 23:56:07 +04:00
|
|
|
virtual ~nsXBLEventHandler();
|
2003-09-11 16:25:06 +04:00
|
|
|
nsXBLPrototypeHandler* mProtoHandler;
|
2000-06-22 04:36:19 +04:00
|
|
|
|
2003-09-11 16:25:06 +04:00
|
|
|
private:
|
|
|
|
nsXBLEventHandler();
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool EventMatched(nsIDOMEvent* aEvent)
|
2003-09-11 16:25:06 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2000-08-16 12:14:01 +04:00
|
|
|
}
|
2003-09-11 16:25:06 +04:00
|
|
|
};
|
2000-08-16 12:14:01 +04:00
|
|
|
|
2003-09-11 16:25:06 +04:00
|
|
|
class nsXBLMouseEventHandler : public nsXBLEventHandler
|
|
|
|
{
|
|
|
|
public:
|
2014-09-02 03:48:51 +04:00
|
|
|
nsXBLMouseEventHandler(nsXBLPrototypeHandler* aHandler);
|
2003-09-11 16:25:06 +04:00
|
|
|
virtual ~nsXBLMouseEventHandler();
|
2000-01-26 13:06:30 +03:00
|
|
|
|
2003-09-11 16:25:06 +04:00
|
|
|
private:
|
2013-05-30 00:43:41 +04:00
|
|
|
bool EventMatched(nsIDOMEvent* aEvent) MOZ_OVERRIDE;
|
2003-09-11 16:25:06 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
class nsXBLKeyEventHandler : public nsIDOMEventListener
|
|
|
|
{
|
|
|
|
public:
|
2012-08-22 19:56:38 +04:00
|
|
|
nsXBLKeyEventHandler(nsIAtom* aEventType, uint8_t aPhase, uint8_t aType);
|
2003-09-11 16:25:06 +04:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2000-08-17 04:09:16 +04:00
|
|
|
|
2003-09-11 16:25:06 +04:00
|
|
|
NS_DECL_NSIDOMEVENTLISTENER
|
2003-02-24 18:41:41 +03:00
|
|
|
|
2003-09-11 16:25:06 +04:00
|
|
|
void AddProtoHandler(nsXBLPrototypeHandler* aProtoHandler)
|
2003-02-24 18:41:41 +03:00
|
|
|
{
|
2003-09-11 16:25:06 +04:00
|
|
|
mProtoHandlers.AppendElement(aProtoHandler);
|
2003-02-24 18:41:41 +03:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
bool Matches(nsIAtom* aEventType, uint8_t aPhase, uint8_t aType) const
|
2003-02-24 18:41:41 +03:00
|
|
|
{
|
2003-09-11 16:25:06 +04:00
|
|
|
return (mEventType == aEventType && mPhase == aPhase && mType == aType);
|
2003-02-24 18:41:41 +03:00
|
|
|
}
|
|
|
|
|
2003-09-11 16:25:06 +04:00
|
|
|
void GetEventName(nsAString& aString) const
|
2003-02-24 18:41:41 +03:00
|
|
|
{
|
2003-09-11 16:25:06 +04:00
|
|
|
mEventType->ToString(aString);
|
2003-02-24 18:41:41 +03:00
|
|
|
}
|
2003-09-11 16:25:06 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t GetPhase() const
|
2003-09-11 16:25:06 +04:00
|
|
|
{
|
|
|
|
return mPhase;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t GetType() const
|
2003-09-11 16:25:06 +04:00
|
|
|
{
|
|
|
|
return mType;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetIsBoundToChrome(bool aIsBoundToChrome)
|
2007-04-15 20:28:53 +04:00
|
|
|
{
|
|
|
|
mIsBoundToChrome = aIsBoundToChrome;
|
|
|
|
}
|
2013-11-01 18:31:58 +04:00
|
|
|
|
2014-06-03 05:04:21 +04:00
|
|
|
void SetUsingContentXBLScope(bool aUsingContentXBLScope)
|
2013-11-01 18:31:58 +04:00
|
|
|
{
|
2014-06-03 05:04:21 +04:00
|
|
|
mUsingContentXBLScope = aUsingContentXBLScope;
|
2013-11-01 18:31:58 +04:00
|
|
|
}
|
|
|
|
|
2003-09-11 16:25:06 +04:00
|
|
|
private:
|
|
|
|
nsXBLKeyEventHandler();
|
2014-06-23 23:56:07 +04:00
|
|
|
virtual ~nsXBLKeyEventHandler();
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
bool ExecuteMatchedHandlers(nsIDOMKeyEvent* aEvent, uint32_t aCharCode,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aIgnoreShiftKey);
|
2003-09-11 16:25:06 +04:00
|
|
|
|
2009-03-20 11:15:35 +03:00
|
|
|
nsTArray<nsXBLPrototypeHandler*> mProtoHandlers;
|
2003-09-11 16:25:06 +04:00
|
|
|
nsCOMPtr<nsIAtom> mEventType;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mPhase;
|
|
|
|
uint8_t mType;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsBoundToChrome;
|
2014-06-03 05:04:21 +04:00
|
|
|
bool mUsingContentXBLScope;
|
2000-01-26 13:06:30 +03:00
|
|
|
};
|
|
|
|
|
2003-03-05 18:08:41 +03:00
|
|
|
nsresult
|
2003-09-11 16:25:06 +04:00
|
|
|
NS_NewXBLEventHandler(nsXBLPrototypeHandler* aHandler,
|
|
|
|
nsIAtom* aEventType,
|
2000-01-26 13:06:30 +03:00
|
|
|
nsXBLEventHandler** aResult);
|
2003-09-11 16:25:06 +04:00
|
|
|
|
|
|
|
nsresult
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_NewXBLKeyEventHandler(nsIAtom* aEventType, uint8_t aPhase,
|
|
|
|
uint8_t aType, nsXBLKeyEventHandler** aResult);
|
2003-09-11 16:25:06 +04:00
|
|
|
|
2000-01-26 13:06:30 +03:00
|
|
|
#endif
|