home *** CD-ROM | disk | FTP | other *** search
- package netscape.application;
-
- import netscape.util.ClassInfo;
- import netscape.util.Codable;
- import netscape.util.CodingException;
- import netscape.util.Decoder;
- import netscape.util.Encoder;
-
- public class ImageAttachment extends TextAttachment implements Codable {
- private Image image;
- boolean incrementalBitmap;
- int width;
- int height;
- static final String IMAGE_KEY = "image";
-
- public ImageAttachment() {
- this.image = null;
- this.incrementalBitmap = false;
- }
-
- public ImageAttachment(Image var1) {
- this.image = var1;
- this.incrementalBitmap = false;
- }
-
- ImageAttachment(Bitmap var1, int var2, int var3) {
- this.image = var1;
- this.width = var2;
- this.height = var3;
- this.incrementalBitmap = true;
- }
-
- public void setImage(Image var1) {
- this.image = var1;
- }
-
- public Image image() {
- return this.image;
- }
-
- public int width() {
- if (this.incrementalBitmap) {
- return this.width;
- } else {
- return this.image != null ? this.image.width() : 0;
- }
- }
-
- public int height() {
- if (this.incrementalBitmap) {
- return this.height;
- } else {
- return this.image != null ? this.image.height() : 0;
- }
- }
-
- public void drawInRect(Graphics var1, Rect var2) {
- if (var1 != null && var2 != null) {
- Rect var3 = var1.clipRect();
- if (this.image != null) {
- this.image.drawAt(var1, var2.x, var2.y);
- }
-
- }
- }
-
- public void describeClassInfo(ClassInfo var1) {
- super.describeClassInfo(var1);
- var1.addClass("netscape.application.ImageAttachment", 1);
- var1.addField("image", (byte)18);
- }
-
- public void encode(Encoder var1) throws CodingException {
- super.encode(var1);
- var1.encodeObject("image", this.image);
- }
-
- public void decode(Decoder var1) throws CodingException {
- super.decode(var1);
- this.image = (Image)var1.decodeObject("image");
- }
-
- public void finishDecoding() throws CodingException {
- super.finishDecoding();
- this.incrementalBitmap = false;
- }
- }
-