Back to index

lightning-sunbird  0.9+nobinonly
nsIMenuItem.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 nsIMenuItem_h__
00039 #define nsIMenuItem_h__
00040 
00041 #include "prtypes.h"
00042 #include "nsISupports.h"
00043 #include "nsString.h"
00044 
00045 #include "nsIDocShell.h"
00046 #include "nsIDOMElement.h"
00047 
00048 
00049 // {f2e79600-1700-11d5-bb6f-90f240fe493c}
00050 #define NS_IMENUITEM_IID      \
00051 { 0xf2e79600, 0x1700, 0x11d5, \
00052   { 0xbb, 0x6f, 0x90, 0xf2, 0x40, 0xfe, 0x49, 0x3c } };
00053 
00054 class nsIMenu;
00055 class nsIWidget;
00056 class nsIMenuListener;
00057 class nsIChangeManager;
00058 class nsIContent;
00059 
00060 enum {
00061   knsMenuItemNoModifier      = 0,
00062   knsMenuItemShiftModifier   = (1 << 0),
00063   knsMenuItemAltModifier     = (1 << 1),
00064   knsMenuItemControlModifier = (1 << 2),
00065   knsMenuItemCommandModifier = (1 << 3)
00066 };
00067 
00071 class nsIMenuItem : public nsISupports {
00072 
00073   public:
00074     NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENUITEM_IID)
00075 
00076     enum EMenuItemType { eRegular = 0, eCheckbox, eRadio } ;
00077 
00082     NS_IMETHOD Create ( nsIMenu* aParent, const nsString & aLabel, PRBool isSeparator, 
00083                           EMenuItemType aItemType, PRBool aEnabled, 
00084                           nsIChangeManager* aManager, nsIDocShell* aShell, nsIContent* aNode ) = 0;
00085     
00090     NS_IMETHOD GetLabel(nsString &aText) = 0;
00091 
00096     NS_IMETHOD SetShortcutChar(const nsString &aText) = 0;
00097   
00102     NS_IMETHOD GetShortcutChar(nsString &aText) = 0;
00103 
00108     NS_IMETHOD GetEnabled(PRBool *aIsEnabled) = 0;
00109 
00114     NS_IMETHOD SetChecked(PRBool aIsEnabled) = 0;
00115 
00120     NS_IMETHOD GetChecked(PRBool *aIsEnabled) = 0;
00121 
00126     NS_IMETHOD GetMenuItemType(EMenuItemType *aType) = 0;
00127     
00132     NS_IMETHOD GetTarget(nsIWidget *& aTarget) = 0;
00133     
00138     NS_IMETHOD GetNativeData(void*& aData) = 0;
00139 
00144     NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener) = 0;
00145 
00150     NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener) = 0;
00151 
00156     NS_IMETHOD IsSeparator(PRBool & aIsSep) = 0;
00157 
00162     NS_IMETHOD DoCommand() = 0;
00163 
00167     NS_IMETHOD SetModifiers(PRUint8 aModifiers) = 0;
00168     NS_IMETHOD GetModifiers(PRUint8 * aModifiers) = 0;
00169 };
00170 
00171 // {58C5DE16-931C-4D31-AB7E-1B5FBDF596C4}
00172 #define NS_IMENUITEM_MOZILLA_1_8_BRANCH_IID \
00173 { 0x58C5DE16, 0x931C, 0x4D31, \
00174   { 0xAB, 0x7E, 0x1B, 0x5F, 0xBD, 0xF5, 0x96, 0xC4 } };
00175 
00176 class nsIMenuItem_MOZILLA_1_8_BRANCH : public nsIMenuItem  {
00177   
00178   public:
00179     NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENUITEM_MOZILLA_1_8_BRANCH_IID)
00180 
00181     
00185     NS_IMETHOD DispatchDOMEvent(const nsString &eventName, PRBool *preventDefaultCalled) = 0;
00186 
00190     NS_IMETHOD SetupIcon() = 0;
00191 };
00192 
00193 #endif