зеркало из https://github.com/mozilla/gecko-dev.git
Added support for dynamic allocation of menu IDs for plugins.
This commit is contained in:
Родитель
572af434a6
Коммит
50952def0f
|
@ -43,17 +43,32 @@ static pascal void EventFilter (EventRecord *ev)
|
|||
// ===========================================================================
|
||||
// LMenuSharing.cp
|
||||
// ===========================================================================
|
||||
// MenuShring class. Based upon Frontier and draper@usis.com code
|
||||
|
||||
// MenuSharing class. Based upon Frontier and draper@usis.com code
|
||||
|
||||
Int16 LMenuSharingAttachment::sInsertAfterMenuID = 0;
|
||||
Int16 LMenuSharingAttachment::sNextPluginMenuID = 20000;
|
||||
|
||||
LMenuSharingAttachment::LMenuSharingAttachment(
|
||||
MessageT inMessage,
|
||||
Boolean inExecuteHost,Int16 resIDofLastMenu)
|
||||
: LAttachment(inMessage, inExecuteHost)
|
||||
{
|
||||
mCanMenuShare = ::InitSharedMenus (ErrorDialog, EventFilter);
|
||||
mInsertAfterMenuID = resIDofLastMenu + 1;
|
||||
sInsertAfterMenuID = resIDofLastMenu + 1;
|
||||
}
|
||||
|
||||
Int16 LMenuSharingAttachment::AllocatePluginMenuID(Boolean isSubmenu)
|
||||
{
|
||||
// force the menus to be recreated.
|
||||
DisposeSharedMenus();
|
||||
if (isSubmenu) {
|
||||
// this needs to take a menu ID out of the space used by MenuSharing.
|
||||
return sInsertAfterMenuID++;
|
||||
} else {
|
||||
// these can come out of a different range, because they aren't hierarchical.
|
||||
return sNextPluginMenuID++;
|
||||
}
|
||||
}
|
||||
|
||||
void LMenuSharingAttachment::ExecuteSelf( MessageT inMessage, void* ioParam)
|
||||
{
|
||||
|
@ -74,8 +89,7 @@ void LMenuSharingAttachment::ExecuteSelf( MessageT inMessage, void* ioParam)
|
|||
Int16 part;
|
||||
LCommander* commander;
|
||||
|
||||
|
||||
CheckSharedMenus(mInsertAfterMenuID);
|
||||
CheckSharedMenus(sInsertAfterMenuID);
|
||||
|
||||
if (ev->what== mouseDown)
|
||||
{
|
||||
|
@ -96,7 +110,7 @@ void LMenuSharingAttachment::ExecuteSelf( MessageT inMessage, void* ioParam)
|
|||
mExecuteHost = false;
|
||||
if (command != cmd_Nothing)
|
||||
{
|
||||
if (LCommander::IsSyntheticCommand(command,menuId, menuItem))
|
||||
if (LCommander::IsSyntheticCommand(command, menuId, menuItem))
|
||||
{
|
||||
if (SharedMenuHit (menuId, menuItem))
|
||||
{
|
||||
|
|
|
@ -24,19 +24,19 @@
|
|||
// ===========================================================================
|
||||
|
||||
|
||||
class LMenuSharingAttachment : public LAttachment
|
||||
{
|
||||
|
||||
class LMenuSharingAttachment : public LAttachment {
|
||||
public:
|
||||
LMenuSharingAttachment(MessageT inMessage,
|
||||
LMenuSharingAttachment(MessageT inMessage,
|
||||
Boolean inExecuteHost,
|
||||
Int16 resIDofLastMenu);
|
||||
// resIDofLastMenu is the id of the menu that shared menus will
|
||||
// will be inserted after.
|
||||
|
||||
static Int16 AllocatePluginMenuID(Boolean isSubmenu);
|
||||
|
||||
protected:
|
||||
virtual void ExecuteSelf(MessageT inMessage, void *ioParam);
|
||||
Boolean mCanMenuShare;
|
||||
Int16 mInsertAfterMenuID;
|
||||
virtual void ExecuteSelf(MessageT inMessage, void *ioParam);
|
||||
Boolean mCanMenuShare;
|
||||
static Int16 sInsertAfterMenuID;
|
||||
static Int16 sNextPluginMenuID;
|
||||
};
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче