Mercurial > projects > dwt2
comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet217.d @ 124:6f2199435268
fixed snippet 217 and OpenGL snippets
author | Denis Shelomovskij <verylonglogin.reg@gmail.com> |
---|---|
date | Thu, 11 Aug 2011 19:28:27 +0300 |
parents | 536e43f63c81 |
children |
comparison
equal
deleted
inserted
replaced
123:746dd3dea737 | 124:6f2199435268 |
---|---|
46 import java.lang.all; | 46 import java.lang.all; |
47 version(JIVE){ | 47 version(JIVE){ |
48 import jive.stacktrace; | 48 import jive.stacktrace; |
49 } | 49 } |
50 | 50 |
51 const OBJ_MARKER = "\uFFFC"; | 51 const char[] OBJ_MARKER = "\uFFFC"; //should be char[] because of dmd v1.069 @@@BUG@@@ Issue 6467 |
52 void main() { | 52 void main() { |
53 static StyledText styledText; | 53 static StyledText styledText; |
54 static String text = | 54 static String text = |
55 "This snippet shows how to embed widgets in a StyledText.\n" | 55 "This snippet shows how to embed widgets in a StyledText.\n" |
56 "Here is one: " ~ OBJ_MARKER ~ ", and here is another: " ~ OBJ_MARKER ~ "."; | 56 "Here is one: " ~ OBJ_MARKER ~ ", and here is another: " ~ OBJ_MARKER ~ "."; |
89 controls[1] = combo; | 89 controls[1] = combo; |
90 offsets = new int[controls.length]; | 90 offsets = new int[controls.length]; |
91 int lastOffset = 0; | 91 int lastOffset = 0; |
92 for (int i = 0; i < controls.length; i++) { | 92 for (int i = 0; i < controls.length; i++) { |
93 int offset = text.indexOf( OBJ_MARKER, lastOffset); | 93 int offset = text.indexOf( OBJ_MARKER, lastOffset); |
94 assert(offset != -1, "Can't find OBJ_MARKER"); | |
94 offsets[i] = offset; | 95 offsets[i] = offset; |
95 addControl(controls[i], offsets[i]); | 96 addControl(controls[i], offsets[i]); |
96 lastOffset = offset + OBJ_MARKER.length; | 97 lastOffset = offset + OBJ_MARKER.length; |
97 } | 98 } |
98 | 99 |