1 | //Adapted from Colloquy (www.colloquy.info) |
---|
2 | |
---|
3 | /*! |
---|
4 | * @class MVMenuButton |
---|
5 | * @brief Button with a popup menu for use with an NSToolbarItem |
---|
6 | * |
---|
7 | * Button which has a popup menu, including a menu arrow in the bottom right corner, for use as the custom view of an NSToolbarItem |
---|
8 | */ |
---|
9 | @interface MVMenuButton : NSButton <NSCopying> { |
---|
10 | NSImage *bigImage; |
---|
11 | NSImage *smallImage; |
---|
12 | NSToolbarItem *toolbarItem; |
---|
13 | NSBezierPath *arrowPath; |
---|
14 | |
---|
15 | BOOL drawsArrow; |
---|
16 | NSControlSize controlSize; |
---|
17 | } |
---|
18 | |
---|
19 | /*! |
---|
20 | * @brief Set the <tt>NSControlSize</tt> at which the button will be displayed. |
---|
21 | * @param inSize A value of type <tt>NSControlSize</tt> |
---|
22 | */ |
---|
23 | - (void)setControlSize:(NSControlSize)inSize; |
---|
24 | /*! |
---|
25 | * @brief The current <tt>NSControlSize</tt> at which the button will be displayed. |
---|
26 | * @return A value of type <tt>NSControlSize</tt> |
---|
27 | */ |
---|
28 | - (NSControlSize)controlSize; |
---|
29 | |
---|
30 | /*! |
---|
31 | * @brief Set the image of the button |
---|
32 | * |
---|
33 | * It will be automatically sized as necessary. |
---|
34 | * @param inImage An <tt>NSImage</tt> to use. |
---|
35 | */ |
---|
36 | - (void)setImage:(NSImage *)inImage; |
---|
37 | /*! |
---|
38 | * @brief Returns the image of the button |
---|
39 | * @return An <tt>NSImage</tt>. |
---|
40 | */ |
---|
41 | - (NSImage *)image; |
---|
42 | |
---|
43 | /*! |
---|
44 | * @brief Set the toolbar item associated with this button |
---|
45 | * |
---|
46 | * This is used for synchronizing sizing. |
---|
47 | * @param item The <tt>NSToolbarItem</tt> to associate. |
---|
48 | */ |
---|
49 | - (void)setToolbarItem:(NSToolbarItem *)item; |
---|
50 | |
---|
51 | /*! |
---|
52 | * @brief Returns the toolbar item associated with this button |
---|
53 | * @return The <tt>NSToolbarItem</tt> |
---|
54 | */ |
---|
55 | - (NSToolbarItem *)toolbarItem; |
---|
56 | |
---|
57 | /*! |
---|
58 | * @brief Set whether the button draws a dropdown arrow. |
---|
59 | * |
---|
60 | * The arrow is black and positioned in the lower righthand corner of the button; it is used to indicate that clicking on the button will reveal further information or choices. |
---|
61 | * @param inDraw YES if the arrow should be drawn. |
---|
62 | */ |
---|
63 | - (void)setDrawsArrow:(BOOL)inDraw; |
---|
64 | |
---|
65 | /*! |
---|
66 | * @brief Returns if the button draws its arrow |
---|
67 | * @return YES if the arrow is drawn. |
---|
68 | */ |
---|
69 | - (BOOL)drawsArrow; |
---|
70 | |
---|
71 | @end |
---|