home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 25 / CDROM25.iso / Share / prog / VJ11 / VJTRIAL.EXE / IE30Java.exe / classd.exe / sun / awt / win32 / MWindowPeer.java < prev    next >
Encoding:
Java Source  |  1997-01-27  |  3.0 KB  |  106 lines

  1. /*
  2.  * @(#)MWindowPeer.java    1.7 96/03/18 Sami Shaio
  3.  *
  4.  * Copyright (c) 1995 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19. package sun.awt.win32;
  20.  
  21. import java.util.Vector;
  22. import java.awt.*;
  23. import java.awt.peer.*;
  24.  
  25. class MWindowPeer extends MPanelPeer implements WindowPeer {
  26.     Insets    insets = new Insets(0,0,0,0);
  27.  
  28.     static Vector allWindows = new Vector();
  29.  
  30.     native void create(MComponentPeer parent);
  31.     native void pShow();
  32.     native void pHide();
  33.     native void pReshape(int x, int y, int width, int height);
  34.  
  35.     // XXX: need separate call to set insets because the insets data member
  36.     // isn't set until after the super constructor is called. This was solved
  37.     // differently on the Motif side but this solution seems cleaner.
  38.     native void setInsets(Insets i);
  39.  
  40.     native void pDispose();
  41.  
  42.     MWindowPeer(Window target) {
  43.     super(target);
  44.  
  45.     // see comment above for setInsets
  46.     setInsets(insets);
  47.     allWindows.addElement(this);
  48.     Font f = target.getFont();
  49.     if (f == null) {
  50.         f = new Font("Dialog", Font.PLAIN, 10);
  51.         target.setFont(f);
  52.         setFont(f);
  53.     }
  54.     Color c = target.getBackground();
  55.     if (c == null) {
  56.         target.setBackground(Color.lightGray);
  57.         setBackground(Color.lightGray);
  58.     }
  59.     c = target.getForeground();
  60.     if (c == null) {
  61.         target.setForeground(Color.black);
  62.         setForeground(Color.black);
  63.     }
  64.     }
  65.  
  66.     public void dispose() {
  67.     allWindows.removeElement(this);
  68.     super.dispose();
  69.     }
  70.  
  71.     public void toFront() {
  72.     show();
  73.     }
  74.     public void toBack() {
  75.     }
  76.  
  77. /* ----------- INSANITY STARTS BELOW THIS LINE --------------- */
  78.     public Insets insets() {
  79.     return insets;
  80.     }
  81.  
  82.     public void handleQuit() {
  83.     target.postEvent(new Event(target, Event.WINDOW_DESTROY, null));
  84.     }
  85.  
  86.     public void handleIconify() {
  87.     target.postEvent(new Event(target, Event.WINDOW_ICONIFY, null));
  88.     }
  89.  
  90.     public void handleDeiconify() {
  91.     target.postEvent(new Event(target, Event.WINDOW_DEICONIFY, null));
  92.     }
  93.  
  94.     /**
  95.      * Called to inform the Dialog that its size has changed and it
  96.      * should layout its children.
  97.      */
  98.     public synchronized void handleResize(int width, int height) {
  99.     //target.resize(width, height);
  100.     target.invalidate();
  101.     target.validate();
  102.     target.repaint();
  103.     }
  104. }
  105.  
  106.