fix for bug #6876 File open dialog shown twice. Removed call to Show() in GetFile().

GetFile should only be used retrieve settings it should not have a side effect of
showing the dialog.
Added WIN32 support for top-level borderless windows.
This commit is contained in:
kmcclusk%netscape.com 1999-05-27 21:09:49 +00:00
parent 73c0eaeb2e
commit 0d8608bccf
3 changed files with 34 additions and 1 deletions

View File

@ -196,7 +196,6 @@ NS_IMETHODIMP nsFileWidget::GetSelectedType(PRInt16& theType)
//-------------------------------------------------------------------------
NS_IMETHODIMP nsFileWidget::GetFile(nsFileSpec& aFile)
{
Show();
nsFilePath filePath(mFile);
nsFileSpec fileSpec(filePath);

View File

@ -105,6 +105,8 @@ nsWindow::nsWindow() : nsBaseWidget()
mHas3DBorder = PR_FALSE;
mMenuBar = nsnull;
mMenuCmdId = 0;
mBorderStyle = eBorderStyle_window;
mBorderlessParent = 0;
mHitMenu = nsnull;
mHitSubMenus = new nsVoidArray();
@ -561,11 +563,17 @@ nsresult nsWindow::StandardWindowCreate(nsIWidget *aParent,
DWORD extendedStyle = WindowExStyle();
if (nsnull != aInitData) {
SetBorderStyle(aInitData->mBorderStyle);
if (aInitData->mBorderStyle == eBorderStyle_dialog ||
aInitData->mBorderStyle == eBorderStyle_none) {
extendedStyle &= ~WS_EX_CLIENTEDGE;
} else if (aInitData->mBorderStyle == eBorderStyle_3DChildWindow) {
extendedStyle |= WS_EX_CLIENTEDGE;
} else if (aInitData->mBorderStyle == eBorderStyle_BorderlessTopLevel) {
extendedStyle = WS_EX_TOPMOST;
style = WS_POPUP;
mBorderlessParent = parent;
}
}
@ -766,6 +774,22 @@ NS_METHOD nsWindow::IsVisible(PRBool & bState)
//-------------------------------------------------------------------------
NS_METHOD nsWindow::Move(PRUint32 aX, PRUint32 aY)
{
// When moving a borderless top-level window the window
// must be placed relative to it's parent. WIN32 want's to
// place it relative to the screen, so we used the cached parent
// to calculate the parent's location then add the x,y passed to
// the move to get the screen coordinate for the borderless top-level
// window.
if (mBorderStyle == eBorderStyle_BorderlessTopLevel) {
HWND parent = mBorderlessParent;
if (parent) {
RECT pr;
VERIFY(::GetWindowRect(parent, &pr));
aX += pr.left;
aY += pr.top;
}
}
mBounds.x = aX;
mBounds.y = aY;
@ -3041,6 +3065,14 @@ DWORD nsWindow::GetBorderStyle(nsBorderStyle aBorderStyle)
return(WS_DLGFRAME | DS_3DLOOK);
break;
case eBorderStyle_BorderlessTopLevel:
return(0);
break;
case eBorderStyle_window:
return(0);
break;
default:
NS_ASSERTION(0, "unknown border style");
return(WS_OVERLAPPEDWINDOW);

View File

@ -86,6 +86,8 @@ public:
virtual nsIWidget* GetParent(void);
NS_IMETHOD Show(PRBool bState);
NS_IMETHOD IsVisible(PRBool & aState);
HWND mBorderlessParent;
NS_IMETHOD Move(PRUint32 aX, PRUint32 aY);
NS_IMETHOD Resize(PRUint32 aWidth,