Impliment Resize for nsWidget (and nsWindow (it calls nsWidget::Resize/Move)

Add patch for gtklayout from Owen Taylor that makes sure the widgets added are
shown and realized.  We now get a window popped up that shows the spinner,
toolbar, menu, etc etc etc.  its getting close!
This commit is contained in:
pavlov%pavlov.net 1998-11-09 05:45:57 +00:00
parent 0fb3972bbc
commit 53129acd64
4 changed files with 32 additions and 19 deletions

@ -162,10 +162,17 @@ gtk_layout_put (GtkLayout *layout,
gtk_widget_size_request (child->widget, &child->requisition);
if (GTK_WIDGET_REALIZED (layout) &&
!GTK_WIDGET_REALIZED (child_widget))
gtk_layout_realize_child (layout, child);
if (GTK_WIDGET_VISIBLE (layout))
{
if (GTK_WIDGET_REALIZED (layout) &&
!GTK_WIDGET_REALIZED (child_widget))
gtk_widget_realize (child_widget);
if (GTK_WIDGET_MAPPED (layout) &&
!GTK_WIDGET_MAPPED (child_widget))
gtk_widget_map (child_widget);
}
gtk_layout_position_child (layout, child, TRUE);
}

@ -48,6 +48,7 @@ NS_METHOD nsAppShell::Create(int* argc, char ** argv)
gtk_init (argc, &argv);
gtk_rc_init();
// Windows and Mac don't create anything here, so why should we?
// mTopLevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
/* we should probibly set even handlers here */

@ -187,27 +187,28 @@ NS_METHOD nsWidget::IsVisible(PRBool &aState)
NS_METHOD nsWidget::Move(PRUint32 aX, PRUint32 aY)
{
NS_NOTYETIMPLEMENTED("nsWidget::Move");
#if 0
fprintf(stderr,"nsWidget::Move called (%d,%d)\n", aX, aY);
mBounds.x = aX;
mBounds.y = aY;
// TODO
// gtk_layout_move(GTK_LAYOUT(layout), mWidget, aX, aY);
XtVaSetValues(mWidget, XmNx, aX, XmNy, GetYCoord(aY), nsnull);
#endif
return NS_OK;
gtk_layout_move(GTK_LAYOUT(mWidget->parent), mWidget, aX, aY);
//XtVaSetValues(mWidget, XmNx, aX, XmNy, GetYCoord(aY), nsnull);
return NS_OK;
}
NS_METHOD nsWidget::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint)
{
NS_NOTYETIMPLEMENTED("nsWidget::Resize");
return NS_OK;
fprintf(stderr,"nsWidget::Resize called w,h(%d,%d)\n", aWidth, aHeight);
mBounds.width = aWidth;
mBounds.height = aHeight;
gtk_widget_set_usize(mWidget,aWidth, aHeight);
return NS_OK;
}
NS_METHOD nsWidget::Resize(PRUint32 aX, PRUint32 aY, PRUint32 aWidth,
PRUint32 aHeight, PRBool aRepaint)
{
NS_NOTYETIMPLEMENTED("nsWidget::Resize");
Resize(aWidth, aHeight, aRepaint);
Move(aX, aY);
return NS_OK;
}

@ -37,9 +37,10 @@
#include "stdio.h"
#define DBG 0
#if 0
#define DEBUG_shaver 1
#define DEBUG_pavlov 1
#endif
static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID);
extern GtkWidget *gAppContext;
@ -209,7 +210,7 @@ nsresult nsWindow::StandardWindowCreate(nsIWidget *aParent,
gtk_box_pack_end(GTK_BOX(mVBox), mWidget, TRUE, TRUE, 0);
} else {
#ifdef DEBUG_shaver
fprintf(stderr, "StandardCreateWindow: creating GtkLayout subarea\n");
fprintf(stderr, "StandardCreateWindow: creating GtkLayout subarea (%d,%d)\n", aRect.x, aRect.y);
#endif
mainWindow = mWidget;
gtk_layout_put(GTK_LAYOUT(parentWidget), mWidget, aRect.x, aRect.y);
@ -413,8 +414,9 @@ NS_METHOD nsWindow::Show(PRBool bState)
//-------------------------------------------------------------------------
NS_METHOD nsWindow::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint)
{
NS_NOTYETIMPLEMENTED("nsWindow::Resize");
nsWidget::Resize(aWidth, aHeight,aRepaint);
#if 0
NS_NOTYETIMPLEMENTED("nsWindow::Resize");
if (DBG) printf("$$$$$$$$$ %s::Resize %d %d Repaint: %s\n",
gInstanceClassName, aWidth, aHeight, (aRepaint?"true":"false"));
mBounds.width = aWidth;
@ -434,8 +436,10 @@ NS_METHOD nsWindow::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint)
//-------------------------------------------------------------------------
NS_METHOD nsWindow::Resize(PRUint32 aX, PRUint32 aY, PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint)
{
NS_NOTYETIMPLEMENTED("nsWindow::Resize");
nsWindow::Resize(aWidth, aHeight,aRepaint);
nsWidget::Move(aX,aY);
#if 0
NS_NOTYETIMPLEMENTED("nsWindow::Resize");
mBounds.x = aX;
mBounds.y = aY;
mBounds.width = aWidth;