01: /*******************************************************************************
02: * Copyright (c) 2000, 2004 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.swt.events;
11:
12: import org.eclipse.swt.widgets.Event;
13: import org.eclipse.swt.graphics.GC;
14:
15: /**
16: * Instances of this class are sent as a result of
17: * visible areas of controls requiring re-painting.
18: *
19: * @see PaintListener
20: */
21:
22: public final class PaintEvent extends TypedEvent {
23:
24: /**
25: * the graphics context to use when painting
26: * that is configured to use the colors, font and
27: * damaged region of the control. It is valid
28: * only during the paint and must not be disposed
29: */
30: public GC gc;
31:
32: /**
33: * the x offset of the bounding rectangle of the
34: * region that requires painting
35: */
36: public int x;
37:
38: /**
39: * the y offset of the bounding rectangle of the
40: * region that requires painting
41: */
42: public int y;
43:
44: /**
45: * the width of the bounding rectangle of the
46: * region that requires painting
47: */
48: public int width;
49:
50: /**
51: * the height of the bounding rectangle of the
52: * region that requires painting
53: */
54: public int height;
55:
56: /**
57: * the number of following paint events which
58: * are pending which may always be zero on
59: * some platforms
60: */
61: public int count;
62:
63: static final long serialVersionUID = 3256446919205992497L;
64:
65: /**
66: * Constructs a new instance of this class based on the
67: * information in the given untyped event.
68: *
69: * @param e the untyped event containing the information
70: */
71: public PaintEvent(Event e) {
72: super (e);
73: this .gc = e.gc;
74: this .x = e.x;
75: this .y = e.y;
76: this .width = e.width;
77: this .height = e.height;
78: this .count = e.count;
79: }
80:
81: /**
82: * Returns a string containing a concise, human-readable
83: * description of the receiver.
84: *
85: * @return a string representation of the event
86: */
87: public String toString() {
88: String string = super .toString();
89: return string.substring(0, string.length() - 1) // remove trailing '}'
90: + " gc=" + gc + " x=" + x + " y=" + y
91: + " width="
92: + width + " height=" + height + " count=" + count + "}";
93: }
94: }
|