michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsMenuGroupOwnerX_h_ michael@0: #define nsMenuGroupOwnerX_h_ michael@0: michael@0: #import michael@0: michael@0: #include "nsMenuBaseX.h" michael@0: #include "nsIMutationObserver.h" michael@0: #include "nsHashKeys.h" michael@0: #include "nsDataHashtable.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "nsString.h" michael@0: michael@0: michael@0: class nsMenuX; michael@0: class nsMenuItemX; michael@0: class nsChangeObserver; michael@0: class nsIWidget; michael@0: class nsIContent; michael@0: class nsIDocument; michael@0: michael@0: class nsMenuGroupOwnerX : public nsMenuObjectX, public nsIMutationObserver michael@0: { michael@0: public: michael@0: nsMenuGroupOwnerX(); michael@0: virtual ~nsMenuGroupOwnerX(); michael@0: michael@0: nsresult Create(nsIContent * aContent); michael@0: michael@0: void RegisterForContentChanges(nsIContent* aContent, michael@0: nsChangeObserver* aMenuObject); michael@0: void UnregisterForContentChanges(nsIContent* aContent); michael@0: uint32_t RegisterForCommand(nsMenuItemX* aItem); michael@0: void UnregisterCommand(uint32_t aCommandID); michael@0: nsMenuItemX* GetMenuItemForCommandID(uint32_t inCommandID); michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIMUTATIONOBSERVER michael@0: michael@0: protected: michael@0: nsChangeObserver* LookupContentChangeObserver(nsIContent* aContent); michael@0: michael@0: uint32_t mCurrentCommandID; // unique command id (per menu-bar) to michael@0: // give to next item that asks michael@0: nsIDocument* mDocument; // pointer to document michael@0: michael@0: // stores observers for content change notification michael@0: nsDataHashtable, nsChangeObserver *> mContentToObserverTable; michael@0: michael@0: // stores mapping of command IDs to menu objects michael@0: nsDataHashtable mCommandToMenuObjectTable; michael@0: }; michael@0: michael@0: #endif // nsMenuGroupOwner_h_