comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96.d @ 120:536e43f63c81

Comprehensive update for Win32/Linux32 dmd-2.053/dmd-1.068+Tango-r5661 ===D2=== * added [Try]Immutable/Const/Shared templates to work with differenses in D1/D2 instead of version statements used these templates to work with strict type storage rules of dmd-2.053 * com.ibm.icu now also compilable with D2, but not tested yet * small fixes Snippet288 - shared data is in TLS ===Phobos=== * fixed critical bugs in Phobos implemention completely incorrect segfault prone fromStringz (Linux's port ruthless killer) terrible, incorrect StringBuffer realization (StyledText killer) * fixed small bugs as well Snippet72 - misprint in the snippet * implemented missed functionality for Phobos ByteArrayOutputStream implemented (image loading available) formatting correctly works for all DWT's cases As a result, folowing snippets now works with Phobos (Snippet### - what is fixed): Snippet24, 42, 111, 115, 130, 235, 276 - bad string formatting Snippet48, 282 - crash on image loading Snippet163, 189, 211, 213, 217, 218, 222 - crash on copy/cut in StyledText Snippet244 - hang-up ===Tango=== * few changes for the latest Tango trunc-r5661 * few small performance improvments ===General=== * implMissing-s for only one version changed to implMissingInTango/InPhobos * incorrect calls to Format in toString-s fixed * fixed loading \uXXXX characters in ResourceBundle * added good UTF-8 support for StyledText, TextLayout (Win32) and friends UTF functions revised and tested. It is now in java.nonstandard.*Utf modules StyledText and TextLayout (Win32) modules revised for UTF-8 support * removed small diferences in most identical files in *.swt.* folders *.swt.internal.image, *.swt.events and *.swt.custom are identical in Win32/Linux32 now 179 of 576 (~31%) files in *.swt.* folders are fully identical * Win32: snippets now have right subsystem, pretty icons and native system style controls * small fixes in snippets Snippet44 - it's not Snippet44 Snippet212 - functions work with different images and offsets arrays Win32: Snippet282 - crash on close if the button has an image Snippet293 - setGrayed is commented and others Win32: As a result, folowing snippets now works Snippet68 - color doesn't change Snippet163, 189, 211, 213, 217, 218, 222 - UTF-8 issues (see above) Snippet193 - no tabel headers
author Denis Shelomovskij <verylonglogin.reg@gmail.com>
date Sat, 09 Jul 2011 15:50:20 +0300
parents 9f4c18c268b2
children
comparison
equal deleted inserted replaced
119:d00e8db0a568 120:536e43f63c81
84 // while over a cell in the table 84 // while over a cell in the table
85 ControlEditor editor = new ControlEditor(cursor); 85 ControlEditor editor = new ControlEditor(cursor);
86 editor.grabHorizontal = true; 86 editor.grabHorizontal = true;
87 editor.grabVertical = true; 87 editor.grabVertical = true;
88 88
89 cursor.addSelectionListener(new class(table, editor, cursor) SelectionAdapter { 89 cursor.addSelectionListener(new class SelectionAdapter {
90 // when the TableEditor is over a cell, select the corresponding row in 90 // when the TableEditor is over a cell, select the corresponding row in
91 // the table 91 // the table
92
93 Table table;
94 ControlEditor editor;
95 TableCursor cursor;
96 this(Table table_, ControlEditor editor_, TableCursor cursor_)
97 {
98 table = table_;
99 editor = editor_;
100 cursor = cursor_;
101 }
102
103 public void widgetSelected(SelectionEvent e) { 92 public void widgetSelected(SelectionEvent e) {
104 table.setSelection([cursor.getRow()]); 93 table.setSelection([cursor.getRow()]);
105 } 94 }
106 // when the user hits "ENTER" in the TableCursor, pop up a text editor so that 95 // when the user hits "ENTER" in the TableCursor, pop up a text editor so that
107 // they can change the text of the cell 96 // they can change the text of the cell
148 text.setFocus(); 137 text.setFocus();
149 } 138 }
150 }); 139 });
151 // Hide the TableCursor when the user hits the "CTRL" or "SHIFT" key. 140 // Hide the TableCursor when the user hits the "CTRL" or "SHIFT" key.
152 // This alows the user to select multiple items in the table. 141 // This alows the user to select multiple items in the table.
153 cursor.addKeyListener(new class(cursor) KeyAdapter { 142 cursor.addKeyListener(new class KeyAdapter {
154 TableCursor cursor;
155 this(TableCursor cursor_)
156 {
157 cursor = cursor_;
158 }
159 public void keyPressed(KeyEvent e) { 143 public void keyPressed(KeyEvent e) {
160 if (e.keyCode == SWT.CTRL 144 if (e.keyCode == SWT.CTRL
161 || e.keyCode == SWT.SHIFT 145 || e.keyCode == SWT.SHIFT
162 || (e.stateMask & SWT.CONTROL) != 0 146 || (e.stateMask & SWT.CONTROL) != 0
163 || (e.stateMask & SWT.SHIFT) != 0) { 147 || (e.stateMask & SWT.SHIFT) != 0) {
165 } 149 }
166 } 150 }
167 }); 151 });
168 // When the user double clicks in the TableCursor, pop up a text editor so that 152 // When the user double clicks in the TableCursor, pop up a text editor so that
169 // they can change the text of the cell 153 // they can change the text of the cell
170 cursor.addMouseListener(new class(cursor, editor) MouseAdapter { 154 cursor.addMouseListener(new class MouseAdapter {
171 ControlEditor editor;
172 TableCursor cursor;
173 this(TableCursor cursor_, ControlEditor editor_)
174 {
175 cursor = cursor_;
176 editor = editor_;
177 }
178
179 public void mouseDown(MouseEvent e) { 155 public void mouseDown(MouseEvent e) {
180 Text text = new Text(cursor, SWT.NONE); 156 Text text = new Text(cursor, SWT.NONE);
181 TableItem row = cursor.getRow(); 157 TableItem row = cursor.getRow();
182 int column = cursor.getColumn(); 158 int column = cursor.getColumn();
183 text.setText(row.getText(column)); 159 text.setText(row.getText(column));
220 } 196 }
221 }); 197 });
222 198
223 // Show the TableCursor when the user releases the "SHIFT" or "CTRL" key. 199 // Show the TableCursor when the user releases the "SHIFT" or "CTRL" key.
224 // This signals the end of the multiple selection task. 200 // This signals the end of the multiple selection task.
225 table.addKeyListener(new class(table, cursor) KeyAdapter { 201 table.addKeyListener(new class KeyAdapter {
226 Table table;
227 TableCursor cursor;
228 this(Table table_, TableCursor cursor_)
229 {
230 table = table_;
231 cursor = cursor_;
232 }
233 public void keyReleased(KeyEvent e) { 202 public void keyReleased(KeyEvent e) {
234 if (e.keyCode == SWT.CONTROL && (e.stateMask & SWT.SHIFT) != 0) 203 if (e.keyCode == SWT.CONTROL && (e.stateMask & SWT.SHIFT) != 0)
235 return; 204 return;
236 if (e.keyCode == SWT.SHIFT && (e.stateMask & SWT.CONTROL) != 0) 205 if (e.keyCode == SWT.SHIFT && (e.stateMask & SWT.CONTROL) != 0)
237 return; 206 return;