aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPChooseMenuItemDialog.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-12-03 14:09:15 +0000
committerBibiko <bibiko@eva.mpg.de>2010-12-03 14:09:15 +0000
commit7387efe3ddd3ad7440d54ba1ab10e5806da63ba7 (patch)
tree9ac55cf34aff38cb9734bf80529224b4bc2e5e26 /Source/SPChooseMenuItemDialog.m
parent5c941dbdd8fb13c0938f03cc7902fa6d7a8a740d (diff)
downloadsequelpro-7387efe3ddd3ad7440d54ba1ab10e5806da63ba7.tar.gz
sequelpro-7387efe3ddd3ad7440d54ba1ab10e5806da63ba7.tar.bz2
sequelpro-7387efe3ddd3ad7440d54ba1ab10e5806da63ba7.zip
• further work on the choosMenuItem [not yet working]
Diffstat (limited to 'Source/SPChooseMenuItemDialog.m')
-rw-r--r--Source/SPChooseMenuItemDialog.m64
1 files changed, 64 insertions, 0 deletions
diff --git a/Source/SPChooseMenuItemDialog.m b/Source/SPChooseMenuItemDialog.m
index 2dc73077..e966613b 100644
--- a/Source/SPChooseMenuItemDialog.m
+++ b/Source/SPChooseMenuItemDialog.m
@@ -27,4 +27,68 @@
@implementation SPChooseMenuItemDialog
+@synthesize contextMenu;
+
+- (id)init;
+{
+ if(self = [self initWithContentRect:NSMakeRect(10,10,10,10)
+ styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO])
+ {
+ ;
+ }
+ return self;
+}
+
+- (void)dealloc
+{
+ [tv release];
+ [super dealloc];
+}
+
+- (void)initMeWithOptions:(NSDictionary *)displayOptions
+{
+ [self setReleasedWhenClosed:YES];
+ [self setLevel:NSNormalWindowLevel];
+ [self setHidesOnDeactivate:YES];
+ [self setHasShadow:YES];
+ [self setAlphaValue:0.9];
+ tv = [[NSTextView alloc] initWithFrame:NSMakeRect(10,10,10,10)];
+ [self setContentView:tv];
+ [tv setDelegate:self];
+ [tv setEditable:YES];
+}
+
++ (void)displayMenu:(NSMenu*)theMenu atPosition:(NSPoint)location
+{
+
+ SPChooseMenuItemDialog *dialog = [SPChooseMenuItemDialog new];
+ [dialog initMeWithOptions:nil];
+
+ NSMenuItem *returnItem = nil;
+
+ [dialog setContextMenu:theMenu];
+ [dialog setFrameTopLeftPoint:location];
+
+ [dialog orderFront:nil];
+ NSEvent *theEvent = [NSEvent
+ mouseEventWithType:NSRightMouseDown
+ location:NSMakePoint(1,1)
+ modifierFlags:0
+ timestamp:1
+ windowNumber:[dialog windowNumber]
+ context:[NSGraphicsContext currentContext]
+ eventNumber:1
+ clickCount:1
+ pressure:0.0];
+
+ [[NSApplication sharedApplication] postEvent:theEvent atStart:NO];
+
+}
+
+- (NSMenu *)menuForEvent:(NSEvent *)event
+{
+ NSLog(@"asdasdasd");
+ return contextMenu;
+}
+
@end