Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSFontDescriptor.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
11 * Port to the D Programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
13 *******************************************************************************/ | |
14 module dwt.internal.cocoa.NSFontDescriptor; | |
15 | |
16 import dwt.internal.cocoa.CGFloat; | |
17 import dwt.internal.cocoa.id; | |
18 import dwt.internal.cocoa.NSAffineTransform; | |
19 import dwt.internal.cocoa.NSArray; | |
20 import dwt.internal.cocoa.NSDictionary; | |
21 import dwt.internal.cocoa.NSObject; | |
22 import dwt.internal.cocoa.NSSet; | |
23 import dwt.internal.cocoa.NSString; | |
24 import dwt.internal.cocoa.OS; | |
25 import objc = dwt.internal.objc.runtime; | |
26 | |
27 alias uint NSFontSymbolicTraits; | |
28 | |
29 public class NSFontDescriptor : NSObject | |
30 { | |
31 | |
32 public this () | |
33 { | |
34 super(); | |
35 } | |
36 | |
37 public this (objc.id id) | |
38 { | |
39 super(id); | |
40 } | |
41 | |
42 public NSDictionary fontAttributes () | |
43 { | |
44 objc.id result = OS.objc_msgSend(this.id, OS.sel_fontAttributes); | |
45 return result !is null ? new NSDictionary(result) : null; | |
46 } | |
47 | |
48 public NSFontDescriptor fontDescriptorByAddingAttributes (NSDictionary attributes) | |
49 { | |
50 objc.id result = OS.objc_msgSend(this.id, OS.sel_fontDescriptorByAddingAttributes_1, attributes !is null ? attributes.id : null); | |
51 return result is this.id ? this : (result !is null ? new NSFontDescriptor(result) : null); | |
52 } | |
53 | |
54 public NSFontDescriptor fontDescriptorWithFace (NSString newFace) | |
55 { | |
56 objc.id result = OS.objc_msgSend(this.id, OS.sel_fontDescriptorWithFace_1, newFace !is null ? newFace.id : null); | |
57 return result is this.id ? this : (result !is null ? new NSFontDescriptor(result) : null); | |
58 } | |
59 | |
60 public NSFontDescriptor fontDescriptorWithFamily (NSString newFamily) | |
61 { | |
62 objc.id result = OS.objc_msgSend(this.id, OS.sel_fontDescriptorWithFamily_1, newFamily !is null ? newFamily.id : null); | |
63 return result is this.id ? this : (result !is null ? new NSFontDescriptor(result) : null); | |
64 } | |
65 | |
66 public static NSFontDescriptor fontDescriptorWithFontAttributes (NSDictionary attributes) | |
67 { | |
68 objc.id result = OS.objc_msgSend(OS.class_NSFontDescriptor, OS.sel_fontDescriptorWithFontAttributes_1, | |
69 attributes !is null ? attributes.id : null); | |
70 return result !is null ? new NSFontDescriptor(result) : null; | |
71 } | |
72 | |
73 public NSFontDescriptor fontDescriptorWithMatrix (NSAffineTransform matrix) | |
74 { | |
75 objc.id result = OS.objc_msgSend(this.id, OS.sel_fontDescriptorWithMatrix_1, matrix !is null ? matrix.id : null); | |
76 return result is this.id ? this : (result !is null ? new NSFontDescriptor(result) : null); | |
77 } | |
78 | |
79 public static NSFontDescriptor static_fontDescriptorWithName_matrix_ (NSString fontName, NSAffineTransform matrix) | |
80 { | |
81 objc.id result = OS.objc_msgSend(OS.class_NSFontDescriptor, OS.sel_fontDescriptorWithName_1matrix_1, fontName !is null ? fontName.id : null, | |
82 matrix !is null ? matrix.id : null); | |
83 return result !is null ? new NSFontDescriptor(result) : null; | |
84 } | |
85 | |
86 public static NSFontDescriptor static_fontDescriptorWithName_size_ (NSString fontName, CGFloat size) | |
87 { | |
88 objc.id result = OS.objc_msgSend(OS.class_NSFontDescriptor, OS.sel_fontDescriptorWithName_1size_1, fontName !is null ? fontName.id : null, | |
89 size); | |
90 return result !is null ? new NSFontDescriptor(result) : null; | |
91 } | |
92 | |
93 public NSFontDescriptor fontDescriptorWithSize (CGFloat newPointSize) | |
94 { | |
95 objc.id result = OS.objc_msgSend(this.id, OS.sel_fontDescriptorWithSize_1, newPointSize); | |
96 return result is this.id ? this : (result !is null ? new NSFontDescriptor(result) : null); | |
97 } | |
98 | |
99 public NSFontDescriptor fontDescriptorWithSymbolicTraits (NSFontSymbolicTraits symbolicTraits) | |
100 { | |
101 objc.id result = OS.objc_msgSend(this.id, OS.sel_fontDescriptorWithSymbolicTraits_1, symbolicTraits); | |
102 return result is this.id ? this : (result !is null ? new NSFontDescriptor(result) : null); | |
103 } | |
104 | |
105 public id initWithFontAttributes (NSDictionary attributes) | |
106 { | |
107 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithFontAttributes_1, attributes !is null ? attributes.id : null); | |
108 return result !is null ? new id(result) : null; | |
109 } | |
110 | |
111 public NSFontDescriptor matchingFontDescriptorWithMandatoryKeys (NSSet mandatoryKeys) | |
112 { | |
113 objc.id result = OS.objc_msgSend(this.id, OS.sel_matchingFontDescriptorWithMandatoryKeys_1, mandatoryKeys !is null ? mandatoryKeys.id : null); | |
114 return result is this.id ? this : (result !is null ? new NSFontDescriptor(result) : null); | |
115 } | |
116 | |
117 public NSArray matchingFontDescriptorsWithMandatoryKeys (NSSet mandatoryKeys) | |
118 { | |
119 objc.id | |
120 result = OS.objc_msgSend(this.id, OS.sel_matchingFontDescriptorsWithMandatoryKeys_1, mandatoryKeys !is null ? mandatoryKeys.id : null); | |
121 return result !is null ? new NSArray(result) : null; | |
122 } | |
123 | |
124 public NSAffineTransform matrix () | |
125 { | |
126 objc.id result = OS.objc_msgSend(this.id, OS.sel_matrix); | |
127 return result !is null ? new NSAffineTransform(result) : null; | |
128 } | |
129 | |
130 public id objectForKey (NSString anAttribute) | |
131 { | |
132 objc.id result = OS.objc_msgSend(this.id, OS.sel_objectForKey_1, anAttribute !is null ? anAttribute.id : null); | |
133 return result !is null ? new id(result) : null; | |
134 } | |
135 | |
136 public CGFloat pointSize () | |
137 { | |
138 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_pointSize); | |
139 } | |
140 | |
141 public NSString postscriptName () | |
142 { | |
143 objc.id result = OS.objc_msgSend(this.id, OS.sel_postscriptName); | |
144 return result !is null ? new NSString(result) : null; | |
145 } | |
146 | |
147 public NSFontSymbolicTraits symbolicTraits () | |
148 { | |
149 return OS.objc_msgSend(this.id, OS.sel_symbolicTraits); | |
150 } | |
151 | |
152 } |