2001-09-29 00:14:13 +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/. */
|
1999-07-18 11:27:02 +04:00
|
|
|
#ifndef nsMenuBarListener_h__
|
|
|
|
#define nsMenuBarListener_h__
|
|
|
|
|
2013-05-29 23:37:49 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-05-22 08:06:06 +04:00
|
|
|
#include "mozilla/EventForwards.h"
|
2011-07-01 01:20:02 +04:00
|
|
|
#include "nsIDOMEventListener.h"
|
1999-07-18 11:27:02 +04:00
|
|
|
|
2011-07-01 01:20:02 +04:00
|
|
|
// X.h defines KeyPress
|
|
|
|
#ifdef KeyPress
|
|
|
|
#undef KeyPress
|
|
|
|
#endif
|
|
|
|
|
1999-07-18 11:27:02 +04:00
|
|
|
class nsMenuBarFrame;
|
2000-08-30 04:33:58 +04:00
|
|
|
class nsIDOMKeyEvent;
|
1999-07-18 11:27:02 +04:00
|
|
|
|
|
|
|
/** editor Implementation of the DragListener interface
|
|
|
|
*/
|
2014-08-05 21:33:55 +04:00
|
|
|
class nsMenuBarListener MOZ_FINAL : public nsIDOMEventListener
|
1999-07-18 11:27:02 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** default constructor
|
|
|
|
*/
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit nsMenuBarListener(nsMenuBarFrame* aMenuBar);
|
2014-02-18 21:07:27 +04:00
|
|
|
|
|
|
|
static void InitializeStatics();
|
1999-07-18 11:27:02 +04:00
|
|
|
|
2013-05-29 23:37:49 +04:00
|
|
|
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) MOZ_OVERRIDE;
|
1999-07-21 11:42:16 +04:00
|
|
|
|
2011-07-01 01:20:02 +04:00
|
|
|
nsresult KeyUp(nsIDOMEvent* aMouseEvent);
|
|
|
|
nsresult KeyDown(nsIDOMEvent* aMouseEvent);
|
|
|
|
nsresult KeyPress(nsIDOMEvent* aMouseEvent);
|
|
|
|
nsresult Blur(nsIDOMEvent* aEvent);
|
|
|
|
nsresult MouseDown(nsIDOMEvent* aMouseEvent);
|
2000-08-25 03:39:39 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static nsresult GetMenuAccessKey(int32_t* aAccessKey);
|
2000-01-11 01:05:27 +03:00
|
|
|
|
1999-07-18 11:27:02 +04:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool IsAccessKeyPressed(nsIDOMKeyEvent* event);
|
2004-08-10 02:22:02 +04:00
|
|
|
|
1999-07-18 11:27:02 +04:00
|
|
|
protected:
|
2014-06-24 02:40:01 +04:00
|
|
|
/** default destructor
|
|
|
|
*/
|
|
|
|
virtual ~nsMenuBarListener();
|
|
|
|
|
2000-08-25 03:39:39 +04:00
|
|
|
static void InitAccessKey();
|
2000-08-17 04:09:16 +04:00
|
|
|
|
2014-05-22 08:06:06 +04:00
|
|
|
static mozilla::Modifiers GetModifiersForAccessKey(nsIDOMKeyEvent* event);
|
2004-08-19 12:04:11 +04:00
|
|
|
|
2007-07-04 19:49:38 +04: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();
|
|
|
|
|
1999-07-19 12:09:30 +04:00
|
|
|
nsMenuBarFrame* mMenuBarFrame; // The menu bar object.
|
2010-12-04 04:55:15 +03:00
|
|
|
// Whether or not the ALT key is currently down.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mAccessKeyDown;
|
2010-12-04 04:55:15 +03:00
|
|
|
// Whether or not the ALT key down is canceled by other action.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mAccessKeyDownCanceled;
|
|
|
|
static bool mAccessKeyFocuses; // Does the access key by itself focus the menubar?
|
2012-08-22 19:56:38 +04:00
|
|
|
static int32_t mAccessKey; // See nsIDOMKeyEvent.h for sample values
|
2014-05-22 08:06:06 +04:00
|
|
|
static mozilla::Modifiers mAccessKeyMask;// Modifier mask for the access key
|
1999-07-18 11:27:02 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|