Changeset 246:fd9c62a2998e for dwt/custom/StyledText.d
- Timestamp:
- 07/01/08 04:15:59 (6 months ago)
- Files:
-
- dwt/custom/StyledText.d (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/custom/StyledText.d
r244 r246 1 1 /******************************************************************************* 2 * Copyright (c) 2000, 200 7IBM Corporation and others.2 * Copyright (c) 2000, 2008 IBM Corporation and others. 3 3 * All rights reserved. This program and the accompanying materials 4 4 * are made available under the terms of the Eclipse Public License v1.0 … … 144 144 * IMPORTANT: This class is <em>not</em> intended to be subclassed. 145 145 * </p> 146 * 147 * @see <a href="http://www.eclipse.org/swt/snippets/#styledtext">StyledText snippets</a> 148 * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Examples: CustomControlExample, TextEditor</a> 149 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> 146 150 */ 147 151 public class StyledText : Canvas { … … 198 202 bool editable = true; 199 203 bool wordWrap = false; 200 bool doubleClickEnabled = true; // see getDoubleClickEnabled201 bool overwrite = false; // insert/overwrite edit mode204 bool doubleClickEnabled = true; // see getDoubleClickEnabled 205 bool overwrite = false; // insert/overwrite edit mode 202 206 int textLimit = -1; // limits the number of characters the user can type in the widget. Unlimited by default. 203 207 int[int] keyActionMap; … … 215 219 int lastLineBottom; // the bottom pixel of the last line been replaced 216 220 bool isMirrored_; 217 bool bidiColoring = false; // apply the BIDI algorithm on text segments of the same color221 bool bidiColoring = false; // apply the BIDI algorithm on text segments of the same color 218 222 Image leftCaretBitmap = null; 219 223 Image rightCaretBitmap = null; … … 264 268 int startLine; // first (wrapped) line to print 265 269 int endLine; // last (wrapped) line to print 266 bool singleLine; // widget single line mode270 bool singleLine; // widget single line mode 267 271 Point selection = null; // selected text 268 bool mirrored; // indicates the printing gc should be mirrored272 bool mirrored; // indicates the printing gc should be mirrored 269 273 int lineSpacing; 270 274 int printMargin; … … 3825 3829 * It means this function can be used to retrieve the bottom pixel of any line. 3826 3830 * 3831 * @return the top pixel of a given line index 3832 * 3827 3833 * @since 3.2 3828 3834 */ … … 3851 3857 * Returns the line index for a y, relative to the client area. 3852 3858 * The line index returned is always in the range 0..lineCount - 1. 3859 * 3860 * @param y the y-coordinate pixel 3861 * 3862 * @return the line index for a given y-coordinate pixel 3853 3863 * 3854 3864 * @since 3.2 … … 5128 5138 if (length is ime.getCommitCount()) { 5129 5139 content.replaceTextRange(start, end - start, ""); 5130 caretOffset = start;5140 caretOffset = ime.getCompositionOffset(); 5131 5141 caretWidth = 0; 5132 5142 caretDirection = DWT.NULL; … … 5135 5145 caretOffset = ime.getCaretOffset(); 5136 5146 if (ime.getWideCaret()) { 5147 start = ime.getCompositionOffset(); 5137 5148 int lineIndex = getCaretLine(); 5138 5149 int lineOffset = content.getOffsetAtLine(lineIndex); … … 5518 5529 if (lastLineBottom !is newLastLineBottom) { 5519 5530 super.redraw(); 5520 if (wordWrap) setCaretLocation();5521 5531 } else { 5522 5532 super.redraw(0, firstLineTop, clientAreaWidth, newLastLineBottom - firstLineTop, false); … … 6065 6075 * 6066 6076 * @param printer the printer to print to 6077 * 6078 * @return a <code>Runnable</code> for printing the receiver's text 6079 * 6067 6080 * @exception DWTException <ul> 6068 6081 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> … … 6094 6107 * @param printer the printer to print to 6095 6108 * @param options print options to use during printing 6109 * 6110 * @return a <code>Runnable</code> for printing the receiver's text 6111 * 6096 6112 * @exception DWTException <ul> 6097 6113 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> … … 6252 6268 * Removes the specified bidirectional segment listener. 6253 6269 * 6254 * @param listener the listener 6270 * @param listener the listener which should no longer be notified 6271 * 6255 6272 * @exception DWTException <ul> 6256 6273 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> … … 6260 6277 * <li>ERROR_NULL_ARGUMENT when listener is null</li> 6261 6278 * </ul> 6279 * 6262 6280 * @since 2.0 6263 6281 */ … … 6270 6288 * Removes the specified extended modify listener. 6271 6289 * 6272 * @param extendedModifyListener the listener 6290 * @param extendedModifyListener the listener which should no longer be notified 6291 * 6273 6292 * @exception DWTException <ul> 6274 6293 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> … … 6287 6306 * Removes the specified line background listener. 6288 6307 * 6289 * @param listener the listener 6308 * @param listener the listener which should no longer be notified 6309 * 6290 6310 * @exception DWTException <ul> 6291 6311 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> … … 6304 6324 * Removes the specified line style listener. 6305 6325 * 6306 * @param listener the listener 6326 * @param listener the listener which should no longer be notified 6327 * 6307 6328 * @exception DWTException <ul> 6308 6329 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> … … 6321 6342 * Removes the specified modify listener. 6322 6343 * 6323 * @param modifyListener the listener 6344 * @param modifyListener the listener which should no longer be notified 6345 * 6324 6346 * @exception DWTException <ul> 6325 6347 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> … … 6338 6360 * Removes the specified listener. 6339 6361 * 6340 * @param listener the listener 6362 * @param listener the listener which should no longer be notified 6363 * 6341 6364 * @exception DWTException <ul> 6342 6365 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> … … 6378 6401 * Removes the specified verify listener. 6379 6402 * 6380 * @param verifyListener the listener 6403 * @param verifyListener the listener which should no longer be notified 6404 * 6381 6405 * @exception DWTException <ul> 6382 6406 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> … … 6395 6419 * Removes the specified key verify listener. 6396 6420 * 6397 * @param listener the listener 6421 * @param listener the listener which should no longer be notified 6422 * 6398 6423 * @exception DWTException <ul> 6399 6424 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> … … 6411 6436 * Removes the specified word movement listener. 6412 6437 * 6413 * @param listener the listener 6438 * @param listener the listener which should no longer be notified 6439 * 6414 6440 * @exception DWTException <ul> 6415 6441 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> … … 7109 7135 super.redraw(); 7110 7136 } 7111 /**7112 * @see dwt.widgets.Control#setForeground7113 */7114 7137 public override void setForeground(Color color) { 7115 7138 checkWidget(); … … 8400 8423 if (selection.y <= startOffset) { 8401 8424 // selection ends before text change 8425 if (wordWrap) setCaretLocation(); 8402 8426 return; 8403 8427 }
