comparison dwt/widgets/Shell.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
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 *
137 * IMPORTANT: This class is not intended to be subclassed. 137 * IMPORTANT: This class is not intended to be subclassed.
138 * </p> 138 * </p>
139 * 139 *
140 * @see Decorations 140 * @see Decorations
141 * @see DWT 141 * @see DWT
142 * @see <a href="http://www.eclipse.org/swt/snippets/#shell">Shell snippets</a>
143 * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Example: ControlExample</a>
144 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
142 */ 145 */
143 public class Shell : Decorations { 146 public class Shell : Decorations {
144 147
145 alias Decorations.createHandle createHandle; 148 alias Decorations.createHandle createHandle;
146 alias Decorations.fixStyle fixStyle; 149 alias Decorations.fixStyle fixStyle;
385 388
386 public static Shell gtk_new (Display display, GtkWidget* handle) { 389 public static Shell gtk_new (Display display, GtkWidget* handle) {
387 return new Shell (display, null, DWT.NO_TRIM, handle, true); 390 return new Shell (display, null, DWT.NO_TRIM, handle, true);
388 } 391 }
389 392
393 /**
394 * Invokes platform specific functionality to allocate a new shell
395 * that is not embedded.
396 * <p>
397 * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
398 * API for <code>Shell</code>. It is marked public only so that it
399 * can be shared within the packages provided by DWT. It is not
400 * available on all platforms, and should never be called from
401 * application code.
402 * </p>
403 *
404 * @param display the display for the shell
405 * @param handle the handle for the shell
406 * @return a new shell object containing the specified display and handle
407 *
408 * @since 3.3
409 */
390 public static Shell internal_new (Display display, GtkWidget* handle) { 410 public static Shell internal_new (Display display, GtkWidget* handle) {
391 return new Shell (display, null, DWT.NO_TRIM, handle, false); 411 return new Shell (display, null, DWT.NO_TRIM, handle, false);
392 } 412 }
393 413
394 static int checkStyle (int style) { 414 static int checkStyle (int style) {
824 allocation.width = width; 844 allocation.width = width;
825 allocation.height = height; 845 allocation.height = height;
826 OS.gtk_widget_size_allocate (cast(GtkWidget*)vboxHandle, &allocation); 846 OS.gtk_widget_size_allocate (cast(GtkWidget*)vboxHandle, &allocation);
827 } 847 }
828 848
849 /**
850 * Returns the receiver's alpha value. The alpha value
851 * is between 0 (transparent) and 255 (opaque).
852 *
853 * @return the alpha value
854 *
855 * @exception DWTException <ul>
856 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
857 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
858 * </ul>
859 *
860 * @since 3.4
861 */
829 public int getAlpha () { 862 public int getAlpha () {
830 checkWidget (); 863 checkWidget ();
831 if (OS.GTK_VERSION >= OS.buildVERSION (2, 12, 0)) { 864 if (OS.GTK_VERSION >= OS.buildVERSION (2, 12, 0)) {
832 if (OS.gtk_widget_is_composited (shellHandle)) { 865 if (OS.gtk_widget_is_composited (shellHandle)) {
833 return cast(int) (OS.gtk_window_get_opacity (shellHandle) * 255); 866 return cast(int) (OS.gtk_window_get_opacity (shellHandle) * 255);
834 } 867 }
835 } 868 }
836 return 255; 869 return 255;
837 } 870 }
838 871
872 /**
873 * Returns <code>true</code> if the receiver is currently
874 * in fullscreen state, and false otherwise.
875 * <p>
876 *
877 * @return the fullscreen state
878 *
879 * @exception DWTException <ul>
880 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
881 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
882 * </ul>
883 *
884 * @since 3.4
885 */
839 public bool getFullScreen () { 886 public bool getFullScreen () {
840 checkWidget(); 887 checkWidget();
841 return fullScreen; 888 return fullScreen;
842 } 889 }
843 890
1240 activate [i].sendEvent (DWT.Activate); 1287 activate [i].sendEvent (DWT.Activate);
1241 } 1288 }
1242 } 1289 }
1243 } 1290 }
1244 1291
1292 /**
1293 * Sets the receiver's alpha value which must be
1294 * between 0 (transparent) and 255 (opaque).
1295 * <p>
1296 * This operation requires the operating system's advanced
1297 * widgets subsystem which may not be available on some
1298 * platforms.
1299 * </p>
1300 * @param alpha the alpha value
1301 *
1302 * @exception DWTException <ul>
1303 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
1304 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
1305 * </ul>
1306 *
1307 * @since 3.4
1308 */
1245 public void setAlpha (int alpha) { 1309 public void setAlpha (int alpha) {
1246 checkWidget (); 1310 checkWidget ();
1247 if (OS.GTK_VERSION >= OS.buildVERSION (2, 12, 0)) { 1311 if (OS.GTK_VERSION >= OS.buildVERSION (2, 12, 0)) {
1248 if (OS.gtk_widget_is_composited (shellHandle)) { 1312 if (OS.gtk_widget_is_composited (shellHandle)) {
1249 alpha &= 0xFF; 1313 alpha &= 0xFF;
1388 if (enabled && display.activeShell is this) { 1452 if (enabled && display.activeShell is this) {
1389 if (!restoreFocus ()) traverseGroup (false); 1453 if (!restoreFocus ()) traverseGroup (false);
1390 } 1454 }
1391 } 1455 }
1392 1456
1457 /**
1458 * Sets the full screen state of the receiver.
1459 * If the argument is <code>true</code> causes the receiver
1460 * to switch to the full screen state, and if the argument is
1461 * <code>false</code> and the receiver was previously switched
1462 * into full screen state, causes the receiver to switch back
1463 * to either the maximmized or normal states.
1464 * <p>
1465 * Note: The result of intermixing calls to <code>setFullScreen(true)</code>,
1466 * <code>setMaximized(true)</code> and <code>setMinimized(true)</code> will
1467 * vary by platform. Typically, the behavior will match the platform user's
1468 * expectations, but not always. This should be avoided if possible.
1469 * </p>
1470 *
1471 * @param fullScreen the new fullscreen state
1472 *
1473 * @exception DWTException <ul>
1474 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
1475 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
1476 * </ul>
1477 *
1478 * @since 3.4
1479 */
1393 public void setFullScreen (bool fullScreen) { 1480 public void setFullScreen (bool fullScreen) {
1394 checkWidget(); 1481 checkWidget();
1395 if (fullScreen) { 1482 if (fullScreen) {
1396 OS.gtk_window_fullscreen (shellHandle); 1483 OS.gtk_window_fullscreen (shellHandle);
1397 } else { 1484 } else {