home *** CD-ROM | disk | FTP | other *** search
- package sun.awt.motif;
-
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Font;
- import java.awt.Frame;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.Insets;
- import java.awt.MenuBar;
- import java.awt.Rectangle;
- import java.awt.Window;
- import java.awt.event.ComponentEvent;
- import java.awt.event.WindowEvent;
- import java.awt.peer.FramePeer;
- import java.util.Vector;
- import sun.awt.image.ImageRepresentation;
-
- class MFramePeer extends MPanelPeer implements FramePeer {
- Insets insets;
- static Vector allFrames = new Vector();
-
- native void create(MComponentPeer var1, Object var2);
-
- native void pSetTitle(String var1);
-
- native void pShow();
-
- native void pHide();
-
- native void pReshape(int var1, int var2, int var3, int var4);
-
- native void pDispose();
-
- native void pSetIconImage(ImageRepresentation var1);
-
- public native void setResizable(boolean var1);
-
- native void addTextComponent();
-
- MFramePeer(Frame var1) {
- super(var1, new Insets(Integer.getInteger("awt.frame.topInset", 25), Integer.getInteger("awt.frame.leftInset", 5), Integer.getInteger("awt.frame.bottomInset", 5), Integer.getInteger("awt.frame.rightInset", 5)));
- allFrames.addElement(this);
- if (var1.getTitle() != null) {
- this.pSetTitle(var1.getTitle());
- }
-
- Font var2 = ((Component)var1).getFont();
- if (var2 == null) {
- var2 = new Font("Dialog", 0, 12);
- ((Component)var1).setFont(var2);
- ((MComponentPeer)this).setFont(var2);
- }
-
- Color var3 = ((Component)var1).getBackground();
- if (var3 == null) {
- ((Component)var1).setBackground(Color.lightGray);
- ((MComponentPeer)this).setBackground(Color.lightGray);
- }
-
- var3 = ((Component)var1).getForeground();
- if (var3 == null) {
- ((Component)var1).setForeground(Color.black);
- ((MComponentPeer)this).setForeground(Color.black);
- }
-
- Image var4 = var1.getIconImage();
- if (var4 != null) {
- this.setIconImage(var4);
- }
-
- this.setResizable(var1.isResizable());
- }
-
- public void setTitle(String var1) {
- this.pSetTitle(var1);
- }
-
- public void dispose() {
- allFrames.removeElement(this);
- super.dispose();
- }
-
- public void setIconImage(Image var1) {
- ImageRepresentation var2 = ((X11Image)var1).getImageRep();
- var2.reconstruct(32);
- this.pSetIconImage(var2);
- }
-
- public void setMenuBar(MenuBar var1) {
- MMenuBarPeer var2 = (MMenuBarPeer)MToolkit.targetToPeer(var1);
- this.pSetMenuBar(var2);
- if (super.target.isVisible()) {
- Rectangle var3 = super.target.bounds();
- this.pReshape(var3.x, var3.y, var3.width, var3.height);
- super.target.invalidate();
- super.target.validate();
- }
-
- }
-
- native void pSetMenuBar(MMenuBarPeer var1);
-
- public void handleActivate() {
- ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 205));
- }
-
- public void handleDeactivate() {
- ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 206));
- }
-
- public void handleQuit() {
- ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 201));
- }
-
- public void handleIconify() {
- ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 203));
- }
-
- public void handleDeiconify() {
- ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 204));
- }
-
- public void toFront() {
- this.pShow();
- }
-
- public native void toBack();
-
- public synchronized void handleMoved(int var1, int var2) {
- ((MComponentPeer)this).postEvent(new ComponentEvent(super.target, 100));
- }
-
- public synchronized void handleResize(int var1, int var2) {
- ((MComponentPeer)this).postEvent(new ComponentEvent(super.target, 101));
- }
-
- public Insets getInsets() {
- return this.insets;
- }
-
- public void print(Graphics var1) {
- super.print(var1);
- Frame var2 = (Frame)super.target;
- MenuBar var3 = var2.getMenuBar();
- if (var3 != null) {
- MMenuBarPeer var4 = (MMenuBarPeer)MToolkit.targetToPeer(var3);
- if (var4 != null) {
- Insets var5 = this.insets();
- Graphics var6 = var1.create();
-
- try {
- var6.translate(var5.left, 24);
- var4.print(var6);
- } finally {
- var6.dispose();
- }
-
- return;
- }
- }
-
- }
-
- public Insets insets() {
- return this.getInsets();
- }
- }
-