From a0d9472205c58c0679791d981155474e4b76de83 Mon Sep 17 00:00:00 2001 From: kmcclusk Date: Sat, 18 Apr 1998 00:27:48 +0000 Subject: [PATCH] Changed SetBorderStyle to work with child windows only --- widget/public/nsIWidget.h | 2 +- widget/src/windows/nsWindow.cpp | 12 ++++++------ widget/tests/windows/winmain.cpp | 10 ++++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/widget/public/nsIWidget.h b/widget/public/nsIWidget.h index 129939de5bd..afbbd989f36 100644 --- a/widget/public/nsIWidget.h +++ b/widget/public/nsIWidget.h @@ -73,7 +73,7 @@ typedef void* nsNativeWindow; enum nsBorderStyle { ///window border with title area - eBorderStyle_window, + eBorderStyle_none, ///dialog box border + title area eBorderStyle_dialog, }; diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index 74ea9aafdcb..aeb203247d5 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -115,7 +115,7 @@ nsWindow::nsWindow(nsISupports *aOuter) : nsObject(aOuter) mForeground = ::GetSysColor(COLOR_WINDOWTEXT); mPalette = NULL; mCursor = eCursor_standard; - mBorderStyle = eBorderStyle_window; + mBorderStyle = eBorderStyle_none; mIsShiftDown = PR_FALSE; mIsControlDown = PR_FALSE; mIsAltDown = PR_FALSE; @@ -1224,7 +1224,7 @@ LPCTSTR nsWindow::WindowClass() //------------------------------------------------------------------------- DWORD nsWindow::WindowStyle() { - return /*WS_OVERLAPPEDWINDOW | */ GetBorderStyle(mBorderStyle); + return WS_OVERLAPPEDWINDOW; } @@ -1768,7 +1768,7 @@ void nsWindow::Enumerator::GrowArray() //------------------------------------------------------------------------- DWORD ChildWindow::WindowStyle() { - return WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN; + return WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | GetBorderStyle(mBorderStyle); } @@ -1776,12 +1776,12 @@ DWORD nsWindow::GetBorderStyle(nsBorderStyle aBorderStyle) { switch(aBorderStyle) { - case eBorderStyle_window: - return(WS_OVERLAPPEDWINDOW); + case eBorderStyle_none: + return(0); break; case eBorderStyle_dialog: - return(DS_MODALFRAME | WS_CAPTION | WS_SYSMENU); + return(WS_DLGFRAME | DS_3DLOOK); break; default: diff --git a/widget/tests/windows/winmain.cpp b/widget/tests/windows/winmain.cpp index a2c2820e46a..fdfe3a802bd 100644 --- a/widget/tests/windows/winmain.cpp +++ b/widget/tests/windows/winmain.cpp @@ -909,7 +909,6 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmd NSRepository::CreateInstance(kCWindowCID, nsnull, kIWidgetIID, (LPVOID*)&window); nsRect rect(100, 100, 600, 700); - window->SetBorderStyle(eBorderStyle_dialog); window->Create((nsIWidget*)NULL, rect, HandleEvent, NULL); window->SetTitle("TOP-LEVEL window"); @@ -923,11 +922,14 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmd int x = 10; int y = 10; - rect.SetRect(x, y, 50, 50); + rect.SetRect(x, y, 200, 100); NSRepository::CreateInstance(kCChildCID, nsnull, kIWidgetIID, (LPVOID*)&child); + + + child->SetBorderStyle(eBorderStyle_dialog); child->Create(window, rect, HandleEvent, NULL); - // child->SetBackgroundColor(NS_RGB(100, 200,200)); - // child->SetForegroundColor(NS_RGB(100, 200,200)); + //child->SetBackgroundColor(NS_RGB(255, 255, 0)); + child->SetForegroundColor(NS_RGB(255, 0, 0)); NS_RELEASE(child); // the parent keeps a reference on this child y += rect.height + 5;