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/. */
6 #ifndef nsMenuGroupOwnerX_h_
7 #define nsMenuGroupOwnerX_h_
9 #import <Cocoa/Cocoa.h>
11 #include "nsMenuBaseX.h"
12 #include "nsIMutationObserver.h"
13 #include "nsHashKeys.h"
14 #include "nsDataHashtable.h"
15 #include "nsAutoPtr.h"
21 class nsChangeObserver
;
26 class nsMenuGroupOwnerX
: public nsMenuObjectX
, public nsIMutationObserver
31 nsresult
Create(nsIContent
* aContent
);
33 void RegisterForContentChanges(nsIContent
* aContent
,
34 nsChangeObserver
* aMenuObject
);
35 void UnregisterForContentChanges(nsIContent
* aContent
);
36 uint32_t RegisterForCommand(nsMenuItemX
* aItem
);
37 void UnregisterCommand(uint32_t aCommandID
);
38 nsMenuItemX
* GetMenuItemForCommandID(uint32_t inCommandID
);
41 NS_DECL_NSIMUTATIONOBSERVER
44 virtual ~nsMenuGroupOwnerX();
46 nsChangeObserver
* LookupContentChangeObserver(nsIContent
* aContent
);
48 uint32_t mCurrentCommandID
; // unique command id (per menu-bar) to
49 // give to next item that asks
50 nsIDocument
* mDocument
; // pointer to document
52 // stores observers for content change notification
53 nsDataHashtable
<nsPtrHashKey
<nsIContent
>, nsChangeObserver
*> mContentToObserverTable
;
55 // stores mapping of command IDs to menu objects
56 nsDataHashtable
<nsUint32HashKey
, nsMenuItemX
*> mCommandToMenuObjectTable
;
59 #endif // nsMenuGroupOwner_h_