mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 11:21:55 +00:00
Reformatted to comply to coding standards
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16293 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7f06057763
commit
77a4ed465b
1 changed files with 89 additions and 89 deletions
|
@ -143,11 +143,11 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
|
|
||||||
- (id)initAsTearOff
|
- (id)initAsTearOff
|
||||||
{
|
{
|
||||||
[self initWithFrame: NSZeroRect];
|
[self initWithFrame: NSZeroRect];
|
||||||
|
|
||||||
if (_menu)
|
|
||||||
[_menu setTornOff: YES];
|
|
||||||
|
|
||||||
|
if (_menu)
|
||||||
|
[_menu setTornOff: YES];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,26 +450,26 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
{
|
{
|
||||||
NSDebugLLog (@"NSMenu", @"update called on menu view");
|
NSDebugLLog (@"NSMenu", @"update called on menu view");
|
||||||
|
|
||||||
if (![_menu _ownedByPopUp] && !_titleView)
|
if (![_menu _ownedByPopUp] && !_titleView)
|
||||||
{
|
{
|
||||||
// Add title view. If this menu not owned by popup
|
// Add title view. If this menu not owned by popup
|
||||||
_titleView = [[NSMenuWindowTitleView alloc] init];
|
_titleView = [[NSMenuWindowTitleView alloc] init];
|
||||||
[self addSubview: _titleView];
|
[self addSubview: _titleView];
|
||||||
[_titleView release];
|
[_titleView release];
|
||||||
}
|
}
|
||||||
else if ([_menu _ownedByPopUp] && _titleView)
|
else if ([_menu _ownedByPopUp] && _titleView)
|
||||||
{
|
{
|
||||||
// Remove title view if this menu owned by popup
|
// Remove title view if this menu owned by popup
|
||||||
[_titleView removeFromSuperview];
|
[_titleView removeFromSuperview];
|
||||||
_titleView = nil;
|
_titleView = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([_titleView menu] == nil && _titleView)
|
if ([_titleView menu] == nil && _titleView)
|
||||||
[_titleView setMenu: _menu];
|
[_titleView setMenu: _menu];
|
||||||
|
|
||||||
// Resize it anyway.
|
// Resize it anyway.
|
||||||
[self sizeToFit];
|
[self sizeToFit];
|
||||||
|
|
||||||
if ([_menu isTornOff] && ![_menu isTransient])
|
if ([_menu isTornOff] && ![_menu isTransient])
|
||||||
{
|
{
|
||||||
[_titleView addCloseButton];
|
[_titleView addCloseButton];
|
||||||
|
@ -563,16 +563,16 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
neededStateImageWidth = aStateImageWidth;
|
neededStateImageWidth = aStateImageWidth;
|
||||||
|
|
||||||
if (anImageAndTitleWidth > neededImageAndTitleWidth)
|
if (anImageAndTitleWidth > neededImageAndTitleWidth)
|
||||||
neededImageAndTitleWidth = anImageAndTitleWidth;
|
neededImageAndTitleWidth = anImageAndTitleWidth;
|
||||||
|
|
||||||
if (aKeyEquivalentWidth > neededKeyEquivalentWidth)
|
if (aKeyEquivalentWidth > neededKeyEquivalentWidth)
|
||||||
neededKeyEquivalentWidth = aKeyEquivalentWidth;
|
neededKeyEquivalentWidth = aKeyEquivalentWidth;
|
||||||
|
|
||||||
// Title view width less than item's left part width
|
// Title view width less than item's left part width
|
||||||
if ((anImageAndTitleWidth + aStateImageWidth)
|
if ((anImageAndTitleWidth + aStateImageWidth)
|
||||||
> neededImageAndTitleWidth)
|
> neededImageAndTitleWidth)
|
||||||
wideTitleView = 0;
|
wideTitleView = 0;
|
||||||
|
|
||||||
// Popup menu has only one item with nibble or arrow image
|
// Popup menu has only one item with nibble or arrow image
|
||||||
if (anImageWidth)
|
if (anImageWidth)
|
||||||
popupImageWidth = anImageWidth;
|
popupImageWidth = anImageWidth;
|
||||||
|
@ -582,38 +582,38 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
_stateImageWidth = neededStateImageWidth;
|
_stateImageWidth = neededStateImageWidth;
|
||||||
_imageAndTitleWidth = neededImageAndTitleWidth;
|
_imageAndTitleWidth = neededImageAndTitleWidth;
|
||||||
_keyEqWidth = neededKeyEquivalentWidth;
|
_keyEqWidth = neededKeyEquivalentWidth;
|
||||||
|
|
||||||
accumulatedOffset = _horizontalEdgePad;
|
accumulatedOffset = _horizontalEdgePad;
|
||||||
if (howMany)
|
if (howMany)
|
||||||
{
|
{
|
||||||
// Calculate the offsets and cache them.
|
// Calculate the offsets and cache them.
|
||||||
if (neededStateImageWidth)
|
if (neededStateImageWidth)
|
||||||
{
|
{
|
||||||
_stateImageOffset = accumulatedOffset;
|
_stateImageOffset = accumulatedOffset;
|
||||||
accumulatedOffset += neededStateImageWidth += _horizontalEdgePad;
|
accumulatedOffset += neededStateImageWidth += _horizontalEdgePad;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (neededImageAndTitleWidth)
|
if (neededImageAndTitleWidth)
|
||||||
{
|
{
|
||||||
_imageAndTitleOffset = accumulatedOffset;
|
_imageAndTitleOffset = accumulatedOffset;
|
||||||
accumulatedOffset += neededImageAndTitleWidth;
|
accumulatedOffset += neededImageAndTitleWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wideTitleView)
|
if (wideTitleView)
|
||||||
{
|
{
|
||||||
_keyEqOffset = accumulatedOffset = neededImageAndTitleWidth
|
_keyEqOffset = accumulatedOffset = neededImageAndTitleWidth
|
||||||
+ (3 * _horizontalEdgePad);
|
+ (3 * _horizontalEdgePad);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_keyEqOffset = accumulatedOffset += (2 * _horizontalEdgePad);
|
_keyEqOffset = accumulatedOffset += (2 * _horizontalEdgePad);
|
||||||
}
|
}
|
||||||
accumulatedOffset += neededKeyEquivalentWidth + _horizontalEdgePad;
|
accumulatedOffset += neededKeyEquivalentWidth + _horizontalEdgePad;
|
||||||
|
|
||||||
if ([_menu supermenu] != nil && neededKeyEquivalentWidth < 8)
|
if ([_menu supermenu] != nil && neededKeyEquivalentWidth < 8)
|
||||||
{
|
{
|
||||||
accumulatedOffset += 8 - neededKeyEquivalentWidth;
|
accumulatedOffset += 8 - neededKeyEquivalentWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -729,7 +729,7 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
for (i = 0; i < howMany; i++)
|
for (i = 0; i < howMany; i++)
|
||||||
{
|
{
|
||||||
NSRect aRect = [self rectOfItemAtIndex: i];
|
NSRect aRect = [self rectOfItemAtIndex: i];
|
||||||
|
|
||||||
aRect = _addLeftBorderOffsetToRect(aRect);
|
aRect = _addLeftBorderOffsetToRect(aRect);
|
||||||
|
|
||||||
if (NSMouseInRect(point, aRect, NO))
|
if (NSMouseInRect(point, aRect, NO))
|
||||||
|
@ -802,12 +802,12 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
cellFrame.origin = [_window convertScreenToBase: screenRect.origin];
|
cellFrame.origin = [_window convertScreenToBase: screenRect.origin];
|
||||||
cellFrame = [self convertRect: cellFrame fromView: nil];
|
cellFrame = [self convertRect: cellFrame fromView: nil];
|
||||||
|
|
||||||
// Only call update if needed.
|
// Only call update if needed.
|
||||||
if ((NSEqualSizes(_cellSize, cellFrame.size) == NO) || _needsSizing)
|
if ((NSEqualSizes(_cellSize, cellFrame.size) == NO) || _needsSizing)
|
||||||
{
|
{
|
||||||
_cellSize = cellFrame.size;
|
_cellSize = cellFrame.size;
|
||||||
[self update];
|
[self update];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compute the frame
|
* Compute the frame
|
||||||
|
@ -1037,10 +1037,10 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
candidateMenu = [_menu supermenu];
|
candidateMenu = [_menu supermenu];
|
||||||
while (candidateMenu
|
while (candidateMenu
|
||||||
&& !NSMouseInRect (locationInScreenCoordinates,
|
&& !NSMouseInRect (locationInScreenCoordinates,
|
||||||
[[candidateMenu window] frame],
|
[[candidateMenu window] frame],
|
||||||
NO) // not found yet
|
NO) // not found yet
|
||||||
&& (! ([candidateMenu isTornOff]
|
&& (! ([candidateMenu isTornOff]
|
||||||
&& ![candidateMenu isTransient])) // no root of display tree
|
&& ![candidateMenu isTransient])) // no root of display tree
|
||||||
&& [candidateMenu isAttached]) // has displayed parent
|
&& [candidateMenu isAttached]) // has displayed parent
|
||||||
{
|
{
|
||||||
candidateMenu = [candidateMenu supermenu];
|
candidateMenu = [candidateMenu supermenu];
|
||||||
|
@ -1055,15 +1055,15 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
// menu and the attached menu is already correct.
|
// menu and the attached menu is already correct.
|
||||||
[[[candidateMenu attachedMenu] menuRepresentation]
|
[[[candidateMenu attachedMenu] menuRepresentation]
|
||||||
detachSubmenu];
|
detachSubmenu];
|
||||||
|
|
||||||
// Reset highlighted index for this menu.
|
// Reset highlighted index for this menu.
|
||||||
// This way if we return to this submenu later there
|
// This way if we return to this submenu later there
|
||||||
// won't be a highlighted item.
|
// won't be a highlighted item.
|
||||||
[[[candidateMenu attachedMenu] menuRepresentation]
|
[[[candidateMenu attachedMenu] menuRepresentation]
|
||||||
setHighlightedItemIndex: -1];
|
setHighlightedItemIndex: -1];
|
||||||
|
|
||||||
return [[candidateMenu menuRepresentation]
|
return [[candidateMenu menuRepresentation]
|
||||||
trackWithEvent: original];
|
trackWithEvent: original];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3b - Check if we enter the attached submenu
|
// 3b - Check if we enter the attached submenu
|
||||||
|
@ -1440,12 +1440,12 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
// create the menu's close button
|
// create the menu's close button
|
||||||
NSImage *closeImage = [NSImage imageNamed: @"common_Close"];
|
NSImage *closeImage = [NSImage imageNamed: @"common_Close"];
|
||||||
NSImage *closeHImage = [NSImage imageNamed: @"common_CloseH"];
|
NSImage *closeHImage = [NSImage imageNamed: @"common_CloseH"];
|
||||||
NSRect rect;
|
NSRect rect;
|
||||||
|
|
||||||
imageSize = [closeImage size];
|
imageSize = [closeImage size];
|
||||||
rect = NSMakeRect (_frame.size.width - imageSize.width - 4,
|
rect = NSMakeRect (_frame.size.width - imageSize.width - 4,
|
||||||
(_frame.size.height - imageSize.height) / 2 ,
|
(_frame.size.height - imageSize.height) / 2 ,
|
||||||
imageSize.width, imageSize.height );
|
imageSize.width, imageSize.height );
|
||||||
|
|
||||||
button = [[NSButton alloc] initWithFrame: rect];
|
button = [[NSButton alloc] initWithFrame: rect];
|
||||||
[button setRefusesFirstResponder: YES];
|
[button setRefusesFirstResponder: YES];
|
||||||
|
@ -1472,10 +1472,10 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
if (button == nil)
|
if (button == nil)
|
||||||
[self createButton];
|
[self createButton];
|
||||||
|
|
||||||
// Update location
|
// Update location
|
||||||
[button setFrameOrigin:
|
[button setFrameOrigin:
|
||||||
NSMakePoint (_frame.size.width - imageSize.width - 4,
|
NSMakePoint (_frame.size.width - imageSize.width - 4,
|
||||||
(_frame.size.height - imageSize.height) / 2)];
|
(_frame.size.height - imageSize.height) / 2)];
|
||||||
|
|
||||||
[self addSubview: button];
|
[self addSubview: button];
|
||||||
[self setNeedsDisplay: YES];
|
[self setNeedsDisplay: YES];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue