From a9158459784ffbf3fa6442dc28bbc6951bfb8169 Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Tue, 6 Oct 1998 23:28:42 +0000 Subject: [PATCH] Changes for laying out toolbars git-svn-id: svn://10.0.0.236/trunk@12119 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/cmd/macfe/gui/CRDFToolbarItem.cp | 30 ++++++++++++++++++++---- mozilla/cmd/macfe/gui/CRDFToolbarItem.h | 2 ++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/mozilla/cmd/macfe/gui/CRDFToolbarItem.cp b/mozilla/cmd/macfe/gui/CRDFToolbarItem.cp index f8656b98570..daf2062a257 100644 --- a/mozilla/cmd/macfe/gui/CRDFToolbarItem.cp +++ b/mozilla/cmd/macfe/gui/CRDFToolbarItem.cp @@ -353,7 +353,9 @@ CRDFPushButton::NaturalSize( SDimension16 inAvailable ) const size; * an item with a percentage size can calculate it based on |inAvailable|; - * an item with a space-filling size can simply return |inAvailable|. + * an item with a space-filling size should return the smallest space + it can live in. The toolbar will know it is stretchy because + it can call IsStretchy(). Problems: this routine is essentially a hack. In particular, if |inAvailable| @@ -849,7 +851,13 @@ CRDFURLBar :: FinishCreate ( ) LWindow* window = LWindow::FetchWindowObject(GetMacPort()); LView* view = UReanimator::CreateView(1104, this, window); // create the url bar - + // chances are good that if this button streams in after the window has been + // created, the url bar will have not been hooked up to the current context. Doing + // it here ensures it will. + CBrowserWindow* browser = dynamic_cast(window); + if ( browser ) + browser->HookupContextToToolbars(); + } // FinishCreate @@ -857,11 +865,25 @@ CRDFURLBar :: FinishCreate ( ) // NaturalSize // (See comment on CRDFPushButton::NaturalSize() for tons of info.) // -// Since we want to take as much room as possible, return what is available. +// Return the smallest size we can live in. // SDimension16 CRDFURLBar::NaturalSize( SDimension16 inAvailable ) const { - return inAvailable; + SDimension16 desiredSpace; + desiredSpace.width = 50; desiredSpace.height = 25; //еее is this enough? + + return desiredSpace; } // NaturalSize + + +// +// IsStretchy +// +// +bool +CRDFURLBar :: IsStretchy ( ) const +{ + return true; //еее do this right. +} diff --git a/mozilla/cmd/macfe/gui/CRDFToolbarItem.h b/mozilla/cmd/macfe/gui/CRDFToolbarItem.h index 28bbf462e99..8900b2b2cc4 100644 --- a/mozilla/cmd/macfe/gui/CRDFToolbarItem.h +++ b/mozilla/cmd/macfe/gui/CRDFToolbarItem.h @@ -51,6 +51,7 @@ public: virtual void ResizeFrameTo ( SInt16 inWidth, SInt16 inHeight, Boolean inRefresh ) = 0; virtual void PlaceInSuperFrameAt ( SInt32 inHoriz, SInt32 inVert, Boolean inRefresh ) = 0; virtual SDimension16 NaturalSize ( SDimension16 inAvail ) const = 0; + virtual bool IsStretchy ( ) const { return false; } // Post-creation init routines // These are called AFTER the item has been placed inside its parent @@ -239,6 +240,7 @@ public: LPane::PlaceInSuperFrameAt(inHoriz, inVert, inRefresh); } virtual SDimension16 NaturalSize ( SDimension16 inAvail ) const ; + virtual bool IsStretchy ( ) const ; virtual void FinishCreate ( ) ;