Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsMenuGroupOwnerX_h_ |
michael@0 | 7 | #define nsMenuGroupOwnerX_h_ |
michael@0 | 8 | |
michael@0 | 9 | #import <Cocoa/Cocoa.h> |
michael@0 | 10 | |
michael@0 | 11 | #include "nsMenuBaseX.h" |
michael@0 | 12 | #include "nsIMutationObserver.h" |
michael@0 | 13 | #include "nsHashKeys.h" |
michael@0 | 14 | #include "nsDataHashtable.h" |
michael@0 | 15 | #include "nsAutoPtr.h" |
michael@0 | 16 | #include "nsString.h" |
michael@0 | 17 | |
michael@0 | 18 | |
michael@0 | 19 | class nsMenuX; |
michael@0 | 20 | class nsMenuItemX; |
michael@0 | 21 | class nsChangeObserver; |
michael@0 | 22 | class nsIWidget; |
michael@0 | 23 | class nsIContent; |
michael@0 | 24 | class nsIDocument; |
michael@0 | 25 | |
michael@0 | 26 | class nsMenuGroupOwnerX : public nsMenuObjectX, public nsIMutationObserver |
michael@0 | 27 | { |
michael@0 | 28 | public: |
michael@0 | 29 | nsMenuGroupOwnerX(); |
michael@0 | 30 | virtual ~nsMenuGroupOwnerX(); |
michael@0 | 31 | |
michael@0 | 32 | nsresult Create(nsIContent * aContent); |
michael@0 | 33 | |
michael@0 | 34 | void RegisterForContentChanges(nsIContent* aContent, |
michael@0 | 35 | nsChangeObserver* aMenuObject); |
michael@0 | 36 | void UnregisterForContentChanges(nsIContent* aContent); |
michael@0 | 37 | uint32_t RegisterForCommand(nsMenuItemX* aItem); |
michael@0 | 38 | void UnregisterCommand(uint32_t aCommandID); |
michael@0 | 39 | nsMenuItemX* GetMenuItemForCommandID(uint32_t inCommandID); |
michael@0 | 40 | |
michael@0 | 41 | NS_DECL_ISUPPORTS |
michael@0 | 42 | NS_DECL_NSIMUTATIONOBSERVER |
michael@0 | 43 | |
michael@0 | 44 | protected: |
michael@0 | 45 | nsChangeObserver* LookupContentChangeObserver(nsIContent* aContent); |
michael@0 | 46 | |
michael@0 | 47 | uint32_t mCurrentCommandID; // unique command id (per menu-bar) to |
michael@0 | 48 | // give to next item that asks |
michael@0 | 49 | nsIDocument* mDocument; // pointer to document |
michael@0 | 50 | |
michael@0 | 51 | // stores observers for content change notification |
michael@0 | 52 | nsDataHashtable<nsPtrHashKey<nsIContent>, nsChangeObserver *> mContentToObserverTable; |
michael@0 | 53 | |
michael@0 | 54 | // stores mapping of command IDs to menu objects |
michael@0 | 55 | nsDataHashtable<nsUint32HashKey, nsMenuItemX *> mCommandToMenuObjectTable; |
michael@0 | 56 | }; |
michael@0 | 57 | |
michael@0 | 58 | #endif // nsMenuGroupOwner_h_ |