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.events.PaintEvent;
14 
15 
16 import org.eclipse.swt.widgets.Event;
17 import org.eclipse.swt.graphics.GC;
18 
19 import org.eclipse.swt.events.TypedEvent;
20 
21 import java.lang.all;
22 
23 /**
24  * Instances of this class are sent as a result of
25  * visible areas of controls requiring re-painting.
26  *
27  * @see PaintListener
28  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
29  */
30 
31 public final class PaintEvent : TypedEvent {
32 
33     /**
34      * the graphics context to use when painting
35      * that is configured to use the colors, font and
36      * damaged region of the control.  It is valid
37      * only during the paint and must not be disposed
38      */
39     public GC gc;
40 
41     /**
42      * the x offset of the bounding rectangle of the
43      * region that requires painting
44      */
45     public int x;
46 
47     /**
48      * the y offset of the bounding rectangle of the
49      * region that requires painting
50      */
51     public int y;
52 
53     /**
54      * the width of the bounding rectangle of the
55      * region that requires painting
56      */
57     public int width;
58 
59     /**
60      * the height of the bounding rectangle of the
61      * region that requires painting
62      */
63     public int height;
64 
65     /**
66      * the number of following paint events which
67      * are pending which may always be zero on
68      * some platforms
69      */
70     public int count;
71 
72     //static const long serialVersionUID = 3256446919205992497L;
73 
74 /**
75  * Constructs a new instance of this class based on the
76  * information in the given untyped event.
77  *
78  * @param e the untyped event containing the information
79  */
80 public this(Event e) {
81     super(e);
82     this.gc = e.gc;
83     this.x = e.x;
84     this.y = e.y;
85     this.width = e.width;
86     this.height = e.height;
87     this.count = e.count;
88 }
89 
90 /**
91  * Returns a string containing a concise, human-readable
92  * description of the receiver.
93  *
94  * @return a string representation of the event
95  */
96 public override String toString() {
97     return Format( "{} gc={} x={} y={} width={} height={} count={}}",
98         super.toString[ 0 .. $-1 ],
99         gc is null ? "null" : gc.toString,
100         x,
101         y,
102         width,
103         height,
104         count );
105 }
106 }
107