1 /** 2 * Copyright 2010 JogAmp Community. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without modification, are 5 * permitted provided that the following conditions are met: 6 * 7 * 1. Redistributions of source code must retain the above copyright notice, this list of 8 * conditions and the following disclaimer. 9 * 10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list 11 * of conditions and the following disclaimer in the documentation and/or other materials 12 * provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED 15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * 24 * The views and conclusions contained in the software and documentation are those of the 25 * authors and should not be interpreted as representing official policies, either expressed 26 * or implied, of JogAmp Community. 27 */ 28 29 package com.jogamp.newt; 30 31 import java.util.List; 32 33 import com.jogamp.newt.Display.PointerIcon; 34 import com.jogamp.newt.event.GestureHandler; 35 import com.jogamp.newt.event.WindowEvent; 36 import com.jogamp.newt.event.WindowListener; 37 import com.jogamp.newt.event.KeyListener; 38 import com.jogamp.newt.event.KeyEvent; 39 import com.jogamp.newt.event.InputEvent; 40 import com.jogamp.newt.event.MouseListener; 41 42 import jogamp.newt.Debug; 43 import jogamp.newt.WindowImpl; 44 45 import com.jogamp.nativewindow.CapabilitiesChooser; 46 import com.jogamp.nativewindow.CapabilitiesImmutable; 47 import com.jogamp.nativewindow.NativeWindow; 48 import com.jogamp.nativewindow.ScalableSurface; 49 import com.jogamp.nativewindow.WindowClosingProtocol; 50 import com.jogamp.nativewindow.util.Rectangle; 51 import com.jogamp.nativewindow.util.RectangleImmutable; 52 import com.jogamp.nativewindow.util.SurfaceSize; 53 54 /** 55 * Specifying NEWT's Window functionality: 56 * <ul> 57 * <li>On- and offscreen windows</li> 58 * <li>Keyboard and multi-pointer input</li> 59 * <li>Native reparenting</li> 60 * <li>Toggable fullscreen and decoration mode</li> 61 * <li>Transparency</li> 62 * <li>... and more</li> 63 * </ul> 64 * <p> 65 * One use case is {@link com.jogamp.newt.opengl.GLWindow}, which delegates 66 * window operation to an instance of this interface while providing OpenGL 67 * functionality. 68 * </p> 69 * <p> 70 * All values of this interface are represented in window units, if not stated otherwise. 71 * </p> 72 * 73 * <a name="coordinateSystem"><h5>Coordinate System</h5></a> 74 * <p> 75 * <ul> 76 * <li>Screen space has it's origin in the top-left corner, and may not be at 0/0.</li> 77 * <li>Window origin is in it's top-left corner, see {@link #getX()} and {@link #getY()}. </li> 78 * <li>Window client-area excludes {@link #getInsets() insets}, i.e. window decoration.</li> 79 * <li>Window origin is relative to it's parent window if exist, or the screen position (top-level).</li> 80 * </ul> 81 * See {@link NativeWindow} and {@link Screen}. 82 * </p> 83 * <a name="customwindowicons"><h5>Custom Window Icons</h5></a> 84 * <p> 85 * Custom window icons can be defined via system property <code>newt.window.icons</code>, 86 * which shall contain a list of PNG icon locations from low- to high-resolution, 87 * separated by one whitespace or one comma character. 88 * The location must be resolvable via classpath, i.e. shall reference a location within the jar file. 89 * Example (our default): 90 * <pre> 91 * -Dnewt.window.icons="newt/data/jogamp-16x16.png,newt/data/jogamp-32x32.png" 92 * -Djnlp.newt.window.icons="newt/data/jogamp-16x16.png,newt/data/jogamp-32x32.png" 93 * </pre> 94 * The property can also be set programmatically, which must happen before any NEWT classes are <i>touched</i>: 95 * <pre> 96 * System.setProperty("newt.window.icons", "newt/data/jogamp-16x16.png, newt/data/jogamp-32x32.png"); 97 * </pre> 98 * To disable even Jogamp's own window icons in favor of system icons, 99 * simply set a non-existing location, e.g.: 100 * <pre> 101 * -Dnewt.window.icons="null,null" 102 * </pre> 103 * </p> 104 * 105 * <a name="lifecycleHeavy"><h5>Use of Lifecycle Heavy functions</h5></a> 106 * <p> 107 * Some of the methods specified here are lifecycle-heavy. That is, they are able 108 * to destroy and/or reattach resources to/from the window. Because of this, the methods 109 * are <i>not safe</i> to be called from EDT related threads. For example, it is not 110 * safe for a method in an attached {@link KeyListener} to call {@link #setFullscreen(boolean)} 111 * on a {@link Window} directly. It is safe, however, for that method to spawn a background 112 * worker thread which calls the method directly. The documentation for individual methods 113 * indicates whether or not they are lifecycle-heavy. 114 * </p> 115 */ 116 public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSurface { 117 public static final boolean DEBUG_MOUSE_EVENT = Debug.debug("Window.MouseEvent"); 118 public static final boolean DEBUG_KEY_EVENT = Debug.debug("Window.KeyEvent"); 119 public static final boolean DEBUG_IMPLEMENTATION = Debug.debug("Window"); 120 121 /** A 1s timeout while waiting for a native action response, ie {@link #setVisible(boolean)}. */ 122 public static final long TIMEOUT_NATIVEWINDOW = 1000; 123 124 // 125 // States (keep in sync w/ src/newt/native/Window.h) 126 // 127 /** 128 * Visibility of this instance. 129 * <p>Native instance gets created at first visibility, following NEWT's lazy creation pattern.</p> 130 * <p>Changing this state is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p> 131 * <p>Bit number {@value}.</p> 132 * <p>Defaults to {@code false}.</p> 133 * @see #getStateMask() 134 * @since 2.3.2 135 */ 136 public static final int STATE_BIT_VISIBLE = 0; // reconfig-flag 137 /** 138 * Hinting that no custom position has been set before first {@link #STATE_BIT_VISIBLE visibility} of this instance. 139 * <p>If kept {@code false} at creation, this allows the WM to choose the top-level window position, 140 * otherwise the custom position is being enforced.</p> 141 * <p>Bit number {@value}.</p> 142 * <p>Defaults to {@code true}.</p> 143 * @see #getStateMask() 144 * @since 2.3.2 145 */ 146 public static final int STATE_BIT_AUTOPOSITION = 1; 147 /** 148 * Set if window is a <i>child window</i>, i.e. has been {@link #reparentWindow(NativeWindow, int, int, int) reparented}. 149 * <p> 150 * Otherwise bit is cleared, i.e. window is <i>top-level</i>. 151 * </p> 152 * <p>Changing this state is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p> 153 * <p>Bit number {@value}.</p> 154 * <p>Defaults to {@code false}.</p> 155 * @see #getStateMask() 156 * @since 2.3.2 157 */ 158 public static final int STATE_BIT_CHILDWIN = 2; // reconfig-flag 159 /** 160 * Set if window has <i>the input focus</i>, otherwise cleared. 161 * <p>Bit number {@value}.</p> 162 * <p>Defaults to {@code false}.</p> 163 * @see #getStateMask() 164 * @since 2.3.2 165 */ 166 public static final int STATE_BIT_FOCUSED = 3; 167 /** 168 * Set if window has <i>window decorations</i>, otherwise cleared. 169 * <p>Bit number {@value}.</p> 170 * <p>Defaults to {@code false}.</p> 171 * @see #getStateMask() 172 * @since 2.3.2 173 */ 174 public static final int STATE_BIT_UNDECORATED = 4; // reconfig-flag 175 /** 176 * Set if window is <i>always on top</i>, otherwise cleared. 177 * <p>Bit number {@value}.</p> 178 * <p>Defaults to {@code false}.</p> 179 * @see #getStateMask() 180 * @since 2.3.2 181 */ 182 public static final int STATE_BIT_ALWAYSONTOP = 5; // reconfig-flag 183 /** 184 * Set if window is <i>always on bottom</i>, otherwise cleared. 185 * <p>Bit number {@value}.</p> 186 * <p>Defaults to {@code false}.</p> 187 * @see #getStateMask() 188 * @since 2.3.2 189 */ 190 public static final int STATE_BIT_ALWAYSONBOTTOM = 6; // reconfig-flag 191 /** 192 * Set if window is <i>sticky</i>, i.e. visible <i>on all virtual desktop</i>, otherwise cleared. 193 * <p>Bit number {@value}.</p> 194 * <p>Defaults to {@code false}.</p> 195 * @see #getStateMask() 196 * @since 2.3.2 197 */ 198 public static final int STATE_BIT_STICKY = 7; // reconfig-flag 199 /** 200 * Set if window is <i>resizable</i>, otherwise cleared. 201 * <p>Bit number {@value}.</p> 202 * <p>Defaults to {@code true}.</p> 203 * @see #getStateMask() 204 * @since 2.3.2 205 */ 206 public static final int STATE_BIT_RESIZABLE = 8; // reconfig-flag 207 /** 208 * Set if window is <i>maximized vertically</i>, otherwise cleared. 209 * <p>Bit number {@value}.</p> 210 * <p>Defaults to {@code false}.</p> 211 * @see #getStateMask() 212 * @since 2.3.2 213 */ 214 public static final int STATE_BIT_MAXIMIZED_VERT = 9; // reconfig-flag 215 /** 216 * Set if window is <i>maximized horizontally</i>, otherwise cleared. 217 * <p>Bit number {@value}.</p> 218 * <p>Defaults to {@code false}.</p> 219 * @see #getStateMask() 220 * @since 2.3.2 221 */ 222 public static final int STATE_BIT_MAXIMIZED_HORZ = 10; // reconfig-flag 223 /** 224 * Set if window is in <i>fullscreen mode</i>, otherwise cleared. 225 * <p> 226 * Usually fullscreen mode implies {@link #STATE_BIT_UNDECORATED}, 227 * however, an implementation is allowed to ignore this if unavailable. 228 * </p> 229 * <p>Bit number {@value}.</p> 230 * <p>Defaults to {@code false}.</p> 231 * @see #getStateMask() 232 * @since 2.3.2 233 */ 234 public static final int STATE_BIT_FULLSCREEN = 11; // reconfig-flag 235 236 /** 237 * Set if the <i>pointer is visible</i> when inside the window, otherwise cleared. 238 * <p>Bit number {@value}.</p> 239 * <p>Defaults to {@code true}.</p> 240 * @see #getStateMask() 241 * @since 2.3.2 242 */ 243 public static final int STATE_BIT_POINTERVISIBLE = 12; 244 /** 245 * Set if the <i>pointer is confined</i> to the window, otherwise cleared. 246 * <p>Bit number {@value}.</p> 247 * <p>Defaults to {@code false}.</p> 248 * @see #getStateMask() 249 * @since 2.3.2 250 */ 251 public static final int STATE_BIT_POINTERCONFINED = 13; 252 253 /** 254 * Bitmask for {@link #STATE_BIT_VISIBLE}, {@value}. 255 * @since 2.3.2 256 */ 257 public static final int STATE_MASK_VISIBLE = 1 << STATE_BIT_VISIBLE; 258 /** 259 * Bitmask for {@link #STATE_BIT_AUTOPOSITION}, {@value}. 260 * @since 2.3.2 261 */ 262 public static final int STATE_MASK_AUTOPOSITION = 1 << STATE_BIT_AUTOPOSITION; 263 /** 264 * Bitmask for {@link #STATE_BIT_CHILDWIN}, {@value}. 265 * @since 2.3.2 266 */ 267 public static final int STATE_MASK_CHILDWIN = 1 << STATE_BIT_CHILDWIN; 268 /** 269 * Bitmask for {@link #STATE_BIT_FOCUSED}, {@value}. 270 * @since 2.3.2 271 */ 272 public static final int STATE_MASK_FOCUSED = 1 << STATE_BIT_FOCUSED; 273 /** 274 * Bitmask for {@link #STATE_BIT_UNDECORATED}, {@value}. 275 * @since 2.3.2 276 */ 277 public static final int STATE_MASK_UNDECORATED = 1 << STATE_BIT_UNDECORATED; 278 /** 279 * Bitmask for {@link #STATE_BIT_ALWAYSONTOP}, {@value}. 280 * @since 2.3.2 281 */ 282 public static final int STATE_MASK_ALWAYSONTOP = 1 << STATE_BIT_ALWAYSONTOP; 283 /** 284 * Bitmask for {@link #STATE_BIT_ALWAYSONBOTTOM}, {@value}. 285 * @since 2.3.2 286 */ 287 public static final int STATE_MASK_ALWAYSONBOTTOM = 1 << STATE_BIT_ALWAYSONBOTTOM; 288 /** 289 * Bitmask for {@link #STATE_BIT_STICKY}, {@value}. 290 * @since 2.3.2 291 */ 292 public static final int STATE_MASK_STICKY = 1 << STATE_BIT_STICKY; 293 /** 294 * Bitmask for {@link #STATE_BIT_RESIZABLE}, {@value}. 295 * @since 2.3.2 296 */ 297 public static final int STATE_MASK_RESIZABLE = 1 << STATE_BIT_RESIZABLE; 298 /** 299 * Bitmask for {@link #STATE_BIT_MAXIMIZED_VERT}, {@value}. 300 * @since 2.3.2 301 */ 302 public static final int STATE_MASK_MAXIMIZED_VERT = 1 << STATE_BIT_MAXIMIZED_VERT; 303 /** 304 * Bitmask for {@link #STATE_BIT_MAXIMIZED_HORZ}, {@value}. 305 * @since 2.3.2 306 */ 307 public static final int STATE_MASK_MAXIMIZED_HORZ = 1 << STATE_BIT_MAXIMIZED_HORZ; 308 /** 309 * Bitmask for {@link #STATE_BIT_FULLSCREEN}, {@value}. 310 * @since 2.3.2 311 */ 312 public static final int STATE_MASK_FULLSCREEN = 1 << STATE_BIT_FULLSCREEN; 313 /** 314 * Bitmask for {@link #STATE_BIT_POINTERVISIBLE}, {@value}. 315 * @since 2.3.2 316 */ 317 public static final int STATE_MASK_POINTERVISIBLE = 1 << STATE_BIT_POINTERVISIBLE; 318 /** 319 * Bitmask for {@link #STATE_BIT_POINTERCONFINED}, {@value}. 320 * @since 2.3.2 321 */ 322 public static final int STATE_MASK_POINTERCONFINED = 1 << STATE_BIT_POINTERCONFINED; 323 324 /** 325 * Number of all public state bits. 326 * @see #getStateMask() 327 * @since 2.3.2 328 */ getStatePublicBitCount()329 public int getStatePublicBitCount(); 330 331 /** 332 * Bitmask covering all public state bits. 333 * @see #getStateMask() 334 * @since 2.3.2 335 */ getStatePublicBitmask()336 public int getStatePublicBitmask(); 337 338 /** 339 * Returns the current status mask of this instance. 340 * @see #getSupportedStateMask() 341 * @see #STATE_MASK_VISIBLE 342 * @see #STATE_MASK_AUTOPOSITION 343 * @see #STATE_MASK_CHILDWIN 344 * @see #STATE_MASK_FOCUSED 345 * @see #STATE_MASK_UNDECORATED 346 * @see #STATE_MASK_ALWAYSONTOP 347 * @see #STATE_MASK_ALWAYSONBOTTOM 348 * @see #STATE_MASK_STICKY 349 * @see #STATE_MASK_RESIZABLE 350 * @see #STATE_MASK_MAXIMIZED_VERT 351 * @see #STATE_MASK_MAXIMIZED_HORZ 352 * @see #STATE_MASK_FULLSCREEN 353 * @see #STATE_MASK_POINTERVISIBLE 354 * @see #STATE_MASK_POINTERCONFINED 355 * @since 2.3.2 356 */ getStateMask()357 int getStateMask(); 358 359 /** 360 * Returns a string representation of the {@link #getStateMask() current state mask}. 361 * @since 2.3.2 362 */ getStateMaskString()363 String getStateMaskString(); 364 365 /** 366 * Returns the supported {@link #getStateMask() state mask} of the implementation. 367 * <p> 368 * Implementation provides supported {@link #getStateMask() state mask} values at runtime 369 * <i>after</i> native window creation, i.e. first visibility. 370 * </p> 371 * <p> 372 * Please note that a window's size shall also be allowed to change, i.e. {@link #setSize(int, int)}. 373 * </p> 374 * <p> 375 * Default value is {@link #STATE_MASK_VISIBLE} | {@link #STATE_MASK_FOCUSED} | {@link #STATE_MASK_FULLSCREEN}, 376 * i.e. the <b>minimum requirement</b> for all implementations. 377 * </p> 378 * <p> 379 * Before native window creation {@link #getStatePublicBitmask()} is returned, 380 * i.e. it is assumed all features are supported. 381 * </p> 382 * <p> 383 * Semantic of the supported state-mask bits (after native creation, i.e. 1st visibility): 384 * <ul> 385 * <li>{@link #STATE_MASK_VISIBLE}: {@link #setVisible(boolean) Visibility} can be toggled. <b>Minimum requirement</b>.</li> 386 * <li>{@link #STATE_MASK_CHILDWIN}: {@link #reparentWindow(NativeWindow, int, int, int) Native window parenting} is supported.</li> 387 * <li>{@link #STATE_MASK_FOCUSED}: Window {@link #requestFocus() focus management} is supported. <b>Minimum requirement</b>.</li> 388 * <li>{@link #STATE_MASK_UNDECORATED}: {@link #setUndecorated(boolean) Window decoration} can be toggled.</li> 389 * <li>{@link #STATE_MASK_ALWAYSONTOP}: Window can be set {@link #setAlwaysOnTop(boolean) always-on-top}. </li> 390 * <li>{@link #STATE_MASK_ALWAYSONBOTTOM}: Window can be set {@link #setAlwaysOnBottom(boolean) always-on-bottom}. </li> 391 * <li>{@link #STATE_MASK_STICKY}: Window can be set {@link #setSticky(boolean) sticky}.</li> 392 * <li>{@link #STATE_MASK_RESIZABLE}: Window {@link #setResizable(boolean) resizability} can be toggled.</li> 393 * <li>{@link #STATE_MASK_MAXIMIZED_VERT}: Window can be {@link #setMaximized(boolean, boolean) maximized-vertically}. </li> 394 * <li>{@link #STATE_MASK_MAXIMIZED_HORZ}: Window can be {@link #setMaximized(boolean, boolean) maximized-horizontally}. </li> 395 * <li>{@link #STATE_MASK_FULLSCREEN}: Window {@link #setFullscreen(boolean) fullscreen} can be toggled. </li> 396 * <li>{@link #STATE_MASK_POINTERVISIBLE}: Window {@link #setPointerVisible(boolean) pointer visibility} can be toggled. </li> 397 * <li>{@link #STATE_MASK_POINTERCONFINED}: Window {@link #confinePointer(boolean) pointer can be confined}. </li> 398 * </ul> 399 * </p> 400 * @see #getStateMask() 401 * @since 2.3.2 402 */ getSupportedStateMask()403 int getSupportedStateMask(); 404 405 /** 406 * Returns a string representation of the {@link #getSupportedStateMask() supported state mask}. 407 * @since 2.3.2 408 */ getSupportedStateMaskString()409 String getSupportedStateMaskString(); 410 411 // 412 // Lifecycle 413 // 414 415 /** 416 * @return true if the native window handle is valid and ready to operate, ie 417 * if the native window has been created via {@link #setVisible(boolean) setVisible(true)}, otherwise false. 418 * 419 * @see #setVisible(boolean) 420 * @see #destroy(boolean) 421 */ isNativeValid()422 boolean isNativeValid(); 423 424 /** 425 * @return The associated {@link Screen} 426 */ getScreen()427 Screen getScreen(); 428 429 /** 430 * Returns the {@link MonitorDevice} with the highest {@link MonitorDevice#getViewportInWindowUnits() viewport} 431 * {@link RectangleImmutable#coverage(RectangleImmutable) coverage} of this window. 432 * <p> 433 * If no coverage is detected the first {@link MonitorDevice} is returned. 434 * </p> 435 */ getMainMonitor()436 MonitorDevice getMainMonitor(); 437 438 /** 439 * Set the CapabilitiesChooser to help determine the native visual type. 440 * 441 * @param chooser the new CapabilitiesChooser 442 * @return the previous CapabilitiesChooser 443 */ setCapabilitiesChooser(CapabilitiesChooser chooser)444 CapabilitiesChooser setCapabilitiesChooser(CapabilitiesChooser chooser); 445 446 /** 447 * Gets an immutable set of requested capabilities. 448 * 449 * @return the requested capabilities 450 */ getRequestedCapabilities()451 CapabilitiesImmutable getRequestedCapabilities(); 452 453 /** 454 * Gets an immutable set of chosen capabilities. 455 * 456 * @return the chosen capabilities 457 */ getChosenCapabilities()458 CapabilitiesImmutable getChosenCapabilities(); 459 460 /** 461 * {@inheritDoc} 462 * <p> 463 * Also iterates through this window's children and destroys them. 464 * </p> 465 * <p> 466 * Visibility is set to false. 467 * </p> 468 * <p> 469 * Method sends out {@link WindowEvent#EVENT_WINDOW_DESTROY_NOTIFY pre-} and 470 * {@link WindowEvent#EVENT_WINDOW_DESTROYED post-} destruction events 471 * to all of it's {@link WindowListener}. 472 * </p> 473 * <p> 474 * This method invokes {@link Screen#removeReference()} after it's own destruction,<br> 475 * which will issue {@link Screen#destroy()} if the reference count becomes 0.<br> 476 * This destruction sequence shall end up in {@link Display#destroy()}, if all reference counts become 0. 477 * </p> 478 * <p> 479 * The Window can be recreate via {@link #setVisible(boolean) setVisible(true)}. 480 * </p> 481 * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p> 482 * @see #destroy() 483 * @see #setVisible(boolean) 484 */ 485 @Override destroy()486 void destroy(); 487 488 /** 489 * Set a custom action handling destruction issued by a {@link WindowImpl#windowDestroyNotify(boolean) toolkit triggered window destroy} 490 * replacing the default {@link #destroy()} action. 491 * <p> 492 * The custom action shall call {@link #destroy()} 493 * but may perform further tasks before and after. 494 * </p> 495 */ setWindowDestroyNotifyAction(Runnable r)496 void setWindowDestroyNotifyAction(Runnable r); 497 498 /** 499 * Calls {@link #setVisible(boolean, boolean) setVisible(true, visible)}, 500 * i.e. blocks until the window becomes visible. 501 * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p> 502 * @see #setVisible(boolean, boolean) 503 * @see #STATE_BIT_VISIBLE 504 */ setVisible(boolean visible)505 void setVisible(boolean visible); 506 507 /** 508 * <code>setVisible(..)</code> makes the window and children visible if <code>visible</code> is true, 509 * otherwise the window and children becomes invisible. 510 * <p>Native instance gets created at first visibility, following NEWT's lazy creation pattern.</p> 511 * <p> 512 * If <code>wait</code> is true, method blocks until window is {@link #isVisible() visible} and {@link #isNativeValid() valid}, 513 * otherwise method returns immediately. 514 * </p> 515 * <p> 516 * Zero size semantics are respected, see {@link #setSize(int,int)}:<br> 517 * <pre> 518 * if ( 0 == windowHandle && visible ) { 519 * this.visible = visible; 520 * if( 0 < width && 0 < height ) { 521 * createNative(); 522 * } 523 * } else if ( this.visible != visible ) { 524 * this.visible = visible; 525 * setNativeSizeImpl(); 526 * } 527 * </pre></p> 528 * <p> 529 * In case this window is {@link #isChildWindow() a child window} and has a {@link com.jogamp.nativewindow.NativeWindow} parent,<br> 530 * <code>setVisible(wait, true)</code> has no effect as long the parent's is not valid yet, 531 * i.e. {@link com.jogamp.nativewindow.NativeWindow#getWindowHandle()} returns <code>null</code>.<br> 532 * <code>setVisible(wait, true)</code> shall be repeated when the parent becomes valid. 533 * </p> 534 * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p> 535 * @see #STATE_BIT_VISIBLE 536 */ setVisible(boolean wait, boolean visible)537 void setVisible(boolean wait, boolean visible); 538 539 /** 540 * @see #STATE_BIT_VISIBLE 541 * @see #setVisible(boolean, boolean) 542 */ isVisible()543 boolean isVisible(); 544 545 /** 546 * If the implementation uses delegation, return the delegated {@link Window} instance, 547 * otherwise return <code>this</code> instance. */ getDelegatedWindow()548 Window getDelegatedWindow(); 549 550 // 551 // Child Window Management 552 // 553 addChild(NativeWindow win)554 boolean addChild(NativeWindow win); 555 removeChild(NativeWindow win)556 boolean removeChild(NativeWindow win); 557 558 // 559 // Modes / States 560 // 561 562 /** 563 * Returns a newly created {@link Rectangle} containing window origin, {@link #getX()} & {@link #getY()}, 564 * and size, {@link #getWidth()} & {@link #getHeight()}, in window units. 565 */ getBounds()566 Rectangle getBounds(); 567 568 /** 569 * Returns the <i>pixels per millimeter</i> of this window's {@link NativeSurface} 570 * according to the {@link #getMainMonitor() main monitor}'s <i>current</i> {@link MonitorMode mode}'s 571 * {@link SurfaceSize#getResolution() surface resolution}. 572 * <p> 573 * Method takes the {@link #getCurrentSurfaceScale(float[]) current surface-scale} and {@link #getMaximumSurfaceScale(float[]) native surface-scale} 574 * into account, i.e.: 575 * <pre> 576 * surfacePpMM = monitorPpMM * currentSurfaceScale / nativeSurfaceScale, 577 * with PpMM == pixel per millimeter 578 * </pre> 579 * </p> 580 * <p> 581 * To convert the result to <i>dpi</i>, i.e. dots-per-inch, multiply both components with <code>25.4f</code>. 582 * </p> 583 * @param ppmmStore float[2] storage for the ppmm result 584 * @return the passed storage containing the ppmm for chaining 585 */ getPixelsPerMM(final float[] ppmmStore)586 float[] getPixelsPerMM(final float[] ppmmStore); 587 588 /** 589 * Sets the size of the window's client area in window units, excluding decorations. 590 * 591 * <p> 592 * Zero size semantics are respected, see {@link #setVisible(boolean)}:<br> 593 * <pre> 594 * if ( visible && 0 != windowHandle && ( 0 ≥ width || 0 ≥ height ) ) { 595 * setVisible(false); 596 * } else if ( visible && 0 == windowHandle && 0 < width && 0 < height ) { 597 * setVisible(true); 598 * } else { 599 * // as expected .. 600 * } 601 * </pre></p> 602 * <p> 603 * This call is ignored if in fullscreen mode.<br></p> 604 * 605 * @param width of the window's client area in window units 606 * @param height of the window's client area in window units 607 * 608 * @see #setSurfaceSize(int, int) 609 * @see #setTopLevelSize(int, int) 610 * @see #getInsets() 611 */ setSize(int width, int height)612 void setSize(int width, int height); 613 614 /** 615 * Sets the size of the window's surface in pixel units which claims the window's client area excluding decorations. 616 * 617 * <p> 618 * In multiple monitor mode, setting the window's surface size in pixel units 619 * might not be possible due to unknown <i>scale</i> values of the target display. 620 * Hence re-setting the pixel unit size after window creation is recommended. 621 * </p> 622 * <p> 623 * Zero size semantics are respected, see {@link #setVisible(boolean)}:<br> 624 * <pre> 625 * if ( visible && 0 != windowHandle && ( 0 ≥ width || 0 ≥ height ) ) { 626 * setVisible(false); 627 * } else if ( visible && 0 == windowHandle && 0 < width && 0 < height ) { 628 * setVisible(true); 629 * } else { 630 * // as expected .. 631 * } 632 * </pre></p> 633 * <p> 634 * This call is ignored if in fullscreen mode.<br></p> 635 * 636 * @param pixelWidth of the window's client area in pixel units 637 * @param pixelHeight of the window's client area in pixel units 638 * 639 * @see #setSize(int, int) 640 * @see #getInsets() 641 */ setSurfaceSize(int pixelWidth, int pixelHeight)642 void setSurfaceSize(int pixelWidth, int pixelHeight); 643 644 /** 645 * Sets the size of the top-level window including insets (window decorations) in window units. 646 * 647 * <p> 648 * Note: Insets (if supported) are available only after the window is set visible and hence has been created. 649 * </p> 650 * 651 * @param width of the top-level window area in window units 652 * @param height of the top-level window area in window units 653 * 654 * @see #setSize(int, int) 655 * @see #getInsets() 656 */ setTopLevelSize(int width, int height)657 void setTopLevelSize(int width, int height); 658 659 /** 660 * Sets the location of the window's client area excluding insets (window decorations) in window units.<br> 661 * 662 * This call is ignored if in fullscreen mode.<br> 663 * 664 * @param x coord of the client-area's top left corner in window units 665 * @param y coord of the client-area's top left corner in window units 666 * 667 * @see #getInsets() 668 */ setPosition(int x, int y)669 void setPosition(int x, int y); 670 671 /** 672 * Sets the location of the top-level window inclusive insets (window decorations) in window units.<br> 673 * 674 * <p> 675 * Note: Insets (if supported) are available only after the window is set visible and hence has been created. 676 * </p> 677 * 678 * This call is ignored if in fullscreen mode.<br> 679 * 680 * @param x coord of the top-level left corner in window units 681 * @param y coord of the top-level left corner in window units 682 * 683 * @see #setPosition(int, int) 684 * @see #getInsets() 685 */ setTopLevelPosition(int x, int y)686 void setTopLevelPosition(int x, int y); 687 688 /** 689 * @see {@link #STATE_BIT_UNDECORATED} 690 * @see {@link #STATE_MASK_UNDECORATED} 691 */ setUndecorated(boolean value)692 void setUndecorated(boolean value); 693 /** 694 * @see {@link #STATE_BIT_UNDECORATED} 695 * @see {@link #STATE_MASK_UNDECORATED} 696 */ isUndecorated()697 boolean isUndecorated(); 698 699 /** 700 * <p>Operation is ignored if this instance {@link #isChildWindow() is a child window}.</p> 701 * @see {@link #STATE_BIT_ALWAYSONTOP} 702 * @see {@link #STATE_MASK_ALWAYSONTOP} 703 */ setAlwaysOnTop(boolean value)704 void setAlwaysOnTop(boolean value); 705 /** 706 * @see {@link #STATE_BIT_ALWAYSONTOP} 707 * @see {@link #STATE_MASK_ALWAYSONTOP} 708 */ isAlwaysOnTop()709 boolean isAlwaysOnTop(); 710 711 /** 712 * <p>Operation is ignored if this instance {@link #isChildWindow() is a child window}.</p> 713 * @see {@link #STATE_BIT_ALWAYSONBOTTOM} 714 * @see {@link #STATE_MASK_ALWAYSONBOTTOM} 715 * @since 2.3.2 716 */ setAlwaysOnBottom(boolean value)717 void setAlwaysOnBottom(boolean value); 718 /** 719 * @see {@link #STATE_BIT_ALWAYSONBOTTOM} 720 * @see {@link #STATE_MASK_ALWAYSONBOTTOM} 721 * @since 2.3.2 722 */ isAlwaysOnBottom()723 boolean isAlwaysOnBottom(); 724 725 /** 726 * <p>Operation is ignored if this instance {@link #isChildWindow() is a child window}.</p> 727 * @see {@link #STATE_BIT_RESIZABLE} 728 * @see {@link #STATE_MASK_RESIZABLE} 729 * @since 2.3.2 730 */ setResizable(final boolean value)731 void setResizable(final boolean value); 732 /** 733 * @see {@link #STATE_BIT_RESIZABLE} 734 * @see {@link #STATE_MASK_RESIZABLE} 735 * @since 2.3.2 736 */ isResizable()737 boolean isResizable(); 738 739 /** 740 * <p>Operation is ignored if this instance {@link #isChildWindow() is a child window}.</p> 741 * @see {@link #STATE_BIT_STICKY} 742 * @see {@link #STATE_MASK_STICKY} 743 * @since 2.3.2 744 */ setSticky(final boolean value)745 void setSticky(final boolean value); 746 /** 747 * @see {@link #STATE_BIT_STICKY} 748 * @see {@link #STATE_MASK_STICKY} 749 * @since 2.3.2 750 */ isSticky()751 boolean isSticky(); 752 753 /** 754 * <p>Operation is ignored if this instance {@link #isChildWindow() is a child window}.</p> 755 * @see {@link #STATE_BIT_MAXIMIZED_HORZ} 756 * @see {@link #STATE_BIT_MAXIMIZED_VERT} 757 * @see {@link #STATE_MASK_MAXIMIZED_HORZ} 758 * @see {@link #STATE_MASK_MAXIMIZED_VERT} 759 * @since 2.3.2 760 */ setMaximized(final boolean horz, final boolean vert)761 void setMaximized(final boolean horz, final boolean vert); 762 /** 763 * @see {@link #STATE_BIT_MAXIMIZED_VERT} 764 * @see {@link #STATE_MASK_MAXIMIZED_VERT} 765 * @since 2.3.2 766 */ isMaximizedVert()767 boolean isMaximizedVert(); 768 /** 769 * @see {@link #STATE_BIT_MAXIMIZED_HORZ} 770 * @see {@link #STATE_MASK_MAXIMIZED_HORZ} 771 * @since 2.3.2 772 */ isMaximizedHorz()773 boolean isMaximizedHorz(); 774 setTitle(String title)775 void setTitle(String title); 776 getTitle()777 String getTitle(); 778 779 /** @see #setPointerVisible(boolean) */ isPointerVisible()780 boolean isPointerVisible(); 781 782 /** 783 * Makes the pointer visible or invisible. 784 * 785 * @param pointerVisible defaults to <code>true</code> for platforms w/ visible pointer, 786 * otherwise defaults to <code>true</code>, eg. Android. 787 * @see #confinePointer(boolean) 788 */ setPointerVisible(boolean pointerVisible)789 void setPointerVisible(boolean pointerVisible); 790 791 /** 792 * Returns the current {@link PointerIcon}, which maybe <code>null</code> for the default. 793 * @see #setPointerIcon(PointerIcon) 794 */ getPointerIcon()795 PointerIcon getPointerIcon(); 796 797 /** 798 * @param pi Valid {@link PointerIcon} reference or <code>null</code> to reset the pointer icon to default. 799 * 800 * @see PointerIcon 801 * @see Display#createPointerIcon(com.jogamp.common.util.IOUtil.ClassResources, int, int) 802 */ setPointerIcon(final PointerIcon pi)803 void setPointerIcon(final PointerIcon pi); 804 805 /** @see #confinePointer(boolean) */ isPointerConfined()806 boolean isPointerConfined(); 807 808 /** 809 * Confine the pointer to this window, ie. pointer jail. 810 * <p> 811 * Before jailing the mouse pointer, 812 * the window request the focus and the pointer is centered in the window. 813 * </p> 814 * <p> 815 * In combination w/ {@link #warpPointer(int, int)} 816 * and maybe {@link #setPointerVisible(boolean)} a simple mouse 817 * navigation can be realized.</p> 818 * 819 * @param confine defaults to <code>false</code>. 820 */ confinePointer(boolean confine)821 void confinePointer(boolean confine); 822 823 /** 824 * Moves the pointer to x/y relative to this window's origin in pixel units. 825 * 826 * @param x relative pointer x position within this window in pixel units 827 * @param y relative pointer y position within this window in pixel units 828 * 829 * @see #confinePointer(boolean) 830 */ warpPointer(int x, int y)831 void warpPointer(int x, int y); 832 833 /** Reparenting operation types */ 834 public enum ReparentOperation { 835 /** No native reparenting valid */ 836 ACTION_INVALID, 837 838 /** No native reparenting action required, no change*/ 839 ACTION_NOP, 840 841 /** Native reparenting incl. Window tree */ 842 ACTION_NATIVE_REPARENTING, 843 844 /** Native window creation after tree change - instead of reparenting. */ 845 ACTION_NATIVE_CREATION, 846 847 /** Change Window tree only, native creation is pending */ 848 ACTION_NATIVE_CREATION_PENDING; 849 } 850 851 /** Reparenting hint (bitfield value): Force destroy and hence {@link ReparentOperation#ACTION_NATIVE_CREATION re-creating} the window. */ 852 public static final int REPARENT_HINT_FORCE_RECREATION = 1 << 0; 853 /** Reparenting hint (bitfield value): Claim window becomes visible after reparenting, which is important for e.g. preserving the GL-states in case window is invisible while reparenting. */ 854 public static final int REPARENT_HINT_BECOMES_VISIBLE = 1 << 1; 855 856 /** 857 * Change this window's parent window.<br> 858 * <P> 859 * In case the old parent is not null and a Window, 860 * this window is removed from it's list of children.<br> 861 * In case the new parent is not null and a Window, 862 * this window is added to it's list of children.<br></P> 863 * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p> 864 * 865 * @param newParent The new parent NativeWindow. If null, this Window becomes a top level window. 866 * @param x new top-level position in window units, use -1 for default position. 867 * @param y new top-level position in window units, use -1 for default position. 868 * @param hints May contain hints (bitfield values) like {@link #REPARENT_HINT_FORCE_RECREATION} or {@link #REPARENT_HINT_BECOMES_VISIBLE}. 869 * 870 * @return The issued reparent action type (strategy) as defined in Window.ReparentAction 871 */ reparentWindow(NativeWindow newParent, int x, int y, int hints)872 ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, int hints); 873 874 /** 875 * Returns {@code true} if this window is a child window, 876 * i.e. has been {@link #reparentWindow(NativeWindow, int, int, int) reparented}. 877 * <p> 878 * Otherwise return {@code false}, i.e. this window is a top-level window. 879 * </p> 880 */ isChildWindow()881 boolean isChildWindow(); 882 883 /** 884 * Enable or disable fullscreen mode for this window. 885 * <p> 886 * Fullscreen mode is established on the {@link #getMainMonitor() main monitor}. 887 * </p> 888 * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p> 889 * @param fullscreen enable or disable fullscreen mode 890 * @return success 891 * @see #setFullscreen(List) 892 * @see #isFullscreen() 893 */ setFullscreen(boolean fullscreen)894 boolean setFullscreen(boolean fullscreen); 895 896 /** 897 * Enable fullscreen mode for this window spanning across the given {@link MonitorDevice}s 898 * or across all {@link MonitorDevice}s. 899 * <p> 900 * Disable fullscreen via {@link #setFullscreen(boolean)}. 901 * </p> 902 * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p> 903 * @param monitors if <code>null</code> fullscreen will be spanned across all {@link MonitorDevice}s, 904 * otherwise across the given list of {@link MonitorDevice}. 905 * @return success 906 * @see #setFullscreen(boolean) 907 * @see #isFullscreen() 908 */ setFullscreen(List<MonitorDevice> monitors)909 boolean setFullscreen(List<MonitorDevice> monitors); 910 isFullscreen()911 boolean isFullscreen(); 912 913 static interface FocusRunnable { 914 /** 915 * @return false if NEWT shall proceed requesting the focus, 916 * true if NEWT shall not request the focus. 917 */ run()918 public boolean run(); 919 } 920 921 /** 922 * Sets a {@link FocusRunnable}, 923 * which {@link FocusRunnable#run()} method is executed before the native focus is requested. 924 * <p> 925 * This allows notifying a covered window toolkit like AWT that the focus is requested, 926 * hence focus traversal can be made transparent. 927 * </p> 928 */ setFocusAction(FocusRunnable focusAction)929 void setFocusAction(FocusRunnable focusAction); 930 931 /** 932 * Sets a {@link KeyListener} allowing focus traversal with a covered window toolkit like AWT. 933 * <p> 934 * The {@link KeyListener} methods are invoked prior to all other {@link KeyListener}'s 935 * allowing to suppress the {@link KeyEvent} via the {@link InputEvent#consumedTag} 936 * and to perform focus traversal with a 3rd party toolkit. 937 * </p> 938 * <p> 939 * The {@link KeyListener} methods are not invoked for {@link KeyEvent#isAutoRepeat() auto-repeat} events. 940 * </p> 941 * @param l 942 */ setKeyboardFocusHandler(KeyListener l)943 void setKeyboardFocusHandler(KeyListener l); 944 945 /** 946 * Request focus for this native window 947 * <p> 948 * The request is handled on this Window EDT and blocked until finished. 949 * </p> 950 * 951 * @see #requestFocus(boolean) 952 */ requestFocus()953 void requestFocus(); 954 955 /** 956 * Request focus for this native window 957 * <p> 958 * The request is handled on this Window EDT. 959 * </p> 960 * 961 * @param wait true if waiting until the request is executed, otherwise false 962 * @see #requestFocus() 963 */ requestFocus(boolean wait)964 void requestFocus(boolean wait); 965 966 /** 967 * Trigger window repaint while passing the dirty region in pixel units. 968 * @param x dirty-region y-pos in pixel units 969 * @param y dirty-region x-pos in pixel units 970 * @param width dirty-region width in pixel units 971 * @param height dirty-region height in pixel units 972 */ windowRepaint(int x, int y, int width, int height)973 void windowRepaint(int x, int y, int width, int height); 974 975 /** 976 * Enqueues a {@link com.jogamp.newt.event.NEWTEvent NEWT event}. 977 * @param wait Passing <code>true</code> will block until the event has been processed, otherwise method returns immediately. 978 * @param event The {@link com.jogamp.newt.event.NEWTEvent event} to enqueue. 979 */ enqueueEvent(boolean wait, com.jogamp.newt.event.NEWTEvent event)980 void enqueueEvent(boolean wait, com.jogamp.newt.event.NEWTEvent event); 981 runOnEDTIfAvail(boolean wait, final Runnable task)982 void runOnEDTIfAvail(boolean wait, final Runnable task); 983 984 985 // 986 // WindowListener 987 // 988 989 /** 990 * Send a {@link WindowEvent} to all {@link WindowListener}. 991 * @param eventType a {@link WindowEvent} type, e.g. {@link WindowEvent#EVENT_WINDOW_REPAINT}. 992 */ sendWindowEvent(int eventType)993 public void sendWindowEvent(int eventType); 994 995 /** 996 * Appends the given {@link com.jogamp.newt.event.WindowListener} to the end of 997 * the list. 998 */ addWindowListener(WindowListener l)999 void addWindowListener(WindowListener l); 1000 1001 /** 1002 * 1003 * Inserts the given {@link com.jogamp.newt.event.WindowListener} at the 1004 * specified position in the list.<br> 1005 * 1006 * @param index Position where the listener will be inserted. 1007 * Should be within (0 <= index && index <= size()). 1008 * An index value of -1 is interpreted as the end of the list, size(). 1009 * @param l The listener object to be inserted 1010 * @throws IndexOutOfBoundsException If the index is not within (0 <= index && index <= size()), or -1 1011 */ addWindowListener(int index, WindowListener l)1012 void addWindowListener(int index, WindowListener l) throws IndexOutOfBoundsException; 1013 removeWindowListener(WindowListener l)1014 void removeWindowListener(WindowListener l); 1015 getWindowListener(int index)1016 WindowListener getWindowListener(int index); 1017 getWindowListeners()1018 WindowListener[] getWindowListeners(); 1019 1020 // 1021 // KeyListener 1022 // 1023 1024 /** 1025 * In case the platform supports or even requires a virtual on-screen keyboard, 1026 * this method shows or hide it depending on whether <code>visible</code> is <code>true</code> 1027 * or <code>false</code>. 1028 * <p> 1029 * One known platform where NEWT supports this feature is <code>Android</code>. 1030 * </p> 1031 */ setKeyboardVisible(boolean visible)1032 void setKeyboardVisible(boolean visible); 1033 1034 /** 1035 * Return <code>true</code> if the virtual on-screen keyboard is visible, otherwise <code>false</code>. 1036 * <p> 1037 * Currently on <code>Android</code>, the only supported platform right now, 1038 * there is no way to reliably be notified of the current keyboard state.<br> 1039 * It would be best, if your code does not rely on this information. 1040 * </p> 1041 * @see #setKeyboardVisible(boolean) 1042 */ isKeyboardVisible()1043 boolean isKeyboardVisible(); 1044 1045 /** 1046 * 1047 * Appends the given {@link com.jogamp.newt.event.KeyListener} to the end of 1048 * the list. 1049 */ addKeyListener(KeyListener l)1050 void addKeyListener(KeyListener l); 1051 1052 /** 1053 * 1054 * Inserts the given {@link com.jogamp.newt.event.KeyListener} at the 1055 * specified position in the list.<br> 1056 * 1057 * @param index Position where the listener will be inserted. 1058 * Should be within (0 <= index && index <= size()). 1059 * An index value of -1 is interpreted as the end of the list, size(). 1060 * @param l The listener object to be inserted 1061 * @throws IndexOutOfBoundsException If the index is not within (0 <= index && index <= size()), or -1 1062 */ addKeyListener(int index, KeyListener l)1063 void addKeyListener(int index, KeyListener l); 1064 removeKeyListener(KeyListener l)1065 void removeKeyListener(KeyListener l); 1066 getKeyListener(int index)1067 KeyListener getKeyListener(int index); 1068 getKeyListeners()1069 KeyListener[] getKeyListeners(); 1070 1071 1072 // 1073 // MouseListener 1074 // 1075 1076 /** 1077 * Appends the given {@link MouseListener} to the end of the list. 1078 */ addMouseListener(MouseListener l)1079 void addMouseListener(MouseListener l); 1080 1081 /** 1082 * Inserts the given {@link MouseListener} at the 1083 * specified position in the list.<br> 1084 * 1085 * @param index Position where the listener will be inserted. 1086 * Should be within (0 <= index && index <= size()). 1087 * An index value of -1 is interpreted as the end of the list, size(). 1088 * @param l The listener object to be inserted 1089 * @throws IndexOutOfBoundsException If the index is not within (0 <= index && index <= size()), or -1 1090 */ addMouseListener(int index, MouseListener l)1091 void addMouseListener(int index, MouseListener l); 1092 1093 /** 1094 * Removes the given {@link MouseListener} from the list. 1095 */ removeMouseListener(MouseListener l)1096 void removeMouseListener(MouseListener l); 1097 1098 /** 1099 * Returns the {@link MouseListener} from the list at the given index. 1100 */ getMouseListener(int index)1101 MouseListener getMouseListener(int index); 1102 1103 /** 1104 * Returns all {@link MouseListener} 1105 */ getMouseListeners()1106 MouseListener[] getMouseListeners(); 1107 1108 /** Enable or disable default {@link GestureHandler}. Default is enabled. */ setDefaultGesturesEnabled(boolean enable)1109 void setDefaultGesturesEnabled(boolean enable); 1110 /** Return true if default {@link GestureHandler} are enabled. */ areDefaultGesturesEnabled()1111 boolean areDefaultGesturesEnabled(); 1112 /** 1113 * Appends the given {@link GestureHandler} to the end of the list. 1114 */ addGestureHandler(GestureHandler gh)1115 void addGestureHandler(GestureHandler gh); 1116 /** 1117 * Inserts the given {@link GestureHandler} at the 1118 * specified position in the list.<br> 1119 * 1120 * @param index Position where the listener will be inserted. 1121 * Should be within (0 <= index && index <= size()). 1122 * An index value of -1 is interpreted as the end of the list, size(). 1123 * @param l The listener object to be inserted 1124 * @throws IndexOutOfBoundsException If the index is not within (0 <= index && index <= size()), or -1 1125 */ addGestureHandler(int index, GestureHandler gh)1126 void addGestureHandler(int index, GestureHandler gh); 1127 /** 1128 * Removes the given {@link GestureHandler} from the list. 1129 */ removeGestureHandler(GestureHandler gh)1130 void removeGestureHandler(GestureHandler gh); 1131 /** 1132 * Appends the given {@link GestureHandler.GestureListener} to the end of the list. 1133 */ addGestureListener(GestureHandler.GestureListener gl)1134 void addGestureListener(GestureHandler.GestureListener gl); 1135 /** 1136 * Inserts the given {@link GestureHandler.GestureListener} at the 1137 * specified position in the list.<br> 1138 * 1139 * @param index Position where the listener will be inserted. 1140 * Should be within (0 <= index && index <= size()). 1141 * An index value of -1 is interpreted as the end of the list, size(). 1142 * @param l The listener object to be inserted 1143 * @throws IndexOutOfBoundsException If the index is not within (0 <= index && index <= size()), or -1 1144 */ addGestureListener(int index, GestureHandler.GestureListener gl)1145 void addGestureListener(int index, GestureHandler.GestureListener gl); 1146 /** 1147 * Removes the given {@link GestureHandler.GestureListener} from the list. 1148 */ removeGestureListener(GestureHandler.GestureListener gl)1149 void removeGestureListener(GestureHandler.GestureListener gl); 1150 } 1151