widget/cocoa/nsMenuGroupOwnerX.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/cocoa/nsMenuGroupOwnerX.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,58 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsMenuGroupOwnerX_h_
    1.10 +#define nsMenuGroupOwnerX_h_
    1.11 +
    1.12 +#import <Cocoa/Cocoa.h>
    1.13 +
    1.14 +#include "nsMenuBaseX.h"
    1.15 +#include "nsIMutationObserver.h"
    1.16 +#include "nsHashKeys.h"
    1.17 +#include "nsDataHashtable.h"
    1.18 +#include "nsAutoPtr.h"
    1.19 +#include "nsString.h"
    1.20 +
    1.21 +
    1.22 +class nsMenuX;
    1.23 +class nsMenuItemX;
    1.24 +class nsChangeObserver;
    1.25 +class nsIWidget;
    1.26 +class nsIContent;
    1.27 +class nsIDocument;
    1.28 +
    1.29 +class nsMenuGroupOwnerX : public nsMenuObjectX, public nsIMutationObserver
    1.30 +{
    1.31 +public:
    1.32 +  nsMenuGroupOwnerX();
    1.33 +  virtual ~nsMenuGroupOwnerX();
    1.34 +
    1.35 +  nsresult Create(nsIContent * aContent);
    1.36 +
    1.37 +  void RegisterForContentChanges(nsIContent* aContent,
    1.38 +                                 nsChangeObserver* aMenuObject);
    1.39 +  void UnregisterForContentChanges(nsIContent* aContent);
    1.40 +  uint32_t RegisterForCommand(nsMenuItemX* aItem);
    1.41 +  void UnregisterCommand(uint32_t aCommandID);
    1.42 +  nsMenuItemX* GetMenuItemForCommandID(uint32_t inCommandID);
    1.43 +
    1.44 +  NS_DECL_ISUPPORTS
    1.45 +  NS_DECL_NSIMUTATIONOBSERVER
    1.46 +
    1.47 +protected:
    1.48 +  nsChangeObserver* LookupContentChangeObserver(nsIContent* aContent);
    1.49 +
    1.50 +  uint32_t  mCurrentCommandID;  // unique command id (per menu-bar) to
    1.51 +                                // give to next item that asks
    1.52 +  nsIDocument* mDocument;       // pointer to document
    1.53 +
    1.54 +  // stores observers for content change notification
    1.55 +  nsDataHashtable<nsPtrHashKey<nsIContent>, nsChangeObserver *> mContentToObserverTable;
    1.56 +
    1.57 +  // stores mapping of command IDs to menu objects
    1.58 +  nsDataHashtable<nsUint32HashKey, nsMenuItemX *> mCommandToMenuObjectTable;
    1.59 +};
    1.60 +
    1.61 +#endif // nsMenuGroupOwner_h_

mercurial