root/tags/2C11/AICustomTabsView.h

Revision 2039, 4.5 kB (checked in by timothy, 4 years ago)

Latest Adium tab code. Merged our tooltip code in.

Line 
1 /*-------------------------------------------------------------------------------------------------------*\
2 | Adium, Copyright (C) 2001-2004, Adam Iser  (adamiser@mac.com | http://www.adiumx.com)                   |
3 \---------------------------------------------------------------------------------------------------------/
4  | This program is free software; you can redistribute it and/or modify it under the terms of the GNU
5  | General Public License as published by the Free Software Foundation; either version 2 of the License,
6  | or (at your option) any later version.
7  |
8  | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9  | the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
10  | Public License for more details.
11  |
12  | You should have received a copy of the GNU General Public License along with this program; if not,
13  | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
14  \------------------------------------------------------------------------------------------------------ */
15
16 #import "ESFloater.h"
17 #define TAB_CELL_IDENTIFIER     @"Tab Cell Identifier"
18
19 @class AICustomTabCell, AICustomTabsView;
20
21 @interface NSObject (AICustomTabsViewDelegate)
22 - (void)customTabView:(AICustomTabsView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem;
23 - (void)customTabView:(AICustomTabsView *)tabView closeTabViewItem:(NSTabViewItem *)tabViewItem;
24 - (void)customTabViewDidChangeNumberOfTabViewItems:(AICustomTabsView *)tabView;
25 - (void)customTabViewDidChangeOrderOfTabViewItems:(AICustomTabsView *)tabView;
26 - (void)customTabView:(AICustomTabsView *)tabView didMoveTabViewItem:(NSTabViewItem *)tabViewItem toCustomTabView:(AICustomTabsView *)destTabView index:(int)index screenPoint:(NSPoint)point;
27 - (NSMenu *)customTabView:(AICustomTabsView *)tabView menuForTabViewItem:(NSTabViewItem *)tabViewItem;
28 - (NSString *)customTabView:(AICustomTabsView *)tabView toolTipForTabViewItem:(NSTabViewItem *)tabViewItem;
29 - (BOOL)customTabView:(AICustomTabsView *)tabView didAcceptDragPasteboard:(NSPasteboard *)pasteboard onTabViewItem:(NSTabViewItem *)tabViewItem;
30 - (NSArray *)customTabViewAcceptableDragTypes:(AICustomTabsView *)tabView;
31 - (int)customTabView:(AICustomTabsView *)tabView indexForInsertingTabViewItem:(NSTabViewItem *)tabViewItem;
32 @end
33
34 @interface AICustomTabsView : NSView {
35     IBOutlet    NSTabView                       *tabView;
36
37     id                                  delegate;
38     BOOL                                allowsInactiveTabClosing;       //Allow closing of inactive tabs
39         BOOL                            allowsTabRearranging;           //Allow tabs to be rearranged in the window
40         BOOL                            trackingCursor;                         //Tracking rects are installed
41         BOOL                            ignoreTabNumberChange;          //Ignore tab count changes, used for re-arranging
42         
43         //Tab Dragging
44     BOOL                removingLastTabHidesWindow;     //Removing the last tab hides our window
45         int                             tabGapWidth;                            //Gap in our tabs
46         int                             tabGapIndex;                            //Location of the gap
47     NSPoint                             lastClickLocation;                      //Last click location                   
48     NSTimer             *arrangeCellTimer;                      //Timer for tab animations
49         
50         //Guarded.  Access these using the internal accessors
51     NSMutableArray              *tabCellArray;
52     AICustomTabCell             *selectedCustomTabCell;
53        
54         //
55         AICustomTabCell     *dragCell;
56 }
57
58 //Delegate
59 - (void)setDelegate:(id)inDelegate;
60 - (id)delegate;
61
62 //Toggle closing of this window when the last tab is removed
63 - (void)setRemovingLastTabHidesWindow:(BOOL)inValue;
64 - (BOOL)removingLastTabHidesWindow;
65
66 //Allow closing of inactive tabs
67 - (void)setAllowsInactiveTabClosing:(BOOL)inValue;
68 - (BOOL)allowsInactiveTabClosing;
69
70 //Permit rearranging within the window
71 - (void)setAllowsTabRearranging:(BOOL)inValue;
72 - (BOOL)allowsTabRearranging;
73
74 //Misc
75 - (void)redisplayTabForTabViewItem:(NSTabViewItem *)inTabViewItem;
76 - (void)resizeTabForTabViewItem:(NSTabViewItem *)inTabViewItem;
77 - (void)moveTab:(NSTabViewItem *)tabViewItem toIndex:(int)index;
78 - (int)numberOfTabViewItems;
79
80 //Private
81 - (void)rebuildTabCells;
82 - (AICustomTabCell *)tabAtPoint:(NSPoint)clickLocation;
83 - (int)totalWidthOfTabs;
84 - (void)moveTab:(NSTabViewItem *)tabViewItem toIndex:(int)index selectTab:(BOOL)shouldSelect animate:(BOOL)animate;
85 - (int)numberOfTabViewItems;
86 - (void)closeTab:(AICustomTabCell *)tabCell;
87 - (void)closeAllTabsExceptFor:(AICustomTabCell *)targetCell;
88 - (void)drawBackgroundInRect:(NSRect)rect withFrame:(NSRect)viewFrame selectedTabRect:(NSRect)tabFrame;
89 - (void)resetCursorTracking;
90 - (AICustomTabCell *)tabCellForTabViewItem:(NSTabViewItem *)tabViewItem;
91
92 @end
93
Note: See TracBrowser for help on using the browser.