Changeset 4082


Ignore:
Timestamp:
Dec 6, 2007, 8:09:45 PM (14 years ago)
Author:
livings124
Message:

get new toolbar buttons working in text-only mode

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/ButtonGroupToolbarItem.h

    r4081 r4082  
    2727@interface ButtonGroupToolbarItem : NSToolbarItem
    2828{
    29     NSArray * fIdentifiers;
     29    NSArray * fLabels, * fIdentifiers;
    3030}
    3131
     32- (void) setLabels: (NSArray *) labels;
    3233- (void) setIdentifiers: (NSArray *) identifiers;
    3334
  • trunk/macosx/ButtonGroupToolbarItem.m

    r4081 r4082  
    3333}
    3434
     35- (void) setLabels: (NSArray *) labels
     36{
     37    [fLabels release];
     38    fLabels = [labels retain];
     39}
     40
    3541- (void) setIdentifiers: (NSArray *) identifiers
    3642{
     
    4955}
    5056
    51 /*- (NSMenuItem *) menuFormRepresentation
     57- (NSMenuItem *) menuFormRepresentation
    5258{
    53     NSMenuItem * menu = [[NSMenuItem alloc] initWithTitle: [self label] action: [self action] keyEquivalent: @""];
    54     [menu setTarget: [self target]];
    55     [menu setEnabled: [[self target] validateToolbarItem: self]];
     59    NSMenuItem * menuItem = [[NSMenuItem alloc] initWithTitle: [self label] action: NULL keyEquivalent: @""];
     60    NSMenu * menu = [[NSMenu alloc] initWithTitle: [self label]];
     61    [menuItem setSubmenu: menu];
    5662   
    57     return [menu autorelease];
    58 }*/
     63    [menu setAutoenablesItems: NO];
     64   
     65    NSMenuItem * addItem;
     66    int i;
     67    for (i = 0; i < [(NSSegmentedControl *)[self view] segmentCount]; i++)
     68    {
     69        addItem = [[NSMenuItem alloc] initWithTitle: [fLabels objectAtIndex: i] action: [self action] keyEquivalent: @""];
     70        [addItem setTarget: [self target]];
     71        [addItem setTag: i];
     72        [addItem setEnabled: [[self target] validateToolbarItem:
     73            [[[NSToolbarItem alloc] initWithItemIdentifier: [fIdentifiers objectAtIndex: i]] autorelease]]];
     74       
     75        [menu addItem: addItem];
     76        [addItem release];
     77    }
     78   
     79    [menu release];
     80    return [menuItem autorelease];
     81}
    5982
    6083@end
  • trunk/macosx/ButtonToolbarItem.m

    r4056 r4082  
    3434- (NSMenuItem *) menuFormRepresentation
    3535{
    36     NSMenuItem * menu = [[NSMenuItem alloc] initWithTitle: [self label] action: [self action] keyEquivalent: @""];
    37     [menu setTarget: [self target]];
    38     [menu setEnabled: [[self target] validateToolbarItem: self]];
     36    NSMenuItem * menuItem = [[NSMenuItem alloc] initWithTitle: [self label] action: [self action] keyEquivalent: @""];
     37    [menuItem setTarget: [self target]];
     38    [menuItem setEnabled: [[self target] validateToolbarItem: self]];
    3939   
    40     return [menu autorelease];
     40    return [menuItem autorelease];
    4141}
    4242
  • trunk/macosx/Controller.m

    r4081 r4082  
    27312731       
    27322732        [groupItem setIdentifiers: [NSArray arrayWithObjects: TOOLBAR_PAUSE_ALL, TOOLBAR_RESUME_ALL, nil]];
     2733        [groupItem setLabels: [NSArray arrayWithObjects: NSLocalizedString(@"Pause All", "All toolbar item -> label"),
     2734                                        NSLocalizedString(@"Resume All", "All toolbar item -> label"), nil]];
    27332735       
    27342736        [segmentedControl setImage: [NSImage imageNamed: @"PauseAll.png"] forSegment: 0];
     
    27642766       
    27652767        [groupItem setIdentifiers: [NSArray arrayWithObjects: TOOLBAR_PAUSE_SELECTED, TOOLBAR_RESUME_SELECTED, nil]];
     2768        [groupItem setLabels: [NSArray arrayWithObjects: NSLocalizedString(@"Pause Selected", "Selected toolbar item -> label"),
     2769                                        NSLocalizedString(@"Resume Selected", "Selected toolbar item -> label"), nil]];
    27662770       
    27672771        [segmentedControl setImage: [NSImage imageNamed: @"PauseSelected.png"] forSegment: 0];
     
    27952799- (void) allToolbarClicked: (id) sender
    27962800{
    2797     if ([sender selectedSegment] == 0)
     2801    if ([sender tag] == 0)
    27982802        [self stopAllTorrents: sender];
    2799     else if ([sender selectedSegment] == 1)
     2803    else if ([sender tag] == 1)
    28002804        [self resumeAllTorrents: sender];
    28012805    else;
     
    28052809- (void) selectedToolbarClicked: (id) sender
    28062810{
    2807     if ([sender selectedSegment] == 0)
     2811    if ([sender tag] == 0)
    28082812        [self stopSelectedTorrents: sender];
    2809     else if ([sender selectedSegment] == 1)
     2813    else if ([sender tag] == 1)
    28102814        [self resumeSelectedTorrents: sender];
    28112815    else;
Note: See TracChangeset for help on using the changeset viewer.