view dstep/appkit/NSPanel.d @ 16:19885b43130e

Huge update, the bridge actually works now
author Jacob Carlborg <doob@me.com>
date Sun, 03 Jan 2010 22:06:11 +0100
parents
children b9de51448c6b
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Sep 24, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.appkit.NSPanel;

import dstep.appkit.NSWindow;
import dstep.foundation.NSObjCRuntime;
import dstep.foundation.NSString;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;

import bindings = dstep.appkit.NSPanel_bindings;

enum
{
	NSAlertDefaultReturn = 1,
	NSAlertAlternateReturn = 0,
	NSAlertOtherReturn = -1,
	NSAlertErrorReturn = -2
}

enum
{
	NSOKButton = 1,
	NSCancelButton = 0
}

enum
{
	NSUtilityWindowMask = 1 << 4,
	NSDocModalWindowMask = 1 << 6
}

enum
{
	NSNonactivatingPanelMask = 1 << 7
}

enum
{
	NSHUDWindowMask = 1 << 13
}

class NSPanel : NSWindow
{
	mixin (ObjcWrap);

	bool isFloatingPanel ()
	{
		return invokeObjcSelf!(bool, "isFloatingPanel");
	}

	void setFloatingPanel (bool flag)
	{
		return invokeObjcSelf!(void, "setFloatingPanel:", bool)(flag);
	}

	bool becomesKeyOnlyIfNeeded ()
	{
		return invokeObjcSelf!(bool, "becomesKeyOnlyIfNeeded");
	}

	void setBecomesKeyOnlyIfNeeded (bool flag)
	{
		return invokeObjcSelf!(void, "setBecomesKeyOnlyIfNeeded:", bool)(flag);
	}

	bool worksWhenModal ()
	{
		return invokeObjcSelf!(bool, "worksWhenModal");
	}

	void setWorksWhenModal (bool flag)
	{
		return invokeObjcSelf!(void, "setWorksWhenModal:", bool)(flag);
	}
}

NSInteger NSRunAlertPanel (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, ARGS args)
{
	return Bridge.invokeObjcFunction!(NSInteger, bindings.NSRunAlertPanel, NSString, NSString, NSString, NSString, NSString)(title, msgFormat, defaultButton, alternateButton, otherButton, args);
}

NSInteger NSRunInformationalAlertPanel (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, ARGS args)
{
	return Bridge.invokeObjcFunction!(NSInteger, bindings.NSRunInformationalAlertPanel, NSString, NSString, NSString, NSString, NSString)(title, msgFormat, defaultButton, alternateButton, otherButton, args);
}

NSInteger NSRunCriticalAlertPanel (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, ARGS args)
{
	return Bridge.invokeObjcFunction!(NSInteger, bindings.NSRunCriticalAlertPanel, NSString, NSString, NSString, NSString, NSString)(title, msgFormat, defaultButton, alternateButton, otherButton, args);
}

NSInteger NSRunAlertPanelRelativeToWindow (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, NSWindow docWindow, ARGS args)
{
	return Bridge.invokeObjcFunction!(NSInteger, bindings.NSRunAlertPanelRelativeToWindow, NSString, NSString, NSString, NSString, NSString, NSWindow)(title, msgFormat, defaultButton, alternateButton, otherButton, docWindow, args);
}

NSInteger NSRunInformationalAlertPanelRelativeToWindow (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, NSWindow docWindow, ARGS args)
{
	return Bridge.invokeObjcFunction!(NSInteger, bindings.NSRunInformationalAlertPanelRelativeToWindow, NSString, NSString, NSString, NSString, NSString, NSWindow)(title, msgFormat, defaultButton, alternateButton, otherButton, docWindow, args);
}

NSInteger NSRunCriticalAlertPanelRelativeToWindow (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, NSWindow docWindow, ARGS args)
{
	return Bridge.invokeObjcFunction!(NSInteger, bindings.NSRunCriticalAlertPanelRelativeToWindow, NSString, NSString, NSString, NSString, NSString, NSWindow)(title, msgFormat, defaultButton, alternateButton, otherButton, docWindow), args;
}

void NSBeginAlertSheet (ARGS...) (NSString title, NSString defaultButton, NSString alternateButton, NSString otherButton, NSWindow docWindow, Object modalDelegate, SEL didEndSelector, SEL didDismissSelector, void* contextInfo, NSString msgFormat, ARGS args)
{
	return Bridge.invokeObjcFunction!(void, bindings.NSBeginAlertSheet, NSString, NSString, NSString, NSString, NSWindow, Object, SEL, SEL, void*, NSString)(title, defaultButton, alternateButton, otherButton, docWindow, modalDelegate, didEndSelector, didDismissSelector, contextInfo, msgFormat, args);
}

void NSBeginInformationalAlertSheet (ARGS...) (NSString title, NSString defaultButton, NSString alternateButton, NSString otherButton, NSWindow docWindow, Object modalDelegate, SEL didEndSelector, SEL didDismissSelector, void* contextInfo, NSString msgFormat, ARGS args)
{
	return Bridge.invokeObjcFunction!(void, bindings.NSBeginInformationalAlertSheet, NSString, NSString, NSString, NSString, NSWindow, Object, SEL, SEL, void*, NSString)(title, defaultButton, alternateButton, otherButton, docWindow, modalDelegate, didEndSelector, didDismissSelector, contextInfo, msgFormat, args);
}

void NSBeginCriticalAlertSheet (ARGS...) (NSString title, NSString defaultButton, NSString alternateButton, NSString otherButton, NSWindow docWindow, Object modalDelegate, SEL didEndSelector, SEL didDismissSelector, void* contextInfo, NSString msgFormat, ARGS args)
{
	return Bridge.invokeObjcFunction!(void, bindings.NSBeginCriticalAlertSheet, NSString, NSString, NSString, NSString, NSWindow, Object, SEL, SEL, void*, NSString)(title, defaultButton, alternateButton, otherButton, docWindow, modalDelegate, didEndSelector, didDismissSelector, contextInfo, msgFormat, args);
}

Object NSGetAlertPanel (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, ARGS args)
{
	return Bridge.invokeObjcFunction!(Object, bindings.NSGetAlertPanel, NSString, NSString, NSString, NSString, NSString)(title, msgFormat, defaultButton, alternateButton, otherButton, args, args);
}

Object NSGetInformationalAlertPanel (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, ARGS args)
{
	return Bridge.invokeObjcFunction!(Object, bindings.NSGetInformationalAlertPanel, NSString, NSString, NSString, NSString, NSString)(title, msgFormat, defaultButton, alternateButton, otherButton, args, args);
}

Object NSGetCriticalAlertPanel (ARGS...) (NSString title, NSString msgFormat, NSString defaultButton, NSString alternateButton, NSString otherButton, ARGS args)
{
	return Bridge.invokeObjcFunction!(Object, bindings.NSGetCriticalAlertPanel, NSString, NSString, NSString, NSString, NSString)(title, msgFormat, defaultButton, alternateButton, otherButton, args, args);
}

void NSReleaseAlertPanel (Object panel)
{
	return Bridge.invokeObjcFunction!(void, bindings.NSReleaseAlertPanel, Object)(panel);
}