mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 18:50:48 +00:00
When sizing a menu view correctly take into account that the first
item of a pull down menu is not visible. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30837 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1d8f81f716
commit
6e30942930
2 changed files with 29 additions and 3 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2010-06-23 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
|
* Source/NSMenuView.m (-sizeToFit): Correctly take into account
|
||||||
|
that the first item of a pull down menu is not visible.
|
||||||
|
|
||||||
|
* Source/NSMenuView.m (-setHorizontal:): Ensure that the layout is
|
||||||
|
recomputed after changing the view from vertical to horizontal and
|
||||||
|
vice versa.
|
||||||
|
|
||||||
2010-06-22 Doug Simons <doug.simons@testplant.com>
|
2010-06-22 Doug Simons <doug.simons@testplant.com>
|
||||||
|
|
||||||
* Source/NSButton.m:
|
* Source/NSButton.m:
|
||||||
|
|
|
@ -306,6 +306,7 @@ static NSMapTable *viewInfo = 0;
|
||||||
|
|
||||||
scRect.size.height = [NSMenuView menuBarHeight];
|
scRect.size.height = [NSMenuView menuBarHeight];
|
||||||
[self setFrameSize: scRect.size];
|
[self setFrameSize: scRect.size];
|
||||||
|
[self setNeedsSizing: YES];
|
||||||
}
|
}
|
||||||
else if (flag == NO && _horizontal == YES)
|
else if (flag == NO && _horizontal == YES)
|
||||||
{
|
{
|
||||||
|
@ -317,6 +318,7 @@ static NSMapTable *viewInfo = 0;
|
||||||
NSZoneFree(NSDefaultMallocZone(), a);
|
NSZoneFree(NSDefaultMallocZone(), a);
|
||||||
NSMapRemove(viewInfo, self);
|
NSMapRemove(viewInfo, self);
|
||||||
}
|
}
|
||||||
|
[self setNeedsSizing: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
_horizontal = flag;
|
_horizontal = flag;
|
||||||
|
@ -649,6 +651,9 @@ static NSMapTable *viewInfo = 0;
|
||||||
|
|
||||||
- (void) sizeToFit
|
- (void) sizeToFit
|
||||||
{
|
{
|
||||||
|
BOOL isPullDown =
|
||||||
|
[_attachedMenu _ownedByPopUp] && [[_attachedMenu _owningPopUp] pullsDown];
|
||||||
|
|
||||||
if (_horizontal == YES)
|
if (_horizontal == YES)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
@ -665,7 +670,17 @@ static NSMapTable *viewInfo = 0;
|
||||||
*/
|
*/
|
||||||
_cellSize.height = [NSMenuView menuBarHeight];
|
_cellSize.height = [NSMenuView menuBarHeight];
|
||||||
|
|
||||||
for (i = 0; i < howMany; i++)
|
if (howMany && isPullDown)
|
||||||
|
{
|
||||||
|
GSCellRect elem;
|
||||||
|
elem.rect = NSMakeRect (currentX,
|
||||||
|
0,
|
||||||
|
(2 * _horizontalEdgePad),
|
||||||
|
_cellSize.height);
|
||||||
|
GSIArrayAddItem(cellRects, (GSIArrayItem)elem);
|
||||||
|
currentX += 2 * _horizontalEdgePad;
|
||||||
|
}
|
||||||
|
for (i = isPullDown ? 1 : 0; i < howMany; i++)
|
||||||
{
|
{
|
||||||
GSCellRect elem;
|
GSCellRect elem;
|
||||||
NSMenuItemCell *aCell = [self menuItemCellForItemAtIndex: i];
|
NSMenuItemCell *aCell = [self menuItemCellForItemAtIndex: i];
|
||||||
|
@ -722,8 +737,8 @@ static NSMapTable *viewInfo = 0;
|
||||||
{
|
{
|
||||||
menuBarHeight += _leftBorderOffset;
|
menuBarHeight += _leftBorderOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < howMany; i++)
|
for (i = isPullDown ? 1 : 0; i < howMany; i++)
|
||||||
{
|
{
|
||||||
float aStateImageWidth;
|
float aStateImageWidth;
|
||||||
float aTitleWidth;
|
float aTitleWidth;
|
||||||
|
@ -787,6 +802,8 @@ static NSMapTable *viewInfo = 0;
|
||||||
if (anImageWidth)
|
if (anImageWidth)
|
||||||
popupImageWidth = anImageWidth;
|
popupImageWidth = anImageWidth;
|
||||||
}
|
}
|
||||||
|
if (isPullDown && howMany)
|
||||||
|
howMany -= 1;
|
||||||
|
|
||||||
// Cache the needed widths.
|
// Cache the needed widths.
|
||||||
_stateImageWidth = neededStateImageWidth;
|
_stateImageWidth = neededStateImageWidth;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue