Ignore:
Timestamp:
Aug 20, 2007, 4:49:53 PM (15 years ago)
Author:
livings124
Message:

add a menu additions class

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/TorrentTableView.m

    r2840 r2879  
    2727#import "Controller.h"
    2828#import "Torrent.h"
     29#import "NSMenuAdditions.h"
    2930
    3031#define PADDING 3.0
     
    5354
    5455- (void) updateFileMenu: (NSMenu *) menu forFiles: (NSArray *) files;
    55 
    56 - (void) moveItemsFromMenu: (NSMenu *) oldMenu inRange: (NSRange) range toMenu: (NSMenu *) newMenu;
    5756
    5857@end
     
    320319    //add file menu items to action menu
    321320    NSRange range = NSMakeRange(0, [fileMenu numberOfItems]);
    322     [self moveItemsFromMenu: fileMenu inRange: range toMenu: fActionMenu];
     321    [fActionMenu moveItemsToEndFromMenu: fileMenu inRange: range];
    323322   
    324323    //place menu below button
     
    336335    //move file menu items back to the torrent's file menu
    337336    range.location = [fActionMenu numberOfItems] - range.length;
    338     [self moveItemsFromMenu: fActionMenu inRange: range toMenu: fileMenu];
     337    [fileMenu moveItemsToEndFromMenu: fActionMenu inRange: range];
    339338   
    340339    [fMenuTorrent release];
     
    636635}
    637636
    638 #warning move to additions
    639 - (void) moveItemsFromMenu: (NSMenu *) oldMenu inRange: (NSRange) range toMenu: (NSMenu *) newMenu
    640 {
    641     NSMenuItem * item;
    642     int i;
    643     for (i=0; i<range.length; i++)
    644     {
    645         item = [[oldMenu itemAtIndex: range.location] retain];
    646         [oldMenu removeItem: item];
    647         [newMenu addItem: item];
    648         [item release];
    649     }
    650 }
    651 
    652637@end
Note: See TracChangeset for help on using the changeset viewer.