This commit is contained in:
danm%netscape.com 1999-06-04 04:00:30 +00:00
Родитель d4a7918972
Коммит ca940ca440
15 изменённых файлов: 89 добавлений и 28 удалений

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

@ -518,11 +518,20 @@ class nsIWidget : public nsISupports {
* Set the widget's MenuBar.
* Must be called after Create.
*
* @param aTitle string displayed as the title of the widget
* @param aMenuBar the menubar
*/
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar) = 0;
/**
* Set the widget's MenuBar's visibility, without affecting ownership
* or any other sticky considerations.
*
* @param aShow PR_TRUE to show, PR_FALSE to hide
*/
NS_IMETHOD ShowMenuBar(PRBool aShow) = 0;
/**
* Set the collection of tooltip rectangles.
* A NS_SHOW_TOOLTIP event is generated when the mouse hovers over one

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

@ -764,8 +764,15 @@ NS_METHOD nsWidget::SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight)
NS_METHOD nsWidget::SetMenuBar(nsIMenuBar * aMenuBar)
{
g_print("bleh\n");
NS_NOTYETIMPLEMENTED("nsWidget::SetMenuBar");
return NS_OK;
NS_NOTYETIMPLEMENTED("nsWidget::SetMenuBar");
return NS_OK;
}
NS_METHOD nsWidget::ShowMenuBar(PRBool aShow)
{
g_print("bleh\n");
NS_NOTYETIMPLEMENTED("nsWidget::ShowMenuBar");
return NS_OK;
}
nsresult nsWidget::CreateWidget(nsIWidget *aParent,

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

@ -109,6 +109,7 @@ class nsWidget : public nsBaseWidget
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
NS_IMETHOD SetMenuBar(nsIMenuBar *aMenuBar);
NS_IMETHOD ShowMenuBar(PRBool aShow);
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
NS_IMETHOD Invalidate(const nsRect &aRect, PRBool aIsSynchronous);

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

@ -595,6 +595,11 @@ NS_METHOD nsWindow::SetMenuBar(nsIMenuBar* aMenuBar)
return NS_OK;
}
NS_METHOD nsWindow::ShowMenuBar(PRBool aShow)
{
return NS_ERROR_FAILURE; // DRaM
}
//----------------------------------------------------------------------

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

@ -61,6 +61,7 @@ public:
nsresult SetIcon(GdkPixmap *window_pixmap,
GdkBitmap *window_mask);
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar);
NS_IMETHOD ShowMenuBar(PRBool aShow);
NS_IMETHOD SetTooltips(PRUint32 aNumberOfTips,nsRect* aTooltipAreas[]);
NS_IMETHOD UpdateTooltips(nsRect* aNewTips[]);

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

@ -56,23 +56,23 @@ nsWindow::nsWindow() : nsBaseWidget() , nsDeleteObserved(this)
mResizingChildren = PR_FALSE;
mVisible = PR_FALSE;
mEnabled = PR_TRUE;
SetPreferredSize(0,0);
SetPreferredSize(0,0);
mFontMetrics = nsnull;
mMenuBar = nsnull;
mTempRenderingContext = nsnull;
mFontMetrics = nsnull;
mMenuBar = nsnull;
mTempRenderingContext = nsnull;
mWindowRegion = nsnull;
mVisRegion = nsnull;
mWindowPtr = nsnull;
mDrawing = PR_FALSE;
mDestroyCalled = PR_FALSE;
mDestructorCalled = PR_FALSE;
mDestroyCalled = PR_FALSE;
mDestructorCalled = PR_FALSE;
SetBackgroundColor(NS_RGB(255, 255, 255));
SetForegroundColor(NS_RGB(0, 0, 0));
mPluginPort = nsnull;
SetBackgroundColor(NS_RGB(255, 255, 255));
SetForegroundColor(NS_RGB(0, 0, 0));
mPluginPort = nsnull;
}
@ -404,6 +404,12 @@ NS_IMETHODIMP nsWindow::SetMenuBar(nsIMenuBar * aMenuBar)
return NS_OK;
}
NS_IMETHODIMP nsWindow::ShowMenuBar(PRBool aShow)
{
// this may never be implemented on the Mac
return NS_ERROR_FAILURE;
}
//-------------------------------------------------------------------------
//
// Get the widget's MenuBar.

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

@ -121,6 +121,7 @@ public:
void LocalToWindowCoordinate(nsRect& aRect) {ConvertToDeviceCoordinates(aRect.x, aRect.y);}
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar);
NS_IMETHOD ShowMenuBar(PRBool aShow);
virtual nsIMenuBar* GetMenuBar();
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight);
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight);

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

@ -1592,6 +1592,11 @@ NS_METHOD nsWindow::SetMenuBar(nsIMenuBar * aMenuBar)
return NS_ERROR_FAILURE;
}
NS_METHOD nsWindow::ShowMenuBar(PRBool aShow)
{
return NS_ERROR_FAILURE;
}
NS_METHOD nsWindow::GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight)
{
aWidth = mPreferredWidth;

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

@ -129,6 +129,7 @@ public:
NS_IMETHOD BeginResizingChildren(void);
NS_IMETHOD EndResizingChildren(void);
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar);
NS_IMETHOD ShowMenuBar(PRBool aShow);
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight);
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight);
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);

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

@ -823,6 +823,11 @@ NS_METHOD nsWindow::SetMenuBar( nsIMenuBar * aMenuBar )
return res;
}
NS_METHOD nsWindow::ShowMenuBar( PRBool aShow)
{
return NS_ERROR_FAILURE;
}
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////

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

@ -61,6 +61,7 @@ public:
NS_IMETHOD SetTitle(const nsString& aTitle);
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar);
NS_IMETHOD ShowMenuBar(PRBool aShow);
NS_IMETHOD GetBounds( nsRect &aRect );
NS_IMETHOD GetClientBounds( nsRect &aRect );

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

@ -112,12 +112,12 @@ nsWindow::nsWindow() : nsBaseWidget()
mHitSubMenus = new nsVoidArray();
mVScrollbar = nsnull;
mIMEProperty = 0;
mIMEIsComposing = PR_FALSE;
mIMECompositionString = NULL;
mIMECompositionStringSize = 0;
mIMECompositionStringSize = 0;
mIMECompositionUniString = NULL;
mIMEProperty = 0;
mIMEIsComposing = PR_FALSE;
mIMECompositionString = NULL;
mIMECompositionStringSize = 0;
mIMECompositionStringSize = 0;
mIMECompositionUniString = NULL;
#ifdef NEW_DRAG_AND_DROP
mNativeDragTarget = nsnull;
@ -3120,19 +3120,31 @@ NS_METHOD nsWindow::SetMenuBar(nsIMenuBar * aMenuBar)
{
mMenuBar = aMenuBar;
NS_ADDREF(mMenuBar);
return ShowMenuBar(PR_TRUE);
}
HMENU nativeMenuHandle;
void * voidData;
aMenuBar->GetNativeData(voidData);
nativeMenuHandle = (HMENU)voidData;
NS_METHOD nsWindow::ShowMenuBar(PRBool aShow)
{
nsresult rv = NS_ERROR_FAILURE;
if (nsnull != nativeMenuHandle) {
::SetMenu(mWnd, nativeMenuHandle);
return NS_OK;
if (aShow) {
if (mMenuBar) {
HMENU nativeMenuHandle;
void *voidData;
mMenuBar->GetNativeData(voidData);
nativeMenuHandle = (HMENU)voidData;
if (nativeMenuHandle) {
::SetMenu(mWnd, nativeMenuHandle);
rv = NS_OK;
}
}
} else {
return NS_ERROR_FAILURE;
::SetMenu(mWnd, 0);
rv = NS_OK;
}
}
return rv;
}
NS_METHOD nsWindow::GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight)
{

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

@ -115,6 +115,7 @@ public:
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
NS_IMETHOD SetTitle(const nsString& aTitle);
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar);
NS_IMETHOD ShowMenuBar(PRBool aShow);
NS_IMETHOD SetTooltips(PRUint32 aNumberOfTips,nsRect* aTooltipAreas[]);
NS_IMETHOD RemoveTooltips();
NS_IMETHOD UpdateTooltips(nsRect* aNewTips[]);

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

@ -206,6 +206,11 @@ NS_IMETHODIMP nsWidget::SetMenuBar(nsIMenuBar * aMenuBar)
return NS_OK;
}
NS_IMETHODIMP nsWidget::ShowMenuBar(PRBool aShow)
{
return NS_ERROR_FAILURE;
}
void * nsWidget::GetNativeData(PRUint32 aDataType)
{
switch (aDataType) {

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

@ -84,6 +84,7 @@ public:
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
NS_IMETHOD SetTitle(const nsString& aTitle);
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar);
NS_IMETHOD ShowMenuBar(PRBool aShow);
NS_IMETHOD SetTooltips(PRUint32 aNumberOfTips,nsRect* aTooltipAreas[]);
NS_IMETHOD RemoveTooltips();
NS_IMETHOD UpdateTooltips(nsRect* aNewTips[]);