Mercurial > projects > dwt-mac
comparison dwt/custom/ViewForm.d @ 41:6337764516f1
Sync dwt/custom with dwt-linux (took copy of complete folder)
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 07 Oct 2008 16:29:55 +0200 |
parents | e831403a80a9 |
children |
comparison
equal
deleted
inserted
replaced
40:fbe68c33eeee | 41:6337764516f1 |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
10 *******************************************************************************/ | 12 *******************************************************************************/ |
11 module dwt.custom; | 13 module dwt.custom.ViewForm; |
12 | 14 |
13 | 15 import dwt.dwthelper.utils; |
14 import dwt.graphics.*; | 16 |
15 import dwt.widgets.*; | 17 |
16 import dwt.*; | 18 |
19 import dwt.DWT; | |
20 import dwt.DWTException; | |
21 import dwt.graphics.Color; | |
22 import dwt.graphics.GC; | |
23 import dwt.graphics.Point; | |
24 import dwt.graphics.RGB; | |
25 import dwt.graphics.Rectangle; | |
26 import dwt.widgets.Composite; | |
27 import dwt.widgets.Control; | |
28 import dwt.widgets.Event; | |
29 import dwt.widgets.Layout; | |
30 import dwt.widgets.Listener; | |
31 import dwt.custom.ViewFormLayout; | |
17 | 32 |
18 /** | 33 /** |
19 * Instances of this class implement a Composite that positions and sizes | 34 * Instances of this class implement a Composite that positions and sizes |
20 * children and allows programmatic control of layout and border parameters. | 35 * children and allows programmatic control of layout and border parameters. |
21 * ViewForm is used in the workbench to lay out a view's label/menu/toolbar | 36 * ViewForm is used in the workbench to lay out a view's label/menu/toolbar |
22 * local bar. | 37 * local bar. |
23 * <p> | 38 * <p> |
24 * Note that although this class is a subclass of <code>Composite</code>, | 39 * Note that although this class is a subclass of <code>Composite</code>, |
25 * it does not make sense to set a layout on it. | 40 * it does not make sense to set a layout on it. |
26 * </p><p> | 41 * </p><p> |
27 * <dl> | 42 * <dl> |
28 * <dt><b>Styles:</b></dt> | 43 * <dt><b>Styles:</b></dt> |
29 * <dd>BORDER, FLAT</dd> | 44 * <dd>BORDER, FLAT</dd> |
30 * <dt><b>Events:</b></dt> | 45 * <dt><b>Events:</b></dt> |
31 * <dd>cast(None)</dd> | 46 * <dd>(None)</dd> |
32 * </dl> | 47 * </dl> |
33 * <p> | 48 * <p> |
34 * IMPORTANT: This class is <em>not</em> intended to be subclassed. | 49 * IMPORTANT: This class is <em>not</em> intended to be subclassed. |
35 * </p> | 50 * </p> |
51 * | |
52 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> | |
36 */ | 53 */ |
37 | 54 |
38 public class ViewForm : Composite { | 55 public class ViewForm : Composite { |
39 | 56 |
40 /** | 57 /** |
64 * edge of one cell and the top edge of its neighbouring cell underneath. | 81 * edge of one cell and the top edge of its neighbouring cell underneath. |
65 * | 82 * |
66 * The default value is 1. | 83 * The default value is 1. |
67 */ | 84 */ |
68 public int verticalSpacing = 1; | 85 public int verticalSpacing = 1; |
69 | 86 |
70 /** | 87 /** |
71 * Color of innermost line of drop shadow border. | 88 * Color of innermost line of drop shadow border. |
72 * | 89 * |
73 * NOTE This field is badly named and can not be fixed for backwards compatibility. | 90 * NOTE This field is badly named and can not be fixed for backwards compatibility. |
74 * It should be capitalized. | 91 * It should be capitalized. |
75 * | 92 * |
76 * @deprecated | 93 * @deprecated |
77 */ | 94 */ |
78 public static RGB borderInsideRGB = new RGB (132, 130, 132); | 95 public static RGB borderInsideRGB; |
79 /** | 96 /** |
80 * Color of middle line of drop shadow border. | 97 * Color of middle line of drop shadow border. |
81 * | 98 * |
82 * NOTE This field is badly named and can not be fixed for backwards compatibility. | 99 * NOTE This field is badly named and can not be fixed for backwards compatibility. |
83 * It should be capitalized. | 100 * It should be capitalized. |
84 * | 101 * |
85 * @deprecated | 102 * @deprecated |
86 */ | 103 */ |
87 public static RGB borderMiddleRGB = new RGB (143, 141, 138); | 104 public static RGB borderMiddleRGB; |
88 /** | 105 /** |
89 * Color of outermost line of drop shadow border. | 106 * Color of outermost line of drop shadow border. |
90 * | 107 * |
91 * NOTE This field is badly named and can not be fixed for backwards compatibility. | 108 * NOTE This field is badly named and can not be fixed for backwards compatibility. |
92 * It should be capitalized. | 109 * It should be capitalized. |
93 * | 110 * |
94 * @deprecated | 111 * @deprecated |
95 */ | 112 */ |
96 public static RGB borderOutsideRGB = new RGB (171, 168, 165); | 113 public static RGB borderOutsideRGB; |
97 | 114 |
98 // DWT widgets | 115 // DWT widgets |
99 Control topLeft; | 116 Control topLeft; |
100 Control topCenter; | 117 Control topCenter; |
101 Control topRight; | 118 Control topRight; |
102 Control content; | 119 Control content; |
103 | 120 |
104 // Configuration and state info | 121 // Configuration and state info |
105 bool separateTopCenter = false; | 122 bool separateTopCenter = false; |
106 bool showBorder = false; | 123 bool showBorder = false; |
107 | 124 |
108 int separator = -1; | 125 int separator = -1; |
109 int borderTop = 0; | 126 int borderTop = 0; |
110 int borderBottom = 0; | 127 int borderBottom = 0; |
111 int borderLeft = 0; | 128 int borderLeft = 0; |
112 int borderRight = 0; | 129 int borderRight = 0; |
113 int highlight = 0; | 130 int highlight = 0; |
114 Point oldSize; | 131 Point oldSize; |
115 | 132 |
116 Color selectionBackground; | 133 Color selectionBackground; |
117 | 134 |
118 static final int OFFSCREEN = -200; | 135 static final int OFFSCREEN = -200; |
119 static final int BORDER1_COLOR = DWT.COLOR_WIDGET_NORMAL_SHADOW; | 136 static final int BORDER1_COLOR = DWT.COLOR_WIDGET_NORMAL_SHADOW; |
120 static final int SELECTION_BACKGROUND = DWT.COLOR_LIST_BACKGROUND; | 137 static final int SELECTION_BACKGROUND = DWT.COLOR_LIST_BACKGROUND; |
138 | |
139 | |
140 static this(){ | |
141 borderInsideRGB = new RGB (132, 130, 132); | |
142 borderMiddleRGB = new RGB (143, 141, 138); | |
143 borderOutsideRGB = new RGB (171, 168, 165); | |
144 } | |
121 /** | 145 /** |
122 * Constructs a new instance of this class given its parent | 146 * Constructs a new instance of this class given its parent |
123 * and a style value describing its behavior and appearance. | 147 * and a style value describing its behavior and appearance. |
124 * <p> | 148 * <p> |
125 * The style value is either one of the style constants defined in | 149 * The style value is either one of the style constants defined in |
126 * class <code>DWT</code> which is applicable to instances of this | 150 * class <code>DWT</code> which is applicable to instances of this |
127 * class, or must be built by <em>bitwise OR</em>'ing together | 151 * class, or must be built by <em>bitwise OR</em>'ing together |
128 * (that is, using the <code>int</code> "|" operator) two or more | 152 * (that is, using the <code>int</code> "|" operator) two or more |
129 * of those <code>DWT</code> style constants. The class description | 153 * of those <code>DWT</code> style constants. The class description |
130 * lists the style constants that are applicable to the class. | 154 * lists the style constants that are applicable to the class. |
131 * Style bits are also inherited from superclasses. | 155 * Style bits are also inherited from superclasses. |
132 * </p> | 156 * </p> |
142 * </ul> | 166 * </ul> |
143 * | 167 * |
144 * @see DWT#BORDER | 168 * @see DWT#BORDER |
145 * @see DWT#FLAT | 169 * @see DWT#FLAT |
146 * @see #getStyle() | 170 * @see #getStyle() |
147 */ | 171 */ |
148 public this(Composite parent, int style) { | 172 public this(Composite parent, int style) { |
149 super(parent, checkStyle(style)); | 173 super(parent, checkStyle(style)); |
150 super.setLayout(new ViewFormLayout()); | 174 super.setLayout(new ViewFormLayout()); |
151 | 175 |
152 setBorderVisible((style & DWT.BORDER) !is 0); | 176 setBorderVisible((style & DWT.BORDER) !is 0); |
153 | 177 |
154 Listener listener = new Listener() { | 178 Listener listener = new class() Listener { |
155 public void handleEvent(Event e) { | 179 public void handleEvent(Event e) { |
156 switch (e.type) { | 180 switch (e.type) { |
157 case DWT.Dispose: onDispose(); break; | 181 case DWT.Dispose: onDispose(); break; |
158 case DWT.Paint: onPaint(e.gc); break; | 182 case DWT.Paint: onPaint(e.gc); break; |
159 case DWT.Resize: onResize(); break; | 183 case DWT.Resize: onResize(); break; |
184 default: | |
160 } | 185 } |
161 } | 186 } |
162 }; | 187 }; |
163 | 188 |
164 int[] events = new int[] {DWT.Dispose, DWT.Paint, DWT.Resize}; | 189 int[] events = [DWT.Dispose, DWT.Paint, DWT.Resize]; |
165 | 190 |
166 for (int i = 0; i < events.length; i++) { | 191 for (int i = 0; i < events.length; i++) { |
167 addListener(events[i], listener); | 192 addListener(events[i], listener); |
168 } | 193 } |
169 } | 194 } |
170 | 195 |
174 } | 199 } |
175 | 200 |
176 //protected void checkSubclass () { | 201 //protected void checkSubclass () { |
177 // String name = getClass().getName (); | 202 // String name = getClass().getName (); |
178 // String validName = ViewForm.class.getName(); | 203 // String validName = ViewForm.class.getName(); |
179 // if (!validName.opEquals(name)) { | 204 // if (!validName.equals(name)) { |
180 // DWT.error (DWT.ERROR_INVALID_SUBCLASS); | 205 // DWT.error (DWT.ERROR_INVALID_SUBCLASS); |
181 // } | 206 // } |
182 //} | 207 //} |
183 | 208 |
184 public Rectangle computeTrim (int x, int y, int width, int height) { | 209 public override Rectangle computeTrim (int x, int y, int width, int height) { |
185 checkWidget (); | 210 checkWidget (); |
186 int trimX = x - borderLeft - highlight; | 211 int trimX = x - borderLeft - highlight; |
187 int trimY = y - borderTop - highlight; | 212 int trimY = y - borderTop - highlight; |
188 int trimWidth = width + borderLeft + borderRight + 2*highlight; | 213 int trimWidth = width + borderLeft + borderRight + 2*highlight; |
189 int trimHeight = height + borderTop + borderBottom + 2*highlight; | 214 int trimHeight = height + borderTop + borderBottom + 2*highlight; |
190 return new Rectangle(trimX, trimY, trimWidth, trimHeight); | 215 return new Rectangle(trimX, trimY, trimWidth, trimHeight); |
191 } | 216 } |
192 public Rectangle getClientArea() { | 217 public override Rectangle getClientArea() { |
193 checkWidget(); | 218 checkWidget(); |
194 Rectangle clientArea = super.getClientArea(); | 219 Rectangle clientArea = super.getClientArea(); |
195 clientArea.x += borderLeft; | 220 clientArea.x += borderLeft; |
196 clientArea.y += borderTop; | 221 clientArea.y += borderTop; |
197 clientArea.width -= borderLeft + borderRight; | 222 clientArea.width -= borderLeft + borderRight; |
198 clientArea.height -= borderTop + borderBottom; | 223 clientArea.height -= borderTop + borderBottom; |
199 return clientArea; | 224 return clientArea; |
200 } | 225 } |
201 /** | 226 /** |
202 * Returns the content area. | 227 * Returns the content area. |
203 * | 228 * |
204 * @return the control in the content area of the pane or null | 229 * @return the control in the content area of the pane or null |
205 */ | 230 */ |
206 public Control getContent() { | 231 public Control getContent() { |
207 //checkWidget(); | 232 //checkWidget(); |
208 return content; | 233 return content; |
209 } | 234 } |
210 /** | 235 /** |
211 * Returns Control that appears in the top center of the pane. | 236 * Returns Control that appears in the top center of the pane. |
212 * Typically this is a toolbar. | 237 * Typically this is a toolbar. |
213 * | 238 * |
214 * @return the control in the top center of the pane or null | 239 * @return the control in the top center of the pane or null |
215 */ | 240 */ |
216 public Control getTopCenter() { | 241 public Control getTopCenter() { |
217 //checkWidget(); | 242 //checkWidget(); |
218 return topCenter; | 243 return topCenter; |
219 } | 244 } |
220 /** | 245 /** |
221 * Returns the Control that appears in the top left corner of the pane. | 246 * Returns the Control that appears in the top left corner of the pane. |
222 * Typically this is a label such as CLabel. | 247 * Typically this is a label such as CLabel. |
223 * | 248 * |
224 * @return the control in the top left corner of the pane or null | 249 * @return the control in the top left corner of the pane or null |
225 */ | 250 */ |
226 public Control getTopLeft() { | 251 public Control getTopLeft() { |
227 //checkWidget(); | 252 //checkWidget(); |
228 return topLeft; | 253 return topLeft; |
229 } | 254 } |
230 /** | 255 /** |
231 * Returns the control in the top right corner of the pane. | 256 * Returns the control in the top right corner of the pane. |
232 * Typically this is a Close button or a composite with a Menu and Close button. | 257 * Typically this is a Close button or a composite with a Menu and Close button. |
233 * | 258 * |
234 * @return the control in the top right corner of the pane or null | 259 * @return the control in the top right corner of the pane or null |
235 */ | 260 */ |
236 public Control getTopRight() { | 261 public Control getTopRight() { |
237 //checkWidget(); | 262 //checkWidget(); |
238 return topRight; | 263 return topRight; |
255 if (highlight > 0) { | 280 if (highlight > 0) { |
256 int x1 = 1; | 281 int x1 = 1; |
257 int y1 = 1; | 282 int y1 = 1; |
258 int x2 = size.x - 1; | 283 int x2 = size.x - 1; |
259 int y2 = size.y - 1; | 284 int y2 = size.y - 1; |
260 int[] shape = new int[] {x1,y1, x2,y1, x2,y2, x1,y2, x1,y1+highlight, | 285 int[] shape = [x1,y1, x2,y1, x2,y2, x1,y2, x1,y1+highlight, |
261 x1+highlight,y1+highlight, x1+highlight,y2-highlight, | 286 x1+highlight,y1+highlight, x1+highlight,y2-highlight, |
262 x2-highlight,y2-highlight, x2-highlight,y1+highlight, x1,y1+highlight}; | 287 x2-highlight,y2-highlight, x2-highlight,y1+highlight, x1,y1+highlight]; |
263 Color highlightColor = getDisplay().getSystemColor(DWT.COLOR_LIST_SELECTION); | 288 Color highlightColor = getDisplay().getSystemColor(DWT.COLOR_LIST_SELECTION); |
264 gc.setBackground(highlightColor); | 289 gc.setBackground(highlightColor); |
265 gc.fillPolygon(shape); | 290 gc.fillPolygon(shape); |
266 } | 291 } |
267 } | 292 } |
278 } else { | 303 } else { |
279 int width = 0; | 304 int width = 0; |
280 if (oldSize.x < size.x) { | 305 if (oldSize.x < size.x) { |
281 width = size.x - oldSize.x + borderRight + highlight; | 306 width = size.x - oldSize.x + borderRight + highlight; |
282 } else if (oldSize.x > size.x) { | 307 } else if (oldSize.x > size.x) { |
283 width = borderRight + highlight; | 308 width = borderRight + highlight; |
284 } | 309 } |
285 redraw(size.x - width, 0, width, size.y, false); | 310 redraw(size.x - width, 0, width, size.y, false); |
286 | 311 |
287 int height = 0; | 312 int height = 0; |
288 if (oldSize.y < size.y) { | 313 if (oldSize.y < size.y) { |
289 height = size.y - oldSize.y + borderBottom + highlight; | 314 height = size.y - oldSize.y + borderBottom + highlight; |
290 } | 315 } |
291 if (oldSize.y > size.y) { | 316 if (oldSize.y > size.y) { |
292 height = borderBottom + highlight; | 317 height = borderBottom + highlight; |
293 } | 318 } |
294 redraw(0, size.y - height, size.x, height, false); | 319 redraw(0, size.y - height, size.x, height, false); |
295 } | 320 } |
296 oldSize = size; | 321 oldSize = size; |
297 } | 322 } |
298 /** | 323 /** |
299 * Sets the content. | 324 * Sets the content. |
300 * Setting the content to null will remove it from | 325 * Setting the content to null will remove it from |
301 * the pane - however, the creator of the content must dispose of the content. | 326 * the pane - however, the creator of the content must dispose of the content. |
302 * | 327 * |
303 * @param content the control to be displayed in the content area or null | 328 * @param content the control to be displayed in the content area or null |
304 * | 329 * |
305 * @exception DWTException <ul> | 330 * @exception DWTException <ul> |
306 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | 331 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
307 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | 332 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
308 * <li>ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm</li> | 333 * <li>ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm</li> |
309 * </ul> | 334 * </ul> |
332 * @exception DWTException <ul> | 357 * @exception DWTException <ul> |
333 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | 358 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
334 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | 359 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
335 * </ul> | 360 * </ul> |
336 */ | 361 */ |
337 public void setLayout (Layout layout) { | 362 public override void setLayout (Layout layout) { |
338 checkWidget(); | 363 checkWidget(); |
339 return; | 364 return; |
340 } | 365 } |
341 void setSelectionBackground (Color color) { | 366 void setSelectionBackground (Color color) { |
342 checkWidget(); | 367 checkWidget(); |
346 redraw(); | 371 redraw(); |
347 } | 372 } |
348 /** | 373 /** |
349 * Set the control that appears in the top center of the pane. | 374 * Set the control that appears in the top center of the pane. |
350 * Typically this is a toolbar. | 375 * Typically this is a toolbar. |
351 * The topCenter is optional. Setting the topCenter to null will remove it from | 376 * The topCenter is optional. Setting the topCenter to null will remove it from |
352 * the pane - however, the creator of the topCenter must dispose of the topCenter. | 377 * the pane - however, the creator of the topCenter must dispose of the topCenter. |
353 * | 378 * |
354 * @param topCenter the control to be displayed in the top center or null | 379 * @param topCenter the control to be displayed in the top center or null |
355 * | 380 * |
356 * @exception DWTException <ul> | 381 * @exception DWTException <ul> |
357 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | 382 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
358 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | 383 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
359 * <li>ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm</li> | 384 * <li>ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm</li> |
360 * </ul> | 385 * </ul> |
372 layout(false); | 397 layout(false); |
373 } | 398 } |
374 /** | 399 /** |
375 * Set the control that appears in the top left corner of the pane. | 400 * Set the control that appears in the top left corner of the pane. |
376 * Typically this is a label such as CLabel. | 401 * Typically this is a label such as CLabel. |
377 * The topLeft is optional. Setting the top left control to null will remove it from | 402 * The topLeft is optional. Setting the top left control to null will remove it from |
378 * the pane - however, the creator of the control must dispose of the control. | 403 * the pane - however, the creator of the control must dispose of the control. |
379 * | 404 * |
380 * @param c the control to be displayed in the top left corner or null | 405 * @param c the control to be displayed in the top left corner or null |
381 * | 406 * |
382 * @exception DWTException <ul> | 407 * @exception DWTException <ul> |
383 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | 408 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
384 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | 409 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
385 * <li>ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm</li> | 410 * <li>ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm</li> |
386 * </ul> | 411 * </ul> |
398 layout(false); | 423 layout(false); |
399 } | 424 } |
400 /** | 425 /** |
401 * Set the control that appears in the top right corner of the pane. | 426 * Set the control that appears in the top right corner of the pane. |
402 * Typically this is a Close button or a composite with a Menu and Close button. | 427 * Typically this is a Close button or a composite with a Menu and Close button. |
403 * The topRight is optional. Setting the top right control to null will remove it from | 428 * The topRight is optional. Setting the top right control to null will remove it from |
404 * the pane - however, the creator of the control must dispose of the control. | 429 * the pane - however, the creator of the control must dispose of the control. |
405 * | 430 * |
406 * @param c the control to be displayed in the top right corner or null | 431 * @param c the control to be displayed in the top right corner or null |
407 * | 432 * |
408 * @exception DWTException <ul> | 433 * @exception DWTException <ul> |
409 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | 434 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
410 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | 435 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
411 * <li>ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm</li> | 436 * <li>ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm</li> |
412 * </ul> | 437 * </ul> |
423 this.topRight = c; | 448 this.topRight = c; |
424 layout(false); | 449 layout(false); |
425 } | 450 } |
426 /** | 451 /** |
427 * Specify whether the border should be displayed or not. | 452 * Specify whether the border should be displayed or not. |
428 * | 453 * |
429 * @param show true if the border should be displayed | 454 * @param show true if the border should be displayed |
430 * | 455 * |
431 * @exception DWTException <ul> | 456 * @exception DWTException <ul> |
432 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | 457 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
433 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | 458 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
434 * </ul> | 459 * </ul> |
435 */ | 460 */ |
436 public void setBorderVisible(bool show) { | 461 public void setBorderVisible(bool show) { |
437 checkWidget(); | 462 checkWidget(); |
438 if (showBorder is show) return; | 463 if (showBorder is show) return; |
439 | 464 |
440 showBorder = show; | 465 showBorder = show; |
441 if (showBorder) { | 466 if (showBorder) { |
442 borderLeft = borderTop = borderRight = borderBottom = 1; | 467 borderLeft = borderTop = borderRight = borderBottom = 1; |
443 if ((getStyle() & DWT.FLAT)== 0) highlight = 2; | 468 if ((getStyle() & DWT.FLAT)is 0) highlight = 2; |
444 } else { | 469 } else { |
445 borderBottom = borderTop = borderLeft = borderRight = 0; | 470 borderBottom = borderTop = borderLeft = borderRight = 0; |
446 highlight = 0; | 471 highlight = 0; |
447 } | 472 } |
448 layout(false); | 473 layout(false); |
449 redraw(); | 474 redraw(); |
450 } | 475 } |
451 /** | 476 /** |
452 * If true, the topCenter will always appear on a separate line by itself, otherwise the | 477 * If true, the topCenter will always appear on a separate line by itself, otherwise the |
453 * topCenter will appear in the top row if there is room and will be moved to the second row if | 478 * topCenter will appear in the top row if there is room and will be moved to the second row if |
454 * required. | 479 * required. |
455 * | 480 * |
456 * @param show true if the topCenter will always appear on a separate line by itself | 481 * @param show true if the topCenter will always appear on a separate line by itself |
457 * | 482 * |
458 * @exception DWTException <ul> | 483 * @exception DWTException <ul> |
459 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | 484 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> |
460 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | 485 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> |
461 * </ul> | 486 * </ul> |
462 */ | 487 */ |