1 /*******************************************************************************
2  * Copyright (c) 2000, 2008 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  * Port to the D programming language:
11  *     Frank Benoit <benoit@tionex.de>
12  *******************************************************************************/
13 module org.eclipse.swt.graphics.ImageLoaderEvent;
14 
15 import java.lang.all;
16 
17 
18 public import org.eclipse.swt.internal.SWTEventObject;
19 public import org.eclipse.swt.graphics.ImageLoader;
20 public import org.eclipse.swt.graphics.ImageData;
21 
22 
23 /**
24  * Instances of this class are sent as a result of the incremental
25  * loading of image data.
26  * <p>
27  * <b>Notes:</b>
28  * </p><ul>
29  * <li>The number of events which will be sent when loading images
30  * is not constant. It varies by image type, and for JPEG images it
31  * varies from image to image.</li>
32  * <li>For image sources which contain multiple images, the
33  * <code>endOfImage</code> flag in the event will be set to true
34  * after each individual image is loaded.</li>
35  * </ul>
36  *
37  * @see ImageLoader
38  * @see ImageLoaderListener
39  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
40  */
41 
42 public class ImageLoaderEvent : SWTEventObject {
43 
44     /**
45      * if the <code>endOfImage</code> flag is false, then this is a
46      * partially complete copy of the current <code>ImageData</code>,
47      * otherwise this is a completely loaded <code>ImageData</code>
48      */
49     public ImageData imageData;
50 
51     /**
52      * the zero-based count of image data increments -- this is
53      * equivalent to the number of events that have been generated
54      * while loading a particular image
55      */
56     public int incrementCount;
57 
58     /**
59      * If this flag is true, then the current image data has been
60      * completely loaded, otherwise the image data is only partially
61      * loaded, and further ImageLoader events will occur unless an
62      * exception is thrown
63      */
64     public bool endOfImage;
65 
66     //static final long serialVersionUID = 3257284738325558065L;
67 
68 /**
69  * Constructs a new instance of this class given the event source and
70  * the values to store in its fields.
71  *
72  * @param source the ImageLoader that was loading when the event occurred
73  * @param imageData the image data for the event
74  * @param incrementCount the image data increment for the event
75  * @param endOfImage the end of image flag for the event
76  */
77 public this(ImageLoader source, ImageData imageData, int incrementCount, bool endOfImage) {
78     super(source);
79     this.imageData = imageData;
80     this.incrementCount = incrementCount;
81     this.endOfImage = endOfImage;
82 }
83 
84 /**
85  * Returns a string containing a concise, human-readable
86  * description of the receiver.
87  *
88  * @return a string representation of the event
89  */
90 public override String toString () {
91     return Format( "ImageLoaderEvent {{source={} imageData={} incrementCount={} endOfImage={}}", source, imageData, incrementCount, endOfImage); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
92 }
93 
94 }