2 // PSMTabBarControlInspector.m
5 // Created by John Pannell on 12/21/05.
6 // Copyright Positive Spin Media 2005 . All rights reserved.
9 #import "PSMTabBarControlInspector.h"
10 #import "PSMTabBarControl.h"
12 #define kPSMStyleTag 0
13 #define kPSMCanCloseOnlyTabTag 1
14 #define kPSMHideForSingleTabTag 2
15 #define kPSMShowAddTabTag 3
16 #define kPSMMinWidthTag 4
17 #define kPSMMaxWidthTag 5
18 #define kPSMOptimumWidthTag 6
19 #define kPSMSizeToFitTag 7
20 #define kPSMAllowsDragBetweenWindows 8
22 @implementation PSMTabBarControlInspector
27 [NSBundle loadNibNamed:@"PSMTabBarControlInspector" owner:self];
33 if([sender tag] == kPSMStyleTag){
34 [[self object] setStyleNamed:[sender titleOfSelectedItem]];
36 } else if([sender tag] == kPSMCanCloseOnlyTabTag){
37 [[self object] setCanCloseOnlyTab:[sender state]];
39 } else if([sender tag] == kPSMHideForSingleTabTag){
40 [[self object] setHideForSingleTab:[sender state]];
42 } else if([sender tag] == kPSMShowAddTabTag){
43 [[self object] setShowAddTabButton:[sender state]];
45 } else if([sender tag] == kPSMMinWidthTag){
46 if([[self object] cellOptimumWidth] < [sender intValue]){
47 [[self object] setCellMinWidth:[[self object] cellOptimumWidth]];
48 [sender setIntValue:[[self object] cellOptimumWidth]];
50 [[self object] setCellMinWidth:[sender intValue]];
53 } else if([sender tag] == kPSMMaxWidthTag){
54 if([[self object] cellOptimumWidth] > [sender intValue]){
55 [[self object] setCellMaxWidth:[[self object] cellOptimumWidth]];
56 [sender setIntValue:[[self object] cellOptimumWidth]];
58 [[self object] setCellMaxWidth:[sender intValue]];
61 } else if([sender tag] == kPSMOptimumWidthTag){
62 if([[self object] cellMaxWidth] < [sender intValue]){
63 [[self object] setCellOptimumWidth:[[self object] cellMaxWidth]];
64 [sender setIntValue:[[self object] cellMaxWidth]];
65 } else if([[self object] cellMinWidth] > [sender intValue]){
66 [[self object] setCellOptimumWidth:[[self object] cellMinWidth]];
67 [sender setIntValue:[[self object] cellMinWidth]];
69 [[self object] setCellOptimumWidth:[sender intValue]];
72 } else if([sender tag] == kPSMSizeToFitTag){
73 [[self object] setSizeCellsToFit:[sender state]];
75 } else if([sender tag] == kPSMAllowsDragBetweenWindows){
76 [[self object] setAllowsDragBetweenWindows:[sender state]];
84 - (void)revert:(id)sender
86 [_stylePopUp selectItemWithTitle:[[self object] styleName]];
87 [_canCloseOnlyTab setState:[[self object] canCloseOnlyTab]];
88 [_hideForSingleTab setState:[[self object] hideForSingleTab]];
89 [_showAddTab setState:[[self object] showAddTabButton]];
90 [_cellMinWidth setIntValue:[[self object] cellMinWidth]];
91 [_cellMaxWidth setIntValue:[[self object] cellMaxWidth]];
92 [_cellOptimumWidth setIntValue:[[self object] cellOptimumWidth]];
93 [_sizeToFit setState:[[self object] sizeCellsToFit]];
94 [_allowsDragBetweenWindows setState:[[self object] allowsDragBetweenWindows]];
96 [super revert:sender];