Changes for laying out toolbars

This commit is contained in:
pinkerton%netscape.com 1998-10-06 23:28:42 +00:00
Родитель 56b127574c
Коммит 1e0a8727b8
2 изменённых файлов: 28 добавлений и 4 удалений

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

@ -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,6 +851,12 @@ 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<CBrowserWindow*>(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.
}

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

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