Mercurial > projects > dstep
comparison dstep/appkit/NSTokenField.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.NSTokenField; | |
8 | |
9 import dstep.appkit.NSTextContainer; | |
10 import dstep.appkit.NSTextField; | |
11 import dstep.appkit.NSTokenFieldCell; | |
12 import dstep.foundation.Foundation; | |
13 import dstep.objc.bridge.Bridge; | |
14 import dstep.objc.objc; | |
15 | |
16 class NSTokenField : NSTextField | |
17 { | |
18 mixin (ObjcWrap); | |
19 | |
20 void setTokenStyle (uint style) | |
21 { | |
22 return invokeObjcSelf!(void, "setTokenStyle:", uint)(style); | |
23 } | |
24 | |
25 uint tokenStyle () | |
26 { | |
27 return invokeObjcSelf!(uint, "tokenStyle"); | |
28 } | |
29 | |
30 void setCompletionDelay (double delay) | |
31 { | |
32 return invokeObjcSelf!(void, "setCompletionDelay:", double)(delay); | |
33 } | |
34 | |
35 double completionDelay () | |
36 { | |
37 return invokeObjcSelf!(double, "completionDelay"); | |
38 } | |
39 | |
40 static double defaultCompletionDelay () | |
41 { | |
42 return invokeObjcSelfClass!(double, "defaultCompletionDelay"); | |
43 } | |
44 | |
45 void setTokenizingCharacterSet (NSCharacterSet characterSet) | |
46 { | |
47 return invokeObjcSelf!(void, "setTokenizingCharacterSet:", NSCharacterSet)(characterSet); | |
48 } | |
49 | |
50 NSCharacterSet tokenizingCharacterSet () | |
51 { | |
52 return invokeObjcSelf!(NSCharacterSet, "tokenizingCharacterSet"); | |
53 } | |
54 | |
55 static NSCharacterSet defaultTokenizingCharacterSet () | |
56 { | |
57 return invokeObjcSelfClass!(NSCharacterSet, "defaultTokenizingCharacterSet"); | |
58 } | |
59 } | |
60 | |
61 const TNSTokenFieldDelegate = ` | |
62 | |
63 NSArray tokenField (NSTokenField tokenField, NSString substring, NSInteger tokenIndex, NSInteger* selectedIndex) | |
64 { | |
65 return invokeObjcSelf!(NSArray, "tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem:", NSTokenField, NSString, NSInteger, NSInteger*)(tokenField, substring, tokenIndex, selectedIndex); | |
66 } | |
67 | |
68 NSArray tokenField (NSTokenField tokenField, NSArray tokens, NSUInteger index) | |
69 { | |
70 return invokeObjcSelf!(NSArray, "tokenField:shouldAddObjects:atIndex:", NSTokenField, NSArray, NSUInteger)(tokenField, tokens, index); | |
71 } | |
72 | |
73 NSString tokenField (NSTokenField tokenField, Object representedObject) | |
74 { | |
75 return invokeObjcSelf!(NSString, "tokenField:displayStringForRepresentedObject:", NSTokenField, Object)(tokenField, representedObject); | |
76 } | |
77 | |
78 NSString tokenField (NSTokenField tokenField, Object representedObject) | |
79 { | |
80 return invokeObjcSelf!(NSString, "tokenField:editingStringForRepresentedObject:", NSTokenField, Object)(tokenField, representedObject); | |
81 } | |
82 | |
83 Object tokenField (NSTokenField tokenField, NSString editingString) | |
84 { | |
85 return invokeObjcSelf!(Object, "tokenField:representedObjectForEditingString:", NSTokenField, NSString)(tokenField, editingString); | |
86 } | |
87 | |
88 bool tokenField (NSTokenField tokenField, NSArray objects, NSPasteboard pboard) | |
89 { | |
90 return invokeObjcSelf!(bool, "tokenField:writeRepresentedObjects:toPasteboard:", NSTokenField, NSArray, NSPasteboard)(tokenField, objects, pboard); | |
91 } | |
92 | |
93 NSArray tokenField (NSTokenField tokenField, NSPasteboard pboard) | |
94 { | |
95 return invokeObjcSelf!(NSArray, "tokenField:readFromPasteboard:", NSTokenField, NSPasteboard)(tokenField, pboard); | |
96 } | |
97 | |
98 NSMenu tokenField (NSTokenField tokenField, Object representedObject) | |
99 { | |
100 return invokeObjcSelf!(NSMenu, "tokenField:menuForRepresentedObject:", NSTokenField, Object)(tokenField, representedObject); | |
101 } | |
102 | |
103 bool tokenField (NSTokenField tokenField, Object representedObject) | |
104 { | |
105 return invokeObjcSelf!(bool, "tokenField:hasMenuForRepresentedObject:", NSTokenField, Object)(tokenField, representedObject); | |
106 } | |
107 | |
108 uint tokenField (NSTokenField tokenField, Object representedObject) | |
109 { | |
110 return invokeObjcSelf!(uint, "tokenField:styleForRepresentedObject:", NSTokenField, Object)(tokenField, representedObject); | |
111 } | |
112 | |
113 //mixin ObjcBindMethod!(tokenField, "tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem:"); | |
114 //mixin ObjcBindMethod!(tokenField, "tokenField:shouldAddObjects:atIndex:"); | |
115 //mixin ObjcBindMethod!(tokenField, "tokenField:displayStringForRepresentedObject:"); | |
116 //mixin ObjcBindMethod!(tokenField, "tokenField:editingStringForRepresentedObject:"); | |
117 //mixin ObjcBindMethod!(tokenField, "tokenField:representedObjectForEditingString:"); | |
118 //mixin ObjcBindMethod!(tokenField, "tokenField:writeRepresentedObjects:toPasteboard:"); | |
119 //mixin ObjcBindMethod!(tokenField, "tokenField:readFromPasteboard:"); | |
120 //mixin ObjcBindMethod!(tokenField, "tokenField:menuForRepresentedObject:"); | |
121 //mixin ObjcBindMethod!(tokenField, "tokenField:hasMenuForRepresentedObject:"); | |
122 //mixin ObjcBindMethod!(tokenField, "tokenField:styleForRepresentedObject:"); | |
123 | |
124 `; | |
125 |