diff options
author | Sven Weidauer <sven.weidauer@gmail.com> | 2011-01-26 10:52:13 +0000 |
---|---|---|
committer | Sven Weidauer <sven.weidauer@gmail.com> | 2011-01-26 10:52:13 +0000 |
commit | 7b2694e9f6c35d9f50c3fb3cf38b0fc766478162 (patch) | |
tree | c4e3d07a6bb51de884f53312a96d05849f072db1 /cocoa/PSMTabBarControl/PSMTabBarControl.h | |
parent | a663cf8f84942e1147d1d2f3db292308639c7fa5 (diff) | |
download | netsurf-7b2694e9f6c35d9f50c3fb3cf38b0fc766478162.tar.gz netsurf-7b2694e9f6c35d9f50c3fb3cf38b0fc766478162.tar.bz2 |
Updated PSMTabBarControl source code to version from https://github.com/dergraf83/PSMTabBarControl
svn path=/trunk/netsurf/; revision=11490
Diffstat (limited to 'cocoa/PSMTabBarControl/PSMTabBarControl.h')
-rw-r--r-- | cocoa/PSMTabBarControl/PSMTabBarControl.h | 159 |
1 files changed, 82 insertions, 77 deletions
diff --git a/cocoa/PSMTabBarControl/PSMTabBarControl.h b/cocoa/PSMTabBarControl/PSMTabBarControl.h index c61b92f42..5ad02e5c1 100644 --- a/cocoa/PSMTabBarControl/PSMTabBarControl.h +++ b/cocoa/PSMTabBarControl/PSMTabBarControl.h @@ -7,33 +7,36 @@ // /* - This view provides a control interface to manage a regular NSTabView. It looks and works like the tabbed browsing interface of many popular browsers. + This view provides a control interface to manage a regular NSTabView. It looks and works like the tabbed browsing interface of many popular browsers. */ #import <Cocoa/Cocoa.h> -#define PSMTabDragDidEndNotification @"PSMTabDragDidEndNotification" -#define PSMTabDragDidBeginNotification @"PSMTabDragDidBeginNotification" +#define PSMTabDragDidEndNotification @ "PSMTabDragDidEndNotification" +#define PSMTabDragDidBeginNotification @ "PSMTabDragDidBeginNotification" -#define kPSMTabBarControlHeight 22 +#define kPSMTabBarControlHeight 22 // internal cell border -#define MARGIN_X 6 -#define MARGIN_Y 3 +#define MARGIN_X 6 +#define MARGIN_Y 3 // padding between objects -#define kPSMTabBarCellPadding 4 +#define kPSMTabBarCellPadding 4 // fixed size objects -#define kPSMMinimumTitleWidth 30 -#define kPSMTabBarIndicatorWidth 16.0 -#define kPSMTabBarIconWidth 16.0 -#define kPSMHideAnimationSteps 3.0 +#define kPSMMinimumTitleWidth 30 +#define kPSMTabBarIndicatorWidth 16.0 +#define kPSMTabBarIconWidth 16.0 +#define kPSMHideAnimationSteps 3.0 // Value used in _currentStep to indicate that resizing operation is not in progress -#define kPSMIsNotBeingResized -1 +#define kPSMIsNotBeingResized -1 // Value used in _currentStep when a resizing operation has just been started -#define kPSMStartResizeAnimation 0 +#define kPSMStartResizeAnimation 0 -@class PSMOverflowPopUpButton, PSMRolloverButton, PSMTabBarCell, PSMTabBarController; +@class PSMOverflowPopUpButton; +@class PSMRolloverButton; +@class PSMTabBarCell; +@class PSMTabBarController; @protocol PSMTabStyle; typedef enum { @@ -47,72 +50,72 @@ typedef enum { } PSMTabBarTearOffStyle; enum { - PSMTab_SelectedMask = 1 << 1, - PSMTab_LeftIsSelectedMask = 1 << 2, - PSMTab_RightIsSelectedMask = 1 << 3, - PSMTab_PositionLeftMask = 1 << 4, - PSMTab_PositionMiddleMask = 1 << 5, - PSMTab_PositionRightMask = 1 << 6, - PSMTab_PositionSingleMask = 1 << 7 + PSMTab_SelectedMask = 1 << 1, + PSMTab_LeftIsSelectedMask = 1 << 2, + PSMTab_RightIsSelectedMask = 1 << 3, + PSMTab_PositionLeftMask = 1 << 4, + PSMTab_PositionMiddleMask = 1 << 5, + PSMTab_PositionRightMask = 1 << 6, + PSMTab_PositionSingleMask = 1 << 7, }; @interface PSMTabBarControl : NSControl { - - // control basics - NSMutableArray *_cells; // the cells that draw the tabs - IBOutlet NSTabView *tabView; // the tab view being navigated - PSMOverflowPopUpButton *_overflowPopUpButton; // for too many tabs - PSMRolloverButton *_addTabButton; - PSMTabBarController *_controller; - - // Spring-loading. - NSTimer *_springTimer; - NSTabViewItem *_tabViewItemWithSpring; - - // drawing style - id<PSMTabStyle> style; - BOOL _canCloseOnlyTab; - BOOL _disableTabClose; - BOOL _hideForSingleTab; - BOOL _showAddTabButton; - BOOL _sizeCellsToFit; - BOOL _useOverflowMenu; - BOOL _alwaysShowActiveTab; - BOOL _allowsScrubbing; - NSInteger _resizeAreaCompensation; - PSMTabBarOrientation _orientation; - BOOL _automaticallyAnimates; - NSTimer *_animationTimer; - PSMTabBarTearOffStyle _tearOffStyle; - + + // control basics + NSMutableArray *_cells; // the cells that draw the tabs + IBOutlet NSTabView *tabView; // the tab view being navigated + PSMOverflowPopUpButton *_overflowPopUpButton; // for too many tabs + PSMRolloverButton *_addTabButton; + PSMTabBarController *_controller; + + // Spring-loading. + NSTimer *_springTimer; + NSTabViewItem *_tabViewItemWithSpring; + + // drawing style + id<PSMTabStyle> style; + BOOL _canCloseOnlyTab; + BOOL _disableTabClose; + BOOL _hideForSingleTab; + BOOL _showAddTabButton; + BOOL _sizeCellsToFit; + BOOL _useOverflowMenu; + BOOL _alwaysShowActiveTab; + BOOL _allowsScrubbing; + NSInteger _resizeAreaCompensation; + PSMTabBarOrientation _orientation; + BOOL _automaticallyAnimates; + NSTimer *_animationTimer; + PSMTabBarTearOffStyle _tearOffStyle; + // behavior - BOOL _allowsBackgroundTabClosing; - BOOL _selectsTabsOnMouseDown; - + BOOL _allowsBackgroundTabClosing; + BOOL _selectsTabsOnMouseDown; + // vertical tab resizing - BOOL _allowsResizing; - BOOL _resizing; - - // cell width - NSInteger _cellMinWidth; - NSInteger _cellMaxWidth; - NSInteger _cellOptimumWidth; - - // animation for hide/show - NSInteger _currentStep; - BOOL _isHidden; - IBOutlet id partnerView; // gets resized when hide/show - BOOL _awakenedFromNib; - NSInteger _tabBarWidth; - NSTimer *_showHideAnimationTimer; - - // drag and drop - NSEvent *_lastMouseDownEvent; // keep this for dragging reference - BOOL _didDrag; - BOOL _closeClicked; - - // MVC help - IBOutlet id delegate; + BOOL _allowsResizing; + BOOL _resizing; + + // cell width + NSInteger _cellMinWidth; + NSInteger _cellMaxWidth; + NSInteger _cellOptimumWidth; + + // animation for hide/show + NSInteger _currentStep; + BOOL _isHidden; + IBOutlet id partnerView; // gets resized when hide/show + BOOL _awakenedFromNib; + NSInteger _tabBarWidth; + NSTimer *_showHideAnimationTimer; + + // drag and drop + NSEvent *_lastMouseDownEvent; // keep this for dragging reference + BOOL _didDrag; + BOOL _closeClicked; + + // MVC help + IBOutlet id delegate; } // control characteristics @@ -160,6 +163,8 @@ enum { - (PSMTabBarTearOffStyle)tearOffStyle; - (void)setTearOffStyle:(PSMTabBarTearOffStyle)tearOffStyle; ++ (Class) defaultStyleClass; + // accessors - (NSTabView *)tabView; - (void)setTabView:(NSTabView *)view; @@ -178,7 +183,7 @@ enum { - (PSMTabBarCell *)lastVisibleTab; // special effects -- (void)hideTabBar:(BOOL)hide animate:(BOOL)animate; +- (void)hideTabBar:(BOOL) hide animate:(BOOL)animate; - (BOOL)isTabBarHidden; - (BOOL)isAnimating; @@ -197,7 +202,7 @@ enum { //"Spring-loaded" tabs methods - (NSArray *)allowedDraggedTypesForTabView:(NSTabView *)aTabView; -- (void)tabView:(NSTabView *)aTabView acceptedDraggingInfo:(id <NSDraggingInfo>)draggingInfo onTabViewItem:(NSTabViewItem *)tabViewItem; +- (void)tabView:(NSTabView *)aTabView acceptedDraggingInfo:(id <NSDraggingInfo>) draggingInfo onTabViewItem:(NSTabViewItem *)tabViewItem; //Contextual menu method - (NSMenu *)tabView:(NSTabView *)aTabView menuForTabViewItem:(NSTabViewItem *)tabViewItem; |