Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 54 lines (38 sloc) 0.775 kb
919cab1 CommitWindow:
Chris Thomas authored
1 //
2 // CXMenuButton.m
3 //
4 // Created by Chris Thomas on 2006-10-09.
5 // Copyright 2006 Chris Thomas. All rights reserved.
6 // MIT license.
7 //
8
9 #import "CXMenuButton.h"
10
11 @implementation CXMenuButton
12
13 // Initialization
14
15 - (void) commonInit
16 {
17 // Use alternateImage for pressed state
18 [[self cell] setHighlightsBy:NSCellLightsByContents];
19 }
20
21 - (void) awakeFromNib
22 {
23 [self commonInit];
24 }
25
26 // Events
27
28 - (void) mouseDown:(NSEvent *)event
29 {
30 [self highlight:YES];
31 [NSMenu popUpContextMenu:menu withEvent:event forView:self withFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
32 [self highlight:NO];
33 }
34
35 // Accessors
36
37 - (NSMenu *)menu
38 {
39 return menu;
40 }
41
42 - (void)setMenu:(NSMenu *)aValue
43 {
44 NSMenu *oldMenu = menu;
45 menu = [aValue retain];
46 [oldMenu release];
47 }
48
49 @end
50
51
52
53
Something went wrong with that request. Please try again.