mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-26 13:30:55 +00:00
Minor fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5672 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c23e5e2e11
commit
623f5da51a
2 changed files with 122 additions and 121 deletions
|
@ -3,6 +3,7 @@ Wed Jan 5 16:27:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
|||
* Source/NSMenuItem.m: minor fixes and tidying.
|
||||
* Source/NSMenuView.m: reverted to previous version - last change
|
||||
broke much more than it fixed.
|
||||
Also tidied coding style a bit and fixed a couple of encode/decode bugs.
|
||||
|
||||
Mon Jan 3 18:35:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
|
|
|
@ -46,25 +46,25 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
|
||||
@implementation NSMenuView
|
||||
|
||||
//
|
||||
// Class methods.
|
||||
//
|
||||
/*
|
||||
* Class methods.
|
||||
*/
|
||||
+ (float) menuBarHeight
|
||||
{
|
||||
return GSMenuBarHeight;
|
||||
}
|
||||
|
||||
//
|
||||
// NSView overrides
|
||||
//
|
||||
/*
|
||||
* NSView overrides
|
||||
*/
|
||||
- (BOOL) acceptsFirstMouse: (NSEvent*)theEvent
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
//
|
||||
// Init methods.
|
||||
//
|
||||
/*
|
||||
* Init methods.
|
||||
*/
|
||||
- (id) init
|
||||
{
|
||||
return [self initWithFrame: NSZeroRect];
|
||||
|
@ -98,14 +98,14 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
return self;
|
||||
}
|
||||
|
||||
//
|
||||
// Getting and Setting Menu View Attributes
|
||||
//
|
||||
/*
|
||||
* Getting and Setting Menu View Attributes
|
||||
*/
|
||||
- (void) setMenu: (NSMenu*)menu
|
||||
{
|
||||
NSNotificationCenter *theCenter = [NSNotificationCenter defaultCenter];
|
||||
|
||||
if (menuv_menu)
|
||||
if (menuv_menu != nil)
|
||||
{
|
||||
// Remove this menu view from the old menu list of observers.
|
||||
[theCenter removeObserver: self name: nil object: menuv_menu];
|
||||
|
@ -276,9 +276,9 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
return menuv_horizontalEdgePad;
|
||||
}
|
||||
|
||||
//
|
||||
// Notification Methods
|
||||
//
|
||||
/*
|
||||
* Notification Methods
|
||||
*/
|
||||
- (void) itemChanged: (NSNotification*)notification
|
||||
{
|
||||
int index = [[[notification userInfo] objectForKey: @"NSMenuItemIndex"]
|
||||
|
@ -334,9 +334,9 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
[self setNeedsSizing: YES];
|
||||
}
|
||||
|
||||
//
|
||||
// Working with Submenus.
|
||||
//
|
||||
/*
|
||||
* Working with Submenus.
|
||||
*/
|
||||
- (void) detachSubmenu
|
||||
{
|
||||
NSMenu *attachedMenu = [menuv_menu attachedMenu];
|
||||
|
@ -362,11 +362,12 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
|
||||
- (void) attachSubmenuForItemAtIndex: (int)index
|
||||
{
|
||||
// Transient menus are used for torn-off menus, which are already on the
|
||||
// screen and for sons of transient menus. As transients disappear as
|
||||
// soon as we release the mouse the user will be able to leave submenus
|
||||
// open on the screen and interact with other menus at the same time.
|
||||
|
||||
/*
|
||||
* Transient menus are used for torn-off menus, which are already on the
|
||||
* screen and for sons of transient menus. As transients disappear as
|
||||
* soon as we release the mouse the user will be able to leave submenus
|
||||
* open on the screen and interact with other menus at the same time.
|
||||
*/
|
||||
NSMenu *attachableMenu = [[menuv_items_link objectAtIndex: index] submenu];
|
||||
|
||||
if ([attachableMenu isTornOff] || [menuv_menu isFollowTransient])
|
||||
|
@ -380,9 +381,9 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
[attachableMenu display];
|
||||
}
|
||||
|
||||
//
|
||||
// Calculating Menu Geometry
|
||||
//
|
||||
/*
|
||||
* Calculating Menu Geometry
|
||||
*/
|
||||
- (void) update
|
||||
{
|
||||
[menuv_menu update];
|
||||
|
@ -634,9 +635,9 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
display: YES];
|
||||
}
|
||||
|
||||
//
|
||||
// Drawing.
|
||||
//
|
||||
/*
|
||||
* Drawing.
|
||||
*/
|
||||
- (void) drawRect: (NSRect)rect
|
||||
{
|
||||
int i;
|
||||
|
@ -669,9 +670,9 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Event Handling
|
||||
//
|
||||
/*
|
||||
* Event Handling
|
||||
*/
|
||||
- (void) performActionWithHighlightingForItemAtIndex: (int)index
|
||||
{
|
||||
NSMenu *candidateMenu = menuv_menu;
|
||||
|
@ -680,9 +681,9 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
|
||||
for (;;)
|
||||
{
|
||||
if (![candidateMenu supermenu] ||
|
||||
[candidateMenu isAttached] ||
|
||||
[candidateMenu isTornOff])
|
||||
if (![candidateMenu supermenu]
|
||||
|| [candidateMenu isAttached]
|
||||
|| [candidateMenu isTornOff])
|
||||
{
|
||||
targetMenuView = [candidateMenu menuRepresentation];
|
||||
|
||||
|
@ -819,9 +820,8 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
}
|
||||
|
||||
// Close menus if needed.
|
||||
if (!menuv_keepAttachedMenus ||
|
||||
index == -1 ||
|
||||
(alreadyAttachedMenu && [alreadyAttachedMenu isFollowTransient]))
|
||||
if (!menuv_keepAttachedMenus || index == -1
|
||||
|| (alreadyAttachedMenu && [alreadyAttachedMenu isFollowTransient]))
|
||||
{
|
||||
NSMenu *parentMenu;
|
||||
NSMenu *masterMenu;
|
||||
|
@ -884,9 +884,9 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
return [menuv_menu performKeyEquivalent: theEvent];
|
||||
}
|
||||
|
||||
//
|
||||
// NSCoding Protocol
|
||||
//
|
||||
/*
|
||||
* NSCoding Protocol
|
||||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)encoder
|
||||
{
|
||||
[super encodeWithCoder: encoder];
|
||||
|
@ -904,8 +904,8 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
{
|
||||
self = [super initWithCoder: decoder];
|
||||
|
||||
menuv_itemCells = [decoder decodeObject];
|
||||
menuv_font = [decoder decodeObject];
|
||||
[decoder decodeValueOfObjCType: @encode(id) at: &menuv_itemCells];
|
||||
[decoder decodeValueOfObjCType: @encode(id) at: &menuv_font];
|
||||
menuv_menu = [decoder decodeObject];
|
||||
menuv_items_link = [decoder decodeObject];
|
||||
[decoder decodeValueOfObjCType: @encode(BOOL) at: &menuv_horizontal];
|
||||
|
|
Loading…
Reference in a new issue