Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 58942 Details for
Bug 174121
SWT - Add resource create/dispose callback to Device
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to add resource callbacks
GDI_listener.txt (text/plain), 4.17 KB, created by
Chris Grindstaff
on 2007-02-13 23:12:57 EST
(
hide
)
Description:
Patch to add resource callbacks
Filename:
MIME Type:
Creator:
Chris Grindstaff
Created:
2007-02-13 23:12:57 EST
Size:
4.17 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java,v >retrieving revision 1.47 >diff -u -r1.47 Device.java >--- Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java 14 Dec 2006 16:42:09 -0000 1.47 >+++ Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java 14 Feb 2007 04:02:43 -0000 >@@ -14,6 +14,7 @@ > import org.eclipse.swt.internal.*; > import org.eclipse.swt.internal.gdip.*; > import org.eclipse.swt.internal.win32.*; >+import org.eclipse.swt.widgets.Listener; > import org.eclipse.swt.*; > > /** >@@ -30,6 +31,7 @@ > boolean tracking = DEBUG; > Error [] errors; > Object [] objects; >+ Listener listener; > > /** > * Palette >@@ -125,6 +127,7 @@ > if (data != null) { > debug = data.debug; > tracking = data.tracking; >+ listener = data.listener; > } > create (data); > init (); >@@ -270,6 +273,13 @@ > void dispose_Object (Object object) { > for (int i=0; i<objects.length; i++) { > if (objects [i] == object) { >+ if(listener != null) { >+ Event event = new ResourceEvent(object); >+ event.time = OS.GetMessageTime(); >+ event.data = errors[i]; >+ event.type = SWT.Dispose; >+ listener.handleEvent(event); >+ } > objects [i] = null; > errors [i] = null; > return; >@@ -779,11 +789,43 @@ > return OS.AddFontResourceExW (buffer, OS.FR_PRIVATE, 0) != 0; > } > >+/** >+ * Loads the font specified by a file. The font will be >+ * present in the list of fonts available to the application. >+ * >+ * @param path the font file path >+ * @return whether the font was successfully loaded >+ * >+ * @exception SWTException <ul> >+ * <li>ERROR_NULL_ARGUMENT - if path is null</li> >+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> >+ * </ul> >+ * >+ * @see Font >+ * >+ * @since 3.3 >+ */ >+public boolean loadFont (String path) { >+ checkDevice(); >+ if (path == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); >+ int length = path.length (); >+ char[] buffer = new char [length + 1]; >+ path.getChars (0, length, buffer, 0); >+ return OS.AddFontResourceExW (buffer, OS.FR_PRIVATE, 0) != 0; >+} >+ > void new_Object (Object object) { > for (int i=0; i<objects.length; i++) { > if (objects [i] == null) { > objects [i] = object; > errors [i] = new Error (); >+ if(listener != null) { >+ Event event = new ResourceEvent(object); >+ event.time = OS.GetMessageTime(); >+ event.type = SWT.Show; >+ event.data = errors[i]; >+ listener.handleEvent(event); >+ } > return; > } > } >Index: Eclipse SWT/win32/org/eclipse/swt/graphics/DeviceData.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/DeviceData.java,v >retrieving revision 1.7 >diff -u -r1.7 DeviceData.java >--- Eclipse SWT/win32/org/eclipse/swt/graphics/DeviceData.java 28 Feb 2005 21:50:52 -0000 1.7 >+++ Eclipse SWT/win32/org/eclipse/swt/graphics/DeviceData.java 14 Feb 2007 04:02:43 -0000 >@@ -10,6 +10,8 @@ > *******************************************************************************/ > package org.eclipse.swt.graphics; > >+import org.eclipse.swt.widgets.Listener; >+ > > public class DeviceData { > /* >@@ -20,4 +22,5 @@ > public boolean tracking; > public Error [] errors; > public Object [] objects; >+ public Listener listener; > } >Index: Eclipse SWT/common/org/eclipse/swt/graphics/ResourceEvent.java >=================================================================== >RCS file: Eclipse SWT/common/org/eclipse/swt/graphics/ResourceEvent.java >diff -N Eclipse SWT/common/org/eclipse/swt/graphics/ResourceEvent.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse SWT/common/org/eclipse/swt/graphics/ResourceEvent.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,13 @@ >+package org.eclipse.swt.graphics; >+import org.eclipse.swt.widgets.Event; >+ >+ >+public class ResourceEvent extends Event { >+ public Object resource; >+ >+ public ResourceEvent(Object resource) { >+ super(); >+ this.resource = resource; >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 174121
:
58942
|
59072