Back to index

lightning-sunbird  0.9+nobinonly
nsIMenu.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef nsIMenu_h__
00039 #define nsIMenu_h__
00040 
00041 #include "nsISupports.h"
00042 #include "nsStringFwd.h"
00043 
00044 class nsIDocShell;
00045 class nsIMenuBar;
00046 class nsIMenu;
00047 class nsIMenuItem;
00048 class nsIMenuListener;
00049 class nsIChangeManager;
00050 class nsIContent;
00051 class nsIMenuCommandDispatcher;
00052 
00053 
00054 // {ab6cea83-00ff-11d5-bb6f-f432a43ead7c}
00055 #define NS_IMENU_IID      \
00056 { 0xab6cea83, 0x00ff, 0x11d5, \
00057   { 0xbb, 0x6f, 0xf4, 0x32, 0xa4, 0x3e, 0xad, 0x7c } };
00058 
00059 
00063 class nsIMenu : public nsISupports {
00064 
00065   public:
00066     NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENU_IID)
00067 
00068   
00072     NS_IMETHOD Create ( nsISupports * aParent, const nsAString &aLabel, const nsAString &aAccessKey, 
00073                           nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) = 0;
00074 
00079     NS_IMETHOD GetParent(nsISupports *&aParent) = 0;
00080 
00085     NS_IMETHOD GetLabel(nsString &aText) = 0;
00086 
00091     NS_IMETHOD SetLabel(const nsAString &aText) = 0;
00092 
00097        NS_IMETHOD GetAccessKey(nsString &aText) = 0;
00098    
00103        NS_IMETHOD SetAccessKey(const nsAString &aText) = 0;
00104 
00109        NS_IMETHOD SetEnabled(PRBool aIsEnabled) = 0;
00110 
00115        NS_IMETHOD GetEnabled(PRBool* aIsEnabled) = 0;
00116        
00121        NS_IMETHOD IsHelpMenu(PRBool* aIsHelpMenu) = 0;
00122        
00127     NS_IMETHOD AddItem(nsISupports* aItem) = 0;
00128 
00133     NS_IMETHOD AddSeparator() = 0;
00134 
00139     NS_IMETHOD GetItemCount(PRUint32 &aCount) = 0;
00140 
00145     NS_IMETHOD GetItemAt(const PRUint32 aPos, nsISupports *& aMenuItem) = 0;
00146 
00151     NS_IMETHOD InsertItemAt(const PRUint32 aPos, nsISupports * aMenuItem) = 0;
00152 
00157     NS_IMETHOD RemoveItem(const PRUint32 aPos) = 0;
00158 
00163     NS_IMETHOD RemoveAll() = 0;
00164 
00169     NS_IMETHOD  GetNativeData(void** aData) = 0;
00170 
00175     NS_IMETHOD  SetNativeData(void* aData) = 0;
00176     
00181     NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener) = 0;
00182 
00187     NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener) = 0;
00188 
00193     NS_IMETHOD GetMenuContent(nsIContent ** aMenuContent) = 0;
00194     
00195 };
00196 
00197 // {FF2CE8E5-9755-4DFA-86A3-FBB558093C04}
00198 #define NS_IMENU_MOZILLA_1_8_BRANCH_IID \
00199 { 0xFF2CE8E5, 0x9755, 0x4DFA, \
00200   { 0x86, 0xA3, 0xFB, 0xB5, 0x58, 0x09, 0xC3, 0x04 } };
00201 
00202 class nsIMenu_MOZILLA_1_8_BRANCH : public nsIMenu
00203 {
00204   public:
00205     NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENU_MOZILLA_1_8_BRANCH_IID)
00206 
00207    
00211     NS_IMETHOD ChangeNativeEnabledStatusForMenuItem(nsIMenuItem* aMenuItem,
00212                                                     PRBool aEnabled) = 0;
00213 
00218     NS_IMETHOD GetMenuRefAndItemIndexForMenuItem(nsISupports* aMenuItem,
00219                                                  void**       aMenuRef,
00220                                                  PRUint16*    aMenuItemIndex) = 0;
00221 
00225     NS_IMETHOD SetupIcon() = 0;
00226 };
00227 
00228 #endif