com.threerings.opengl.gui
Class Window

java.lang.Object
  extended by com.threerings.opengl.gui.Component
      extended by com.threerings.opengl.gui.Container
          extended by com.threerings.opengl.gui.Window
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>, Comparable<Window>
Direct Known Subclasses:
DecoratedWindow, PopupWindow, StretchWindow, UserInterfaceWindow

public class Window
extends Container
implements Comparable<Window>

A window defines the top-level of a component hierarchy. It must be created with a stylesheet and layout manager.


Field Summary
 
Fields inherited from class com.threerings.opengl.gui.Component
DEFAULT, DISABLED, HOVER
 
Constructor Summary
Window(GlContext ctx, LayoutManager layout)
           
 
Method Summary
 void center()
          Positions this window in the center of the display.
 int compareTo(Window other)
           
 void dismiss()
          Detaches this window from the root node and removes it from the display.
 int getLayer()
          Returns the layer occupied by this window.
 Window getParentWindow()
          Returne the parent window.
 Root getRoot()
          Returns the root node that manages this window.
 void invalidate()
          Marks this component as invalid and needing a relayout.
 boolean isAdded()
          Returns true if this component is added to a hierarchy of components that culminates in a top-level window.
 boolean isModal()
          Returns whether or not this window is modal.
 boolean isOverlay()
          Returns whether or not this window is an overlay, in which case its children will not receive input focus by default.
 void pack()
          Sizes this window to its preferred size.
 void pack(int whint, int hhint)
          Sizes this window to its preferred size, accounting for the specified width or height hints.
 void setBounds(int x, int y, int width, int height)
          Sets the bounds of this component in screen coordinates.
 void setLayer(int layer)
          Configures the "layer" occupied by this window.
 void setModal(boolean modal)
          Configures this window to be modal which causes it to "steal" all mouse and keyboard input while it is added to the interface hierarchy.
 void setParent(Container parent)
          Informs this component of its parent in the interface heirarchy.
 void setParentWindow(Window parentWindow)
          Set the parent window.
 boolean shouldShadeBehind()
          Returns whether this window should have shading applied beneath it.
 
Methods inherited from class com.threerings.opengl.gui.Container
add, add, add, add, getComponent, getComponentCount, getComponentIndex, getHitComponent, getLayoutManager, remove, remove, removeAll, replace, setAlpha, setEnabled, setHoverable, setLayoutManager, validate
 
Methods inherited from class com.threerings.opengl.gui.Component
acceptsFocus, addListener, boundsToString, configUpdated, contains, createDefaultTooltipComponent, createDefaultTooltipComponent, dispatchEvent, getAbsoluteX, getAbsoluteY, getAlpha, getBackground, getBorder, getBounds, getColor, getContext, getCursor, getFocusTarget, getHeight, getInsets, getParent, getPreferredSize, getProperty, getState, getStyleConfigs, getTooltipText, getTooltipTimeout, getTooltipWindowStyle, getTransferHandler, getWidth, getX, getY, hasFocus, isEnabled, isHoverable, isShowing, isTooltipRelativeToMouse, isValid, isVisible, removeAllListeners, removeAllListeners, removeListener, render, requestFocus, scrollRectToVisible, setBackground, setCursor, setLocation, setPreferredSize, setPreferredSize, setProperty, setSize, setStyleConfig, setStyleConfig, setStyleConfig, setStyleConfigs, setTooltipRelativeToMouse, setTooltipText, setTransferHandler, setVisible
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Window

public Window(GlContext ctx,
              LayoutManager layout)
Method Detail

pack

public void pack()
Sizes this window to its preferred size. This method does not change the window's coordinates.


pack

public void pack(int whint,
                 int hhint)
Sizes this window to its preferred size, accounting for the specified width or height hints. Specify -1 for a dimension to indicate that it is freely resizable and a non-negative hint for a dimension that should be no larger than a particular size. This method does not change the window's coordinates.


center

public void center()
Positions this window in the center of the display. This should be called after configuring the size of the window (using, for example, a call to pack()).


setModal

public void setModal(boolean modal)
Configures this window to be modal which causes it to "steal" all mouse and keyboard input while it is added to the interface hierarchy. Mouse movement and button press events that would normally go to other windows or to the default mouse target will instead be sent to the top-most modal window. Other events destined for other windows (key events and mouse entry and exit events) will not be dispatched.


isModal

public boolean isModal()
Returns whether or not this window is modal. See setModal(boolean) for more information on modality.


shouldShadeBehind

public boolean shouldShadeBehind()
Returns whether this window should have shading applied beneath it.


isOverlay

public boolean isOverlay()
Returns whether or not this window is an overlay, in which case its children will not receive input focus by default.


getRoot

public Root getRoot()
Returns the root node that manages this window.


getLayer

public int getLayer()
Returns the layer occupied by this window. See setLayer(int) for more details.


setLayer

public void setLayer(int layer)
Configures the "layer" occupied by this window. Windows normally stack one atop another with the most recently added window being highest in the stack. The layer configuration allows a window to be added above windows in a lower layer regardless of when it or other windows are added. All windows default to a layer of zero, windows with a higher layer will be "above" those with a lower layer. Windows in the same layer stack according to the order in which they are added.


dismiss

public void dismiss()
Detaches this window from the root node and removes it from the display.


compareTo

public int compareTo(Window other)
Specified by:
compareTo in interface Comparable<Window>

setParent

public void setParent(Container parent)
Description copied from class: Component
Informs this component of its parent in the interface heirarchy.

Overrides:
setParent in class Component

invalidate

public void invalidate()
Description copied from class: Component
Marks this component as invalid and needing a relayout. If the component is valid, its parent will also be marked as invalid.

Overrides:
invalidate in class Component

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Description copied from class: Component
Sets the bounds of this component in screen coordinates.

Overrides:
setBounds in class Component
See Also:
Component.setLocation(int, int), Component.setSize(int, int)

isAdded

public boolean isAdded()
Description copied from class: Component
Returns true if this component is added to a hierarchy of components that culminates in a top-level window.

Overrides:
isAdded in class Component

setParentWindow

public void setParentWindow(Window parentWindow)
Set the parent window. If the parent window is removed from its root node, this window will also be removed.


getParentWindow

public Window getParentWindow()
Returne the parent window.



Copyright © 2011. All Rights Reserved.