From 456bc0af52725d0babe8db1a6cec88943a3cbed1 Mon Sep 17 00:00:00 2001 From: megacz Date: Fri, 30 Jan 2004 07:44:43 +0000 Subject: [PATCH] 2004/01/17 07:30:31 darcs-hash:20040130074443-2ba56-1941f7e723992e020907dfac5dcb228091a80a0d.gz --- src/org/xwt/Box.java | 4 ++++ src/org/xwt/Surface.java | 1 + src/org/xwt/plat/AWT.java | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/src/org/xwt/Box.java b/src/org/xwt/Box.java index 9bb8645..e00ecf7 100644 --- a/src/org/xwt/Box.java +++ b/src/org/xwt/Box.java @@ -509,8 +509,12 @@ public final class Box extends JSScope implements Scheduler.Task { case "height": put("maxheight", value); put("minheight", value); MARK_RESIZE; case "maxwidth": setMaxWidth(value); case "minwidth": CHECKSET_INT(minwidth); MARK_RESIZE; + if (parent == null && getSurface() != null) + getSurface().setMinimumSize(minwidth, minheight, minwidth != maxwidth || minheight != maxheight); case "maxheight": setMaxHeight(value); case "minheight": CHECKSET_INT(minheight); MARK_RESIZE; + if (parent == null && getSurface() != null) + getSurface().setMinimumSize(minwidth, minheight, minwidth != maxwidth || minheight != maxheight); case "colspan": CHECKSET_SHORT(colspan); MARK_REPACK_parent; case "rowspan": CHECKSET_SHORT(rowspan); MARK_REPACK_parent; case "rows": CHECKSET_SHORT(rows); if (rows==0){set(FIXED, COLS);if(cols==0)cols=1;} else set(FIXED, ROWS); MARK_REPACK; diff --git a/src/org/xwt/Surface.java b/src/org/xwt/Surface.java index 99533f6..79a6194 100644 --- a/src/org/xwt/Surface.java +++ b/src/org/xwt/Surface.java @@ -79,6 +79,7 @@ public abstract class Surface extends PixelBuffer implements Scheduler.Task { public abstract void setTitleBarText(String s); ///< Sets the surface's title bar text, if applicable public abstract void setIcon(Picture i); ///< Sets the surface's title bar text, if applicable public abstract void _dispose(); ///< Destroy the surface + public void setMinimumSize(int minx, int miny, boolean resizable) { } protected void setSize(int w, int h) { if (w == actualWidth && h == actualHeight) return; diff --git a/src/org/xwt/plat/AWT.java b/src/org/xwt/plat/AWT.java index 6a0ed9b..7c775bb 100644 --- a/src/org/xwt/plat/AWT.java +++ b/src/org/xwt/plat/AWT.java @@ -296,6 +296,8 @@ public class AWT extends JVM { class InnerFrame extends Frame { public InnerFrame() throws java.lang.UnsupportedOperationException { } + public Dimension getMinimumSize() { + return new Dimension(root == null ? 0 : root.minwidth, root == null ? 0 : root.minheight); } public void update(Graphics gr) { paint(gr); } public void paint(Graphics gr) { Rectangle r = gr.getClipBounds(); @@ -313,6 +315,8 @@ public class AWT extends JVM { class InnerWindow extends Window { public InnerWindow() throws java.lang.UnsupportedOperationException { super(new Frame()); } + public Dimension getMinimumSize() { + return new Dimension(root == null ? 0 : root.minwidth, root == null ? 0 : root.minheight); } public void update(Graphics gr) { paint(gr); } public void paint(Graphics gr) { Rectangle r = gr.getClipBounds(); @@ -320,6 +324,8 @@ public class AWT extends JVM { } } + public void setMinimumSize(int minx, int miny, boolean resizable) { if (frame != null) frame.setResizable(resizable); } + public void render() { // useful optimizatin; window.setBackground((root.fillcolor & 0xFF000000) == 0 ? -- 1.7.10.4