Changed SetBorderStyle to work with child windows only

This commit is contained in:
kmcclusk 1998-04-18 00:27:48 +00:00
Родитель f8195a35d6
Коммит 2968c8e276
3 изменённых файлов: 13 добавлений и 11 удалений

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

@ -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,
};

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

@ -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:

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

@ -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;