Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Unified Diff: ui/base/cocoa/controls/hover_image_menu_button.mm

Issue 15955003: Menu for the OSX app launcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor HoverImageMenuButton into /ui/base/cocoa/controls Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/base/cocoa/controls/hover_image_menu_button.mm
diff --git a/ui/base/cocoa/controls/hover_image_menu_button.mm b/ui/base/cocoa/controls/hover_image_menu_button.mm
new file mode 100644
index 0000000000000000000000000000000000000000..8b1ea3c087c9178d733a802d89d03a1025d1cd9e
--- /dev/null
+++ b/ui/base/cocoa/controls/hover_image_menu_button.mm
@@ -0,0 +1,44 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ui/base/cocoa/controls/hover_image_menu_button.h"
+
+@implementation HoverImageMenuButton
+
++ (Class)cellClass {
+ return [HoverImageMenuButtonCell class];
+}
+
+- (id)initWithFrame:(NSRect)frameRect
+ pullsDown:(BOOL)flag {
+ if ((self = [super initWithFrame:frameRect
+ pullsDown:flag])) {
+ trackingArea_.reset(
+ [[CrTrackingArea alloc] initWithRect:NSZeroRect
+ options:NSTrackingInVisibleRect |
+ NSTrackingMouseEnteredAndExited |
+ NSTrackingActiveInKeyWindow
+ owner:self
+ userInfo:nil]);
+ [self addTrackingArea:trackingArea_.get()];
+
+ // Item 0 is the button label, which is not used.
+ [[self menu] addItemWithTitle:[NSString string]
tapted 2013/06/03 12:49:18 note: I've removed this from HoverImageMenuButton.
+ action:NULL
+ keyEquivalent:[NSString string]];
+ }
+ return self;
+}
+
+- (void)mouseEntered:(NSEvent*)theEvent {
+ [[self cell] setHovered:YES];
+ [self setNeedsDisplay:YES];
+}
+
+- (void)mouseExited:(NSEvent*)theEvent {
+ [[self cell] setHovered:NO];
+ [self setNeedsDisplay:YES];
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698