Changeset 4086


Ignore:
Timestamp:
Dec 7, 2007, 3:41:46 AM (15 years ago)
Author:
livings124
Message:

group toolbar buttons consistently work in both text and icon modes

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/ButtonGroupToolbarItem.m

    r4085 r4086  
    4242{
    4343    NSSegmentedControl * control = (NSSegmentedControl *)[self view];
     44    NSLog(@"%d %d", [(NSSegmentedCell *)[control cell] tagForSegment: 0], [(NSSegmentedCell *)[control cell] tagForSegment: 1]);
    4445   
    4546    int i;
  • trunk/macosx/Controller.m

    r4085 r4086  
    27302730        [(NSSegmentedCell *)[segmentedControl cell] setTrackingMode: NSSegmentSwitchTrackingMomentary];
    27312731       
    2732         NSSize groupSize = NSMakeSize(72.0, 25.0);
    2733         [groupItem setMinSize: groupSize];
    2734         [groupItem setMaxSize: groupSize];
    2735        
    27362732        [groupItem setLabel: NSLocalizedString(@"Apply All", "All toolbar item -> label")];
    27372733        [groupItem setPaletteLabel: NSLocalizedString(@"Pause / Resume All", "All toolbar item -> palette label")];
     
    27412737        [groupItem setIdentifiers: [NSArray arrayWithObjects: TOOLBAR_PAUSE_ALL, TOOLBAR_RESUME_ALL, nil]];
    27422738       
     2739        [(NSSegmentedCell *)[segmentedControl cell] setTag: TOOLBAR_PAUSE_TAG forSegment: TOOLBAR_PAUSE_TAG];
    27432740        [segmentedControl setImage: [NSImage imageNamed: @"PauseAll.png"] forSegment: TOOLBAR_PAUSE_TAG];
    27442741        [(NSSegmentedCell *)[segmentedControl cell] setToolTip: NSLocalizedString(@"Pause all transfers",
    27452742                                                        "All toolbar item -> tooltip") forSegment: TOOLBAR_PAUSE_TAG];
    27462743       
     2744        [(NSSegmentedCell *)[segmentedControl cell] setTag: TOOLBAR_RESUME_TAG forSegment: TOOLBAR_RESUME_TAG];
    27472745        [segmentedControl setImage: [NSImage imageNamed: @"ResumeAll.png"] forSegment: TOOLBAR_RESUME_TAG];
    27482746        [(NSSegmentedCell *)[segmentedControl cell] setToolTip: NSLocalizedString(@"Resume all transfers",
    27492747                                                        "All toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG];
     2748        NSLog(@"%d %d", [(NSSegmentedCell *)[segmentedControl cell] tagForSegment: TOOLBAR_PAUSE_TAG],
     2749        [(NSSegmentedCell *)[segmentedControl cell] tagForSegment: TOOLBAR_RESUME_TAG]);
    27502750       
    27512751        [groupItem createMenu: [NSArray arrayWithObjects: NSLocalizedString(@"Pause All", "All toolbar item -> label"),
    27522752                                        NSLocalizedString(@"Resume All", "All toolbar item -> label"), nil]];
    27532753       
     2754        NSSize groupSize = NSMakeSize(72.0, 25.0);
     2755        [groupItem setMinSize: groupSize];
     2756        [groupItem setMaxSize: groupSize];
     2757       
    27542758        [segmentedControl release];
     2759       
    27552760        return [groupItem autorelease];
    27562761    }
     
    27762781        [groupItem setIdentifiers: [NSArray arrayWithObjects: TOOLBAR_PAUSE_SELECTED, TOOLBAR_RESUME_SELECTED, nil]];
    27772782       
     2783        [(NSSegmentedCell *)[segmentedControl cell] setTag: TOOLBAR_PAUSE_TAG forSegment: TOOLBAR_PAUSE_TAG];
    27782784        [segmentedControl setImage: [NSImage imageNamed: @"PauseSelected.png"] forSegment: TOOLBAR_PAUSE_TAG];
    27792785        [(NSSegmentedCell *)[segmentedControl cell] setToolTip: NSLocalizedString(@"Pause selected transfers",
    27802786                                                        "Selected toolbar item -> tooltip") forSegment: TOOLBAR_PAUSE_TAG];
    27812787       
     2788        [(NSSegmentedCell *)[segmentedControl cell] setTag: TOOLBAR_RESUME_TAG forSegment: TOOLBAR_RESUME_TAG];
    27822789        [segmentedControl setImage: [NSImage imageNamed: @"ResumeSelected.png"] forSegment: TOOLBAR_RESUME_TAG];
    27832790        [(NSSegmentedCell *)[segmentedControl cell] setToolTip: NSLocalizedString(@"Resume selected transfers",
     
    28102817- (void) allToolbarClicked: (id) sender
    28112818{
    2812     switch ([sender tag])
     2819    int tagValue = [sender isKindOfClass: [NSSegmentedControl class]]
     2820                    ? [(NSSegmentedCell *)[sender cell] tagForSegment: [sender selectedSegment]] : [sender tag];
     2821    switch (tagValue)
    28132822    {
    28142823        case TOOLBAR_PAUSE_TAG:
     
    28232832- (void) selectedToolbarClicked: (id) sender
    28242833{
    2825     switch ([sender tag])
     2834    int tagValue = [sender isKindOfClass: [NSSegmentedControl class]]
     2835                    ? [(NSSegmentedCell *)[sender cell] tagForSegment: [sender selectedSegment]] : [sender tag];
     2836    switch (tagValue)
    28262837    {
    28272838        case TOOLBAR_PAUSE_TAG:
Note: See TracChangeset for help on using the changeset viewer.