adium/adium

Parents 4d355a3b6dad
Children e4945899f84c
improved emoticon menu's alignment in relation to emoticon button, fixes #16434
--- a/Source/AIMessageViewEmoticonsController.m Thu Aug 22 13:09:04 2013 +0200
+++ b/Source/AIMessageViewEmoticonsController.m Tue Aug 27 18:55:31 2013 +0200
@@ -20,9 +20,12 @@
#import <Adium/AIEmoticonPack.h>
#import <Adium/AIEmoticon.h>
#import <AIUtilities/AIImageDrawingAdditions.h>
+#import "AIMessageEntryTextView.h"
#define PREFERENCES_GROUP_EMOTICONS @"Emoticons"
+#define MENU_PADDING 15 // Padding between emoticons button and displayed emoticons menu
+
#pragma mark AIMessageViewEmoticonsController
@@ -104,6 +107,17 @@
// Adjust opening position
aPoint.x -= [menu size].width;
+ // add padding to prevent button being covered by menu
+ NSPoint screenPoint = [aView.window convertBaseToScreen:aPoint];
+ if (screenPoint.y - MENU_PADDING - [menu size].height < 20) {
+ // position the menu above the button if it would be to near to the screen's bottom edge otherwise
+ // - this prevents the view automatically being repositioned by cocoa and therefore covering the button again
+ aPoint.y = aPoint.y - MENU_PADDING - [menu size].height;
+ }
+ else {
+ aPoint.y += MENU_PADDING/2;
+ }
+
[menu popUpMenuPositioningItem:[menu itemAtIndex:0]
atLocation:aPoint
inView:[aView superview]];