mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 22:10:58 +00:00
Added [dealloc]. [setWindowFrameForAttachingToRect:...] now
expects the screenRect to be the frame of the cell to attach to. Removed [_setCellSize:]. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10914 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d28df375e0
commit
e1982e4353
1 changed files with 53 additions and 18 deletions
|
@ -3,9 +3,10 @@
|
||||||
|
|
||||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Author: Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
Date: Sep 2001
|
||||||
Author: David Lazaro Saz <khelekir@encomix.es>
|
Author: David Lazaro Saz <khelekir@encomix.es>
|
||||||
Date: Oct 1999
|
Date: Oct 1999
|
||||||
|
|
||||||
Author: Michael Hanni <mhanni@sprintmail.com>
|
Author: Michael Hanni <mhanni@sprintmail.com>
|
||||||
Date: 1999
|
Date: 1999
|
||||||
|
|
||||||
|
@ -92,6 +93,15 @@
|
||||||
return [self init];
|
return [self init];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
RELEASE(_font);
|
||||||
|
RELEASE(_itemCells);
|
||||||
|
TEST_RELEASE(_menu);
|
||||||
|
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Getting and Setting Menu View Attributes
|
* Getting and Setting Menu View Attributes
|
||||||
*/
|
*/
|
||||||
|
@ -644,6 +654,38 @@
|
||||||
popUpSelectedItem: (int)selectedItemIndex
|
popUpSelectedItem: (int)selectedItemIndex
|
||||||
{
|
{
|
||||||
NSRect r;
|
NSRect r;
|
||||||
|
NSRect cellFrame;
|
||||||
|
NSRect screenFrame;
|
||||||
|
int items = [_itemCells count];
|
||||||
|
|
||||||
|
// Convert the screen rect to our view
|
||||||
|
cellFrame.size = screenRect.size;
|
||||||
|
cellFrame.origin = [_window convertScreenToBase: screenRect.origin];
|
||||||
|
cellFrame = [self convertRect: cellFrame fromView: nil];
|
||||||
|
|
||||||
|
_cellSize = cellFrame.size;
|
||||||
|
[self sizeToFit];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compute the frame
|
||||||
|
*/
|
||||||
|
screenFrame = screenRect;
|
||||||
|
if (items > 1)
|
||||||
|
{
|
||||||
|
float f;
|
||||||
|
|
||||||
|
if (!_horizontal)
|
||||||
|
{
|
||||||
|
f = screenRect.size.height * (items - 1);
|
||||||
|
screenFrame.size.height += f;
|
||||||
|
screenFrame.origin.y -= f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f = screenRect.size.width * (items - 1);
|
||||||
|
screenFrame.size.width += f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Move the menu window to screen?
|
// Move the menu window to screen?
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -651,22 +693,25 @@
|
||||||
// Compute position for popups, if needed
|
// Compute position for popups, if needed
|
||||||
if (selectedItemIndex > -1)
|
if (selectedItemIndex > -1)
|
||||||
{
|
{
|
||||||
screenRect.origin.y
|
if (!_horizontal)
|
||||||
+= [self convertSize: _cellSize toView: nil].height * selectedItemIndex;
|
{
|
||||||
|
screenFrame.origin.y += screenRect.size.height * selectedItemIndex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
screenFrame.origin.x -= screenRect.size.width * selectedItemIndex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the frameRect
|
// Get the frameRect
|
||||||
r = [NSWindow frameRectForContentRect: screenRect
|
r = [NSWindow frameRectForContentRect: screenFrame
|
||||||
styleMask: [_window styleMask]];
|
styleMask: [_window styleMask]];
|
||||||
|
|
||||||
// Update position,if needed, using the preferredEdge;
|
// Update position,if needed, using the preferredEdge;
|
||||||
// It seems we should be calling [self resizeWindowWithMaxHeight:];
|
|
||||||
// see the (quite obscure) doc.
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
// Set the window frame
|
// Set the window frame
|
||||||
[_window setFrame: r
|
[_window setFrame: r display: NO];
|
||||||
display: YES];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1032,13 +1077,3 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation NSMenuView (GNUstepExtension)
|
|
||||||
|
|
||||||
- (void) _setCellSize: (NSSize)aSize
|
|
||||||
{
|
|
||||||
_cellSize = aSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue