-
Notifications
You must be signed in to change notification settings - Fork 41
/
AMButtonMenu.m
43 lines (34 loc) · 885 Bytes
/
AMButtonMenu.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// AMButtonMenu.m
// SSHTunnel
//
// Created by Antoine Mercadal on 18/08/08.
// Copyright 2008 Capgemini. All rights reserved.
//
#import "AMButtonMenu.h"
@implementation AMButtonMenu
- (void)awakeFromNib
{
popUpCell = [[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:YES];
[popUpCell setMenu:popUpMenu];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(menuClosed:)
name:NSMenuDidEndTrackingNotification
object:popUpMenu];
}
- (void)mouseDown:(NSEvent *)theEvent
{
[self highlight:YES];
[popUpCell performClickWithFrame:[self bounds] inView:self];
}
- (void)menuClosed:(NSNotification *)note
{
[self highlight:NO];
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSMenuDidEndTrackingNotification
object:popUpMenu];
}
@end