comparison dwt/internal/cocoa/NSTextBlock.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.NSTextBlock;
15
16 import dwt.internal.cocoa.CGFloat;
17 import dwt.internal.cocoa.NSColor;
18 import dwt.internal.cocoa.NSLayoutManager;
19 import dwt.internal.cocoa.NSObject;
20 import dwt.internal.cocoa.NSPoint;
21 import dwt.internal.cocoa.NSRange;
22 import dwt.internal.cocoa.NSRect;
23 import dwt.internal.cocoa.NSTextContainer;
24 import dwt.internal.cocoa.NSTextTable : NSTextBlockDimension, NSTextBlockLayer, NSTextBlockValueType, NSTextBlockVerticalAlignment;
25 import dwt.internal.cocoa.NSView;
26 import dwt.internal.cocoa.OS;
27 import objc = dwt.internal.objc.runtime;
28
29 public class NSTextBlock : 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 NSColor backgroundColor ()
43 {
44 objc.id result = OS.objc_msgSend(this.id, OS.sel_backgroundColor);
45 return result !is null ? new NSColor(result) : null;
46 }
47
48 public NSColor borderColorForEdge (NSRectEdge edge)
49 {
50 objc.id result = OS.objc_msgSend(this.id, OS.sel_borderColorForEdge_1, edge);
51 return result !is null ? new NSColor(result) : null;
52 }
53
54 public NSRect boundsRectForContentRect (NSRect contentRect, NSRect rect, NSTextContainer textContainer, NSRange charRange)
55 {
56 NSRect result;
57 OS.objc_msgSend_stret(result, this.id, OS.sel_boundsRectForContentRect_1inRect_1textContainer_1characterRange_1, contentRect, rect,
58 textContainer !is null ? textContainer.id : null, charRange);
59 return result;
60 }
61
62 public CGFloat contentWidth ()
63 {
64 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_contentWidth);
65 }
66
67 public NSTextBlockValueType contentWidthValueType ()
68 {
69 return cast(NSTextBlockValueType) OS.objc_msgSend(this.id, OS.sel_contentWidthValueType);
70 }
71
72 public void drawBackgroundWithFrame (NSRect frameRect, NSView controlView, NSRange charRange, NSLayoutManager layoutManager)
73 {
74 OS.objc_msgSend(this.id, OS.sel_drawBackgroundWithFrame_1inView_1characterRange_1layoutManager_1, frameRect,
75 controlView !is null ? controlView.id : null, charRange, layoutManager !is null ? layoutManager.id : null);
76 }
77
78 public NSRect rectForLayoutAtPoint (NSPoint startingPoint, NSRect rect, NSTextContainer textContainer, NSRange charRange)
79 {
80 NSRect result;
81 OS.objc_msgSend_stret(result, this.id, OS.sel_rectForLayoutAtPoint_1inRect_1textContainer_1characterRange_1, startingPoint, rect,
82 textContainer !is null ? textContainer.id : null, charRange);
83 return result;
84 }
85
86 public void setBackgroundColor (NSColor color)
87 {
88 OS.objc_msgSend(this.id, OS.sel_setBackgroundColor_1, color !is null ? color.id : null);
89 }
90
91 public void setBorderColor_ (NSColor color)
92 {
93 OS.objc_msgSend(this.id, OS.sel_setBorderColor_1, color !is null ? color.id : null);
94 }
95
96 public void setBorderColor_forEdge_ (NSColor color, NSRectEdge edge)
97 {
98 OS.objc_msgSend(this.id, OS.sel_setBorderColor_1forEdge_1, color !is null ? color.id : null, edge);
99 }
100
101 public void setContentWidth (CGFloat val, NSTextBlockValueType type)
102 {
103 OS.objc_msgSend(this.id, OS.sel_setContentWidth_1type_1, val, type);
104 }
105
106 public void setValue (CGFloat val, NSTextBlockValueType type, NSTextBlockDimension dimension)
107 {
108 OS.objc_msgSend(this.id, OS.sel_setValue_1type_1forDimension_1, val, type, dimension);
109 }
110
111 public void setVerticalAlignment (NSTextBlockVerticalAlignment alignment)
112 {
113 OS.objc_msgSend(this.id, OS.sel_setVerticalAlignment_1, alignment);
114 }
115
116 public void setWidth_type_forLayer_ (CGFloat val, NSTextBlockValueType type, NSTextBlockLayer layer)
117 {
118 OS.objc_msgSend(this.id, OS.sel_setWidth_1type_1forLayer_1, val, type, layer);
119 }
120
121 public void setWidth_type_forLayer_edge_ (CGFloat val, NSTextBlockValueType type, NSTextBlockLayer layer, NSRectEdge edge)
122 {
123 OS.objc_msgSend(this.id, OS.sel_setWidth_1type_1forLayer_1edge_1, val, type, layer, edge);
124 }
125
126 public CGFloat valueForDimension (NSTextBlockDimension dimension)
127 {
128 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_valueForDimension_1, dimension);
129 }
130
131 public NSTextBlockValueType valueTypeForDimension (NSTextBlockDimension dimension)
132 {
133 return cast(NSTextBlockValueType) OS.objc_msgSend(this.id, OS.sel_valueTypeForDimension_1, dimension);
134 }
135
136 public NSTextBlockVerticalAlignment verticalAlignment ()
137 {
138 return cast(NSTextBlockVerticalAlignment) OS.objc_msgSend(this.id, OS.sel_verticalAlignment);
139 }
140
141 public CGFloat widthForLayer (NSTextBlockLayer layer, NSRectEdge edge)
142 {
143 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_widthForLayer_1edge_1, layer, edge);
144 }
145
146 public NSTextBlockValueType widthValueTypeForLayer (NSTextBlockLayer layer, NSRectEdge edge)
147 {
148 return cast(NSTextBlockValueType) OS.objc_msgSend(this.id, OS.sel_widthValueTypeForLayer_1edge_1, layer, edge);
149 }
150
151 }