bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix: NSMenuView.m, -itemAdded:


From: Georg Fleischmann
Subject: Fix: NSMenuView.m, -itemAdded:
Date: Tue, 11 Jun 2002 22:32:40 GMT

here is a patch for NSMenuView to highlight/unhighlight the items correctly,  
when an item is added.

Georg



2002-06-11  Georg Fleischmann
        * gui/Source/NSMenuView.m [NSMenuView -itemAdded:]:
        highlighting corrected



*** gui/Source/NSMenuView.m.old Tue Jun 11 21:36:51 2002
--- gui/Source/NSMenuView.m     Wed Jun 12 00:06:47 2002
***************
*** 309,314 ****
--- 309,315 ----
  {
    int         index  = [[[notification userInfo]
                          objectForKey: @"NSMenuItemIndex"] intValue];
+   int         hIndex = [self highlightedItemIndex];
    NSMenuItem *anItem = [_items_link objectAtIndex: index];
    id          aCell  = [NSMenuItemCell new];

***************
*** 316,327 ****
    [aCell setMenuView: self];
    [aCell setFont: _font];

!   if ([self highlightedItemIndex] == index)
!     [aCell setHighlighted: YES];
!   else
!     [aCell setHighlighted: NO];

    [_itemCells insertObject: aCell atIndex: index];
    [aCell setNeedsSizing: YES];
    RELEASE(aCell);

--- 317,330 ----
    [aCell setMenuView: self];
    [aCell setFont: _font];

!   if (hIndex != -1)
!     [[_itemCells objectAtIndex: hIndex] setHighlighted: NO];

    [_itemCells insertObject: aCell atIndex: index];
+
+   if (hIndex != -1)
+     [[_itemCells objectAtIndex: hIndex] setHighlighted: YES];
+
    [aCell setNeedsSizing: YES];
    RELEASE(aCell);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]