layout/xul/nsMenuBarListener.h

branch
TOR_BUG_9701
changeset 10
ac0c01689b40
equal deleted inserted replaced
-1:000000000000 0:7fd5305fae86
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef nsMenuBarListener_h__
6 #define nsMenuBarListener_h__
7
8 #include "mozilla/Attributes.h"
9 #include "nsIDOMEventListener.h"
10
11 // X.h defines KeyPress
12 #ifdef KeyPress
13 #undef KeyPress
14 #endif
15
16 class nsMenuBarFrame;
17 class nsIDOMKeyEvent;
18
19 /** editor Implementation of the DragListener interface
20 */
21 class nsMenuBarListener : public nsIDOMEventListener
22 {
23 public:
24 /** default constructor
25 */
26 nsMenuBarListener(nsMenuBarFrame* aMenuBar);
27 /** default destructor
28 */
29 virtual ~nsMenuBarListener();
30
31 static void InitializeStatics();
32
33 NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) MOZ_OVERRIDE;
34
35 nsresult KeyUp(nsIDOMEvent* aMouseEvent);
36 nsresult KeyDown(nsIDOMEvent* aMouseEvent);
37 nsresult KeyPress(nsIDOMEvent* aMouseEvent);
38 nsresult Blur(nsIDOMEvent* aEvent);
39 nsresult MouseDown(nsIDOMEvent* aMouseEvent);
40
41 static nsresult GetMenuAccessKey(int32_t* aAccessKey);
42
43 NS_DECL_ISUPPORTS
44
45 static bool IsAccessKeyPressed(nsIDOMKeyEvent* event);
46
47 protected:
48 static void InitAccessKey();
49
50 static uint32_t GetModifiers(nsIDOMKeyEvent* event);
51
52 // This should only be called by the nsMenuBarListener during event dispatch,
53 // thus ensuring that this doesn't get destroyed during the process.
54 void ToggleMenuActiveState();
55
56 nsMenuBarFrame* mMenuBarFrame; // The menu bar object.
57 // Whether or not the ALT key is currently down.
58 bool mAccessKeyDown;
59 // Whether or not the ALT key down is canceled by other action.
60 bool mAccessKeyDownCanceled;
61 static bool mAccessKeyFocuses; // Does the access key by itself focus the menubar?
62 static int32_t mAccessKey; // See nsIDOMKeyEvent.h for sample values
63 static uint32_t mAccessKeyMask;// Modifier mask for the access key
64 };
65
66
67 #endif

mercurial