1 /*******************************************************************************
2 * Copyright (c) 2000, 2011 IBM Corporation and others.
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
9 * SPDX-License-Identifier: EPL-2.0
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.events;
17 import org.eclipse.swt.widgets.Event;
18 import org.eclipse.swt.graphics.GC;
21 * Instances of this class are sent as a result of
22 * visible areas of controls requiring re-painting.
25 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
28 public final class PaintEvent extends TypedEvent {
31 * the graphics context to use when painting
32 * that is configured to use the colors, font and
33 * damaged region of the control. It is valid
34 * only during the paint and must not be disposed
39 * the x offset of the bounding rectangle of the
40 * region that requires painting
45 * the y offset of the bounding rectangle of the
46 * region that requires painting
51 * the width of the bounding rectangle of the
52 * region that requires painting
57 * the height of the bounding rectangle of the
58 * region that requires painting
63 * the number of following paint events which
64 * are pending which may always be zero on
69 static final long serialVersionUID = 3256446919205992497L;
72 * Constructs a new instance of this class based on the
73 * information in the given untyped event.
75 * @param e the untyped event containing the information
77 public PaintEvent(Event e) {
83 this.height = e.height;
88 * Returns a string containing a concise, human-readable
89 * description of the receiver.
91 * @return a string representation of the event
94 public String toString() {
95 String string = super.toString ();
96 return string.substring (0, string.length() - 1) // remove trailing '}'
101 + " height=" + height