adium 5624:80b4bd62f0d2: Add a subclass of NSButton that support...

commits at adium.im commits at adium.im
Fri Jul 5 18:41:37 UTC 2013


details:	http://hg.adium.im/adium/rev/80b4bd62f0d2
revision:	5624:80b4bd62f0d2
branch:		adium-1.6
author:		Frank Dowsett <wixardy at adium.im>
date:		Fri Jul 05 13:53:42 2013 -0400

Add a subclass of NSButton that supports a custom cursor and change the emoticon menu and the push/pop buttons to use an arrow. Fixes #16432

diffs (168 lines):

diff -r 1fb54e359a5f -r 80b4bd62f0d2 Adium.xcodeproj/project.pbxproj
--- a/Adium.xcodeproj/project.pbxproj	Thu Jul 04 22:44:26 2013 -0400
+++ b/Adium.xcodeproj/project.pbxproj	Fri Jul 05 13:53:42 2013 -0400
@@ -1061,6 +1061,8 @@
 		5A9A9F8911F2951400328DF9 /* AIDoNothingContactAlertPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A9A9F8811F2951400328DF9 /* AIDoNothingContactAlertPlugin.m */; };
 		5A9A9F8B11F295EB00328DF9 /* events-do-nothing.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 5A9A9F8A11F295EB00328DF9 /* events-do-nothing.tiff */; };
 		5AA2A0EE14B3EFF500B4DB65 /* AIOSCompatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 5AA2A0ED14B3EFF500B4DB65 /* AIOSCompatibility.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		5ACA086A17873AEA00B15047 /* AIButtonWithCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 5ACA086817873AEA00B15047 /* AIButtonWithCursor.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		5ACA086B17873AEA00B15047 /* AIButtonWithCursor.m in Sources */ = {isa = PBXBuildFile; fileRef = 5ACA086917873AEA00B15047 /* AIButtonWithCursor.m */; };
 		5ACF27391392C74A004B6AEF /* AIHighlightingTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 5ACF27351392C74A004B6AEF /* AIHighlightingTextField.h */; };
 		5ACF273A1392C74A004B6AEF /* AIHighlightingTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 5ACF27361392C74A004B6AEF /* AIHighlightingTextField.m */; };
 		5ACF273B1392C74A004B6AEF /* AIPreferenceCollectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = 5ACF27371392C74A004B6AEF /* AIPreferenceCollectionView.h */; };
@@ -4016,6 +4018,8 @@
 		5AC7F26313B42952002D7265 /* Preferences-AddressBookIntegration.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = "Preferences-AddressBookIntegration.xib"; path = "Resources/Preferences-AddressBookIntegration.xib"; sourceTree = "<group>"; };
 		5AC7F26513B42A55002D7265 /* Preferences-Encryption.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = "Preferences-Encryption.xib"; path = "Resources/Preferences-Encryption.xib"; sourceTree = "<group>"; };
 		5AC7F26713B43612002D7265 /* Preferences-MessageAlerts.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = "Preferences-MessageAlerts.xib"; path = "Resources/Preferences-MessageAlerts.xib"; sourceTree = "<group>"; };
+		5ACA086817873AEA00B15047 /* AIButtonWithCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIButtonWithCursor.h; path = "Frameworks/AIUtilities Framework/Source/AIButtonWithCursor.h"; sourceTree = "<group>"; };
+		5ACA086917873AEA00B15047 /* AIButtonWithCursor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIButtonWithCursor.m; path = "Frameworks/AIUtilities Framework/Source/AIButtonWithCursor.m"; sourceTree = "<group>"; };
 		5ACF27331392C585004B6AEF /* Preferences.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Preferences.xib; path = Resources/Preferences.xib; sourceTree = "<group>"; };
 		5ACF27351392C74A004B6AEF /* AIHighlightingTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AIHighlightingTextField.h; path = "Frameworks/AIUtilities Framework/Source/AIHighlightingTextField.h"; sourceTree = "<group>"; };
 		5ACF27361392C74A004B6AEF /* AIHighlightingTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AIHighlightingTextField.m; path = "Frameworks/AIUtilities Framework/Source/AIHighlightingTextField.m"; sourceTree = "<group>"; };
@@ -7684,6 +7688,8 @@
 				6334FF370F9C14BF003C77A9 /* Button with a popup menu for toolbar items */,
 				6334FF340F9C14BF003C77A9 /* Button with rollover delegate action */,
 				6334FF310F9C14BF003C77A9 /* Auto-completing textField */,
+				5ACA086817873AEA00B15047 /* AIButtonWithCursor.h */,
+				5ACA086917873AEA00B15047 /* AIButtonWithCursor.m */,
 			);
 			name = "Fun New Controls";
 			sourceTree = "<group>";
@@ -9264,6 +9270,7 @@
 				633400550F9C14C2003C77A9 /* AITextViewWithPlaceholder.h in Headers */,
 				633400570F9C14C2003C77A9 /* AIFlexibleToolbarItem.h in Headers */,
 				6334005B0F9C14C2003C77A9 /* AIDockingWindow.h in Headers */,
+				5ACA086A17873AEA00B15047 /* AIButtonWithCursor.h in Headers */,
 				6334005D0F9C14C2003C77A9 /* AIBorderlessWindow.h in Headers */,
 				6334005F0F9C14C2003C77A9 /* AIGenericViewCell.h in Headers */,
 				633400610F9C14C2003C77A9 /* AIImageTextCell.h in Headers */,
@@ -10781,6 +10788,7 @@
 				633400320F9C14C2003C77A9 /* AIDividedAlternatingRowOutlineView.m in Sources */,
 				633400340F9C14C2003C77A9 /* AIOutlineView.m in Sources */,
 				633400360F9C14C2003C77A9 /* AIAlternatingRowOutlineView.m in Sources */,
+				5ACA086B17873AEA00B15047 /* AIButtonWithCursor.m in Sources */,
 				633400380F9C14C2003C77A9 /* AIVariableHeightFlexibleColumnsOutlineView.m in Sources */,
 				6334003A0F9C14C2003C77A9 /* AIVariableHeightOutlineView.m in Sources */,
 				6334003C0F9C14C2003C77A9 /* AIMultiCellOutlineView.m in Sources */,
diff -r 1fb54e359a5f -r 80b4bd62f0d2 Frameworks/AIUtilities Framework/Source/AIButtonWithCursor.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/AIUtilities Framework/Source/AIButtonWithCursor.h	Fri Jul 05 13:53:42 2013 -0400
@@ -0,0 +1,19 @@
+/*
+ * Adium is the legal property of its developers, whose names are listed in the copyright file included
+ * with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+ * Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program; if not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+ at interface AIButtonWithCursor : NSButton
+ at property (strong) NSCursor *cursor;
+ at end
diff -r 1fb54e359a5f -r 80b4bd62f0d2 Frameworks/AIUtilities Framework/Source/AIButtonWithCursor.m
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/AIUtilities Framework/Source/AIButtonWithCursor.m	Fri Jul 05 13:53:42 2013 -0400
@@ -0,0 +1,29 @@
+/*
+ * Adium is the legal property of its developers, whose names are listed in the copyright file included
+ * with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+ * Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program; if not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#import "AIButtonWithCursor.h"
+
+ at implementation AIButtonWithCursor
+
+- (void)resetCursorRects
+{
+	if (self.cursor)
+		[self addCursorRect:self.bounds cursor:self.cursor];
+	else
+		[super resetCursorRects];
+}
+
+ at end
diff -r 1fb54e359a5f -r 80b4bd62f0d2 Frameworks/Adium Framework/Source/AIMessageEntryTextView.h
--- a/Frameworks/Adium Framework/Source/AIMessageEntryTextView.h	Thu Jul 04 22:44:26 2013 -0400
+++ b/Frameworks/Adium Framework/Source/AIMessageEntryTextView.h	Fri Jul 05 13:53:42 2013 -0400
@@ -18,7 +18,7 @@
 #import <Adium/AIInterfaceControllerProtocol.h>
 #import <Adium/AIContactObserverManager.h>
 
- at class AIListContact, AIAccount, AIChat;
+ at class AIListContact, AIAccount, AIChat, AIButtonWithCursor;
 
 @protocol AIMessageEntryTextViewDelegate <NSTextViewDelegate,NSObject>
 
@@ -53,7 +53,7 @@
 
 	NSMutableArray		*pushArray;
 	BOOL                 pushIndicatorVisible;
-	NSButton			*pushIndicator;
+	AIButtonWithCursor	*pushIndicator;
 	NSMenu              *pushMenu;
 	NSDictionary		*defaultTypingAttributes;
 
@@ -71,7 +71,7 @@
 @protected
     // Emoticons
     BOOL hasEmoticonsMenu;
-    NSButton *emoticonsMenuButton;
+    AIButtonWithCursor *emoticonsMenuButton;
 }
 
 @property (readwrite, assign, nonatomic) id<AIMessageEntryTextViewDelegate> delegate;
diff -r 1fb54e359a5f -r 80b4bd62f0d2 Frameworks/Adium Framework/Source/AIMessageEntryTextView.m
--- a/Frameworks/Adium Framework/Source/AIMessageEntryTextView.m	Thu Jul 04 22:44:26 2013 -0400
+++ b/Frameworks/Adium Framework/Source/AIMessageEntryTextView.m	Fri Jul 05 13:53:42 2013 -0400
@@ -33,6 +33,7 @@
 #import <AIUtilities/AIColorAdditions.h>
 #import <AIUtilities/AITextAttributes.h>
 #import <AIUtilities/AIImageAdditions.h>
+#import <AIUtilities/AIButtonWithCursor.h>
 #import <AIUtilities/AIFileManagerAdditions.h>
 #import <AIUtilities/AIPasteboardAdditions.h>
 #import <AIUtilities/AIBezierPathAdditions.h>
@@ -987,8 +988,9 @@
         [self setFrameSize:size];
 				
 		// Make the indicator and set its action. It is a button with no border.
-		pushIndicator = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, [pushIndicatorImage size].width, [pushIndicatorImage size].height)]; 
+		pushIndicator = [[AIButtonWithCursor alloc] initWithFrame:NSMakeRect(0, 0, [pushIndicatorImage size].width, [pushIndicatorImage size].height)];
 		[pushIndicator setButtonType:NSMomentaryPushButton];
+		[pushIndicator setCursor:[NSCursor arrowCursor]];
         [pushIndicator setAutoresizingMask:(NSViewMinXMargin)];
         [pushIndicator setImage:pushIndicatorImage];
         [pushIndicator setImagePosition:NSImageOnly];
@@ -1785,11 +1787,12 @@
 	if (hasMenu && emoticonsMenuButton == nil) {
 		NSImage *emoticonsMenuIcon = [NSImage imageNamed:@"emoticons_menu"];
 		
-		emoticonsMenuButton = [[NSButton alloc] initWithFrame:NSZeroRect];
+		emoticonsMenuButton = [[AIButtonWithCursor alloc] initWithFrame:NSZeroRect];
 		
 		[emoticonsMenuButton setFrameSize:[emoticonsMenuIcon size]];
 		[emoticonsMenuButton setAutoresizingMask:NSViewMinXMargin];
         [emoticonsMenuButton setButtonType:NSMomentaryChangeButton];
+		[emoticonsMenuButton setCursor:[NSCursor arrowCursor]];
         [emoticonsMenuButton setBordered:NO];
 		[emoticonsMenuButton setAction:@selector(popUpEmoticonsMenu)];
 		[[emoticonsMenuButton cell] setImageScaling:NSImageScaleNone];




More information about the commits mailing list