Mercurial > projects > dwt-linux
comparison dwt/widgets/Button.d @ 259:c0d810de7093
Update SWT 3.4M7 to 3.4
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 29 Jun 2008 14:33:38 +0200 |
parents | 5a30aa9820f3 |
children | 4bffbf81e2d6 |
comparison
equal
deleted
inserted
replaced
257:cc1d3de0e80b | 259:c0d810de7093 |
---|---|
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 * |
48 * when the ARROW style is specified. | 48 * when the ARROW style is specified. |
49 * </p><p> | 49 * </p><p> |
50 * IMPORTANT: This class is intended to be subclassed <em>only</em> | 50 * IMPORTANT: This class is intended to be subclassed <em>only</em> |
51 * within the DWT implementation. | 51 * within the DWT implementation. |
52 * </p> | 52 * </p> |
53 * | |
54 * @see <a href="http://www.eclipse.org/swt/snippets/#button">Button snippets</a> | |
55 * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Example: ControlExample</a> | |
56 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> | |
53 */ | 57 */ |
54 public class Button : Control { | 58 public class Button : Control { |
55 | 59 |
56 alias Control.computeSize computeSize; | 60 alias Control.computeSize computeSize; |
57 alias Control.mnemonicHit mnemonicHit; | 61 alias Control.mnemonicHit mnemonicHit; |
309 if ((style & DWT.CENTER) !is 0) return DWT.CENTER; | 313 if ((style & DWT.CENTER) !is 0) return DWT.CENTER; |
310 if ((style & DWT.RIGHT) !is 0) return DWT.RIGHT; | 314 if ((style & DWT.RIGHT) !is 0) return DWT.RIGHT; |
311 return DWT.LEFT; | 315 return DWT.LEFT; |
312 } | 316 } |
313 | 317 |
318 /** | |
319 * Returns <code>true</code> if the receiver is grayed, | |
320 * and false otherwise. When the widget does not have | |
321 * the <code>CHECK</code> style, return false. | |
322 * | |
323 * @return the grayed state of the checkbox | |
324 * | |
325 * @exception DWTException <ul> | |
326 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
327 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
328 * </ul> | |
329 * | |
330 * @since 3.4 | |
331 */ | |
314 public bool getGrayed () { | 332 public bool getGrayed () { |
315 checkWidget(); | 333 checkWidget(); |
316 if ((style & DWT.CHECK) is 0) return false; | 334 if ((style & DWT.CHECK) is 0) return false; |
317 return grayed; | 335 return grayed; |
318 } | 336 } |
656 setForegroundColor (fixedHandle, color); | 674 setForegroundColor (fixedHandle, color); |
657 if (labelHandle !is null) setForegroundColor (labelHandle, color); | 675 if (labelHandle !is null) setForegroundColor (labelHandle, color); |
658 if (imageHandle !is null) setForegroundColor (imageHandle, color); | 676 if (imageHandle !is null) setForegroundColor (imageHandle, color); |
659 } | 677 } |
660 | 678 |
679 /** | |
680 * Sets the grayed state of the receiver. This state change | |
681 * only applies if the control was created with the DWT.CHECK | |
682 * style. | |
683 * | |
684 * @param grayed the new grayed state | |
685 * | |
686 * @exception DWTException <ul> | |
687 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> | |
688 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> | |
689 * </ul> | |
690 * | |
691 * @since 3.4 | |
692 */ | |
661 public void setGrayed (bool grayed) { | 693 public void setGrayed (bool grayed) { |
662 checkWidget(); | 694 checkWidget(); |
663 if ((style & DWT.CHECK) is 0) return; | 695 if ((style & DWT.CHECK) is 0) return; |
664 this.grayed = grayed; | 696 this.grayed = grayed; |
665 if (grayed && OS.gtk_toggle_button_get_active (handle)) { | 697 if (grayed && OS.gtk_toggle_button_get_active (handle)) { |