2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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 nsMenuBarListener_h__
|
|
|
|
#define nsMenuBarListener_h__
|
|
|
|
|
2013-05-29 12:37:49 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-05-21 21:06:06 -07:00
|
|
|
#include "mozilla/EventForwards.h"
|
2011-06-30 14:20:02 -07:00
|
|
|
#include "nsIDOMEventListener.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-06-30 14:20:02 -07:00
|
|
|
// X.h defines KeyPress
|
|
|
|
#ifdef KeyPress
|
|
|
|
#undef KeyPress
|
|
|
|
#endif
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsMenuBarFrame;
|
|
|
|
class nsIDOMKeyEvent;
|
|
|
|
|
|
|
|
/** editor Implementation of the DragListener interface
|
|
|
|
*/
|
2014-08-05 10:33:55 -07:00
|
|
|
class nsMenuBarListener MOZ_FINAL : public nsIDOMEventListener
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** default constructor
|
|
|
|
*/
|
|
|
|
nsMenuBarListener(nsMenuBarFrame* aMenuBar);
|
2014-02-18 09:07:27 -08:00
|
|
|
|
|
|
|
static void InitializeStatics();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-29 12:37:49 -07:00
|
|
|
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-06-30 14:20:02 -07:00
|
|
|
nsresult KeyUp(nsIDOMEvent* aMouseEvent);
|
|
|
|
nsresult KeyDown(nsIDOMEvent* aMouseEvent);
|
|
|
|
nsresult KeyPress(nsIDOMEvent* aMouseEvent);
|
|
|
|
nsresult Blur(nsIDOMEvent* aEvent);
|
|
|
|
nsresult MouseDown(nsIDOMEvent* aMouseEvent);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
static nsresult GetMenuAccessKey(int32_t* aAccessKey);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool IsAccessKeyPressed(nsIDOMKeyEvent* event);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
2014-06-23 15:40:01 -07:00
|
|
|
/** default destructor
|
|
|
|
*/
|
|
|
|
virtual ~nsMenuBarListener();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
static void InitAccessKey();
|
|
|
|
|
2014-05-21 21:06:06 -07:00
|
|
|
static mozilla::Modifiers GetModifiersForAccessKey(nsIDOMKeyEvent* event);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-07-04 08:49:38 -07:00
|
|
|
// This should only be called by the nsMenuBarListener during event dispatch,
|
|
|
|
// thus ensuring that this doesn't get destroyed during the process.
|
|
|
|
void ToggleMenuActiveState();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsMenuBarFrame* mMenuBarFrame; // The menu bar object.
|
2010-12-03 17:55:15 -08:00
|
|
|
// Whether or not the ALT key is currently down.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mAccessKeyDown;
|
2010-12-03 17:55:15 -08:00
|
|
|
// Whether or not the ALT key down is canceled by other action.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mAccessKeyDownCanceled;
|
|
|
|
static bool mAccessKeyFocuses; // Does the access key by itself focus the menubar?
|
2012-08-22 08:56:38 -07:00
|
|
|
static int32_t mAccessKey; // See nsIDOMKeyEvent.h for sample values
|
2014-05-21 21:06:06 -07:00
|
|
|
static mozilla::Modifiers mAccessKeyMask;// Modifier mask for the access key
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|