1 | /* |
---|
2 | |
---|
3 | BSD License |
---|
4 | |
---|
5 | Copyright (c) 2006, Keith Anderson |
---|
6 | All rights reserved. |
---|
7 | |
---|
8 | Redistribution and use in source and binary forms, with or without modification, |
---|
9 | are permitted provided that the following conditions are met: |
---|
10 | |
---|
11 | * Redistributions of source code must retain the above copyright notice, |
---|
12 | this list of conditions and the following disclaimer. |
---|
13 | * Redistributions in binary form must reproduce the above copyright notice, |
---|
14 | this list of conditions and the following disclaimer in the documentation |
---|
15 | and/or other materials provided with the distribution. |
---|
16 | * Neither the name of keeto.net or Keith Anderson nor the names of its |
---|
17 | contributors may be used to endorse or promote products derived |
---|
18 | from this software without specific prior written permission. |
---|
19 | |
---|
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
---|
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
---|
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
---|
24 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, |
---|
25 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
---|
26 | OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
---|
28 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
---|
29 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
30 | |
---|
31 | |
---|
32 | */ |
---|
33 | |
---|
34 | |
---|
35 | |
---|
36 | @interface KNShelfSplitView : NSView { |
---|
37 | IBOutlet NSView * shelfView; |
---|
38 | IBOutlet NSView * contentView; |
---|
39 | IBOutlet id delegate; |
---|
40 | IBOutlet id target; |
---|
41 | SEL action; |
---|
42 | |
---|
43 | NSString * autosaveName; |
---|
44 | NSImage * actionButtonImage; |
---|
45 | NSImage * contextButtonImage; |
---|
46 | NSColor * shelfBackgroundColor; |
---|
47 | float currentShelfWidth; |
---|
48 | float prevShelfWidthBeforeDoubleClick; |
---|
49 | BOOL isShelfVisible; |
---|
50 | NSMenu * contextButtonMenu; |
---|
51 | |
---|
52 | NSRect controlRect; |
---|
53 | BOOL shouldDrawActionButton; |
---|
54 | NSRect actionButtonRect; |
---|
55 | BOOL shouldDrawContextButton; |
---|
56 | NSRect contextButtonRect; |
---|
57 | NSRect resizeThumbRect; |
---|
58 | NSRect resizeBarRect; |
---|
59 | int activeControlPart; |
---|
60 | BOOL shouldHilite; |
---|
61 | |
---|
62 | BOOL delegateHasValidateWidth; |
---|
63 | |
---|
64 | NSString *stringValue; |
---|
65 | NSAttributedString *attributedStringValue; |
---|
66 | float stringHeight; |
---|
67 | |
---|
68 | NSImage *background; |
---|
69 | NSSize backgroundSize; |
---|
70 | } |
---|
71 | |
---|
72 | -(IBAction)toggleShelf:(id)sender; |
---|
73 | |
---|
74 | -(id)initWithFrame:(NSRect)aFrame shelfView:(NSView *)aShelfView contentView:(NSView *)aContentView; |
---|
75 | |
---|
76 | -(void)setDelegate:(id)aDelegate; |
---|
77 | -(id)delegate; |
---|
78 | -(void)setTarget:(id)aTarget; |
---|
79 | -(id)target; |
---|
80 | -(void)setAction:(SEL)aSelector; |
---|
81 | -(SEL)action; |
---|
82 | -(void)setContextButtonMenu:(NSMenu *)aMenu; |
---|
83 | -(NSMenu *)contextButtonMenu; |
---|
84 | |
---|
85 | -(void)setShelfView:(NSView *)aView; |
---|
86 | -(NSView *)shelfView; |
---|
87 | -(void)setContentView:(NSView *)aView; |
---|
88 | -(NSView *)contentView; |
---|
89 | |
---|
90 | -(void)setShelfWidth:(float)aWidth; |
---|
91 | -(float)shelfWidth; |
---|
92 | |
---|
93 | -(BOOL)isShelfVisible; |
---|
94 | -(void)setShelfIsVisible:(BOOL)visible; |
---|
95 | |
---|
96 | -(void)setAutosaveName:(NSString *)aName; |
---|
97 | -(NSString *)autosaveName; |
---|
98 | |
---|
99 | |
---|
100 | -(void)setActionButtonImage:(NSImage *)anImage; |
---|
101 | -(NSImage *)actionButtonImage; |
---|
102 | -(void)setContextButtonImage:(NSImage *)anImage; |
---|
103 | -(NSImage *)contextButtonImage; |
---|
104 | -(void)setShelfBackgroundColor:(NSColor *)aColor; |
---|
105 | -(NSColor *)shelfBackgroundColor; |
---|
106 | |
---|
107 | |
---|
108 | -(void)recalculateSizes; |
---|
109 | -(void)drawControlBackgroundInRect:(NSRect)aRect active:(BOOL)isActive; |
---|
110 | |
---|
111 | - (void)setResizeThumbStringValue:(NSString *)inString; |
---|
112 | |
---|
113 | |
---|
114 | @end |
---|
115 | |
---|
116 | @interface NSObject (KNShelfSplitViewDelegate) |
---|
117 | -(float)shelfSplitView:(KNShelfSplitView *)shelfSplitView validateWidth:(float)proposedWidth; |
---|
118 | @end |
---|