Added stuff so that NSMenu won't get sized to smaller than it's title width.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5043 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Lyndon Tremblay 1999-10-20 17:29:56 +00:00
parent d24294cb85
commit ad22faa6a2
4 changed files with 33 additions and 6 deletions

View file

@ -59,13 +59,14 @@ static float GSMenuBarHeight = 25.0; // a guess.
- (id)initWithFrame: (NSRect)aFrame
{
cellSize = NSMakeSize(110,20);
i_titleWidth = 110;
menuv_highlightedItemIndex = -1;
return [super initWithFrame: aFrame];
}
- (id)initWithFrame: (NSRect)aFrame
cellSize: (NSSize)aSize
cellSize: (NSSize)aSize
{
[self initWithFrame:aFrame];
@ -315,12 +316,23 @@ static float GSMenuBarHeight = 25.0; // a guess.
return menuv_needsSizing;
}
/*
================
-setTitleWidth:
================
*/
- (void)setTitleWidth:(float)titleWidth
{
i_titleWidth = titleWidth;
[self sizeToFit];
}
- (void)sizeToFit
{
int i;
int howMany = [menuv_items_link count];
int howHigh = (howMany * cellSize.height);
float neededWidth = 0;
float neededWidth = i_titleWidth;
for (i=0;i<howMany;i++)
{
@ -901,7 +913,7 @@ cell do the following */
-(void) performKeyEquivalent: (NSEvent *)theEvent
{
return [menuv_menu performKeyEquivalent: theEvent];
[menuv_menu performKeyEquivalent: theEvent];
}
@end