Mercurial > projects > dwt-win
annotate dwt/custom/CTabItem.d @ 213:36f5cb12e1a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 17 May 2008 17:34:28 +0200 |
parents | ab60f3309436 |
children | a59d51c12b42 |
rev | line source |
---|---|
155 | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module dwt.custom.CTabItem; | |
14 | |
15 | |
16 | |
17 import dwt.DWT; | |
18 import dwt.DWTException; | |
19 import dwt.graphics.Color; | |
20 import dwt.graphics.Font; | |
21 import dwt.graphics.GC; | |
22 import dwt.graphics.Image; | |
23 import dwt.graphics.Point; | |
24 import dwt.graphics.RGB; | |
25 import dwt.graphics.Rectangle; | |
213 | 26 import dwt.graphics.TextLayout; |
155 | 27 import dwt.widgets.Control; |
28 import dwt.widgets.Display; | |
29 import dwt.widgets.Item; | |
30 import dwt.widgets.Widget; | |
31 import dwt.custom.CTabFolder; | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
155
diff
changeset
|
32 import dwt.dwthelper.utils; |
155 | 33 |
34 /** | |
35 * Instances of this class represent a selectable user interface object | |
36 * that represent a page in a notebook widget. | |
37 * | |
38 * <dl> | |
39 * <dt><b>Styles:</b></dt> | |
40 * <dd>DWT.CLOSE</dd> | |
41 * <dt><b>Events:</b></dt> | |
42 * <dd>(none)</dd> | |
43 * </dl> | |
44 * <p> | |
45 * IMPORTANT: This class is <em>not</em> intended to be subclassed. | |
46 * </p> | |
47 */ | |
48 public class CTabItem : Item { | |
49 CTabFolder parent; | |
50 int x,y,width,height = 0; | |
51 Control control; // the tab page | |
52 | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
155
diff
changeset
|
53 String toolTipText; |
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
155
diff
changeset
|
54 String shortenedText; |
155 | 55 int shortenedTextWidth; |
56 | |
57 // Appearance | |
58 Font font; | |
59 Image disabledImage; | |
60 | |
61 Rectangle closeRect; | |
62 int closeImageState = CTabFolder.NONE; | |
63 bool showClose = false; | |
64 bool showing = false; | |
65 | |
66 // internal constants | |
67 static final int TOP_MARGIN = 2; | |
68 static final int BOTTOM_MARGIN = 2; | |
69 static final int LEFT_MARGIN = 4; | |
70 static final int RIGHT_MARGIN = 4; | |
71 static final int INTERNAL_SPACING = 4; | |
72 static final int FLAGS = DWT.DRAW_TRANSPARENT | DWT.DRAW_MNEMONIC; | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
155
diff
changeset
|
73 static final String ELLIPSIS = "..."; //$NON-NLS-1$ // could use the ellipsis glyph on some platforms "\u2026" |
155 | 74 |
75 /** | |
76 * Constructs a new instance of this class given its parent | |
77 * (which must be a <code>CTabFolder</code>) and a style value | |
78 * describing its behavior and appearance. The item is added | |
79 * to the end of the items maintained by its parent. | |
80 * <p> | |
81 * The style value is either one of the style constants defined in | |
82 * class <code>DWT</code> which is applicable to instances of this | |
83 * class, or must be built by <em>bitwise OR</em>'ing together | |
84 * (that is, using the <code>int</code> "|" operator) two or more | |
85 * of those <code>DWT</code> style constants. The class description | |
86 * lists the style constants that are applicable to the class. | |
87 * Style bits are also inherited from superclasses. | |
88 * </p> | |
89 * | |
90 * @param parent a CTabFolder which will be the parent of the new instance (cannot be null) | |
91 * @param style the style of control to construct | |
92 * | |
93 * @exception IllegalArgumentException <ul> | |
94 * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> | |
95 * </ul> | |
96 * @exception DWTException <ul> | |
97 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> | |
98 * </ul> | |
99 * | |
100 * @see DWT | |
101 * @see Widget#getStyle() | |
102 */ | |
103 public this (CTabFolder parent, int style) { | |
104 this(parent, style, parent.getItemCount()); | |
105 } | |
106 /** | |
107 * Constructs a new instance of this class given its parent | |
108 * (which must be a <code>CTabFolder</code>), a style value | |
109 * describing its behavior and appearance, and the index | |
110 * at which to place it in the items maintained by its parent. | |
111 * <p> | |
112 * The style value is either one of the style constants defined in | |
113 * class <code>DWT</code> which is applicable to instances of this | |
114 * class, or must be built by <em>bitwise OR</em>'ing together | |
115 * (that is, using the <code>int</code> "|" operator) two or more | |
116 * of those <code>DWT</code> style constants. The class description | |
117 * lists the style constants that are applicable to the class. | |
118 * Style bits are also inherited from superclasses. | |
119 * </p> | |
120 * | |
121 * @param parent a CTabFolder which will be the parent of the new instance (cannot be null) | |
122 * @param style the style of control to construct | |
123 * @param index the zero-relative index to store the receiver in its parent | |
124 * | |
125 * @exception IllegalArgumentException <ul> | |
126 * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> | |
127 * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the parent (inclusive)</li> | |
128 * </ul> | |
129 * @exception DWTException <ul> | |
130 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> | |
131 * </ul> | |
132 * | |
133 * @see DWT | |
134 * @see Widget#getStyle() | |
135 */ | |
136 public this (CTabFolder parent, int style, int index) { | |
137 closeRect = new Rectangle(0, 0, 0, 0); | |
213 | 138 super (parent, style); |
155 | 139 showClose = (style & DWT.CLOSE) !is 0; |
140 parent.createItem (this, index); | |
141 } | |
142 | |
143 /* | |
144 * Return whether to use ellipses or just truncate labels | |
145 */ | |
146 bool useEllipses() { | |
147 return parent.simple; | |
148 } | |
149 | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
155
diff
changeset
|
150 String shortenText(GC gc, String text, int width) { |
155 | 151 return useEllipses() |
152 ? shortenText(gc, text, width, ELLIPSIS) | |
153 : shortenText(gc, text, width, ""); //$NON-NLS-1$ | |
154 } | |
155 | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
155
diff
changeset
|
156 String shortenText(GC gc, String text, int width, String ellipses) { |
155 | 157 if (gc.textExtent(text, FLAGS).x <= width) return text; |
158 int ellipseWidth = gc.textExtent(ellipses, FLAGS).x; | |
159 int length = text.length; | |
213 | 160 TextLayout layout = new TextLayout(getDisplay()); |
161 layout.setText(text); | |
162 int end = layout.getPreviousOffset(length, DWT.MOVEMENT_CLUSTER); | |
155 | 163 while (end > 0) { |
164 text = text[ 0 .. end ]; | |
165 int l = gc.textExtent(text, FLAGS).x; | |
166 if (l + ellipseWidth <= width) { | |
213 | 167 break; |
155 | 168 } |
213 | 169 end = layout.getPreviousOffset(end, DWT.MOVEMENT_CLUSTER); |
155 | 170 } |
213 | 171 layout.dispose(); |
172 return end is 0 ? text.substring(0, 1) : text ~ ellipses; | |
155 | 173 } |
174 | |
175 public override void dispose() { | |
176 if (isDisposed ()) return; | |
177 //if (!isValidThread ()) error (DWT.ERROR_THREAD_INVALID_ACCESS); | |
178 parent.destroyItem(this); | |
179 super.dispose(); | |
180 parent = null; | |
181 control = null; | |
182 toolTipText = null; | |
183 shortenedText = null; | |
184 font = null; | |
185 } | |
186 void drawClose(GC gc) { | |
187 if (closeRect.width is 0 || closeRect.height is 0) return; | |
188 Display display = getDisplay(); | |
189 | |
190 // draw X 9x9 | |
191 int indent = Math.max(1, (CTabFolder.BUTTON_SIZE-9)/2); | |
192 int x = closeRect.x + indent; | |
193 int y = closeRect.y + indent; | |
194 y += parent.onBottom ? -1 : 1; | |
195 | |
196 Color closeBorder = display.getSystemColor(CTabFolder.BUTTON_BORDER); | |
197 switch (closeImageState) { | |
198 case CTabFolder.NORMAL: { | |
199 int[] shape = [x,y, x+2,y, x+4,y+2, x+5,y+2, x+7,y, x+9,y, | |
200 x+9,y+2, x+7,y+4, x+7,y+5, x+9,y+7, x+9,y+9, | |
201 x+7,y+9, x+5,y+7, x+4,y+7, x+2,y+9, x,y+9, | |
202 x,y+7, x+2,y+5, x+2,y+4, x,y+2]; | |
203 gc.setBackground(display.getSystemColor(CTabFolder.BUTTON_FILL)); | |
204 gc.fillPolygon(shape); | |
205 gc.setForeground(closeBorder); | |
206 gc.drawPolygon(shape); | |
207 break; | |
208 } | |
209 case CTabFolder.HOT: { | |
210 int[] shape = [x,y, x+2,y, x+4,y+2, x+5,y+2, x+7,y, x+9,y, | |
211 x+9,y+2, x+7,y+4, x+7,y+5, x+9,y+7, x+9,y+9, | |
212 x+7,y+9, x+5,y+7, x+4,y+7, x+2,y+9, x,y+9, | |
213 x,y+7, x+2,y+5, x+2,y+4, x,y+2]; | |
214 Color fill = new Color(display, CTabFolder.CLOSE_FILL); | |
215 gc.setBackground(fill); | |
216 gc.fillPolygon(shape); | |
217 fill.dispose(); | |
218 gc.setForeground(closeBorder); | |
219 gc.drawPolygon(shape); | |
220 break; | |
221 } | |
222 case CTabFolder.SELECTED: { | |
223 int[] shape = [x+1,y+1, x+3,y+1, x+5,y+3, x+6,y+3, x+8,y+1, x+10,y+1, | |
224 x+10,y+3, x+8,y+5, x+8,y+6, x+10,y+8, x+10,y+10, | |
225 x+8,y+10, x+6,y+8, x+5,y+8, x+3,y+10, x+1,y+10, | |
226 x+1,y+8, x+3,y+6, x+3,y+5, x+1,y+3]; | |
227 Color fill = new Color(display, CTabFolder.CLOSE_FILL); | |
228 gc.setBackground(fill); | |
229 gc.fillPolygon(shape); | |
230 fill.dispose(); | |
231 gc.setForeground(closeBorder); | |
232 gc.drawPolygon(shape); | |
233 break; | |
234 } | |
235 case CTabFolder.NONE: { | |
236 int[] shape = [x,y, x+10,y, x+10,y+10, x,y+10]; | |
237 if (parent.gradientColors !is null && !parent.gradientVertical) { | |
238 parent.drawBackground(gc, shape, false); | |
239 } else { | |
240 Color defaultBackground = parent.getBackground(); | |
241 Image image = parent.bgImage; | |
242 Color[] colors = parent.gradientColors; | |
243 int[] percents = parent.gradientPercents; | |
244 bool vertical = parent.gradientVertical; | |
245 parent.drawBackground(gc, shape, x, y, 10, 10, defaultBackground, image, colors, percents, vertical); | |
246 } | |
247 break; | |
248 } | |
249 default: | |
250 } | |
251 } | |
252 void drawSelected(GC gc ) { | |
253 Point size = parent.getSize(); | |
254 int rightEdge = Math.min (x + width, parent.getRightItemEdge()); | |
255 | |
256 // Draw selection border across all tabs | |
257 int xx = parent.borderLeft; | |
258 int yy = parent.onBottom ? size.y - parent.borderBottom - parent.tabHeight - parent.highlight_header : parent.borderTop + parent.tabHeight + 1; | |
259 int ww = size.x - parent.borderLeft - parent.borderRight; | |
260 int hh = parent.highlight_header - 1; | |
261 int[] shape = [xx,yy, xx+ww,yy, xx+ww,yy+hh, xx,yy+hh]; | |
262 if (parent.selectionGradientColors !is null && !parent.selectionGradientVertical) { | |
263 parent.drawBackground(gc, shape, true); | |
264 } else { | |
265 gc.setBackground(parent.selectionBackground); | |
266 gc.fillRectangle(xx, yy, ww, hh); | |
267 } | |
268 | |
269 if (parent.single) { | |
270 if (!showing) return; | |
271 } else { | |
272 // if selected tab scrolled out of view or partially out of view | |
273 // just draw bottom line | |
274 if (!showing){ | |
275 int x1 = Math.max(0, parent.borderLeft - 1); | |
276 int y1 = (parent.onBottom) ? y - 1 : y + height; | |
277 int x2 = size.x - parent.borderRight; | |
278 gc.setForeground(CTabFolder.borderColor); | |
279 gc.drawLine(x1, y1, x2, y1); | |
280 return; | |
281 } | |
282 | |
283 // draw selected tab background and outline | |
284 shape = null; | |
285 if (this.parent.onBottom) { | |
286 int[] left = parent.simple ? CTabFolder.SIMPLE_BOTTOM_LEFT_CORNER : CTabFolder.BOTTOM_LEFT_CORNER; | |
287 int[] right = parent.simple ? CTabFolder.SIMPLE_BOTTOM_RIGHT_CORNER : parent.curve; | |
288 if (parent.borderLeft is 0 && parent.indexOf(this) is parent.firstIndex) { | |
289 left = [x, y+height]; | |
290 } | |
291 shape = new int[left.length+right.length+8]; | |
292 int index = 0; | |
293 shape[index++] = x; // first point repeated here because below we reuse shape to draw outline | |
294 shape[index++] = y - 1; | |
295 shape[index++] = x; | |
296 shape[index++] = y - 1; | |
297 for (int i = 0; i < left.length/2; i++) { | |
298 shape[index++] = x + left[2*i]; | |
299 shape[index++] = y + height + left[2*i+1] - 1; | |
300 } | |
301 for (int i = 0; i < right.length/2; i++) { | |
302 shape[index++] = parent.simple ? rightEdge - 1 + right[2*i] : rightEdge - parent.curveIndent + right[2*i]; | |
303 shape[index++] = parent.simple ? y + height + right[2*i+1] - 1 : y + right[2*i+1] - 2; | |
304 } | |
305 shape[index++] = parent.simple ? rightEdge - 1 : rightEdge + parent.curveWidth - parent.curveIndent; | |
306 shape[index++] = y - 1; | |
307 shape[index++] = parent.simple ? rightEdge - 1 : rightEdge + parent.curveWidth - parent.curveIndent; | |
308 shape[index++] = y - 1; | |
309 } else { | |
310 int[] left = parent.simple ? CTabFolder.SIMPLE_TOP_LEFT_CORNER : CTabFolder.TOP_LEFT_CORNER; | |
311 int[] right = parent.simple ? CTabFolder.SIMPLE_TOP_RIGHT_CORNER : parent.curve; | |
312 if (parent.borderLeft is 0 && parent.indexOf(this) is parent.firstIndex) { | |
313 left = [x, y]; | |
314 } | |
315 shape = new int[left.length+right.length+8]; | |
316 int index = 0; | |
317 shape[index++] = x; // first point repeated here because below we reuse shape to draw outline | |
318 shape[index++] = y + height + 1; | |
319 shape[index++] = x; | |
320 shape[index++] = y + height + 1; | |
321 for (int i = 0; i < left.length/2; i++) { | |
322 shape[index++] = x + left[2*i]; | |
323 shape[index++] = y + left[2*i+1]; | |
324 } | |
325 for (int i = 0; i < right.length/2; i++) { | |
326 shape[index++] = parent.simple ? rightEdge - 1 + right[2*i] : rightEdge - parent.curveIndent + right[2*i]; | |
327 shape[index++] = y + right[2*i+1]; | |
328 } | |
329 shape[index++] = parent.simple ? rightEdge - 1 : rightEdge + parent.curveWidth - parent.curveIndent; | |
330 shape[index++] = y + height + 1; | |
331 shape[index++] = parent.simple ? rightEdge - 1 : rightEdge + parent.curveWidth - parent.curveIndent; | |
332 shape[index++] = y + height + 1; | |
333 } | |
334 | |
335 Rectangle clipping = gc.getClipping(); | |
336 Rectangle bounds = getBounds(); | |
337 bounds.height += 1; | |
338 if (parent.onBottom) bounds.y -= 1; | |
339 bool tabInPaint = clipping.intersects(bounds); | |
340 | |
341 if (tabInPaint) { | |
342 // fill in tab background | |
343 if (parent.selectionGradientColors !is null && !parent.selectionGradientVertical) { | |
344 parent.drawBackground(gc, shape, true); | |
345 } else { | |
346 Color defaultBackground = parent.selectionBackground; | |
347 Image image = parent.selectionBgImage; | |
348 Color[] colors = parent.selectionGradientColors; | |
349 int[] percents = parent.selectionGradientPercents; | |
350 bool vertical = parent.selectionGradientVertical; | |
351 xx = x; | |
352 yy = parent.onBottom ? y -1 : y + 1; | |
353 ww = width; | |
354 hh = height; | |
355 if (!parent.single && !parent.simple) ww += parent.curveWidth - parent.curveIndent; | |
356 parent.drawBackground(gc, shape, xx, yy, ww, hh, defaultBackground, image, colors, percents, vertical); | |
357 } | |
358 } | |
359 | |
360 //Highlight MUST be drawn before the outline so that outline can cover it in the right spots (start of swoop) | |
361 //otherwise the curve looks jagged | |
362 drawHighlight(gc, rightEdge); | |
363 | |
364 // draw outline | |
365 shape[0] = Math.max(0, parent.borderLeft - 1); | |
366 if (parent.borderLeft is 0 && parent.indexOf(this) is parent.firstIndex) { | |
367 shape[1] = parent.onBottom ? y + height - 1 : y; | |
368 shape[5] = shape[3] = shape[1]; | |
369 } | |
370 shape[shape.length - 2] = size.x - parent.borderRight + 1; | |
371 for (int i = 0; i < shape.length/2; i++) { | |
372 if (shape[2*i + 1] is y + height + 1) shape[2*i + 1] -= 1; | |
373 } | |
374 RGB inside = parent.selectionBackground.getRGB(); | |
375 if (parent.selectionBgImage !is null || | |
376 (parent.selectionGradientColors !is null && parent.selectionGradientColors.length > 1)) { | |
377 inside = null; | |
378 } | |
379 RGB outside = parent.getBackground().getRGB(); | |
380 if (parent.bgImage !is null || | |
381 (parent.gradientColors !is null && parent.gradientColors.length > 1)) { | |
382 outside = null; | |
383 } | |
384 parent.antialias(shape, CTabFolder.borderColor.getRGB(), inside, outside, gc); | |
385 gc.setForeground(CTabFolder.borderColor); | |
386 gc.drawPolyline(shape); | |
387 | |
388 if (!tabInPaint) return; | |
389 } | |
390 | |
391 // draw Image | |
392 int xDraw = x + LEFT_MARGIN; | |
393 if (parent.single && (parent.showClose || showClose)) xDraw += CTabFolder.BUTTON_SIZE; | |
394 Image image = getImage(); | |
395 if (image !is null) { | |
396 Rectangle imageBounds = image.getBounds(); | |
397 // only draw image if it won't overlap with close button | |
398 int maxImageWidth = rightEdge - xDraw - RIGHT_MARGIN; | |
399 if (!parent.single && closeRect.width > 0) maxImageWidth -= closeRect.width + INTERNAL_SPACING; | |
400 if (imageBounds.width < maxImageWidth) { | |
401 int imageX = xDraw; | |
402 int imageY = y + (height - imageBounds.height) / 2; | |
403 imageY += parent.onBottom ? -1 : 1; | |
404 gc.drawImage(image, imageX, imageY); | |
405 xDraw += imageBounds.width + INTERNAL_SPACING; | |
406 } | |
407 } | |
408 | |
409 // draw Text | |
410 int textWidth = rightEdge - xDraw - RIGHT_MARGIN; | |
411 if (!parent.single && closeRect.width > 0) textWidth -= closeRect.width + INTERNAL_SPACING; | |
412 if (textWidth > 0) { | |
413 Font gcFont = gc.getFont(); | |
414 gc.setFont(font is null ? parent.getFont() : font); | |
415 | |
416 if (shortenedText is null || shortenedTextWidth !is textWidth) { | |
417 shortenedText = shortenText(gc, getText(), textWidth); | |
418 shortenedTextWidth = textWidth; | |
419 } | |
420 Point extent = gc.textExtent(shortenedText, FLAGS); | |
421 int textY = y + (height - extent.y) / 2; | |
422 textY += parent.onBottom ? -1 : 1; | |
423 | |
424 gc.setForeground(parent.selectionForeground); | |
425 gc.drawText(shortenedText, xDraw, textY, FLAGS); | |
426 gc.setFont(gcFont); | |
427 | |
428 // draw a Focus rectangle | |
429 if (parent.isFocusControl()) { | |
430 Display display = getDisplay(); | |
431 if (parent.simple || parent.single) { | |
432 gc.setBackground(display.getSystemColor(DWT.COLOR_BLACK)); | |
433 gc.setForeground(display.getSystemColor(DWT.COLOR_WHITE)); | |
434 gc.drawFocus(xDraw-1, textY-1, extent.x+2, extent.y+2); | |
435 } else { | |
436 gc.setForeground(display.getSystemColor(CTabFolder.BUTTON_BORDER)); | |
437 gc.drawLine(xDraw, textY+extent.y+1, xDraw+extent.x+1, textY+extent.y+1); | |
438 } | |
439 } | |
440 } | |
441 if (parent.showClose || showClose) drawClose(gc); | |
442 } | |
443 | |
444 /* | |
445 * Draw a highlight effect along the left, top, and right edges of the tab. | |
446 * Only for curved tabs, on top. | |
447 * Do not draw if insufficient colors. | |
448 */ | |
449 void drawHighlight(GC gc, int rightEdge) { | |
450 //only draw for curvy tabs and only draw for top tabs | |
451 if(parent.simple || this.parent.onBottom) | |
452 return; | |
453 | |
454 if(parent.selectionHighlightGradientBegin is null) | |
455 return; | |
456 | |
457 Color[] gradients = parent.selectionHighlightGradientColorsCache; | |
458 if(gradients is null) | |
459 return; | |
460 int gradientsSize = gradients.length; | |
461 if(gradientsSize is 0) | |
462 return; //shouldn't happen but just to be tidy | |
463 | |
464 gc.setForeground(gradients[0]); | |
465 | |
466 //draw top horizontal line | |
467 gc.drawLine( | |
468 CTabFolder.TOP_LEFT_CORNER_HILITE[0] + x + 1, //rely on fact that first pair is top/right of curve | |
469 1 + y, | |
470 rightEdge - parent.curveIndent, | |
471 1 + y); | |
472 | |
473 int[] leftHighlightCurve = CTabFolder.TOP_LEFT_CORNER_HILITE; | |
474 | |
475 int d = parent.tabHeight - parent.topCurveHighlightEnd.length /2; | |
476 | |
477 int lastX = 0; | |
478 int lastY = 0; | |
479 int lastColorIndex = 0; | |
480 | |
481 //draw upper left curve highlight | |
482 for (int i = 0; i < leftHighlightCurve.length /2; i++) { | |
483 int rawX = leftHighlightCurve[i * 2]; | |
484 int rawY = leftHighlightCurve[i * 2 + 1]; | |
485 lastX = rawX + x; | |
486 lastY = rawY + y; | |
487 lastColorIndex = rawY - 1; | |
488 gc.setForeground(gradients[lastColorIndex]); | |
489 gc.drawPoint(lastX, lastY); | |
490 } | |
491 //draw left vertical line highlight | |
492 for(int i = lastColorIndex; i < gradientsSize; i++) { | |
493 gc.setForeground(gradients[i]); | |
494 gc.drawPoint(lastX, 1 + lastY++); | |
495 } | |
496 | |
497 int rightEdgeOffset = rightEdge - parent.curveIndent; | |
498 | |
499 //draw right swoop highlight up to diagonal portion | |
500 for (int i = 0; i < parent.topCurveHighlightStart.length /2; i++) { | |
501 int rawX = parent.topCurveHighlightStart[i * 2]; | |
502 int rawY = parent.topCurveHighlightStart[i * 2 + 1]; | |
503 lastX = rawX + rightEdgeOffset; | |
504 lastY = rawY + y; | |
505 lastColorIndex = rawY - 1; | |
506 if(lastColorIndex >= gradientsSize) | |
507 break; //can happen if tabs are unusually short and cut off the curve | |
508 gc.setForeground(gradients[lastColorIndex]); | |
509 gc.drawPoint(lastX, lastY); | |
510 } | |
511 //draw right diagonal line highlight | |
512 for(int i = lastColorIndex; i < lastColorIndex + d; i++) { | |
513 if(i >= gradientsSize) | |
514 break; //can happen if tabs are unusually short and cut off the curve | |
515 gc.setForeground(gradients[i]); | |
516 gc.drawPoint(1 + lastX++, 1 + lastY++); | |
517 } | |
518 | |
519 //draw right swoop highlight from diagonal portion to end | |
520 for (int i = 0; i < parent.topCurveHighlightEnd.length /2; i++) { | |
521 int rawX = parent.topCurveHighlightEnd[i * 2]; //d is already encoded in this value | |
522 int rawY = parent.topCurveHighlightEnd[i * 2 + 1]; //d already encoded | |
523 lastX = rawX + rightEdgeOffset; | |
524 lastY = rawY + y; | |
525 lastColorIndex = rawY - 1; | |
526 if(lastColorIndex >= gradientsSize) | |
527 break; //can happen if tabs are unusually short and cut off the curve | |
528 gc.setForeground(gradients[lastColorIndex]); | |
529 gc.drawPoint(lastX, lastY); | |
530 } | |
531 } | |
532 | |
533 /* | |
534 * Draw the unselected border for the receiver on the right. | |
535 * | |
536 * @param gc | |
537 */ | |
538 void drawRightUnselectedBorder(GC gc) { | |
539 | |
540 int[] shape = null; | |
541 int startX = x + width - 1; | |
542 | |
543 if (this.parent.onBottom) { | |
544 int[] right = parent.simple | |
545 ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER | |
546 : CTabFolder.BOTTOM_RIGHT_CORNER; | |
547 | |
548 shape = new int[right.length + 2]; | |
549 int index = 0; | |
550 | |
551 for (int i = 0; i < right.length / 2; i++) { | |
552 shape[index++] = startX + right[2 * i]; | |
553 shape[index++] = y + height + right[2 * i + 1] - 1; | |
554 } | |
555 shape[index++] = startX; | |
556 shape[index++] = y - 1; | |
557 } else { | |
558 int[] right = parent.simple | |
559 ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER | |
560 : CTabFolder.TOP_RIGHT_CORNER; | |
561 | |
562 shape = new int[right.length + 2]; | |
563 int index = 0; | |
564 | |
565 for (int i = 0; i < right.length / 2; i++) { | |
566 shape[index++] = startX + right[2 * i]; | |
567 shape[index++] = y + right[2 * i + 1]; | |
568 } | |
569 | |
570 shape[index++] = startX; | |
571 shape[index++] = y + height; | |
572 | |
573 } | |
574 | |
575 drawBorder(gc, shape); | |
576 | |
577 } | |
578 | |
579 /* | |
580 * Draw the border of the tab | |
581 * | |
582 * @param gc | |
583 * @param shape | |
584 */ | |
585 void drawBorder(GC gc, int[] shape) { | |
586 | |
587 gc.setForeground(CTabFolder.borderColor); | |
588 gc.drawPolyline(shape); | |
589 } | |
590 | |
591 /* | |
592 * Draw the unselected border for the receiver on the left. | |
593 * | |
594 * @param gc | |
595 */ | |
596 void drawLeftUnselectedBorder(GC gc) { | |
597 | |
598 int[] shape = null; | |
599 if (this.parent.onBottom) { | |
600 int[] left = parent.simple | |
601 ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER | |
602 : CTabFolder.BOTTOM_LEFT_CORNER; | |
603 | |
604 shape = new int[left.length + 2]; | |
605 int index = 0; | |
606 shape[index++] = x; | |
607 shape[index++] = y - 1; | |
608 for (int i = 0; i < left.length / 2; i++) { | |
609 shape[index++] = x + left[2 * i]; | |
610 shape[index++] = y + height + left[2 * i + 1] - 1; | |
611 } | |
612 } else { | |
613 int[] left = parent.simple | |
614 ? CTabFolder.SIMPLE_UNSELECTED_INNER_CORNER | |
615 : CTabFolder.TOP_LEFT_CORNER; | |
616 | |
617 shape = new int[left.length + 2]; | |
618 int index = 0; | |
619 shape[index++] = x; | |
620 shape[index++] = y + height; | |
621 for (int i = 0; i < left.length / 2; i++) { | |
622 shape[index++] = x + left[2 * i]; | |
623 shape[index++] = y + left[2 * i + 1]; | |
624 } | |
625 | |
626 } | |
627 | |
628 drawBorder(gc, shape); | |
629 } | |
630 | |
631 void drawUnselected(GC gc) { | |
632 // Do not draw partial items | |
633 if (!showing) return; | |
634 | |
635 Rectangle clipping = gc.getClipping(); | |
636 Rectangle bounds = getBounds(); | |
637 if (!clipping.intersects(bounds)) return; | |
638 | |
639 // draw border | |
640 int index = parent.indexOf(this); | |
641 | |
642 if (index > 0 && index < parent.selectedIndex) | |
643 drawLeftUnselectedBorder(gc); | |
644 // If it is the last one then draw a line | |
645 if (index > parent.selectedIndex) | |
646 drawRightUnselectedBorder(gc); | |
647 | |
648 // draw Image | |
649 int xDraw = x + LEFT_MARGIN; | |
650 Image image = getImage(); | |
651 if (image !is null && parent.showUnselectedImage) { | |
652 Rectangle imageBounds = image.getBounds(); | |
653 // only draw image if it won't overlap with close button | |
654 int maxImageWidth = x + width - xDraw - RIGHT_MARGIN; | |
655 if (parent.showUnselectedClose && (parent.showClose || showClose)) { | |
656 maxImageWidth -= closeRect.width + INTERNAL_SPACING; | |
657 } | |
658 if (imageBounds.width < maxImageWidth) { | |
659 int imageX = xDraw; | |
660 int imageHeight = imageBounds.height; | |
661 int imageY = y + (height - imageHeight) / 2; | |
662 imageY += parent.onBottom ? -1 : 1; | |
663 int imageWidth = imageBounds.width * imageHeight / imageBounds.height; | |
664 gc.drawImage(image, | |
665 imageBounds.x, imageBounds.y, imageBounds.width, imageBounds.height, | |
666 imageX, imageY, imageWidth, imageHeight); | |
667 xDraw += imageWidth + INTERNAL_SPACING; | |
668 } | |
669 } | |
670 // draw Text | |
671 int textWidth = x + width - xDraw - RIGHT_MARGIN; | |
672 if (parent.showUnselectedClose && (parent.showClose || showClose)) { | |
673 textWidth -= closeRect.width + INTERNAL_SPACING; | |
674 } | |
675 if (textWidth > 0) { | |
676 Font gcFont = gc.getFont(); | |
677 gc.setFont(font is null ? parent.getFont() : font); | |
678 if (shortenedText is null || shortenedTextWidth !is textWidth) { | |
679 shortenedText = shortenText(gc, getText(), textWidth); | |
680 shortenedTextWidth = textWidth; | |
681 } | |
682 Point extent = gc.textExtent(shortenedText, FLAGS); | |
683 int textY = y + (height - extent.y) / 2; | |
684 textY += parent.onBottom ? -1 : 1; | |
685 gc.setForeground(parent.getForeground()); | |
686 gc.drawText(shortenedText, xDraw, textY, FLAGS); | |
687 gc.setFont(gcFont); | |
688 } | |
689 // draw close | |
690 if (parent.showUnselectedClose && (parent.showClose || showClose)) drawClose(gc); | |
691 } | |
692 /** | |
693 * Returns a rectangle describing the receiver's size and location | |
694 * relative to its parent. | |
695 * | |
696 * @return the receiver's bounding column rectangle | |
697 * | |
698 * @exception DWTException <ul> | |
699 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
700 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
701 * </ul> | |
702 */ | |
703 public Rectangle getBounds () { | |
704 //checkWidget(); | |
705 int w = width; | |
706 if (!parent.simple && !parent.single && parent.indexOf(this) is parent.selectedIndex) w += parent.curveWidth - parent.curveIndent; | |
707 return new Rectangle(x, y, w, height); | |
708 } | |
709 /** | |
710 * Gets the control that is displayed in the content area of the tab item. | |
711 * | |
712 * @return the control | |
713 * | |
714 * @exception DWTException <ul> | |
715 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
716 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
717 * </ul> | |
718 */ | |
719 public Control getControl () { | |
720 checkWidget(); | |
721 return control; | |
722 } | |
723 /** | |
724 * Get the image displayed in the tab if the tab is disabled. | |
725 * | |
726 * @return the disabled image or null | |
727 * | |
728 * @exception DWTException <ul> | |
729 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
730 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
731 * </ul> | |
732 * | |
733 * @deprecated the disabled image is not used | |
734 */ | |
735 public Image getDisabledImage(){ | |
736 checkWidget(); | |
737 return disabledImage; | |
738 } | |
739 /** | |
740 * Returns the font that the receiver will use to paint textual information. | |
741 * | |
742 * @return the receiver's font | |
743 * | |
744 * @exception DWTException <ul> | |
745 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
746 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
747 * </ul> | |
748 * | |
749 * @since 3.0 | |
750 */ | |
751 public Font getFont() { | |
752 checkWidget(); | |
753 if (font !is null) return font; | |
754 return parent.getFont(); | |
755 } | |
756 /** | |
757 * Returns the receiver's parent, which must be a <code>CTabFolder</code>. | |
758 * | |
759 * @return the receiver's parent | |
760 * | |
761 * @exception DWTException <ul> | |
762 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
763 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
764 * </ul> | |
765 */ | |
766 public CTabFolder getParent () { | |
767 //checkWidget(); | |
768 return parent; | |
769 } | |
770 /** | |
213 | 771 * Returns <code>true</code> to indicate that the receiver's close button should be shown. |
772 * Otherwise return <code>false</code>. The initial value is defined by the style (DWT.CLOSE) | |
773 * that was used to create the receiver. | |
774 * | |
775 * @return <code>true</code> if the close button should be shown | |
776 * | |
777 * @exception DWTException <ul> | |
778 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
779 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
780 * </ul> | |
781 * | |
782 * @since 3.4 | |
783 */ | |
784 public bool getShowClose() { | |
785 checkWidget(); | |
786 return showClose; | |
787 } | |
788 /** | |
155 | 789 * Returns the receiver's tool tip text, or null if it has |
790 * not been set. | |
791 * | |
792 * @return the receiver's tool tip text | |
793 * | |
794 * @exception DWTException <ul> | |
795 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
796 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
797 * </ul> | |
798 */ | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
155
diff
changeset
|
799 public String getToolTipText () { |
155 | 800 checkWidget(); |
801 if (toolTipText is null && shortenedText !is null) { | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
155
diff
changeset
|
802 String text = getText(); |
155 | 803 if (shortenedText!=text) return text; |
804 } | |
805 return toolTipText; | |
806 } | |
807 /** | |
808 * Returns <code>true</code> if the item will be rendered in the visible area of the CTabFolder. Returns false otherwise. | |
809 * | |
810 * @return <code>true</code> if the item will be rendered in the visible area of the CTabFolder. Returns false otherwise. | |
811 * | |
812 * @exception DWTException <ul> | |
813 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
814 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
815 * </ul> | |
816 * | |
817 * @since 3.0 | |
818 */ | |
819 public bool isShowing () { | |
820 checkWidget(); | |
821 return showing; | |
822 } | |
823 void onPaint(GC gc, bool isSelected) { | |
824 if (width is 0 || height is 0) return; | |
825 if (isSelected) { | |
826 drawSelected(gc); | |
827 } else { | |
828 drawUnselected(gc); | |
829 } | |
830 } | |
831 int preferredHeight(GC gc) { | |
832 Image image = getImage(); | |
833 int h = (image is null) ? 0 : image.getBounds().height; | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
155
diff
changeset
|
834 String text = getText(); |
155 | 835 if (font is null) { |
836 h = Math.max(h, gc.textExtent(text, FLAGS).y); | |
837 } else { | |
838 Font gcFont = gc.getFont(); | |
839 gc.setFont(font); | |
840 h = Math.max(h, gc.textExtent(text, FLAGS).y); | |
841 gc.setFont(gcFont); | |
842 } | |
843 return h + TOP_MARGIN + BOTTOM_MARGIN; | |
844 } | |
845 int preferredWidth(GC gc, bool isSelected, bool minimum) { | |
846 // NOTE: preferred width does not include the "dead space" caused | |
847 // by the curve. | |
848 if (isDisposed()) return 0; | |
849 int w = 0; | |
850 Image image = getImage(); | |
851 if (image !is null && (isSelected || parent.showUnselectedImage)) { | |
852 w += image.getBounds().width; | |
853 } | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
155
diff
changeset
|
854 String text = null; |
155 | 855 if (minimum) { |
856 int minChars = parent.minChars; | |
857 text = minChars is 0 ? null : getText(); | |
858 if (text !is null && text.length > minChars) { | |
859 if (useEllipses()) { | |
860 int end = minChars < ELLIPSIS.length + 1 ? minChars : minChars - ELLIPSIS.length; | |
861 text = text[ 0 .. end ]; | |
862 if (minChars > ELLIPSIS.length + 1) text ~= ELLIPSIS; | |
863 } else { | |
864 int end = minChars; | |
865 text = text[ 0 .. end ]; | |
866 } | |
867 } | |
868 } else { | |
869 text = getText(); | |
870 } | |
871 if (text !is null) { | |
872 if (w > 0) w += INTERNAL_SPACING; | |
873 if (font is null) { | |
874 w += gc.textExtent(text, FLAGS).x; | |
875 } else { | |
876 Font gcFont = gc.getFont(); | |
877 gc.setFont(font); | |
878 w += gc.textExtent(text, FLAGS).x; | |
879 gc.setFont(gcFont); | |
880 } | |
881 } | |
882 if (parent.showClose || showClose) { | |
883 if (isSelected || parent.showUnselectedClose) { | |
884 if (w > 0) w += INTERNAL_SPACING; | |
885 w += CTabFolder.BUTTON_SIZE; | |
886 } | |
887 } | |
888 return w + LEFT_MARGIN + RIGHT_MARGIN; | |
889 } | |
890 /** | |
891 * Sets the control that is used to fill the client area of | |
892 * the tab folder when the user selects the tab item. | |
893 * | |
894 * @param control the new control (or null) | |
895 * | |
896 * @exception IllegalArgumentException <ul> | |
897 * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li> | |
898 * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li> | |
899 * </ul> | |
900 * @exception DWTException <ul> | |
901 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
902 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
903 * </ul> | |
904 */ | |
905 public void setControl (Control control) { | |
906 checkWidget(); | |
907 if (control !is null) { | |
908 if (control.isDisposed()) DWT.error (DWT.ERROR_INVALID_ARGUMENT); | |
909 if (control.getParent() !is parent) DWT.error (DWT.ERROR_INVALID_PARENT); | |
910 } | |
911 if (this.control !is null && !this.control.isDisposed()) { | |
912 this.control.setVisible(false); | |
913 } | |
914 this.control = control; | |
915 if (this.control !is null) { | |
916 int index = parent.indexOf (this); | |
917 if (index is parent.getSelectionIndex ()){ | |
918 this.control.setBounds(parent.getClientArea ()); | |
919 this.control.setVisible(true); | |
920 } else { | |
921 this.control.setVisible(false); | |
922 } | |
923 } | |
924 } | |
925 /** | |
926 * Sets the image that is displayed if the tab item is disabled. | |
927 * Null will clear the image. | |
928 * | |
929 * @param image the image to be displayed when the item is disabled or null | |
930 * | |
931 * @exception DWTException <ul> | |
932 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
933 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
934 * </ul> | |
935 * | |
936 * @deprecated This image is not used | |
937 */ | |
938 public void setDisabledImage (Image image) { | |
939 checkWidget(); | |
940 if (image !is null && image.isDisposed ()) { | |
941 DWT.error(DWT.ERROR_INVALID_ARGUMENT); | |
942 } | |
943 this.disabledImage = image; | |
944 } | |
945 /** | |
946 * Sets the font that the receiver will use to paint textual information | |
947 * for this item to the font specified by the argument, or to the default font | |
948 * for that kind of control if the argument is null. | |
949 * | |
950 * @param font the new font (or null) | |
951 * | |
952 * @exception IllegalArgumentException <ul> | |
953 * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> | |
954 * </ul> | |
955 * @exception DWTException <ul> | |
956 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
957 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
958 * </ul> | |
959 * | |
960 * @since 3.0 | |
961 */ | |
962 public void setFont (Font font){ | |
963 checkWidget(); | |
964 if (font !is null && font.isDisposed ()) { | |
965 DWT.error(DWT.ERROR_INVALID_ARGUMENT); | |
966 } | |
967 if (font is null && this.font is null) return; | |
968 if (font !is null && font==this.font) return; | |
969 this.font = font; | |
970 if (!parent.updateTabHeight(false)) { | |
971 parent.updateItems(); | |
972 parent.redrawTabs(); | |
973 } | |
974 } | |
975 public override void setImage (Image image) { | |
976 checkWidget(); | |
977 if (image !is null && image.isDisposed ()) { | |
978 DWT.error(DWT.ERROR_INVALID_ARGUMENT); | |
979 } | |
980 Image oldImage = getImage(); | |
981 if (image is null && oldImage is null) return; | |
982 if (image !is null && image==oldImage) return; | |
983 super.setImage(image); | |
984 if (!parent.updateTabHeight(false)) { | |
985 // If image is the same size as before, | |
986 // redraw only the image | |
987 if (oldImage !is null && image !is null) { | |
988 Rectangle oldBounds = oldImage.getBounds(); | |
989 Rectangle bounds = image.getBounds(); | |
990 if (bounds.width is oldBounds.width && bounds.height is oldBounds.height) { | |
991 if (showing) { | |
992 bool selected = parent.indexOf(this) is parent.selectedIndex; | |
993 if (selected || parent.showUnselectedImage) { | |
994 int imageX = x + LEFT_MARGIN, maxImageWidth; | |
995 if (selected) { | |
996 if (parent.single && (parent.showClose || showClose)) imageX += CTabFolder.BUTTON_SIZE; | |
997 int rightEdge = Math.min (x + width, parent.getRightItemEdge()); | |
998 maxImageWidth = rightEdge - imageX - RIGHT_MARGIN; | |
999 if (!parent.single && closeRect.width > 0) maxImageWidth -= closeRect.width + INTERNAL_SPACING; | |
1000 } else { | |
1001 maxImageWidth = x + width - imageX - RIGHT_MARGIN; | |
1002 if (parent.showUnselectedClose && (parent.showClose || showClose)) { | |
1003 maxImageWidth -= closeRect.width + INTERNAL_SPACING; | |
1004 } | |
1005 } | |
1006 if (bounds.width < maxImageWidth) { | |
1007 int imageY = y + (height - bounds.height) / 2 + (parent.onBottom ? -1 : 1); | |
1008 parent.redraw(imageX, imageY, bounds.width, bounds.height, false); | |
1009 } | |
1010 } | |
1011 } | |
1012 return; | |
1013 } | |
1014 } | |
1015 parent.updateItems(); | |
1016 parent.redrawTabs(); | |
1017 } | |
1018 } | |
213 | 1019 /** |
1020 * Sets to <code>true</code> to indicate that the receiver's close button should be shown. | |
1021 * If the parent (CTabFolder) was created with DWT.CLOSE style, changing this value has | |
1022 * no effect. | |
1023 * | |
1024 * @param close the new state of the close button | |
1025 * | |
1026 * @exception DWTException <ul> | |
1027 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
1028 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
1029 * </ul> | |
1030 * | |
1031 * @since 3.4 | |
1032 */ | |
1033 public void setShowClose(bool close) { | |
1034 checkWidget(); | |
1035 if (showClose is close) return; | |
1036 showClose = close; | |
1037 parent.updateItems(); | |
1038 parent.redrawTabs(); | |
1039 } | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
155
diff
changeset
|
1040 public override void setText (String string) { |
155 | 1041 checkWidget(); |
1042 if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); | |
1043 if (string==getText()) return; | |
1044 super.setText(string); | |
1045 shortenedText = null; | |
1046 shortenedTextWidth = 0; | |
1047 if (!parent.updateTabHeight(false)) { | |
1048 parent.updateItems(); | |
1049 parent.redrawTabs(); | |
1050 } | |
1051 } | |
1052 /** | |
1053 * Sets the receiver's tool tip text to the argument, which | |
1054 * may be null indicating that no tool tip text should be shown. | |
1055 * | |
1056 * @param string the new tool tip text (or null) | |
1057 * | |
1058 * @exception DWTException <ul> | |
1059 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
1060 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
1061 * </ul> | |
1062 */ | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
155
diff
changeset
|
1063 public void setToolTipText (String string) { |
155 | 1064 checkWidget(); |
1065 toolTipText = string; | |
1066 } | |
213 | 1067 |
155 | 1068 } |