Add nsPIWidgetCocoa interface to top-level window Cocoa widgets. This is part of bug 330587, sheet support. r=mento

This commit is contained in:
joshmoz%gmail.com 2006-05-17 18:53:58 +00:00
Родитель 74fb26fa47
Коммит 0277af7788
4 изменённых файлов: 115 добавлений и 15 удалений

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

@ -138,6 +138,7 @@ XPIDLSRCS += \
nsIChangeManager.idl \
nsIMenuCommandDispatcher.idl \
nsIDragHelperService.idl \
nsPIWidgetCocoa.idl \
$(NULL)
GFX_CPPSRCS := $(addprefix $(topsrcdir)/gfx/src/mac/,$(GFX_LCPPSRCS))

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

@ -43,6 +43,7 @@
#import <Cocoa/Cocoa.h>
#include "nsBaseWidget.h"
#include "nsPIWidgetCocoa.h"
class nsCocoaWindow;
@ -58,7 +59,7 @@ class nsCocoaWindow;
@end
class nsCocoaWindow : public nsBaseWidget
class nsCocoaWindow : public nsBaseWidget, public nsPIWidgetCocoa
{
private:
typedef nsBaseWidget Inherited;
@ -71,6 +72,7 @@ public:
virtual ~nsCocoaWindow();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSPIWIDGETCOCOA
NS_IMETHOD Create(nsNativeWidget aParent,
const nsRect &aRect,
@ -153,8 +155,6 @@ public:
void StartResizing () { mIsResizing = PR_TRUE; }
void StopResizing () { mIsResizing = PR_FALSE; }
void ComeToFront();
// nsIKBStateControl interface
NS_IMETHOD ResetInputState();

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

@ -69,7 +69,7 @@ extern BOOL gSomeMenuBarPainted;
// call getHiddenWindowNativeMenu, don't use this directly
static nsIMenuBar* gHiddenWindowMenuBar;
NS_IMPL_ISUPPORTS_INHERITED0(nsCocoaWindow, Inherited)
NS_IMPL_ISUPPORTS_INHERITED1(nsCocoaWindow, Inherited, nsPIWidgetCocoa)
// get the highest point on any screen
@ -357,8 +357,8 @@ nsresult nsCocoaWindow::StandardCreate(nsIWidget *aParent,
backing:NSBackingStoreBuffered defer:NO];
if (mWindowType == eWindowType_popup) {
[mWindow setLevel:NSPopUpMenuWindowLevel];
[mWindow setHasShadow:YES];
[mWindow setLevel:NSPopUpMenuWindowLevel];
[mWindow setHasShadow:YES];
}
[mWindow setReleasedWhenClosed:NO];
@ -506,7 +506,7 @@ NS_IMETHODIMP nsCocoaWindow::Move(PRInt32 aX, PRInt32 aY)
mParent->WidgetToScreen(localRect,globalRect);
aX=globalRect.x;
aY=globalRect.y;
}
}
}
NSPoint coord = {aX, aY};
@ -634,20 +634,50 @@ PRBool nsCocoaWindow::DragEvent ( unsigned int aMessage, Point aMouseGlobal, UIn
return PR_FALSE;
}
//-------------------------------------------------------------------------
//
// Like ::BringToFront, but constrains the window to its z-level
//
//-------------------------------------------------------------------------
void nsCocoaWindow::ComeToFront()
{
// Like ::BringToFront, but constrains the window to its z-level
NS_IMETHODIMP nsCocoaWindow::ComeToFront()
{
/*
nsZLevelEvent event(PR_TRUE, NS_SETZLEVEL, this);
event.refPoint.x = mBounds.x;
event.refPoint.y = mBounds.y;
event.time = PR_IntervalNow();
event.mImmediate = PR_TRUE;
nsEventStatus status = nsEventStatus_eIgnore;
DispatchEvent(&event, status);
*/
return NS_OK;
}
NS_IMETHODIMP nsCocoaWindow::GetChildSheet(PRBool aShown, nsCocoaWindow** _retval)
{
*_retval = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsCocoaWindow::GetMenuBar(nsIMenuBar** menuBar)
{
*menuBar = mMenuBar;
return NS_OK;
}
NS_IMETHODIMP nsCocoaWindow::GetIsSheet(PRBool* isSheet)
{
*isSheet = mIsSheet;
return NS_OK;
}
NS_IMETHODIMP nsCocoaWindow::ResetInputState()
{
// return mMacEventHandler->ResetInputState();
return NS_OK;
}

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

@ -0,0 +1,69 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corp.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mike Pinkerton
* 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
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIMenuBar;
interface nsCocoaWindow;
//
// nsPIWidgetCocoa
//
// A private interface (unfrozen, private to the widget implementation) that
// gives us access to some extra features on a widget/window.
//
[scriptable, uuid(97e466b1-967f-40fd-81d1-577eaa2ac4d3)]
interface nsPIWidgetCocoa : nsISupports
{
// Like OS ::BringToFront, but constrains the window to its z-level
void ComeToFront();
// Obtain the menubar for a window
nsIMenuBar GetMenuBar();
// Find the displayed child sheet (if aShown) or a child sheet that
// wants to be displayed (if !aShown)
nsCocoaWindow GetChildSheet(in boolean aShown);
// True if window is a sheet
readonly attribute boolean isSheet;
}; // nsPIWidgetCocoa