bug 818009 - canActivate: only click-to-play-type plugins are valid r=jaws
[gecko.git] / widget / cocoa / nsMenuGroupOwnerX.h
blobc48dd516a4f8627200b19e3b814fcbd79e4cb490
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 "nsHashtable.h"
14 #include "nsHashKeys.h"
15 #include "nsDataHashtable.h"
16 #include "nsAutoPtr.h"
17 #include "nsString.h"
20 class nsMenuX;
21 class nsMenuItemX;
22 class nsChangeObserver;
23 class nsIWidget;
24 class nsIContent;
25 class nsIDocument;
27 class nsMenuGroupOwnerX : public nsMenuObjectX, public nsIMutationObserver
29 public:
30 nsMenuGroupOwnerX();
31 virtual ~nsMenuGroupOwnerX();
33 nsresult Create(nsIContent * aContent);
35 void RegisterForContentChanges(nsIContent* aContent,
36 nsChangeObserver* aMenuObject);
37 void UnregisterForContentChanges(nsIContent* aContent);
38 uint32_t RegisterForCommand(nsMenuItemX* aItem);
39 void UnregisterCommand(uint32_t aCommandID);
40 nsMenuItemX* GetMenuItemForCommandID(uint32_t inCommandID);
42 NS_DECL_ISUPPORTS
43 NS_DECL_NSIMUTATIONOBSERVER
45 protected:
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_