Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSPositionalSpecifier.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.NSPositionalSpecifier; | |
15 | |
16 import dwt.internal.cocoa.NSInteger; | |
17 import dwt.internal.cocoa.NSObject; | |
18 import dwt.internal.cocoa.NSScriptClassDescription; | |
19 import dwt.internal.cocoa.NSScriptObjectSpecifier; | |
20 import dwt.internal.cocoa.NSString; | |
21 import dwt.internal.cocoa.OS; | |
22 import objc = dwt.internal.objc.runtime; | |
23 | |
24 enum NSInsertionPosition | |
25 { | |
26 NSPositionAfter, | |
27 NSPositionBefore, | |
28 NSPositionBeginning, | |
29 NSPositionEnd, | |
30 NSPositionReplace | |
31 } | |
32 | |
33 alias NSInsertionPosition.NSPositionAfter NSPositionAfter; | |
34 alias NSInsertionPosition.NSPositionBefore NSPositionBefore; | |
35 alias NSInsertionPosition.NSPositionBeginning NSPositionBeginning; | |
36 alias NSInsertionPosition.NSPositionEnd NSPositionEnd; | |
37 alias NSInsertionPosition.NSPositionReplace NSPositionReplace; | |
38 | |
39 public class NSPositionalSpecifier : NSObject | |
40 { | |
41 | |
42 public this () | |
43 { | |
44 super(); | |
45 } | |
46 | |
47 public this (objc.id id) | |
48 { | |
49 super(id); | |
50 } | |
51 | |
52 public void evaluate () | |
53 { | |
54 OS.objc_msgSend(this.id, OS.sel_evaluate); | |
55 } | |
56 | |
57 public NSPositionalSpecifier initWithPosition (NSInsertionPosition position, NSScriptObjectSpecifier specifier) | |
58 { | |
59 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithPosition_1objectSpecifier_1, position, specifier !is null ? specifier.id : null); | |
60 return result !is null ? this : null; | |
61 } | |
62 | |
63 public id insertionContainer () | |
64 { | |
65 objc.id result = OS.objc_msgSend(this.id, OS.sel_insertionContainer); | |
66 return result !is null ? new id(result) : null; | |
67 } | |
68 | |
69 public NSInteger insertionIndex () | |
70 { | |
71 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_insertionIndex); | |
72 } | |
73 | |
74 public NSString insertionKey () | |
75 { | |
76 objc.id result = OS.objc_msgSend(this.id, OS.sel_insertionKey); | |
77 return result !is null ? new NSString(result) : null; | |
78 } | |
79 | |
80 public bool insertionReplaces () | |
81 { | |
82 return OS.objc_msgSend(this.id, OS.sel_insertionReplaces) !is null; | |
83 } | |
84 | |
85 public NSScriptObjectSpecifier objectSpecifier () | |
86 { | |
87 objc.id result = OS.objc_msgSend(this.id, OS.sel_objectSpecifier); | |
88 return result !is null ? new NSScriptObjectSpecifier(result) : null; | |
89 } | |
90 | |
91 public NSInsertionPosition position () | |
92 { | |
93 return cast(NSInsertionPosition) OS.objc_msgSend(this.id, OS.sel_position); | |
94 } | |
95 | |
96 public void setInsertionClassDescription (NSScriptClassDescription classDescription) | |
97 { | |
98 OS.objc_msgSend(this.id, OS.sel_setInsertionClassDescription_1, classDescription !is null ? classDescription.id : null); | |
99 } | |
100 | |
101 } |