This commit is contained in:
saari%netscape.com 1999-03-14 20:59:10 +00:00
Родитель d42476b2ea
Коммит 15eb92348e
10 изменённых файлов: 66 добавлений и 8 удалений

Просмотреть файл

@ -98,6 +98,12 @@ class nsIMenuBar : public nsISupports {
*/ */
NS_IMETHOD GetNativeData(void*& aData) = 0; 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 * Draw the menubar
* *

Просмотреть файл

@ -178,6 +178,14 @@ NS_METHOD nsMenuBar::GetNativeData(void *& aData)
return NS_OK; 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() NS_METHOD nsMenuBar::Paint()
{ {
@ -198,3 +206,4 @@ nsEventStatus nsMenuBar::MenuDeselected(const nsMenuEvent & aMenuEvent)
{ {
return nsEventStatus_eIgnore; return nsEventStatus_eIgnore;
} }

Просмотреть файл

@ -56,6 +56,7 @@ public:
NS_IMETHOD RemoveAll(); NS_IMETHOD RemoveAll();
NS_IMETHOD GetNativeData(void*& aData); NS_IMETHOD GetNativeData(void*& aData);
NS_IMETHOD Paint(); NS_IMETHOD Paint();
NS_IMETHOD SetNativeData(void* aData);
protected: protected:
PRUint32 mNumMenus; PRUint32 mNumMenus;
GtkWidget *mMenuBar; GtkWidget *mMenuBar;

Просмотреть файл

@ -308,10 +308,20 @@ PRBool nsMacEventHandler::HandleActivateEvent(EventRecord& aOSEvent)
nsWindow* focusedWidget = mTopLevelWidget; nsWindow* focusedWidget = mTopLevelWidget;
toolkit->SetFocus(focusedWidget); toolkit->SetFocus(focusedWidget);
nsIMenuBar* menuBar = focusedWidget->GetMenuBar(); nsIMenuBar* menuBar = focusedWidget->GetMenuBar();
if(menuBar)
//¥TODO: if the focusedWidget doesn't have a menubar, {
// look all the way up to the window void* menuHandle = nsnull;
// until one of the parents has a menubar
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 //¥TODO: set the menu bar here
} }
@ -319,6 +329,11 @@ PRBool nsMacEventHandler::HandleActivateEvent(EventRecord& aOSEvent)
{ {
//¥TODO: save the focused widget for that window //¥TODO: save the focused widget for that window
toolkit->SetFocus(nsnull); toolkit->SetFocus(nsnull);
Handle menuBar = ::GetMenuBar(); // Get a copy of the menu list
nsIMenuBar* menuBarInterface = mTopLevelWidget->GetMenuBar();
menuBarInterface->SetNativeData((void*)menuBar);
} }
} }
return PR_TRUE; return PR_TRUE;

Просмотреть файл

@ -108,9 +108,10 @@ nsMenuBar::nsMenuBar() : nsIMenuBar(), nsIMenuListener()
mIsMenuBarAdded = PR_FALSE; mIsMenuBarAdded = PR_FALSE;
mOriginalMacMBarHandle = nsnull; mOriginalMacMBarHandle = nsnull;
mOriginalMacMBarHandle = ::GetMenuBar(); mMacMBarHandle = nsnull;
mMacMBarHandle = ::GetMenuBar(); // Get a copy of the menu list
::ClearMenuBar(); //::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) 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; return NS_OK;
} }

Просмотреть файл

@ -56,6 +56,7 @@ public:
NS_IMETHOD RemoveAll(); NS_IMETHOD RemoveAll();
NS_IMETHOD GetNativeData(void*& aData); NS_IMETHOD GetNativeData(void*& aData);
NS_IMETHOD Paint(); NS_IMETHOD Paint();
NS_IMETHOD SetNativeData(void* aData);
protected: protected:
PRUint32 mNumMenus; PRUint32 mNumMenus;
nsVoidArray mMenuVoidArray; nsVoidArray mMenuVoidArray;

Просмотреть файл

@ -170,6 +170,14 @@ NS_METHOD nsMenuBar::GetNativeData(void *& aData)
return NS_OK; 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() NS_METHOD nsMenuBar::Paint()
{ {

Просмотреть файл

@ -58,6 +58,7 @@ public:
NS_IMETHOD RemoveAll(); NS_IMETHOD RemoveAll();
NS_IMETHOD GetNativeData(void*& aData); NS_IMETHOD GetNativeData(void*& aData);
NS_IMETHOD Paint(); NS_IMETHOD Paint();
NS_IMETHOD SetNativeData(void* aData);
protected: protected:
PRUint32 mNumMenus; PRUint32 mNumMenus;
Widget mMenu; Widget mMenu;

Просмотреть файл

@ -225,6 +225,14 @@ NS_METHOD nsMenuBar::GetNativeData(void *& aData)
return NS_OK; 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() NS_METHOD nsMenuBar::Paint()
{ {

Просмотреть файл

@ -60,6 +60,7 @@ public:
NS_IMETHOD RemoveAll(); NS_IMETHOD RemoveAll();
NS_IMETHOD GetNativeData(void*& aData); NS_IMETHOD GetNativeData(void*& aData);
NS_IMETHOD Paint(); NS_IMETHOD Paint();
NS_IMETHOD SetNativeData(void* aData);
protected: protected:
PRUint32 mNumMenus; PRUint32 mNumMenus;