root/dwt/events/PaintEvent.d

Revision 246:fd9c62a2998e, 2.7 kB (checked in by Frank Benoit <benoit@tionex.de>, 5 months ago)

Updater SWT 3.4M7 to 3.4

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