aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-09-04 20:32:46 +0200
committerSven Gothel <[email protected]>2011-09-04 20:32:46 +0200
commitd4670328991c02a6f11f8873ea7a2331f17d0ef0 (patch)
tree6111ef98a9142b44aa22f86e1920decc30fa52b1 /src/newt/classes/com
parent70b495519094de5fcca37da68fbbf8762eecbe28 (diff)
NativeWindow/NEWT: Refine Insets definition for size and position, read and write access
Diffstat (limited to 'src/newt/classes/com')
-rw-r--r--src/newt/classes/com/jogamp/newt/Window.java112
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java13
2 files changed, 65 insertions, 60 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index a76862055..c8eb2b1f5 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -37,7 +37,6 @@ import javax.media.nativewindow.CapabilitiesImmutable;
import javax.media.nativewindow.NativeWindow;
import javax.media.nativewindow.SurfaceUpdatedListener;
import javax.media.nativewindow.WindowClosingProtocol;
-import javax.media.nativewindow.util.Insets;
/**
* Specifying the public Window functionality for the
@@ -124,13 +123,13 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* Zero size semantics are respected, see {@link #setSize(int,int)}:<br>
* <pre>
* if ( 0 == windowHandle && visible ) {
- * this.visible = visible;
- * if( 0<width*height ) {
- * createNative();
- * }
+ * this.visible = visible;
+ * if( 0 &lt; width*height ) {
+ * createNative();
+ * }
* } else if ( this.visible != visible ) {
- * this.visible = visible;
- * setNativeSizeImpl();
+ * this.visible = visible;
+ * setNativeSizeImpl();
* }
* </pre></p>
* <p>
@@ -156,39 +155,72 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
//
/**
- * Sets the size of the client area of the window, excluding decorations
- * Total size of the window will be
- * {@code width+insets.left+insets.right, height+insets.top+insets.bottom}<br>
+ * Sets the size of the window's client area, excluding decorations.
+ *
* <p>
* Zero size semantics are respected, see {@link #setVisible(boolean)}:<br>
* <pre>
- * if ( 0 != windowHandle && 0>=width*height && visible ) {
- * setVisible(false);
- * } else if ( 0 == windowHandle && 0<width*height && visible ) {
- * setVisible(true);
+ * if ( 0 != windowHandle && 0 &ge; width*height && visible ) {
+ * setVisible(false);
+ * } else if ( 0 == windowHandle && 0 &lt; width*height && visible ) {
+ * setVisible(true);
* } else {
- * // as expected ..
+ * // as expected ..
* }
* </pre></p>
* <p>
* This call is ignored if in fullscreen mode.<br></p>
*
- * @param width of the client area of the window
- * @param height of the client area of the window
+ * @param width of the window's client area
+ * @param height of the window's client area
+ *
+ * @see #getInsets()
*/
void setSize(int width, int height);
/**
- * Returns the width of the client area of this window
- * @return width of the client area
+ * Sets the size of the top-level window including decorations.
+ *
+ * @param width of the top-level window area
+ * @param height of the top-level window area
+ *
+ * @see #setSize(int, int)
+ * @see #getInsets()
*/
- int getWidth();
-
+ void setTopLevelSize(int width, int height);
+
+ /**
+ * Sets the location of the window's client area, excluding decorations.<br>
+ *
+ * This call is ignored if in fullscreen mode.<br>
+ *
+ * @param x coord of the client-area's top left corner
+ * @param y coord of the client-area's top left corner
+ *
+ * @see #getInsets()
+ */
+ void setPosition(int x, int y);
+
/**
- * Returns the height of the client area of this window
- * @return height of the client area
+ * Sets the location of the top-level window inclusive decorations.<br>
+ *
+ * This call is ignored if in fullscreen mode.<br>
+ *
+ * @param x coord of the top-level left corner
+ * @param y coord of the top-level left corner
+ *
+ * @see #setPosition(int, int)
+ * @see #getInsets()
*/
- int getHeight();
+ void setTopLevelPosition(int x, int y);
+
+ void setUndecorated(boolean value);
+
+ boolean isUndecorated();
+
+ void setTitle(String title);
+
+ String getTitle();
/** Defining ids for the reparenting strategy */
public interface ReparentAction {
@@ -228,38 +260,6 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
boolean isFullscreen();
- /**
- * Sets the location of the top left corner of the window, including
- * decorations (so the client area will be placed at
- * {@code x+insets.left,y+insets.top}.<br>
- *
- * This call is ignored if in fullscreen mode.<br>
- *
- * @param x coord of the top left corner
- * @param y coord of the top left corner
- */
- void setPosition(int x, int y);
-
- int getX();
-
- int getY();
-
- /**
- * Returns the insets for this native window (the difference between the
- * size of the toplevel window with the decorations and the client area).
- *
- * @return insets for this platform window
- */
- Insets getInsets();
-
- void setUndecorated(boolean value);
-
- boolean isUndecorated();
-
- void setTitle(String title);
-
- String getTitle();
-
static interface FocusRunnable {
/**
* @return false if NEWT shall proceed requesting the focus,
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 559130298..9de664982 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -44,8 +44,8 @@ import com.jogamp.newt.event.*;
import jogamp.newt.WindowImpl;
import javax.media.nativewindow.*;
+import javax.media.nativewindow.util.InsetsImmutable;
import javax.media.nativewindow.util.Point;
-import javax.media.nativewindow.util.Insets;
import javax.media.opengl.*;
import jogamp.opengl.FPSCounterImpl;
@@ -234,13 +234,16 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC
return window.hasFocus();
}
- public final Insets getInsets() {
+ public final InsetsImmutable getInsets() {
return window.getInsets();
}
public final void setPosition(int x, int y) {
window.setPosition(x, y);
}
+ public void setTopLevelPosition(int x, int y) {
+ window.setTopLevelPosition(x, y);
+ }
public final boolean setFullscreen(boolean fullscreen) {
return window.setFullscreen(fullscreen);
@@ -291,7 +294,10 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC
public final void setSize(int width, int height) {
window.setSize(width, height);
}
-
+ public void setTopLevelSize(int width, int height) {
+ window.setTopLevelSize(width, height);
+ }
+
public final boolean isValid() {
return window.isValid();
}
@@ -900,5 +906,4 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC
glWindow.setVisible(true);
glWindow.destroy();
}
-
}