зеркало из https://github.com/mozilla/gecko-dev.git
re-check-in header file changes for Cocoa menus implementation, updated makefile. b=111230 sr=pinkerton
This commit is contained in:
Родитель
0dc29dda98
Коммит
ce30a81af7
|
@ -99,14 +99,14 @@ MAC_LCPPSRCS = \
|
|||
|
||||
|
||||
CPPSRCS = \
|
||||
nsMenuX.cpp \
|
||||
nsMenuBarX.cpp \
|
||||
nsMenuItemX.cpp \
|
||||
$(MAC_LCPPSRCS) \
|
||||
$(GFX_LCPPSRCS) \
|
||||
$(NULL)
|
||||
|
||||
CMMSRCS = \
|
||||
nsMenuX.mm \
|
||||
nsMenuBarX.mm \
|
||||
nsMenuItemX.mm \
|
||||
nsFilePicker.mm \
|
||||
nsToolkit.mm \
|
||||
nsAppShellCocoa.mm \
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Josh Aas <josh@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -49,12 +50,8 @@
|
|||
#include "nsWeakReference.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
#include <MacTypes.h>
|
||||
#include <UnicodeConverter.h>
|
||||
#include <Menus.h>
|
||||
#include <CarbonEvents.h>
|
||||
|
||||
extern nsWeakPtr gMacMenubarX;
|
||||
#import <Carbon/Carbon.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
class nsIWidget;
|
||||
class nsIDocument;
|
||||
|
@ -64,13 +61,14 @@ namespace MenuHelpersX
|
|||
{
|
||||
// utility routine for getting a PresContext out of a docShell
|
||||
nsresult DocShellToPresContext(nsIDocShell* inDocShell, nsPresContext** outContext);
|
||||
|
||||
nsEventStatus DispatchCommandTo(nsIWeakReference* aDocShellWeakRef,
|
||||
nsIContent* aTargetContent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Native Mac MenuBar wrapper
|
||||
*/
|
||||
//
|
||||
// Native Mac menu bar wrapper
|
||||
//
|
||||
|
||||
class nsMenuBarX : public nsIMenuBar,
|
||||
public nsIMenuListener,
|
||||
|
@ -83,7 +81,7 @@ public:
|
|||
nsMenuBarX();
|
||||
virtual ~nsMenuBarX();
|
||||
|
||||
enum { kAppleMenuID = 1 } ;
|
||||
enum {kApplicationMenuID = 1};
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICHANGEMANAGER
|
||||
|
@ -132,12 +130,11 @@ protected:
|
|||
EventRef inEvent, void* userData);
|
||||
nsEventStatus ExecuteCommand(nsIContent* inDispatchTo);
|
||||
|
||||
// build the Apple menu shared by all menu bars.
|
||||
nsresult CreateAppleMenu ( nsIMenu* inMenu ) ;
|
||||
// build the Application menu shared by all menu bars.
|
||||
nsresult CreateApplicationMenu(nsIMenu* inMenu);
|
||||
|
||||
nsHashtable mObserverTable; // stores observers for content change notification
|
||||
nsHashtable mCommandMapTable; // maps CommandIDs to content nodes for CarbonEvent item selection
|
||||
PRUint32 mCurrentCommandID; // unique command id (per menu-bar) to give to next item that asks
|
||||
|
||||
PRUint32 mNumMenus;
|
||||
nsSupportsArray mMenusArray; // holds refs
|
||||
|
@ -146,15 +143,16 @@ protected:
|
|||
// been removed from the menubar
|
||||
nsCOMPtr<nsIContent> mQuitItemContent; // as above, but for quit
|
||||
nsIWidget* mParent; // weak ref
|
||||
|
||||
PRBool mIsMenuBarAdded;
|
||||
PRUint32 mCurrentCommandID; // unique command id (per menu-bar) to give to next item that asks
|
||||
|
||||
|
||||
nsWeakPtr mDocShellWeakRef; // weak ref to docshell
|
||||
nsIDocument* mDocument; // pointer to document
|
||||
|
||||
MenuRef mRootMenu; // root menu, representing entire menu bar.
|
||||
NSMenu* mRootMenu; // root menu, representing entire menu bar.
|
||||
|
||||
static MenuRef sAppleMenu; // AppleMenu shared by all menubars
|
||||
static NSMenu* sApplicationMenu; // Application menu shared by all menubars
|
||||
|
||||
static EventHandlerUPP sCommandEventHandler; // carbon event handler for commands, shared
|
||||
};
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Josh Aas <josh@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -45,17 +46,23 @@
|
|||
#include "nsIChangeManager.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
#include <Menus.h>
|
||||
#include <UnicodeConverter.h>
|
||||
#include <CarbonEvents.h>
|
||||
#import <Carbon/Carbon.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
|
||||
class nsIMenuBar;
|
||||
class nsIMenuListener;
|
||||
class nsMenuX;
|
||||
|
||||
|
||||
//static PRInt16 mMacMenuIDCount; // use GetUniqueMenuID()
|
||||
extern PRInt16 mMacMenuIDCount;// = kMacMenuID;
|
||||
// This class simply receives events from menus as a proxy for a gecko menu
|
||||
@interface MenuDelegate : NSObject
|
||||
{
|
||||
nsMenuX* mGeckoMenu; // weak ref
|
||||
BOOL mHaveInstalledCarbonEvents;
|
||||
}
|
||||
- (id)initWithGeckoMenu:(nsMenuX*)geckoMenu;
|
||||
@end
|
||||
|
||||
|
||||
class nsMenuX : public nsIMenu,
|
||||
|
@ -105,7 +112,6 @@ public:
|
|||
NS_IMETHOD GetEnabled(PRBool* aIsEnabled);
|
||||
NS_IMETHOD IsHelpMenu(PRBool* aIsEnabled);
|
||||
|
||||
//
|
||||
NS_IMETHOD AddMenuItem(nsIMenuItem * aMenuItem);
|
||||
NS_IMETHOD AddMenu(nsIMenu * aMenu);
|
||||
|
||||
|
@ -135,7 +141,7 @@ protected:
|
|||
nsEventStatus HelpMenuConstruct(const nsMenuEvent & aMenuEvent, nsIWidget* aParentWindow,
|
||||
void* unused, void* aDocShell);
|
||||
|
||||
MenuHandle NSStringNewMenu(short menuID, nsString& menuTitle);
|
||||
NSMenu* CreateMenuWithGeckoString(nsString& menuTitle);
|
||||
|
||||
protected:
|
||||
nsString mLabel;
|
||||
|
@ -148,9 +154,10 @@ protected:
|
|||
nsCOMPtr<nsIContent> mMenuContent; // the |menu| tag, strong ref
|
||||
nsCOMPtr<nsIMenuListener> mListener; // strong ref
|
||||
|
||||
// MacSpecific
|
||||
// Mac specific
|
||||
PRInt16 mMacMenuID;
|
||||
MenuHandle mMacMenuHandle;
|
||||
NSMenu* mMacMenu; // strong ref, we own it
|
||||
MenuDelegate* mMenuDelegate; // strong ref, we keep this around to get events for us
|
||||
PRInt16 mHelpMenuOSItemsCount;
|
||||
PRPackedBool mIsHelpMenu;
|
||||
PRPackedBool mIsEnabled;
|
||||
|
|
Загрузка…
Ссылка в новой задаче