annotate dwtexamples/clipboard/ClipboardExample.d @ 33:8c8547842065

Fix: version statement
author Frank Benoit <benoit@tionex.de>
date Fri, 07 Mar 2008 02:25:26 +0100
parents 49188ccea1d1
children 7c3196948c7f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
1 /*******************************************************************************
17
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
3 * All rights reserved. This program and the accompanying materials
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
4 * are made available under the terms of the Eclipse Public License v1.0
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
5 * which accompanies this distribution, and is available at
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
6 * http://www.eclipse.org/legal/epl-v10.html
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
7 *
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
8 * Contributors:
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
9 * IBM Corporation - initial API and implementation
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
10 * D Port:
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
11 * Jesse Phillips <Jesse.K.Phillips+D> gmail.com
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
12 *******************************************************************************/
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
13 module dwtexamples.clipboard;
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
14
17
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
15 import dwt.DWT;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
16 import dwt.custom.ScrolledComposite;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
17 import dwt.custom.StyledText;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
18 import dwt.dnd.Clipboard;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
19 import dwt.dnd.FileTransfer;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
20 import dwt.dnd.HTMLTransfer;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
21 import dwt.dnd.RTFTransfer;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
22 import dwt.dnd.TextTransfer;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
23 import dwt.dnd.Transfer;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
24 import dwt.events.SelectionAdapter;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
25 import dwt.events.SelectionEvent;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
26 import dwt.graphics.Point;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
27 import dwt.graphics.Rectangle;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
28 import dwt.layout.FillLayout;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
29 import dwt.layout.GridData;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
30 import dwt.layout.GridLayout;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
31 import dwt.widgets.Button;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
32 import dwt.widgets.Combo;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
33 import dwt.widgets.Composite;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
34 import dwt.widgets.DirectoryDialog;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
35 import dwt.widgets.Display;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
36 import dwt.widgets.FileDialog;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
37 import dwt.widgets.Group;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
38 import dwt.widgets.Label;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
39 import dwt.widgets.List;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
40 import dwt.widgets.Shell;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
41 import dwt.widgets.Table;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
42 import dwt.widgets.TableItem;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
43 import dwt.widgets.Text;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
44
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
45 import tango.io.Stdout;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
46
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
47 class ClipboardExample {
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
48 static const int SIZE = 60;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
49 Clipboard clipboard;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
50 Shell shell;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
51 Text copyText;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
52 Text pasteText;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
53 Text copyRtfText;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
54 Text pasteRtfText;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
55 Text copyHtmlText;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
56 Text pasteHtmlText;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
57 Table copyFileTable;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
58 Table pasteFileTable;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
59 Text text;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
60 Combo combo;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
61 StyledText styledText;
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
62 Label status;
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
63
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
64 public void open(Display display) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
65 clipboard = new Clipboard(display);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
66 shell = new Shell (display);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
67 shell.setText("DWT Clipboard");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
68 shell.setLayout(new FillLayout());
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
69
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
70 ScrolledComposite sc = new ScrolledComposite(shell, DWT.H_SCROLL | DWT.V_SCROLL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
71 Composite parent = new Composite(sc, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
72 sc.setContent(parent);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
73 parent.setLayout(new GridLayout(2, true));
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
74
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
75 Group copyGroup = new Group(parent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
76 copyGroup.setText("Copy From:");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
77 GridData data = new GridData(GridData.FILL_BOTH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
78 copyGroup.setLayoutData(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
79 copyGroup.setLayout(new GridLayout(3, false));
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
80
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
81 Group pasteGroup = new Group(parent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
82 pasteGroup.setText("Paste To:");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
83 data = new GridData(GridData.FILL_BOTH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
84 pasteGroup.setLayoutData(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
85 pasteGroup.setLayout(new GridLayout(3, false));
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
86
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
87 Group controlGroup = new Group(parent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
88 controlGroup.setText("Control API:");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
89 data = new GridData(GridData.FILL_BOTH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
90 data.horizontalSpan = 2;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
91 controlGroup.setLayoutData(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
92 controlGroup.setLayout(new GridLayout(5, false));
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
93
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
94 /* Enable with Available Types *
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
95 Group typesGroup = new Group(parent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
96 typesGroup.setText("Available Types");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
97 data = new GridData(GridData.FILL_BOTH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
98 data.horizontalSpan = 2;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
99 typesGroup.setLayoutData(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
100 typesGroup.setLayout(new GridLayout(2, false));
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
101 /**/
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
102
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
103 status = new Label(parent, DWT.BORDER);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
104 data = new GridData(GridData.FILL_HORIZONTAL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
105 data.horizontalSpan = 2;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
106 data.heightHint = 60;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
107 status.setLayoutData(data);
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
108
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
109 createTextTransfer(copyGroup, pasteGroup);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
110 //TODO: Doesn't work
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
111 // createRTFTransfer(copyGroup, pasteGroup);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
112 createHTMLTransfer(copyGroup, pasteGroup);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
113 //TODO: Doesn't work
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
114 // createFileTransfer(copyGroup, pasteGroup);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
115 createMyTransfer(copyGroup, pasteGroup);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
116 createControlTransfer(controlGroup);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
117 //TODO: Causes Segfault
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
118 // createAvailableTypes(typesGroup);
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
119
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
120 sc.setMinSize(parent.computeSize(DWT.DEFAULT, DWT.DEFAULT));
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
121 sc.setExpandHorizontal(true);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
122 sc.setExpandVertical(true);
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
123
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
124 Point size = shell.computeSize(DWT.DEFAULT, DWT.DEFAULT);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
125 Rectangle monitorArea = shell.getMonitor().getClientArea();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
126 shell.setSize(Math.min(size.x, monitorArea.width - 20), Math.min(size.y, monitorArea.height - 20));
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
127 shell.open();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
128 while (!shell.isDisposed ()) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
129 if (!display.readAndDispatch ()) display.sleep ();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
130 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
131 clipboard.dispose();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
132 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
133 void createTextTransfer(Composite copyParent, Composite pasteParent) {
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
134
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
135 // TextTransfer
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
136 Label l = new Label(copyParent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
137 l.setText("TextTransfer:"); //$NON-NLS-1$
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
138 copyText = new Text(copyParent, DWT.MULTI | DWT.BORDER | DWT.V_SCROLL | DWT.H_SCROLL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
139 copyText.setText("some\nplain\ntext");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
140 GridData data = new GridData(GridData.FILL_HORIZONTAL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
141 data.heightHint = data.widthHint = SIZE;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
142 copyText.setLayoutData(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
143 Button b = new Button(copyParent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
144 b.setText("Copy");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
145 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
146 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
147 auto data = copyText.getText();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
148 if (data.length > 0) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
149 status.setText("");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
150 auto obj = new Object[1];
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
151 auto trans = new TextTransfer[1];
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
152 obj[0] = cast(Object) new ArrayWrapperString(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
153 trans[0] = TextTransfer.getInstance();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
154 clipboard.setContents(obj, trans);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
155 } else {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
156 status.setText("nothing to copy");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
157 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
158 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
159 });
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
160
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
161 l = new Label(pasteParent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
162 l.setText("TextTransfer:"); //$NON-NLS-1$
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
163 pasteText = new Text(pasteParent, DWT.READ_ONLY | DWT.MULTI | DWT.BORDER | DWT.V_SCROLL | DWT.H_SCROLL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
164 data = new GridData(GridData.FILL_HORIZONTAL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
165 data.heightHint = data.widthHint = SIZE;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
166 pasteText.setLayoutData(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
167 b = new Button(pasteParent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
168 b.setText("Paste");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
169 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
170 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
171 auto data = cast(ArrayWrapperString) clipboard.getContents(TextTransfer.getInstance());
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
172 if (data !is null) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
173 status.setText("");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
174 pasteText.setText("begin paste>"~data.array~"<end paste");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
175 } else {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
176 status.setText("nothing to paste");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
177 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
178 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
179 });
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
180 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
181 void createRTFTransfer(Composite copyParent, Composite pasteParent){
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
182 // RTF Transfer
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
183 Label l = new Label(copyParent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
184 l.setText("RTFTransfer:"); //$NON-NLS-1$
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
185 copyRtfText = new Text(copyParent, DWT.MULTI | DWT.BORDER | DWT.V_SCROLL | DWT.H_SCROLL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
186 copyRtfText.setText("some\nrtf\ntext");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
187 GridData data = new GridData(GridData.FILL_HORIZONTAL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
188 data.heightHint = data.widthHint = SIZE;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
189 copyRtfText.setLayoutData(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
190 Button b = new Button(copyParent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
191 b.setText("Copy");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
192 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
193 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
194 auto data = copyRtfText.getText();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
195 if (data.length > 0) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
196 status.setText("");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
197 data = "{\\rtf1{\\colortbl;\\red255\\green0\\blue0;}\\uc1\\b\\i " ~ data ~ "}";
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
198 auto obj = new Object[1];
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
199 auto trans = new Transfer[1];
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
200 obj[0] = cast(Object) new ArrayWrapperString(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
201 trans[0] = RTFTransfer.getInstance();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
202 clipboard.setContents(obj, trans);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
203 } else {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
204 status.setText("nothing to copy");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
205 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
206 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
207 });
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
208
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
209 l = new Label(pasteParent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
210 l.setText("RTFTransfer:"); //$NON-NLS-1$
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
211 pasteRtfText = new Text(pasteParent, DWT.READ_ONLY | DWT.MULTI | DWT.BORDER | DWT.V_SCROLL | DWT.H_SCROLL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
212 data = new GridData(GridData.FILL_HORIZONTAL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
213 data.heightHint = data.widthHint = SIZE;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
214 pasteRtfText.setLayoutData(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
215 b = new Button(pasteParent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
216 b.setText("Paste");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
217 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
218 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
219 auto data = cast(ArrayWrapperString) clipboard.getContents(RTFTransfer.getInstance());
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
220 if (data !is null) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
221 status.setText("");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
222 pasteRtfText.setText("begin paste>"~data.array~"<end paste");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
223 } else {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
224 status.setText("nothing to paste");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
225 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
226 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
227 });
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
228 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
229 void createHTMLTransfer(Composite copyParent, Composite pasteParent){
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
230 // HTML Transfer
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
231 Label l = new Label(copyParent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
232 l.setText("HTMLTransfer:"); //$NON-NLS-1$
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
233 copyHtmlText = new Text(copyParent, DWT.MULTI | DWT.BORDER | DWT.V_SCROLL | DWT.H_SCROLL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
234 copyHtmlText.setText("<b>Hello World</b>");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
235 GridData data = new GridData(GridData.FILL_HORIZONTAL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
236 data.heightHint = data.widthHint = SIZE;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
237 copyHtmlText.setLayoutData(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
238 Button b = new Button(copyParent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
239 b.setText("Copy");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
240 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
241 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
242 auto data = copyHtmlText.getText();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
243 if (data.length > 0) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
244 status.setText("");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
245 auto obj = new Object[1];
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
246 auto trans = new Transfer[1];
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
247 obj[0] = cast(Object) new ArrayWrapperString(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
248 trans[0] = HTMLTransfer.getInstance();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
249 clipboard.setContents(obj, trans);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
250 } else {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
251 status.setText("nothing to copy");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
252 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
253 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
254 });
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
255
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
256 l = new Label(pasteParent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
257 l.setText("HTMLTransfer:"); //$NON-NLS-1$
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
258 pasteHtmlText = new Text(pasteParent, DWT.READ_ONLY | DWT.MULTI | DWT.BORDER | DWT.V_SCROLL | DWT.H_SCROLL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
259 data = new GridData(GridData.FILL_HORIZONTAL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
260 data.heightHint = data.widthHint = SIZE;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
261 pasteHtmlText.setLayoutData(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
262 b = new Button(pasteParent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
263 b.setText("Paste");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
264 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
265 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
266 auto data = cast(ArrayWrapperString) clipboard.getContents(HTMLTransfer.getInstance());
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
267 if (data !is null) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
268 status.setText("");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
269 pasteHtmlText.setText("begin paste>"~data.array~"<end paste");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
270 } else {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
271 status.setText("nothing to paste");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
272 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
273 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
274 });
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
275 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
276 void createFileTransfer(Composite copyParent, Composite pasteParent){
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
277 //File Transfer
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
278 Label l = new Label(copyParent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
279 l.setText("FileTransfer:"); //$NON-NLS-1$
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
280
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
281 Composite c = new Composite(copyParent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
282 c.setLayout(new GridLayout(2, false));
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
283 GridData data = new GridData(GridData.FILL_HORIZONTAL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
284 c.setLayoutData(data);
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
285
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
286 copyFileTable = new Table(c, DWT.MULTI | DWT.BORDER);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
287 data = new GridData(GridData.FILL_HORIZONTAL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
288 data.heightHint = data.widthHint = SIZE;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
289 data.horizontalSpan = 2;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
290 copyFileTable.setLayoutData(data);
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
291
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
292 Button b = new Button(c, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
293 b.setText("Select file(s)");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
294 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
295 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
296 FileDialog dialog = new FileDialog(shell, DWT.OPEN | DWT.MULTI);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
297 auto result = dialog.open();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
298 if (result !is null && result.length > 0){
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
299 //copyFileTable.removeAll();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
300 //This cannot be used
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
301 //auto separator = System.getProperty("file.separator");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
302 version(linux) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
303 auto separator = "/";
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
304 }
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
305 version(Windows) {
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
306 auto separator = "\\";
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
307 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
308 auto path = dialog.getFilterPath();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
309 auto names = dialog.getFileNames();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
310 for (int i = 0; i < names.length; i++) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
311 TableItem item = new TableItem(copyFileTable, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
312 item.setText(path~separator~names[i]);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
313 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
314 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
315 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
316 });
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
317 b = new Button(c, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
318 b.setText("Select directory");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
319 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
320 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
321 DirectoryDialog dialog = new DirectoryDialog(shell, DWT.OPEN);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
322 auto result = dialog.open();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
323 if (result !is null && result.length > 0){
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
324 //copyFileTable.removeAll();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
325 TableItem item = new TableItem(copyFileTable, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
326 item.setText(result);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
327 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
328 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
329 });
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
330
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
331 b = new Button(copyParent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
332 b.setText("Copy");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
333 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
334 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
335 TableItem[] items = copyFileTable.getItems();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
336 if (items.length > 0){
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
337 status.setText("");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
338 auto data = new char[][items.length];
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
339 for (int i = 0; i < data.length; i++) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
340 data[i] = items[i].getText();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
341 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
342 auto obj = new Object[1];
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
343 auto trans = new Transfer[1];
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
344 obj[0] = cast(Object) new ArrayWrapperString2(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
345 trans[0] = FileTransfer.getInstance();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
346 clipboard.setContents(obj, trans);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
347 } else {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
348 status.setText("nothing to copy");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
349 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
350 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
351 });
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
352
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
353 l = new Label(pasteParent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
354 l.setText("FileTransfer:"); //$NON-NLS-1$
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
355 pasteFileTable = new Table(pasteParent, DWT.MULTI | DWT.BORDER);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
356 data = new GridData(GridData.FILL_HORIZONTAL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
357 data.heightHint = data.widthHint = SIZE;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
358 pasteFileTable.setLayoutData(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
359 b = new Button(pasteParent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
360 b.setText("Paste");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
361 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
362 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
363 auto data = cast(ArrayWrapperString2) clipboard.getContents(FileTransfer.getInstance());
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
364 if (data !is null && data.array.length > 0) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
365 status.setText("");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
366 pasteFileTable.removeAll();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
367 foreach (s; data.array) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
368 TableItem item = new TableItem(pasteFileTable, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
369 item.setText(s);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
370 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
371 } else {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
372 status.setText("nothing to paste");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
373 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
374 }
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
375 });
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
376 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
377 void createMyTransfer(Composite copyParent, Composite pasteParent){
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
378 // MyType Transfer
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
379 // TODO
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
380 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
381 void createControlTransfer(Composite parent){
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
382 Label l = new Label(parent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
383 l.setText("Text:");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
384 Button b = new Button(parent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
385 b.setText("Cut");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
386 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
387 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
388 text.cut();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
389 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
390 });
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
391 b = new Button(parent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
392 b.setText("Copy");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
393 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
394 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
395 text.copy();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
396 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
397 });
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
398 b = new Button(parent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
399 b.setText("Paste");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
400 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
401 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
402 text.paste();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
403 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
404 });
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
405 text = new Text(parent, DWT.BORDER | DWT.MULTI | DWT.H_SCROLL | DWT.V_SCROLL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
406 GridData data = new GridData(GridData.FILL_HORIZONTAL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
407 data.heightHint = data.widthHint = SIZE;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
408 text.setLayoutData(data);
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
409
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
410 l = new Label(parent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
411 l.setText("Combo:");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
412 b = new Button(parent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
413 b.setText("Cut");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
414 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
415 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
416 combo.cut();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
417 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
418 });
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
419 b = new Button(parent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
420 b.setText("Copy");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
421 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
422 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
423 combo.copy();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
424 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
425 });
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
426 b = new Button(parent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
427 b.setText("Paste");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
428 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
429 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
430 combo.paste();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
431 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
432 });
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
433 combo = new Combo(parent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
434 char[][] str = new char[][4];
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
435 str[0] = "Item 1";
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
436 str[1] = "Item 2";
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
437 str[2] = "Item 3";
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
438 str[3] = "A longer Item";
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
439 combo.setItems(str);
33
8c8547842065 Fix: version statement
Frank Benoit <benoit@tionex.de>
parents: 18
diff changeset
440
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
441 l = new Label(parent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
442 l.setText("StyledText:");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
443 l = new Label(parent, DWT.NONE);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
444 l.setVisible(false);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
445 b = new Button(parent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
446 b.setText("Copy");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
447 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
448 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
449 styledText.copy();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
450 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
451 });
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
452 b = new Button(parent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
453 b.setText("Paste");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
454 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
455 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
456 styledText.paste();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
457 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
458 });
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
459 styledText = new StyledText(parent, DWT.BORDER | DWT.MULTI | DWT.H_SCROLL | DWT.V_SCROLL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
460 data = new GridData(GridData.FILL_HORIZONTAL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
461 data.heightHint = data.widthHint = SIZE;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
462 styledText.setLayoutData(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
463 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
464 void createAvailableTypes(Composite parent){
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
465 final List list = new List(parent, DWT.BORDER | DWT.H_SCROLL | DWT.V_SCROLL);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
466 GridData data = new GridData(GridData.FILL_BOTH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
467 data.heightHint = 100;
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
468 list.setLayoutData(data);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
469 Button b = new Button(parent, DWT.PUSH);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
470 b.setText("Get Available Types");
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
471 b.addSelectionListener(new class SelectionAdapter {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
472 public void widgetSelected(SelectionEvent e) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
473 list.removeAll();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
474 auto names = clipboard.getAvailableTypeNames();
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
475 for (int i = 0; i < names.length; i++) {
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
476 list.add(names[i]);
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
477 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
478 }
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
479 });
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
480 }
17
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
481 }
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
482 void main() {
18
49188ccea1d1 changed tabs to spaces in clipboard.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents: 17
diff changeset
483 Stdout.formatln( "The ClipboardExample: still work left" );
17
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
484 Stdout.formatln( "todo: RTF, File Transfer, Available types");
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
485 Stdout.formatln( "line 300, there might be a better way to do" );
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
486 Stdout.formatln( "system independent path seperators in tango" );
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
487 Stdout.formatln( "" );
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
488
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
489
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
490 Display display = new Display();
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
491 (new ClipboardExample()).open(display);
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
492 display.dispose();
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
493 }
7b7a54b047e1 Added unfinished but usable ClipboardExample and Snippet293. Updated other snippets to use the auto keyword. Made the opengl example windows only until it is added to the linux version.
Jesse Phillips <Jesse.K.Phillips+D@gmail.com>
parents:
diff changeset
494