implement nsWidget::Invalidate, nsWidget::Update, make resizing go

git-svn-id: svn://10.0.0.236/trunk@35901 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
blizzard%redhat.com
1999-06-19 20:24:32 +00:00
parent 6acc3bbd87
commit c5cff30ac8
4 changed files with 64 additions and 3 deletions

View File

@@ -322,11 +322,12 @@ nsAppShell::DispatchEvent(XEvent *event)
case Expose:
HandleExposeEvent(event, widget);
break;
#if 0
case ConfigureNotify:
// we need to make sure that this is the LAST of the
// config events.
while (XCheckWindowEvent(gDisplay, event->xany.window, StructureNotifyMask, event) == True);
HandleConfigureNotifyEvent(event, widget);
break;
#endif
case ButtonPress:
case ButtonRelease:
HandleButtonEvent(event, widget);

View File

@@ -228,11 +228,13 @@ NS_IMETHODIMP nsWidget::SetFocus(void)
NS_IMETHODIMP nsWidget::Invalidate(PRBool aIsSynchronous)
{
printf("nsWidget::Invalidate(sync)\n");
return NS_OK;
}
NS_IMETHODIMP nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
{
printf("nsWidget::Invalidate(rect, sync)\n");
return NS_OK;
}
@@ -344,6 +346,7 @@ NS_IMETHODIMP nsWidget::SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight)
NS_IMETHODIMP nsWidget::Update()
{
printf("nsWidget::Update()\n");
return NS_OK;
}
@@ -399,7 +402,7 @@ void nsWidget::CreateNative(Window aParent, nsRect aRect)
// be discarded...
attr.bit_gravity = NorthWestGravity;
// make sure that we listen for events
attr.event_mask = StructureNotifyMask | ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
attr.event_mask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
// set the default background color and border to that awful gray
attr.background_pixel = bg_pixel;
attr.border_pixel = border_pixel;

View File

@@ -102,6 +102,60 @@ nsWindow::CreateNative(Window aParent, nsRect aRect)
AddWindowCallback(mBaseWindow, this);
}
NS_IMETHODIMP nsWindow::Invalidate(PRBool aIsSynchronous)
{
printf("nsWindow::Invalidate(sync)\n");
nsPaintEvent pevent;
pevent.message = NS_PAINT;
pevent.widget = this;
pevent.eventStructType = NS_PAINT_EVENT;
pevent.rect = new nsRect (mBounds.x, mBounds.y,
mBounds.height, mBounds.width);
// XXX fix this
pevent.time = 0;
AddRef();
OnPaint(pevent);
Release();
delete pevent.rect;
return NS_OK;
}
NS_IMETHODIMP nsWindow::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
{
printf("nsWindow::Invalidate(rect, sync)\n");
nsPaintEvent pevent;
pevent.message = NS_PAINT;
pevent.widget = this;
pevent.eventStructType = NS_PAINT_EVENT;
pevent.rect = new nsRect(aRect);
// XXX fix this
pevent.time = 0;
AddRef();
OnPaint(pevent);
Release();
// XXX will this leak?
//delete pevent.rect;
return NS_OK;
}
NS_IMETHODIMP nsWindow::Update()
{
printf("nsWindow::Update()\n");
nsPaintEvent pevent;
pevent.message = NS_PAINT;
pevent.widget = this;
pevent.eventStructType = NS_PAINT_EVENT;
pevent.rect = new nsRect (mBounds.x, mBounds.y,
mBounds.height, mBounds.width);
// XXX fix this
pevent.time = 0;
AddRef();
OnPaint(pevent);
Release();
delete pevent.rect;
return NS_OK;
}
ChildWindow::ChildWindow(): nsWindow()
{
name = "nsChildWindow";

View File

@@ -26,6 +26,9 @@ class nsWindow : public nsWidget
public:
nsWindow();
~nsWindow();
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
NS_IMETHOD Invalidate(const nsRect & aRect, PRBool aIsSynchronous);
NS_IMETHOD Update();
protected:
void CreateNative(Window aParent, nsRect aRect);
void DestroyNative(void);