Mercurial > projects > dwt-mac
comparison dwt/dnd/Clipboard.d @ 7:e831403a80a9
Add 'cast' to casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 14:30:35 +0200 |
parents | 1a8b3cb347e0 |
children | d8635bb48c7c |
comparison
equal
deleted
inserted
replaced
6:b903c16b6f48 | 7:e831403a80a9 |
---|---|
201 * clipboard:</p> | 201 * clipboard:</p> |
202 * | 202 * |
203 * <code><pre> | 203 * <code><pre> |
204 * Clipboard clipboard = new Clipboard(display); | 204 * Clipboard clipboard = new Clipboard(display); |
205 * TextTransfer textTransfer = TextTransfer.getInstance(); | 205 * TextTransfer textTransfer = TextTransfer.getInstance(); |
206 * String textData = (String)clipboard.getContents(textTransfer); | 206 * String textData = cast(String)clipboard.getContents(textTransfer); |
207 * if (textData !is null) System.out.println("Text is "+textData); | 207 * if (textData !is null) System.out.println("Text is "+textData); |
208 * RTFTransfer rtfTransfer = RTFTransfer.getInstance(); | 208 * RTFTransfer rtfTransfer = RTFTransfer.getInstance(); |
209 * String rtfData = (String)clipboard.getContents(rtfTransfer); | 209 * String rtfData = cast(String)clipboard.getContents(rtfTransfer); |
210 * if (rtfData !is null) System.out.println("RTF Text is "+rtfData); | 210 * if (rtfData !is null) System.out.println("RTF Text is "+rtfData); |
211 * clipboard.dispose(); | 211 * clipboard.dispose(); |
212 * </code></pre> | 212 * </code></pre> |
213 * | 213 * |
214 * @param transfer the transfer agent for the type of data being requested | 214 * @param transfer the transfer agent for the type of data being requested |
237 * clipboard:</p> | 237 * clipboard:</p> |
238 * | 238 * |
239 * <code><pre> | 239 * <code><pre> |
240 * Clipboard clipboard = new Clipboard(display); | 240 * Clipboard clipboard = new Clipboard(display); |
241 * TextTransfer textTransfer = TextTransfer.getInstance(); | 241 * TextTransfer textTransfer = TextTransfer.getInstance(); |
242 * String textData = (String)clipboard.getContents(textTransfer); | 242 * String textData = cast(String)clipboard.getContents(textTransfer); |
243 * if (textData !is null) System.out.println("Text is "+textData); | 243 * if (textData !is null) System.out.println("Text is "+textData); |
244 * RTFTransfer rtfTransfer = RTFTransfer.getInstance(); | 244 * RTFTransfer rtfTransfer = RTFTransfer.getInstance(); |
245 * String rtfData = (String)clipboard.getContents(rtfTransfer, DND.CLIPBOARD); | 245 * String rtfData = cast(String)clipboard.getContents(rtfTransfer, DND.CLIPBOARD); |
246 * if (rtfData !is null) System.out.println("RTF Text is "+rtfData); | 246 * if (rtfData !is null) System.out.println("RTF Text is "+rtfData); |
247 * clipboard.dispose(); | 247 * clipboard.dispose(); |
248 * </code></pre> | 248 * </code></pre> |
249 * | 249 * |
250 * <p>The clipboards value is either one of the clipboard constants defined in | 250 * <p>The clipboards value is either one of the clipboard constants defined in |
539 int[] types = _getAvailableTypes(); | 539 int[] types = _getAvailableTypes(); |
540 String[] names = new String[types.length]; | 540 String[] names = new String[types.length]; |
541 for (int i = 0; i < types.length; i++) { | 541 for (int i = 0; i < types.length; i++) { |
542 int type = types[i]; | 542 int type = types[i]; |
543 StringBuffer sb = new StringBuffer(); | 543 StringBuffer sb = new StringBuffer(); |
544 sb.append((char)((type & 0xff000000) >> 24)); | 544 sb.append(cast(wchar)((type & 0xff000000) >> 24)); |
545 sb.append((char)((type & 0x00ff0000) >> 16)); | 545 sb.append(cast(wchar)((type & 0x00ff0000) >> 16)); |
546 sb.append((char)((type & 0x0000ff00) >> 8)); | 546 sb.append(cast(wchar)((type & 0x0000ff00) >> 8)); |
547 sb.append((char)((type & 0x000000ff) >> 0)); | 547 sb.append(cast(wchar)((type & 0x000000ff) >> 0)); |
548 names[i] = sb.toString(); | 548 names[i] = sb.toString(); |
549 } | 549 } |
550 return names; | 550 return names; |
551 } | 551 } |
552 | 552 |