Mercurial > projects > dwt-win
comparison dwt/internal/BidiUtil.d @ 212:ab60f3309436
reverted the char[] to String and use the an alias.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 05 May 2008 00:12:38 +0200 |
parents | 184ab53b7785 |
children | 36f5cb12e1a2 |
comparison
equal
deleted
inserted
replaced
211:ff59aeb96cac | 212:ab60f3309436 |
---|---|
48 * to support CLDC, .class cannot be used because | 48 * to support CLDC, .class cannot be used because |
49 * it does not compile on some Java compilers when | 49 * it does not compile on some Java compilers when |
50 * they are targeted for CLDC. | 50 * they are targeted for CLDC. |
51 */ | 51 */ |
52 // static Callback callback = new Callback (BidiUtil.class, "windowProc", 4); | 52 // static Callback callback = new Callback (BidiUtil.class, "windowProc", 4); |
53 static const char[] CLASS_NAME = "org.eclipse.swt.internal.BidiUtil"; //$NON-NLS-1$ | 53 static const String CLASS_NAME = "org.eclipse.swt.internal.BidiUtil"; //$NON-NLS-1$ |
54 // static this() { | 54 // static this() { |
55 // try { | 55 // try { |
56 // callback = new Callback (Class.forName (CLASS_NAME), "windowProc", 4); //$NON-NLS-1$ | 56 // callback = new Callback (Class.forName (CLASS_NAME), "windowProc", 4); //$NON-NLS-1$ |
57 // if (callback.getAddress () is 0) DWT.error (DWT.ERROR_NO_MORE_CALLBACKS); | 57 // if (callback.getAddress () is 0) DWT.error (DWT.ERROR_NO_MORE_CALLBACKS); |
58 // } catch (ClassNotFoundException e) {} | 58 // } catch (ClassNotFoundException e) {} |
74 static const int ETO_GLYPH_INDEX = 0x0010; | 74 static const int ETO_GLYPH_INDEX = 0x0010; |
75 // Windows primary language identifiers | 75 // Windows primary language identifiers |
76 static const int LANG_ARABIC = 0x01; | 76 static const int LANG_ARABIC = 0x01; |
77 static const int LANG_HEBREW = 0x0d; | 77 static const int LANG_HEBREW = 0x0d; |
78 // code page identifiers | 78 // code page identifiers |
79 static const char[] CD_PG_HEBREW = "1255"; //$NON-NLS-1$ | 79 static const String CD_PG_HEBREW = "1255"; //$NON-NLS-1$ |
80 static const char[] CD_PG_ARABIC = "1256"; //$NON-NLS-1$ | 80 static const String CD_PG_ARABIC = "1256"; //$NON-NLS-1$ |
81 // ActivateKeyboard constants | 81 // ActivateKeyboard constants |
82 static const int HKL_NEXT = 1; | 82 static const int HKL_NEXT = 1; |
83 static const int HKL_PREV = 0; | 83 static const int HKL_PREV = 0; |
84 | 84 |
85 /* | 85 /* |
167 * @param flags an integer representing rendering flag information, input parameter | 167 * @param flags an integer representing rendering flag information, input parameter |
168 * @param offsets text segments that should be measured and reordered separately, input | 168 * @param offsets text segments that should be measured and reordered separately, input |
169 * parameter. See org.eclipse.swt.custom.BidiSegmentEvent for details. | 169 * parameter. See org.eclipse.swt.custom.BidiSegmentEvent for details. |
170 * @return buffer with the glyphs that should be rendered for the given text | 170 * @return buffer with the glyphs that should be rendered for the given text |
171 */ | 171 */ |
172 public static char[] getRenderInfo(GC gc, char[] text, int[] order, byte[] classBuffer, int[] dx, int flags, int [] offsets) { | 172 public static char[] getRenderInfo(GC gc, String text, int[] order, byte[] classBuffer, int[] dx, int flags, int [] offsets) { |
173 auto fontLanguageInfo = OS.GetFontLanguageInfo(gc.handle); | 173 auto fontLanguageInfo = OS.GetFontLanguageInfo(gc.handle); |
174 auto hHeap = OS.GetProcessHeap(); | 174 auto hHeap = OS.GetProcessHeap(); |
175 int[8] lpCs; | 175 int[8] lpCs; |
176 int cs = OS.GetTextCharset(gc.handle); | 176 int cs = OS.GetTextCharset(gc.handle); |
177 bool isRightOriented = false; | 177 bool isRightOriented = false; |
300 * LOCALNUMBER) of each character in the text array, input/output parameter | 300 * LOCALNUMBER) of each character in the text array, input/output parameter |
301 * @param flags an integer representing rendering flag information, input parameter | 301 * @param flags an integer representing rendering flag information, input parameter |
302 * @param offsets text segments that should be measured and reordered separately, input | 302 * @param offsets text segments that should be measured and reordered separately, input |
303 * parameter. See org.eclipse.swt.custom.BidiSegmentEvent for details. | 303 * parameter. See org.eclipse.swt.custom.BidiSegmentEvent for details. |
304 */ | 304 */ |
305 public static void getOrderInfo(GC gc, char[] text, int[] order, byte[] classBuffer, int flags, int [] offsets) { | 305 public static void getOrderInfo(GC gc, String text, int[] order, byte[] classBuffer, int flags, int [] offsets) { |
306 int fontLanguageInfo = OS.GetFontLanguageInfo(gc.handle); | 306 int fontLanguageInfo = OS.GetFontLanguageInfo(gc.handle); |
307 auto hHeap = OS.GetProcessHeap(); | 307 auto hHeap = OS.GetProcessHeap(); |
308 int[8] lpCs; | 308 int[8] lpCs; |
309 int cs = OS.GetTextCharset(gc.handle); | 309 int cs = OS.GetTextCharset(gc.handle); |
310 OS.TranslateCharsetInfo( cast(uint*) cs, cast(CHARSETINFO*)lpCs.ptr, OS.TCI_SRCCHARSET); | 310 OS.TranslateCharsetInfo( cast(uint*) cs, cast(CHARSETINFO*)lpCs.ptr, OS.TCI_SRCCHARSET); |
464 //if (callback !is null) callback.dispose(); | 464 //if (callback !is null) callback.dispose(); |
465 //} | 465 //} |
466 if (isBidiPlatform_ is 1) return true; | 466 if (isBidiPlatform_ is 1) return true; |
467 // need to look at system code page for NT & 98 platforms since EnumSystemLanguageGroups is | 467 // need to look at system code page for NT & 98 platforms since EnumSystemLanguageGroups is |
468 // not supported for these platforms | 468 // not supported for these platforms |
469 char[] codePage = to!(char[])(OS.GetACP()); | 469 String codePage = to!(String)(OS.GetACP()); |
470 if (CD_PG_ARABIC==/*eq*/codePage || CD_PG_HEBREW==/*eq*/codePage) { | 470 if (CD_PG_ARABIC==/*eq*/codePage || CD_PG_HEBREW==/*eq*/codePage) { |
471 isBidiPlatform_ = 1; | 471 isBidiPlatform_ = 1; |
472 } | 472 } |
473 return isBidiPlatform_ is 1; | 473 return isBidiPlatform_ is 1; |
474 } | 474 } |