From 58df60018cb4490db81ba7dfd56b7c7788a6f50d Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Wed, 7 Oct 1998 04:10:21 +0000 Subject: [PATCH] calc button size stuff at startup not at draw time for layout. git-svn-id: svn://10.0.0.236/trunk@12151 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/cmd/macfe/gui/CRDFToolbarItem.cp | 30 ++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/mozilla/cmd/macfe/gui/CRDFToolbarItem.cp b/mozilla/cmd/macfe/gui/CRDFToolbarItem.cp index daf2062a257..9b46e1cc0b7 100644 --- a/mozilla/cmd/macfe/gui/CRDFToolbarItem.cp +++ b/mozilla/cmd/macfe/gui/CRDFToolbarItem.cp @@ -79,6 +79,9 @@ CRDFPushButton :: CRDFPushButton ( HT_Resource inNode ) AttachPaneEnabler(); AssignCommand(); + + // get ready to draw by caching all the graphic and title rects. + PrepareDrawButton(); } @@ -369,7 +372,25 @@ CRDFPushButton::NaturalSize( SDimension16 inAvailable ) const */ { SDimension16 desiredSpace; - desiredSpace.width = 50; desiredSpace.height = 50; //еее for now + + bool iconOnSide = true; + char* value = NULL; + PRBool success = HT_GetTemplateData ( HT_TopNode(HT_GetView(HTNode())), gNavCenter->toolbarBitmapPosition, HT_COLUMN_STRING, &value ); + if ( success && value ) { + if ( strcmp(value, "top") == 0 ) + iconOnSide = false; + } + + if ( iconOnSide ) { + desiredSpace.width = (mCachedTitleFrame.right - mCachedTitleFrame.left) + + (mCachedGraphicFrame.right - mCachedGraphicFrame.left) + 15; + desiredSpace.height = min ( max(mCachedGraphicFrame.bottom - mCachedGraphicFrame.top, + mCachedTitleFrame.bottom - mCachedTitleFrame.top), 24); + } + else { + desiredSpace.width = 50; + desiredSpace.height = 50; //еее for now + } return desiredSpace; } @@ -798,7 +819,7 @@ CRDFSeparator :: DrawSelf ( ) Rect localRect; CalcLocalFrameRect ( localRect ); - ::FrameRect ( &localRect ); + ::PaintRect ( &localRect ); } @@ -812,7 +833,8 @@ SDimension16 CRDFSeparator :: NaturalSize( SDimension16 inAvailable ) const { SDimension16 desiredSpace; - desiredSpace.width = 15; desiredSpace.height = 50; //еее for now + desiredSpace.width = 5; + desiredSpace.height = 24; return desiredSpace; @@ -871,7 +893,7 @@ SDimension16 CRDFURLBar::NaturalSize( SDimension16 inAvailable ) const { SDimension16 desiredSpace; - desiredSpace.width = 50; desiredSpace.height = 25; //еее is this enough? + desiredSpace.width = 100; desiredSpace.height = 50; //еее is this enough? return desiredSpace;