Mercurial > projects > dstep
comparison dstep/appkit/NSFormCell.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.NSFormCell; | |
8 | |
9 import dstep.appkit.NSActionCell; | |
10 import dstep.appkit.NSFont; | |
11 import dstep.applicationservices.coregraphics.CGBase; | |
12 import dstep.foundation.NSAttributedString; | |
13 import dstep.foundation.NSGeometry; | |
14 import dstep.foundation.NSString; | |
15 import dstep.objc.bridge.Bridge; | |
16 import dstep.objc.objc; | |
17 | |
18 const TNSKeyboardUI = ` | |
19 | |
20 void setTitleWithMnemonic (NSString stringWithAmpersand) | |
21 { | |
22 return invokeObjcSelf!(void, "setTitleWithMnemonic:", NSString)(stringWithAmpersand); | |
23 } | |
24 | |
25 //mixin ObjcBindMethod!(setTitleWithMnemonic, "setTitleWithMnemonic:"); | |
26 | |
27 `; | |
28 | |
29 const TNSFormCellAttributedStringMethods = ` | |
30 | |
31 NSAttributedString attributedTitle () | |
32 { | |
33 return invokeObjcSelf!(NSAttributedString, "attributedTitle"); | |
34 } | |
35 | |
36 void setAttributedTitle (NSAttributedString obj) | |
37 { | |
38 return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(obj); | |
39 } | |
40 | |
41 //mixin ObjcBindMethod!(attributedTitle, "attributedTitle"); | |
42 //mixin ObjcBindMethod!(setAttributedTitle, "setAttributedTitle:"); | |
43 | |
44 `; | |
45 | |
46 class NSFormCell : NSActionCell | |
47 { | |
48 mixin (ObjcWrap); | |
49 | |
50 NSFormCell initTextCell (NSString aString) | |
51 { | |
52 id result = invokeObjcSelf!(id, "initTextCell:", NSString)(aString); | |
53 return result is this.objcObject ? this : (result !is null ? new NSFormCell(result) : null); | |
54 } | |
55 | |
56 this (NSString aString) | |
57 { | |
58 super(NSFormCell.alloc.initTextCell(aString).objcObject); | |
59 } | |
60 | |
61 CGFloat titleWidth (NSSize aSize) | |
62 { | |
63 return invokeObjcSelf!(CGFloat, "titleWidth:", NSSize)(aSize); | |
64 } | |
65 | |
66 CGFloat titleWidth () | |
67 { | |
68 return invokeObjcSelf!(CGFloat, "titleWidth"); | |
69 } | |
70 | |
71 void setTitleWidth (CGFloat width) | |
72 { | |
73 return invokeObjcSelf!(void, "setTitleWidth:", CGFloat)(width); | |
74 } | |
75 | |
76 NSString title () | |
77 { | |
78 return invokeObjcSelf!(NSString, "title"); | |
79 } | |
80 | |
81 void setTitle (NSString aString) | |
82 { | |
83 return invokeObjcSelf!(void, "setTitle:", NSString)(aString); | |
84 } | |
85 | |
86 NSFont titleFont () | |
87 { | |
88 return invokeObjcSelf!(NSFont, "titleFont"); | |
89 } | |
90 | |
91 void setTitleFont (NSFont fontObj) | |
92 { | |
93 return invokeObjcSelf!(void, "setTitleFont:", NSFont)(fontObj); | |
94 } | |
95 | |
96 uint titleAlignment () | |
97 { | |
98 return invokeObjcSelf!(uint, "titleAlignment"); | |
99 } | |
100 | |
101 void setTitleAlignment (uint mode) | |
102 { | |
103 return invokeObjcSelf!(void, "setTitleAlignment:", uint)(mode); | |
104 } | |
105 | |
106 bool isOpaque () | |
107 { | |
108 return invokeObjcSelf!(bool, "isOpaque"); | |
109 } | |
110 | |
111 void setPlaceholderString (NSString string) | |
112 { | |
113 return invokeObjcSelf!(void, "setPlaceholderString:", NSString)(string); | |
114 } | |
115 | |
116 NSString placeholderString () | |
117 { | |
118 return invokeObjcSelf!(NSString, "placeholderString"); | |
119 } | |
120 | |
121 void setPlaceholderAttributedString (NSAttributedString string) | |
122 { | |
123 return invokeObjcSelf!(void, "setPlaceholderAttributedString:", NSAttributedString)(string); | |
124 } | |
125 | |
126 NSAttributedString placeholderAttributedString () | |
127 { | |
128 return invokeObjcSelf!(NSAttributedString, "placeholderAttributedString"); | |
129 } | |
130 | |
131 int titleBaseWritingDirection () | |
132 { | |
133 return invokeObjcSelf!(int, "titleBaseWritingDirection"); | |
134 } | |
135 | |
136 void setTitleBaseWritingDirection (int writingDirection) | |
137 { | |
138 return invokeObjcSelf!(void, "setTitleBaseWritingDirection:", int)(writingDirection); | |
139 } | |
140 | |
141 // NSKeyboardUI | |
142 void setTitleWithMnemonic (NSString stringWithAmpersand) | |
143 { | |
144 return invokeObjcSelf!(void, "setTitleWithMnemonic:", NSString)(stringWithAmpersand); | |
145 } | |
146 | |
147 // NSFormCellAttributedStringMethods | |
148 NSAttributedString attributedTitle () | |
149 { | |
150 return invokeObjcSelf!(NSAttributedString, "attributedTitle"); | |
151 } | |
152 | |
153 void setAttributedTitle (NSAttributedString obj) | |
154 { | |
155 return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(obj); | |
156 } | |
157 } |