Mercurial > projects > dwt-linux
annotate dwt/graphics/Resource.d @ 10:63c023465156
moved from org.eclipse.swt to dwt
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 05 Jan 2008 17:58:37 +0100 |
parents | ad2b69216039 |
children | 4db14dc0bc45 |
rev | line source |
---|---|
4 | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2005 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 *******************************************************************************/ | |
10
63c023465156
moved from org.eclipse.swt to dwt
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
11 module dwt.graphics.Resource; |
4 | 12 |
10
63c023465156
moved from org.eclipse.swt to dwt
Frank Benoit <benoit@tionex.de>
parents:
9
diff
changeset
|
13 import dwt.SWT; |
4 | 14 |
15 //PORTING_TYPE | |
16 class Device{} | |
17 | |
18 /** | |
19 * This class is the abstract superclass of all graphics resource objects. | |
20 * Resources created by the application must be disposed. | |
21 * <p> | |
22 * IMPORTANT: This class is intended to be subclassed <em>only</em> | |
23 * within the SWT implementation. However, it has not been marked | |
24 * final to allow those outside of the SWT development team to implement | |
25 * patched versions of the class in order to get around specific | |
26 * limitations in advance of when those limitations can be addressed | |
27 * by the team. Any class built using subclassing to access the internals | |
28 * of this class will likely fail to compile or run between releases and | |
29 * may be strongly platform specific. Subclassing should not be attempted | |
30 * without an intimate and detailed understanding of the workings of the | |
31 * hierarchy. No support is provided for user-written classes which are | |
32 * implemented as subclasses of this class. | |
33 * </p> | |
34 * | |
35 * @see #dispose | |
36 * @see #isDisposed | |
37 * | |
38 * @since 3.1 | |
39 */ | |
40 public abstract class Resource { | |
41 | |
42 /** | |
43 * the device where this resource was created | |
44 */ | |
45 Device device; | |
46 | |
47 /** | |
48 * Disposes of the operating system resources associated with | |
49 * this resource. Applications must dispose of all resources | |
50 * which they allocate. | |
51 */ | |
52 public abstract void dispose(); | |
53 | |
54 /** | |
55 * Returns the <code>Device</code> where this resource was | |
56 * created. | |
57 * | |
58 * @return <code>Device</code> the device of the receiver | |
59 * | |
60 * @since 3.2 | |
61 */ | |
62 public Device getDevice() { | |
63 Device device = this.device; | |
64 if (device is null || isDisposed ()) SWT.error (SWT.ERROR_GRAPHIC_DISPOSED); | |
65 return device; | |
66 } | |
67 | |
68 /** | |
69 * Returns <code>true</code> if the resource has been disposed, | |
70 * and <code>false</code> otherwise. | |
71 * <p> | |
72 * This method gets the dispose state for the resource. | |
73 * When a resource has been disposed, it is an error to | |
74 * invoke any other method using the resource. | |
75 * | |
76 * @return <code>true</code> when the resource is disposed and <code>false</code> otherwise | |
77 */ | |
78 public abstract bool isDisposed(); | |
79 | |
80 } |