More dialog_darwin.go/.m conversion.
This commit is contained in:
parent
7e0a0db492
commit
bc50405364
|
@ -31,10 +31,10 @@ func _msgBox(parent *Window, primarytext string, secondarytext string, style uin
|
||||||
}
|
}
|
||||||
switch style {
|
switch style {
|
||||||
case 0: // normal
|
case 0: // normal
|
||||||
C.msgBox(pwin, primary, secondary, nil)
|
C.msgBox(pwin, primary, secondary)
|
||||||
return OK
|
return OK
|
||||||
case 1: // error
|
case 1: // error
|
||||||
C.msgBoxError(pwin, primary, secondary, nil)
|
C.msgBoxError(pwin, primary, secondary)
|
||||||
return OK
|
return OK
|
||||||
}
|
}
|
||||||
panic(fmt.Errorf("unknown message box style %d\n", style))
|
panic(fmt.Errorf("unknown message box style %d\n", style))
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#define to(T, x) ((T *) (x))
|
#define to(T, x) ((T *) (x))
|
||||||
#define toNSWindow(x) to(NSWindow, (x))
|
#define toNSWindow(x) to(NSWindow, (x))
|
||||||
|
|
||||||
static void alert(id parent, NSString *primary, NSString *secondary, NSAlertStyle style, void *chan)
|
static void alert(id parent, NSString *primary, NSString *secondary, NSAlertStyle style)
|
||||||
{
|
{
|
||||||
NSAlert *box;
|
NSAlert *box;
|
||||||
|
|
||||||
|
@ -23,20 +23,22 @@ static void alert(id parent, NSString *primary, NSString *secondary, NSAlertStyl
|
||||||
if (parent == nil)
|
if (parent == nil)
|
||||||
return (intptr_t) [box runModal];
|
return (intptr_t) [box runModal];
|
||||||
else {
|
else {
|
||||||
|
NSInteger *ret;
|
||||||
|
|
||||||
[box beginSheetModalForWindow:toNSWindow(parent)
|
[box beginSheetModalForWindow:toNSWindow(parent)
|
||||||
modalDelegate:[NSApp delegate]
|
modalDelegate:[NSApp delegate]
|
||||||
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
|
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
|
||||||
contextInfo:chan];
|
contextInfo:&ret];
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void msgBox(id parent, id primary, id secondary, void *chan)
|
void msgBox(id parent, id primary, id secondary)
|
||||||
{
|
{
|
||||||
alert(parent, (NSString *) primary, (NSString *) secondary, NSInformationalAlertStyle, chan);
|
alert(parent, (NSString *) primary, (NSString *) secondary, NSInformationalAlertStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void msgBoxError(id parent, id primary, id secondary, void *chan)
|
void msgBoxError(id parent, id primary, id secondary)
|
||||||
{
|
{
|
||||||
alert(parent, (NSString *) primary, (NSString *) secondary, NSCriticalAlertStyle, chan);
|
alert(parent, (NSString *) primary, (NSString *) secondary, NSCriticalAlertStyle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,8 @@ extern void breakMainLoop(void);
|
||||||
extern void cocoaMainLoop(void);
|
extern void cocoaMainLoop(void);
|
||||||
|
|
||||||
/* dialog_darwin.m */
|
/* dialog_darwin.m */
|
||||||
extern void msgBox(id, id, id, void *);
|
extern void msgBox(id, id, id);
|
||||||
extern void msgBoxError(id, id, id, void *);
|
extern void msgBoxError(id, id, id);
|
||||||
|
|
||||||
/* listbox_darwin.m */
|
/* listbox_darwin.m */
|
||||||
extern id toListboxItem(id, id);
|
extern id toListboxItem(id, id);
|
||||||
|
|
Loading…
Reference in New Issue