com.jogamp.newt
Class Screen

java.lang.Object
  extended by com.jogamp.newt.Screen

public abstract class Screen
extends Object

A screen may span multiple MonitorDevices representing their combined virtual size.


Field Summary
static boolean DEBUG
           
static int SCREEN_MODE_CHANGE_TIMEOUT
          A 10s timeout for screen mode change.
 
Constructor Summary
Screen()
           
 
Method Summary
abstract  void addMonitorModeListener(MonitorModeListener sml)
           
abstract  int addReference()
          See Display.addReference()
abstract  void createNative()
          Manual trigger the native creation, if it is not done yet..
This is useful to be able to request the AbstractGraphicsScreen, via getGraphicsScreen().
Otherwise the abstract device won't be available before the dependent component (Window) is realized.
abstract  void destroy()
          Manually trigger the destruction, incl.
 boolean equals(Object obj)
          return true if obj is of type Display and both FQN getFQName() equals
static int getActiveScreenNumber()
           
static Collection<Screen> getAllScreens()
          Returns the global display collection
abstract  Display getDisplay()
           
static Screen getFirstScreenOf(Display display, int idx, int fromIndex)
           
abstract  String getFQName()
           
abstract  AbstractGraphicsScreen getGraphicsScreen()
           
abstract  int getHeight()
           
abstract  int getIndex()
           
static Screen getLastScreenOf(Display display, int idx, int fromIndex)
           
 MonitorDevice getMainMonitor(RectangleImmutable r)
          Returns the MonitorDevice which viewport covers the given rectangle the most.
abstract  List<MonitorDevice> getMonitorDevices()
          Return a list of available MonitorDevices.
abstract  List<MonitorMode> getMonitorModes()
          Return a list of all MonitorModes for all MonitorDevices.
abstract  int getReferenceCount()
           
abstract  RectangleImmutable getViewport()
           
abstract  int getWidth()
           
abstract  int getX()
           
abstract  int getY()
           
abstract  int hashCode()
          return precomputed hashCode from FQN getFQName()
abstract  boolean isNativeValid()
           
abstract  void removeMonitorModeListener(MonitorModeListener sml)
           
abstract  int removeReference()
          See Display.removeReference()
 Rectangle unionOfMonitorViewportSize(Rectangle result)
          Returns the union of all monitor's viewport.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCREEN_MODE_CHANGE_TIMEOUT

public static final int SCREEN_MODE_CHANGE_TIMEOUT
A 10s timeout for screen mode change. It is observed, that some platforms need a notable amount of time for this task, especially in case of rotation change.

See Also:
Constant Field Values

DEBUG

public static final boolean DEBUG
Constructor Detail

Screen

public Screen()
Method Detail

hashCode

public abstract int hashCode()
return precomputed hashCode from FQN getFQName()

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
return true if obj is of type Display and both FQN getFQName() equals

Overrides:
equals in class Object

createNative

public abstract void createNative()
                           throws NativeWindowException
Manual trigger the native creation, if it is not done yet..
This is useful to be able to request the AbstractGraphicsScreen, via getGraphicsScreen().
Otherwise the abstract device won't be available before the dependent component (Window) is realized.

This method is usually invoke by addReference()

This method invokes Display.addReference() after creating the native peer,
which will issue Display.createNative() if the reference count was 0.

Throws:
NativeWindowException - if the native creation failed.

destroy

public abstract void destroy()
Manually trigger the destruction, incl. native destruction.

This method is usually invoke by removeReference()

This method invokes Display.removeReference() after it's own destruction,
which will issue Display.destroy() if the reference count becomes 0.


isNativeValid

public abstract boolean isNativeValid()

getReferenceCount

public abstract int getReferenceCount()
Returns:
number of references

addReference

public abstract int addReference()
                          throws NativeWindowException
See Display.addReference()

Returns:
number of references post operation
Throws:
NativeWindowException - if the native creation failed.
See Also:
removeReference(), #setDestroyWhenUnused(boolean), #getDestroyWhenUnused()

removeReference

public abstract int removeReference()
See Display.removeReference()

Returns:
number of references post operation
See Also:
addReference(), #setDestroyWhenUnused(boolean), #getDestroyWhenUnused()

getGraphicsScreen

public abstract AbstractGraphicsScreen getGraphicsScreen()

getIndex

public abstract int getIndex()
Returns:
this Screen index of all Screens of getDisplay().

getX

public abstract int getX()
Returns:
the x position of the virtual viewport's top-left origin.

getY

public abstract int getY()
Returns:
the y position of the virtual viewport's top-left origin.

getWidth

public abstract int getWidth()
Returns:
the rotated virtual viewport's width.

getHeight

public abstract int getHeight()
Returns:
the rotated virtual viewport's height.

getViewport

public abstract RectangleImmutable getViewport()
Returns:
the rotated virtual viewport, i.e. origin and size.

getDisplay

public abstract Display getDisplay()
Returns:
the associated Display

getFQName

public abstract String getFQName()
Returns:
The screen fully qualified Screen name, which is a key of Display.getFQName() + getIndex().

getMonitorModes

public abstract List<MonitorMode> getMonitorModes()
Return a list of all MonitorModes for all MonitorDevices.


getMonitorDevices

public abstract List<MonitorDevice> getMonitorDevices()
Return a list of available MonitorDevices.


getMainMonitor

public final MonitorDevice getMainMonitor(RectangleImmutable r)
Returns the MonitorDevice which viewport covers the given rectangle the most.

If no coverage is detected the first MonitorDevice is returned.


unionOfMonitorViewportSize

public final Rectangle unionOfMonitorViewportSize(Rectangle result)
Returns the union of all monitor's viewport.

Should be equal to getX(), getY(), getWidth() and getHeight(), however, some native toolkits may choose a different virtual screen area.

Parameters:
result - storage for result, will be returned

addMonitorModeListener

public abstract void addMonitorModeListener(MonitorModeListener sml)
Parameters:
sml - MonitorModeListener to be added for MonitorEvent

removeMonitorModeListener

public abstract void removeMonitorModeListener(MonitorModeListener sml)
Parameters:
sml - MonitorModeListener to be removed from MonitorEvent

getFirstScreenOf

public static Screen getFirstScreenOf(Display display,
                                      int idx,
                                      int fromIndex)
Parameters:
type -
name -
fromIndex - start index, then increasing until found or end of list *
Returns:

getLastScreenOf

public static Screen getLastScreenOf(Display display,
                                     int idx,
                                     int fromIndex)
Parameters:
type -
name -
fromIndex - start index, then decreasing until found or end of list. -1 is interpreted as size - 1.
Returns:

getAllScreens

public static Collection<Screen> getAllScreens()
Returns the global display collection


getActiveScreenNumber

public static int getActiveScreenNumber()


Copyright 2010 JogAmp Community.