Mercurial > projects > dwt-linux
diff dwt/widgets/Control.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 | f1bb3949939b |
line wrap: on
line diff
--- a/dwt/widgets/Control.d Tue Jun 24 22:12:18 2008 +0200 +++ b/dwt/widgets/Control.d Sun Jun 29 14:33:38 2008 +0200 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -78,6 +78,10 @@ * IMPORTANT: This class is intended to be subclassed <em>only</em> * within the DWT implementation. * </p> + * + * @see <a href="http://www.eclipse.org/swt/snippets/#control">Control snippets</a> + * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Example: ControlExample</a> + * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public abstract class Control : Widget, Drawable { @@ -331,6 +335,23 @@ return OS.GTK_WIDGET_WINDOW (paintHandle); } +/** + * Prints the receiver and all children. + * + * @param gc the gc where the drawing occurs + * @return <code>true</code> if the operation was successful and <code>false</code> otherwise + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if the gc is null</li> + * <li>ERROR_INVALID_ARGUMENT - if the gc has been disposed</li> + * </ul> + * @exception DWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @since 3.4 + */ public bool print (GC gc) { checkWidget (); if (gc is null) error (DWT.ERROR_NULL_ARGUMENT); @@ -970,9 +991,25 @@ setBounds (0, 0, Math.max (0, size.x), Math.max (0, size.y), false, true); } +/** + * Sets the shape of the control to the region specified + * by the argument. When the argument is null, the + * default shape of the control is restored. + * + * @param region the region that defines the shape of the control (or null) + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_INVALID_ARGUMENT - if the region has been disposed</li> + * </ul> + * @exception DWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @since 3.4 + */ public void setRegion (Region region) { checkWidget (); - if ((style & DWT.NO_TRIM) is 0) return; if (region !is null && region.isDisposed()) error (DWT.ERROR_INVALID_ARGUMENT); auto window = OS.GTK_WIDGET_WINDOW (topHandle ()); auto shape_region = (region is null) ? null : region.handle; @@ -2210,7 +2247,9 @@ * When the mouse pointer passes over a control its appearance * is changed to match the control's cursor. * </p> - * </ul> + * + * @return the receiver's cursor or <code>null</code> + * * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -2430,6 +2469,19 @@ return result; } +/** + * Returns the region that defines the shape of the control, + * or null if the control has the default shape. + * + * @return the region that defines the shape of the shell (or null) + * + * @exception DWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @since 3.4 + */ public Region getRegion () { checkWidget (); return region; @@ -3440,7 +3492,8 @@ /** * If the argument is <code>true</code>, causes the receiver to have * all mouse events delivered to it until the method is called with - * <code>false</code> as the argument. + * <code>false</code> as the argument. Note that on some platforms, + * a mouse button must currently be down for capture to be assigned. * * @param capture <code>true</code> to capture the mouse, and <code>false</code> to release it * @@ -3563,18 +3616,17 @@ OS.gtk_widget_realize (handle); auto parentHandle = parent.eventHandle (); auto window = parent.eventWindow(); - Rectangle rect = getBounds (); + auto topHandle_ = topHandle (); GdkWindowAttr attributes; - attributes.x = rect.x; - attributes.y = rect.y; - attributes.width = rect.width; - attributes.height = rect.height; + attributes.x = OS.GTK_WIDGET_X (topHandle_); + attributes.y = OS.GTK_WIDGET_Y (topHandle_); + attributes.width = (state & ZERO_WIDTH) !is 0 ? 0 : OS.GTK_WIDGET_WIDTH (topHandle_); + attributes.height = (state & ZERO_HEIGHT) !is 0 ? 0 : OS.GTK_WIDGET_HEIGHT (topHandle_); attributes.event_mask = (0xFFFFFFFF & ~OS.ExposureMask); attributes.wclass = OS.GDK_INPUT_ONLY; attributes.window_type = OS.GDK_WINDOW_CHILD; enableWindow = OS.gdk_window_new (window, &attributes, OS.GDK_WA_X | OS.GDK_WA_Y); if (enableWindow !is null) { - auto topHandle_ = topHandle (); OS.gdk_window_set_user_data (enableWindow, parentHandle); if (!OS.GDK_WINDOWING_X11 ()) { OS.gdk_window_raise (enableWindow);