adium 5056:512cb1d5bcd7: Modernize MVMenuButton a bit.
commits at adium.im
commits at adium.im
Wed Sep 12 11:47:26 UTC 2012
details: http://hg.adium.im/adium/rev/512cb1d5bcd7
revision: 5056:512cb1d5bcd7
branch: (none)
author: Thijs Alkemade <thijsalkemade at gmail.com>
date: Wed Sep 12 13:47:11 2012 +0200
Modernize MVMenuButton a bit.
diffs (108 lines):
diff -r 300f836d29b2 -r 512cb1d5bcd7 Frameworks/AIUtilities Framework/Source/MVMenuButton.h
--- a/Frameworks/AIUtilities Framework/Source/MVMenuButton.h Wed Sep 12 13:39:18 2012 +0200
+++ b/Frameworks/AIUtilities Framework/Source/MVMenuButton.h Wed Sep 12 13:47:11 2012 +0200
@@ -32,17 +32,8 @@
}
@property (nonatomic, weak) NSToolbarItem *toolbarItem;
-
-/*!
- * @brief Set the <tt>NSControlSize</tt> at which the button will be displayed.
- * @param inSize A value of type <tt>NSControlSize</tt>
-*/
-- (void)setControlSize:(NSControlSize)inSize;
-/*!
- * @brief The current <tt>NSControlSize</tt> at which the button will be displayed.
- * @return A value of type <tt>NSControlSize</tt>
-*/
-- (NSControlSize)controlSize;
+ at property (nonatomic, assign) NSControlSize controlSize;
+ at property (nonatomic, assign) BOOL drawsArrow;
/*!
* @brief Set the image of the button
@@ -57,18 +48,4 @@
*/
- (NSImage *)image;
-/*!
- * @brief Set whether the button draws a dropdown arrow.
- *
- * 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.
- * @param inDraw YES if the arrow should be drawn.
- */
-- (void)setDrawsArrow:(BOOL)inDraw;
-
-/*!
- * @brief Returns if the button draws its arrow
- * @return YES if the arrow is drawn.
- */
-- (BOOL)drawsArrow;
-
@end
diff -r 300f836d29b2 -r 512cb1d5bcd7 Frameworks/AIUtilities Framework/Source/MVMenuButton.m
--- a/Frameworks/AIUtilities Framework/Source/MVMenuButton.m Wed Sep 12 13:39:18 2012 +0200
+++ b/Frameworks/AIUtilities Framework/Source/MVMenuButton.m Wed Sep 12 13:47:11 2012 +0200
@@ -24,17 +24,14 @@
@implementation MVMenuButton
- at synthesize toolbarItem;
+ at synthesize toolbarItem, controlSize, drawsArrow;
- (id)initWithFrame:(NSRect)frame
{
if ((self = [super initWithFrame:frame])) {
//Default configure
- bigImage = nil;
- toolbarItem = nil;
- arrowPath = nil;
- drawsArrow = YES;
- controlSize = NSRegularControlSize;
+ self.drawsArrow = YES;
+ self.controlSize = NSRegularControlSize;
[self setBordered:NO];
[self setButtonType:NSMomentaryChangeButton];
}
@@ -47,9 +44,9 @@
MVMenuButton *newButton = [[[self class] alloc] initWithFrame:[self frame]];
//Copy our config
- [newButton setControlSize:controlSize];
- [newButton setImage:bigImage];
- [newButton setDrawsArrow:drawsArrow];
+ newButton.controlSize = self.controlSize;
+ newButton.image = bigImage;
+ newButton.drawsArrow = drawsArrow;
//Copy super's config
[newButton setMenu:[[self menu] copy]];
@@ -95,10 +92,6 @@
//Reset the popup arrow path cache, we'll need to re-calculate it for the new size
arrowPath = nil;
}
-- (NSControlSize)controlSize
-{
- return controlSize;
-}
//Big Image (This is the one that should be called to configure this button)
- (void)setImage:(NSImage *)inImage
@@ -115,17 +108,6 @@
return bigImage;
}
-//Popup arrow Drawing
-- (void)setDrawsArrow:(BOOL)inDraw
-{
- drawsArrow = inDraw;
-}
-- (BOOL)drawsArrow
-{
- return drawsArrow;
-}
-
-
//Drawing --------------------------------------------------------------------------------------------------------------
#pragma mark Drawing
- (void)drawRect:(NSRect)rect
More information about the commits
mailing list