comparison dstep/appkit/NSTextContainer.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.NSTextContainer;
8
9 import dstep.appkit.NSLayoutManager;
10 import dstep.appkit.NSTextView;
11 import dstep.applicationservices.coregraphics.CGBase;
12 import dstep.foundation.NSCoder;
13 import dstep.foundation.NSGeometry;
14 import dstep.foundation.NSObjCRuntime;
15 import dstep.foundation.NSObject;
16 import dstep.foundation.NSZone;
17 import dstep.objc.bridge.Bridge;
18 import dstep.objc.objc;
19
20 typedef NSUInteger NSLineSweepDirection;
21 typedef NSUInteger NSLineMovementDirection;
22
23 enum : NSUInteger
24 {
25 NSLineSweepLeft = 0,
26 NSLineSweepRight = 1,
27 NSLineSweepDown = 2,
28 NSLineSweepUp = 3
29 }
30
31 enum : NSUInteger
32 {
33 NSLineDoesntMove = 0,
34 NSLineMovesLeft = 1,
35 NSLineMovesRight = 2,
36 NSLineMovesDown = 3,
37 NSLineMovesUp = 4
38 }
39
40 class NSTextContainer : NSObject, INSCoding
41 {
42 mixin (ObjcWrap);
43
44 this (NSCoder aDecoder)
45 {
46 super(typeof(this).alloc.initWithCoder(aDecoder).objcObject);
47 }
48
49 void encodeWithCoder (NSCoder aCoder)
50 {
51 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
52 }
53
54 typeof(this) initWithCoder (NSCoder aDecoder)
55 {
56 return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder);
57 }
58
59 typeof(this) copyWithZone (NSZone* zone)
60 {
61 return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone);
62 }
63
64 NSTextContainer initWithContainerSize (NSSize size)
65 {
66 id result = invokeObjcSelf!(id, "initWithContainerSize:", NSSize)(size);
67 return result is this.objcObject ? this : (result !is null ? new NSTextContainer(result) : null);
68 }
69
70 this (NSSize size)
71 {
72 super(NSTextContainer.alloc.initWithContainerSize(size).objcObject);
73 }
74
75 NSLayoutManager layoutManager ()
76 {
77 return invokeObjcSelf!(NSLayoutManager, "layoutManager");
78 }
79
80 void setLayoutManager (NSLayoutManager layoutManager)
81 {
82 return invokeObjcSelf!(void, "setLayoutManager:", NSLayoutManager)(layoutManager);
83 }
84
85 void replaceLayoutManager (NSLayoutManager newLayoutManager)
86 {
87 return invokeObjcSelf!(void, "replaceLayoutManager:", NSLayoutManager)(newLayoutManager);
88 }
89
90 NSTextView textView ()
91 {
92 return invokeObjcSelf!(NSTextView, "textView");
93 }
94
95 void setTextView (NSTextView textView)
96 {
97 return invokeObjcSelf!(void, "setTextView:", NSTextView)(textView);
98 }
99
100 void setWidthTracksTextView (bool flag)
101 {
102 return invokeObjcSelf!(void, "setWidthTracksTextView:", bool)(flag);
103 }
104
105 bool widthTracksTextView ()
106 {
107 return invokeObjcSelf!(bool, "widthTracksTextView");
108 }
109
110 void setHeightTracksTextView (bool flag)
111 {
112 return invokeObjcSelf!(void, "setHeightTracksTextView:", bool)(flag);
113 }
114
115 bool heightTracksTextView ()
116 {
117 return invokeObjcSelf!(bool, "heightTracksTextView");
118 }
119
120 void setContainerSize (NSSize size)
121 {
122 return invokeObjcSelf!(void, "setContainerSize:", NSSize)(size);
123 }
124
125 NSSize containerSize ()
126 {
127 return invokeObjcSelf!(NSSize, "containerSize");
128 }
129
130 void setLineFragmentPadding (CGFloat pad)
131 {
132 return invokeObjcSelf!(void, "setLineFragmentPadding:", CGFloat)(pad);
133 }
134
135 CGFloat lineFragmentPadding ()
136 {
137 return invokeObjcSelf!(CGFloat, "lineFragmentPadding");
138 }
139
140 NSRect lineFragmentRectForProposedRect (NSRect proposedRect, uint sweepDirection, uint movementDirection, NSRectPointer remainingRect)
141 {
142 return invokeObjcSelf!(NSRect, "lineFragmentRectForProposedRect:sweepDirection:movementDirection:remainingRect:", NSRect, uint, uint, NSRectPointer)(proposedRect, sweepDirection, movementDirection, remainingRect);
143 }
144
145 bool isSimpleRectangularTextContainer ()
146 {
147 return invokeObjcSelf!(bool, "isSimpleRectangularTextContainer");
148 }
149
150 bool containsPoint (NSPoint point)
151 {
152 return invokeObjcSelf!(bool, "containsPoint:", NSPoint)(point);
153 }
154
155 }
156