Add missing defines to Tiger
[MacVim.git] / src / MacVim / PSMTabBarControl / source / PSMTabBarControl.h
blobf797804afe90d70a18d3ac4e0c32da38790b0695
1 //
2 // PSMTabBarControl.h
3 // PSMTabBarControl
4 //
5 // Created by John Pannell on 10/13/05.
6 // Copyright 2005 Positive Spin Media. All rights reserved.
7 //
9 /*
10 This view provides a control interface to manage a regular NSTabView. It looks and works like the tabbed browsing interface of many popular browsers.
13 #import <Cocoa/Cocoa.h>
15 #ifndef NSINTEGER_DEFINED
16 // NSInteger was introduced in 10.5
17 # if __LP64__ || NS_BUILD_32_LIKE_64
18 typedef long NSInteger;
19 typedef unsigned long NSUInteger;
20 # else
21 typedef int NSInteger;
22 typedef unsigned int NSUInteger;
23 # endif
24 # define NSINTEGER_DEFINED 1
25 #endif
27 #define kPSMTabBarControlHeight 22
28 // internal cell border
29 #define MARGIN_X 6
30 #define MARGIN_Y 3
31 // padding between objects
32 #define kPSMTabBarCellPadding 4
33 // fixed size objects
34 #define kPSMMinimumTitleWidth 30
35 #define kPSMTabBarIndicatorWidth 16.0
36 #define kPSMTabBarIconWidth 16.0
37 #define kPSMHideAnimationSteps 2.0
39 @class PSMOverflowPopUpButton;
40 @class PSMRolloverButton;
41 @class PSMTabBarCell;
42 @protocol PSMTabStyle;
44 enum {
45 PSMTab_SelectedMask = 1 << 1,
46 PSMTab_LeftIsSelectedMask = 1 << 2,
47 PSMTab_RightIsSelectedMask = 1 << 3,
48 PSMTab_PositionLeftMask = 1 << 4,
49 PSMTab_PositionMiddleMask = 1 << 5,
50 PSMTab_PositionRightMask = 1 << 6,
51 PSMTab_PositionSingleMask = 1 << 7
54 @interface PSMTabBarControl : NSControl
55 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
56 // 10.6 has turned delegate messages into formal protocols
57 <NSTabViewDelegate>
58 #endif
61 // control basics
62 NSMutableArray *_cells; // the cells that draw the tabs
63 IBOutlet NSTabView *tabView; // the tab view being navigated
64 PSMOverflowPopUpButton *_overflowPopUpButton; // for too many tabs
65 PSMRolloverButton *_addTabButton;
67 // drawing style
68 id<PSMTabStyle> style;
69 BOOL _canCloseOnlyTab;
70 BOOL _hideForSingleTab;
71 BOOL _showAddTabButton;
72 BOOL _sizeCellsToFit;
74 // cell width
75 int _cellMinWidth;
76 int _cellMaxWidth;
77 int _cellOptimumWidth;
79 // animation for hide/show
80 int _currentStep;
81 BOOL _isHidden;
82 BOOL _hideIndicators;
83 IBOutlet id partnerView; // gets resized when hide/show
84 BOOL _awakenedFromNib;
86 // drag and drop
87 NSEvent *_lastMouseDownEvent; // keep this for dragging reference
88 BOOL _allowsDragBetweenWindows;
89 BOOL _delegateHandlingDrag;
90 NSDragOperation _delegateInitialDragOperation;
92 // MVC help
93 IBOutlet id delegate;
96 // control characteristics
97 + (NSBundle *)bundle;
99 // control configuration
100 - (BOOL)canCloseOnlyTab;
101 - (void)setCanCloseOnlyTab:(BOOL)value;
102 - (NSString *)styleName;
103 - (void)setStyleNamed:(NSString *)name;
104 - (BOOL)hideForSingleTab;
105 - (void)setHideForSingleTab:(BOOL)value;
106 - (BOOL)showAddTabButton;
107 - (void)setShowAddTabButton:(BOOL)value;
108 - (int)cellMinWidth;
109 - (void)setCellMinWidth:(int)value;
110 - (int)cellMaxWidth;
111 - (void)setCellMaxWidth:(int)value;
112 - (int)cellOptimumWidth;
113 - (void)setCellOptimumWidth:(int)value;
114 - (BOOL)sizeCellsToFit;
115 - (void)setSizeCellsToFit:(BOOL)value;
116 - (BOOL)allowsDragBetweenWindows;
117 - (void)setAllowsDragBetweenWindows:(BOOL)flag;
119 // tool tips
120 - (void)setToolTip:(NSString *)value forTabViewItem:(NSTabViewItem *)tvi;
122 // accessors
123 - (NSTabView *)tabView;
124 - (void)setTabView:(NSTabView *)view;
125 - (id)delegate;
126 - (void)setDelegate:(id)object;
127 - (id)partnerView;
128 - (void)setPartnerView:(id)view;
130 // the buttons
131 - (PSMRolloverButton *)addTabButton;
132 - (PSMOverflowPopUpButton *)overflowPopUpButton;
133 - (NSMutableArray *)representedTabViewItems;
135 // special effects
136 - (void)hideTabBar:(BOOL)hide animate:(BOOL)animate;
138 @end
141 @interface NSObject (TabBarControlDelegateMethods)
142 - (BOOL)tabView:(NSTabView *)aTabView shouldCloseTabViewItem:(NSTabViewItem *)tabViewItem;
143 - (void)tabView:(NSTabView *)aTabView willCloseTabViewItem:(NSTabViewItem *)tabViewItem;
144 - (void)tabView:(NSTabView *)aTabView didCloseTabViewItem:(NSTabViewItem *)tabViewItem;
145 - (void)tabView:(NSTabView *)aTabView didDragTabViewItem:(NSTabViewItem *)tabViewItem toIndex:(int)idx;
147 - (NSDragOperation)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingEntered:(id <NSDraggingInfo>)sender forTabAtIndex:(NSUInteger)tabIndex;
148 - (NSDragOperation)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingUpdated:(id <NSDraggingInfo>)sender forTabAtIndex:(NSUInteger)tabIndex;
149 - (void)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingExited:(id <NSDraggingInfo>)sender forTabAtIndex:(NSUInteger)tabIndex;
150 - (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl prepareForDragOperation:(id <NSDraggingInfo>)sender forTabAtIndex:(NSUInteger)tabIndex;
151 - (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl performDragOperation:(id <NSDraggingInfo>)sender forTabAtIndex:(NSUInteger)tabIndex;
152 - (void)tabBarControl:(PSMTabBarControl *)theTabBarControl concludeDragOperation:(id <NSDraggingInfo>)sender forTabAtIndex:(NSUInteger)tabIndex;
153 @end