comparison dstep/appkit/NSOpenPanel.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
comparison
equal deleted inserted replaced
15:7ff919f595d5 16:19885b43130e
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Sep 24, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.appkit.NSOpenPanel;
8
9 import dstep.appkit.NSSavePanel;
10 import dstep.foundation.NSArray;
11 import dstep.foundation.NSObjCRuntime;
12 import dstep.foundation.NSString;
13 import dstep.appkit.NSWindow;
14 import dstep.objc.bridge.Bridge;
15 import dstep.objc.objc;
16
17 const TNSOpenPanelRuntime = `
18
19 void beginSheetForDirectory (NSString path, NSString name, NSArray fileTypes, NSWindow docWindow, Object delegate_, SEL didEndSelector, void* contextInfo)
20 {
21 return invokeObjcSelf!(void, "beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:", NSString, NSString, NSArray, NSWindow, Object, SEL, void*)(path, name, fileTypes, docWindow, delegate_, didEndSelector, contextInfo);
22 }
23
24 void beginForDirectory (NSString path, NSString name, NSArray fileTypes, Object delegate_, SEL didEndSelector, void* contextInfo)
25 {
26 return invokeObjcSelf!(void, "beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo:", NSString, NSString, NSArray, Object, SEL, void*)(path, name, fileTypes, delegate_, didEndSelector, contextInfo);
27 }
28
29 NSInteger runModalForDirectory (NSString path, NSString name, NSArray fileTypes)
30 {
31 return invokeObjcSelf!(NSInteger, "runModalForDirectory:file:types:", NSString, NSString, NSArray)(path, name, fileTypes);
32 }
33
34 NSInteger runModalForTypes (NSArray fileTypes)
35 {
36 return invokeObjcSelf!(NSInteger, "runModalForTypes:", NSArray)(fileTypes);
37 }
38
39 //mixin ObjcBindMethod!(beginSheetForDirectory, "beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:");
40 //mixin ObjcBindMethod!(beginForDirectory, "beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo:");
41 //mixin ObjcBindMethod!(runModalForDirectory, "runModalForDirectory:file:types:");
42 //mixin ObjcBindMethod!(runModalForTypes, "runModalForTypes:");
43
44 `;
45
46 class NSOpenPanel : NSSavePanel
47 {
48 mixin (ObjcWrap);
49
50 static NSOpenPanel openPanel ()
51 {
52 return invokeObjcSelfClass!(NSOpenPanel, "openPanel");
53 }
54
55 NSArray URLs ()
56 {
57 return invokeObjcSelf!(NSArray, "URLs");
58 }
59
60 NSArray filenames ()
61 {
62 return invokeObjcSelf!(NSArray, "filenames");
63 }
64
65 bool resolvesAliases ()
66 {
67 return invokeObjcSelf!(bool, "resolvesAliases");
68 }
69
70 void setResolvesAliases (bool flag)
71 {
72 return invokeObjcSelf!(void, "setResolvesAliases:", bool)(flag);
73 }
74
75 bool canChooseDirectories ()
76 {
77 return invokeObjcSelf!(bool, "canChooseDirectories");
78 }
79
80 void setCanChooseDirectories (bool flag)
81 {
82 return invokeObjcSelf!(void, "setCanChooseDirectories:", bool)(flag);
83 }
84
85 bool allowsMultipleSelection ()
86 {
87 return invokeObjcSelf!(bool, "allowsMultipleSelection");
88 }
89
90 void setAllowsMultipleSelection (bool flag)
91 {
92 return invokeObjcSelf!(void, "setAllowsMultipleSelection:", bool)(flag);
93 }
94
95 bool canChooseFiles ()
96 {
97 return invokeObjcSelf!(bool, "canChooseFiles");
98 }
99
100 void setCanChooseFiles (bool flag)
101 {
102 return invokeObjcSelf!(void, "setCanChooseFiles:", bool)(flag);
103 }
104
105 // NSOpenPanelRuntime
106 void beginSheetForDirectory (NSString path, NSString name, NSArray fileTypes, NSWindow docWindow, Object delegate_, SEL didEndSelector, void* contextInfo)
107 {
108 return invokeObjcSelf!(void, "beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:", NSString, NSString, NSArray, NSWindow, Object, SEL, void*)(path, name, fileTypes, docWindow, delegate_, didEndSelector, contextInfo);
109 }
110
111 void beginForDirectory (NSString path, NSString name, NSArray fileTypes, Object delegate_, SEL didEndSelector, void* contextInfo)
112 {
113 return invokeObjcSelf!(void, "beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo:", NSString, NSString, NSArray, Object, SEL, void*)(path, name, fileTypes, delegate_, didEndSelector, contextInfo);
114 }
115
116 NSInteger runModalForDirectory (NSString path, NSString name, NSArray fileTypes)
117 {
118 return invokeObjcSelf!(NSInteger, "runModalForDirectory:file:types:", NSString, NSString, NSArray)(path, name, fileTypes);
119 }
120
121 NSInteger runModalForTypes (NSArray fileTypes)
122 {
123 return invokeObjcSelf!(NSInteger, "runModalForTypes:", NSArray)(fileTypes);
124 }
125 }