From d4670328991c02a6f11f8873ea7a2331f17d0ef0 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 4 Sep 2011 20:32:46 +0200 Subject: NativeWindow/NEWT: Refine Insets definition for size and position, read and write access --- .../javax/media/nativewindow/NativeSurface.java | 10 +++++-- .../javax/media/nativewindow/NativeWindow.java | 34 +++++++++++++++++++++- 2 files changed, 41 insertions(+), 3 deletions(-) (limited to 'src/nativewindow/classes/javax') diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java index a5b71fbf8..22e4b0f80 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java @@ -135,10 +135,16 @@ public interface NativeSurface extends SurfaceUpdatedListener { */ public long getSurfaceHandle(); - /** Returns the current width of this surface. */ + /** + * Returns the width of the client area. + * @return width of the client area + */ public int getWidth(); - /** Returns the current height of this surface. */ + /** + * Returns the height of the client area. + * @return height of the client area + */ public int getHeight(); /** diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java index d65cc8c18..0f6f84f66 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java @@ -40,6 +40,7 @@ package javax.media.nativewindow; +import javax.media.nativewindow.util.InsetsImmutable; import javax.media.nativewindow.util.Point; /** Extend the {@link NativeSurface} interface with windowing @@ -74,10 +75,41 @@ public interface NativeWindow extends NativeSurface { */ public long getWindowHandle(); + /** + * Returns the insets defined as the difference between + * the top-level window with decorations and the client area.
+ * Insets are zero if the window is undecorated, including child windows. + * + * The top-level window area's top-left corner is located at + *
+   *   getX() - getInsets().{@link InsetsImmutable#getLeftWidth() getLeftWidth()}
+   *   getY() - getInsets().{@link InsetsImmutable#getTopHeight() getTopHeight()}
+   * 
+ * + * The top-level window size is + *
+   *   getWidth()  + getInsets().{@link InsetsImmutable#getTotalWidth() getTotalWidth()} 
+   *   getHeight() + getInsets().{@link InsetsImmutable#getTotalHeight() getTotalHeight()}
+   * 
+ * + * @return insets + */ + public InsetsImmutable getInsets(); + /** Returns the current x position of this window, relative to it's parent. */ + + /** + * @return the current x position of the top-left corner + * of the client area, hence excluding decorations if enabled.
+ * @see #getInsets() + */ public int getX(); - /** Returns the current y position of this window, relative to it's parent. */ + /** + * @return the current y position of the top-left corner + * of the client area, hence excluding decorations if enabled.
+ * @see #getInsets() + */ public int getY(); /** -- cgit v1.2.3