0
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2004 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
|
|
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 */
|
|
29
|
|
30 public final class PaintEvent : TypedEvent {
|
|
31
|
|
32 /**
|
|
33 * the graphics context to use when painting
|
|
34 * that is configured to use the colors, font and
|
|
35 * damaged region of the control. It is valid
|
|
36 * only during the paint and must not be disposed
|
|
37 */
|
|
38 public GC gc;
|
|
39
|
|
40 /**
|
|
41 * the x offset of the bounding rectangle of the
|
|
42 * region that requires painting
|
|
43 */
|
|
44 public int x;
|
|
45
|
|
46 /**
|
|
47 * the y offset of the bounding rectangle of the
|
|
48 * region that requires painting
|
|
49 */
|
|
50 public int y;
|
|
51
|
|
52 /**
|
|
53 * the width of the bounding rectangle of the
|
|
54 * region that requires painting
|
|
55 */
|
|
56 public int width;
|
|
57
|
|
58 /**
|
|
59 * the height of the bounding rectangle of the
|
|
60 * region that requires painting
|
|
61 */
|
|
62 public int height;
|
|
63
|
|
64 /**
|
|
65 * the number of following paint events which
|
|
66 * are pending which may always be zero on
|
|
67 * some platforms
|
|
68 */
|
|
69 public int count;
|
|
70
|
|
71 //static final long serialVersionUID = 3256446919205992497L;
|
|
72
|
|
73 /**
|
|
74 * Constructs a new instance of this class based on the
|
|
75 * information in the given untyped event.
|
|
76 *
|
|
77 * @param e the untyped event containing the information
|
|
78 */
|
|
79 public this(Event e) {
|
|
80 super(e);
|
|
81 this.gc = e.gc;
|
|
82 this.x = e.x;
|
|
83 this.y = e.y;
|
|
84 this.width = e.width;
|
|
85 this.height = e.height;
|
|
86 this.count = e.count;
|
|
87 }
|
|
88
|
|
89 /**
|
|
90 * Returns a string containing a concise, human-readable
|
|
91 * description of the receiver.
|
|
92 *
|
|
93 * @return a string representation of the event
|
|
94 */
|
|
95 public char[] toString() {
|
|
96 return Format( "{} gc={} x={} y={} width={} height={} count={}}",
|
|
97 super.toString[ 0 .. $-2 ],
|
|
98 gc, x, y, width, height, count );
|
|
99 }
|
|
100 }
|
|
101
|