layout/xul/nsMenuBarListener.h

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     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__
     8 #include "mozilla/Attributes.h"
     9 #include "nsIDOMEventListener.h"
    11 // X.h defines KeyPress
    12 #ifdef KeyPress
    13 #undef KeyPress
    14 #endif
    16 class nsMenuBarFrame;
    17 class nsIDOMKeyEvent;
    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();
    31   static void InitializeStatics();
    33   NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) MOZ_OVERRIDE;
    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);
    41   static nsresult GetMenuAccessKey(int32_t* aAccessKey);
    43   NS_DECL_ISUPPORTS
    45   static bool IsAccessKeyPressed(nsIDOMKeyEvent* event);
    47 protected:
    48   static void InitAccessKey();
    50   static uint32_t GetModifiers(nsIDOMKeyEvent* event);
    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();
    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 };
    67 #endif

mercurial