uifw/EikStd/coctlinc/aknitemactionmenuregister.h
branchRCL_3
changeset 20 d48ab3b357f1
parent 19 aecbbf00d063
--- a/uifw/EikStd/coctlinc/aknitemactionmenuregister.h	Tue Aug 31 15:28:30 2010 +0300
+++ b/uifw/EikStd/coctlinc/aknitemactionmenuregister.h	Wed Sep 01 12:16:19 2010 +0100
@@ -25,6 +25,7 @@
 class CAknItemActionMenuRegisterArray;
 class CAknItemActionMenu;
 class MObjectProvider;
+class CAknView;
 
 /**
  * Item action menu register.
@@ -67,14 +68,26 @@
             MObjectProvider* aMenuBarOwner, TUint aFlags = 0 );
 
     /**
+     * Sets the current constructing menubar owner to NULL if it matches to
+     * aMenuBarOwner. Otherwise constructing menubar owner is not modified.
+     * 
+     * @internal
+     * @param aMenuBarOwner Pointer to constructing menubar owner. 
+     */
+    IMPORT_C static void RemoveConstructingMenuBarOwner( 
+            MObjectProvider* aMenuBarOwner );
+    
+    /**
      * Registers a collection.
      * 
      * @internal
      * @param aCollection Collection to be registered.
+     * @param aMenuBarOwner Owner of the menubar that collection will be
+     *        registered with.
      * @return Item action menu the collection was registered to.
      */
     static CAknItemActionMenu* RegisterCollectionL(
-            MAknCollection& aCollection );
+            MAknCollection& aCollection, MObjectProvider* aMenuBarOwner );
 
     /**
      * Registers item action menu to aMenuBar.
@@ -162,10 +175,12 @@
      * Registers collection.
      * 
      * @param aCollection State to be registered.
+     * @param aMenuBarOwner Owner of the menubar that collection will be
+     *        registered with.
      * @return Item action menu the collection was registered to.
      */
     CAknItemActionMenu* DoRegisterCollectionL(
-            MAknCollection& aCollection );
+            MAknCollection& aCollection, MObjectProvider* aMenuBarOwner );
 
     /**
      * Registers item action menu to aMenuBar.
@@ -239,6 +254,31 @@
      * @return Overriding object menu bar.
      */
     CEikMenuBar* OverridingObjectMenuBar();
+    
+    /**
+     * Returns pointer to component that owns the current view. This is either
+     * application UI, active view or a dialog. This component is the one that
+     * owns the possible menubar.
+     * 
+     * @return Current view owner.
+     */
+    MObjectProvider* Owner() const;
+    
+    /**
+     * Returns pointer to currently active view.
+     * 
+     * @param aAppUi Application UI.
+     * @return Active view or NULL.
+     */
+    CAknView* View( CAknAppUi* aAppUi ) const;
+    
+    /**
+     * Returns pointer to current application UI.
+     * 
+     * @return Application UI or NULL.
+     */
+    static CAknAppUi* AppUI();
+    
 
     /**
      * Registers collection to item action menu.
@@ -260,7 +300,7 @@
      * @internal
      * @return Pointer to menu bar.
      */
-     CEikMenuBar* FindCurrentMenuBarL();
+    CEikMenuBar* FindCurrentMenuBar();
 
     /**
      * Adds register entry.
@@ -272,13 +312,11 @@
             CEikMenuBar& aMenuBar, CAknItemActionMenu& aItemActionMenu );
 
     /**
-     * Adds observers with aMenuBar to item action menu.
+     * Adds observers that have the same owner and aItemAction to the menu.
      * 
-     * @param aMenuBar Menu bar.
      * @param aItemActionMenu Item action menu.
      */
-    void AddObserversToItemActionMenuL(
-            CEikMenuBar* aMenuBar, CAknItemActionMenu& aItemActionMenu );
+    void AddObserversToItemActionMenuL( CAknItemActionMenu& aItemActionMenu );
 
     /**
      * Creates register instance. 
@@ -286,6 +324,17 @@
      * @return Item action menu register instance.
      */
     static AknItemActionMenuRegister* CreateInstanceL();
+
+    /**
+     * Sets the current constructing menubar owner to NULL if it matches to
+     * aMenuBarOwner. Otherwise constructing menubar owner is not modified.
+     * 
+     * @internal
+     * @param aMenuBarOwner Pointer to constructing menubar owner. 
+     */
+    void DoRemoveConstructingMenuBarOwner( 
+            MObjectProvider* aMenuBarOwner );
+
 private: // data
 
     /**
@@ -320,7 +369,8 @@
          */
         TAknUnregisteredObserverData(
                 CEikMenuBar* aMenuBar,
-                MAknCollectionObserver& aObserver );
+                MAknCollectionObserver& aObserver,
+                MObjectProvider* aOwner );
 
     public:
         /**
@@ -332,6 +382,11 @@
          * Observer.
          */
         MAknCollectionObserver& iObserver;
+        
+        /**
+         * Current menubar owner.
+         */
+        MObjectProvider* iOwner;
         };
 
     /**