зеркало из https://github.com/mozilla/gecko-dev.git
Родитель
d42476b2ea
Коммит
15eb92348e
|
@ -98,6 +98,12 @@ class nsIMenuBar : public nsISupports {
|
|||
*/
|
||||
NS_IMETHOD GetNativeData(void*& aData) = 0;
|
||||
|
||||
/**
|
||||
* Sets Native MenuHandle. Temporary hack for mac until
|
||||
* nsMenuBar does it's own construction
|
||||
*/
|
||||
NS_IMETHOD SetNativeData(void* aData) = 0;
|
||||
|
||||
/**
|
||||
* Draw the menubar
|
||||
*
|
||||
|
|
|
@ -178,6 +178,14 @@ NS_METHOD nsMenuBar::GetNativeData(void *& aData)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenuBar::SetNativeData(void * aData)
|
||||
{
|
||||
// Temporary hack for MacOS. Will go away when nsMenuBar handles it's own
|
||||
// construction
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenuBar::Paint()
|
||||
{
|
||||
|
@ -198,3 +206,4 @@ nsEventStatus nsMenuBar::MenuDeselected(const nsMenuEvent & aMenuEvent)
|
|||
{
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
NS_IMETHOD RemoveAll();
|
||||
NS_IMETHOD GetNativeData(void*& aData);
|
||||
NS_IMETHOD Paint();
|
||||
NS_IMETHOD SetNativeData(void* aData);
|
||||
protected:
|
||||
PRUint32 mNumMenus;
|
||||
GtkWidget *mMenuBar;
|
||||
|
|
|
@ -308,10 +308,20 @@ PRBool nsMacEventHandler::HandleActivateEvent(EventRecord& aOSEvent)
|
|||
nsWindow* focusedWidget = mTopLevelWidget;
|
||||
toolkit->SetFocus(focusedWidget);
|
||||
nsIMenuBar* menuBar = focusedWidget->GetMenuBar();
|
||||
|
||||
//¥TODO: if the focusedWidget doesn't have a menubar,
|
||||
// look all the way up to the window
|
||||
// until one of the parents has a menubar
|
||||
if(menuBar)
|
||||
{
|
||||
void* menuHandle = nsnull;
|
||||
|
||||
menuBar->GetNativeData(menuHandle);
|
||||
::SetMenuBar((Handle)menuHandle);
|
||||
menuBar->Paint();
|
||||
}
|
||||
else
|
||||
{
|
||||
//¥TODO: if the focusedWidget doesn't have a menubar,
|
||||
// look all the way up to the window
|
||||
// until one of the parents has a menubar
|
||||
}
|
||||
|
||||
//¥TODO: set the menu bar here
|
||||
}
|
||||
|
@ -319,6 +329,11 @@ PRBool nsMacEventHandler::HandleActivateEvent(EventRecord& aOSEvent)
|
|||
{
|
||||
//¥TODO: save the focused widget for that window
|
||||
toolkit->SetFocus(nsnull);
|
||||
|
||||
Handle menuBar = ::GetMenuBar(); // Get a copy of the menu list
|
||||
|
||||
nsIMenuBar* menuBarInterface = mTopLevelWidget->GetMenuBar();
|
||||
menuBarInterface->SetNativeData((void*)menuBar);
|
||||
}
|
||||
}
|
||||
return PR_TRUE;
|
||||
|
|
|
@ -108,9 +108,10 @@ nsMenuBar::nsMenuBar() : nsIMenuBar(), nsIMenuListener()
|
|||
mIsMenuBarAdded = PR_FALSE;
|
||||
|
||||
mOriginalMacMBarHandle = nsnull;
|
||||
mOriginalMacMBarHandle = ::GetMenuBar();
|
||||
|
||||
::ClearMenuBar();
|
||||
mMacMBarHandle = nsnull;
|
||||
mMacMBarHandle = ::GetMenuBar(); // Get a copy of the menu list
|
||||
//::SetMenuBar(mMacMBarHandle); // Make the copy the current menu list
|
||||
::ClearMenuBar(); // Clear the copy
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -214,7 +215,14 @@ NS_METHOD nsMenuBar::RemoveAll()
|
|||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenuBar::GetNativeData(void *& aData)
|
||||
{
|
||||
//aData = (void *)mMenu;
|
||||
aData = (void *) mMacMBarHandle;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenuBar::SetNativeData(void* aData)
|
||||
{
|
||||
mMacMBarHandle = (Handle) aData;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
NS_IMETHOD RemoveAll();
|
||||
NS_IMETHOD GetNativeData(void*& aData);
|
||||
NS_IMETHOD Paint();
|
||||
NS_IMETHOD SetNativeData(void* aData);
|
||||
protected:
|
||||
PRUint32 mNumMenus;
|
||||
nsVoidArray mMenuVoidArray;
|
||||
|
|
|
@ -170,6 +170,14 @@ NS_METHOD nsMenuBar::GetNativeData(void *& aData)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenuBar::SetNativeData(void * aData)
|
||||
{
|
||||
// Temporary hack for MacOS. Will go away when nsMenuBar handles it's own
|
||||
// construction
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenuBar::Paint()
|
||||
{
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
NS_IMETHOD RemoveAll();
|
||||
NS_IMETHOD GetNativeData(void*& aData);
|
||||
NS_IMETHOD Paint();
|
||||
NS_IMETHOD SetNativeData(void* aData);
|
||||
protected:
|
||||
PRUint32 mNumMenus;
|
||||
Widget mMenu;
|
||||
|
|
|
@ -225,6 +225,14 @@ NS_METHOD nsMenuBar::GetNativeData(void *& aData)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenuBar::SetNativeData(void * aData)
|
||||
{
|
||||
// Temporary hack for MacOS. Will go away when nsMenuBar handles it's own
|
||||
// construction
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenuBar::Paint()
|
||||
{
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
NS_IMETHOD RemoveAll();
|
||||
NS_IMETHOD GetNativeData(void*& aData);
|
||||
NS_IMETHOD Paint();
|
||||
NS_IMETHOD SetNativeData(void* aData);
|
||||
|
||||
protected:
|
||||
PRUint32 mNumMenus;
|
||||
|
|
Загрузка…
Ссылка в новой задаче