com.jogamp.newt.impl
Class ScreenImpl

java.lang.Object
  extended by com.jogamp.newt.Screen
      extended by com.jogamp.newt.impl.ScreenImpl
All Implemented Interfaces:
ScreenModeListener
Direct Known Subclasses:
AWTScreen, KDScreen, MacScreen, Screen, Screen, WindowsScreen, X11Screen

public abstract class ScreenImpl
extends Screen
implements ScreenModeListener


Field Summary
protected  AbstractGraphicsScreen aScreen
           
protected static boolean DEBUG_TEST_SCREENMODE_DISABLED
           
protected  DisplayImpl display
           
protected  String fqname
           
protected  int hashCode
           
protected  int height
           
protected  int refCount
           
protected  int screen_idx
           
protected static int usrHeight
           
protected static int usrWidth
           
protected  int width
           
 
Fields inherited from class com.jogamp.newt.Screen
DEBUG, SCREEN_MODE_CHANGE_TIMEOUT, screenList, screensActive
 
Constructor Summary
ScreenImpl()
           
 
Method Summary
 int addReference()
          See Display.addReference()
 void addScreenModeListener(ScreenModeListener sml)
           
protected abstract  void closeNativeImpl()
           
static Screen create(Display display, int idx)
           
 void createNative()
          Manual trigger the native creation, if it is not done yet..
This is useful to be able to request the AbstractGraphicsScreen, via Screen.getGraphicsScreen().
Otherwise the abstract device won't be available before the dependent component (Window) is realized.
protected abstract  void createNativeImpl()
           
 void destroy()
          Manually trigger the destruction, incl.
 ScreenMode getCurrentScreenMode()
          Return the current ScreenMode.
protected  ScreenMode getCurrentScreenModeImpl()
          To be implemented by the native specification.
Is called within a thread safe environment.
 Display getDisplay()
           
 String getFQName()
           
 AbstractGraphicsScreen getGraphicsScreen()
           
 int getHeight()
           
 int getIndex()
           
 ScreenMode getOriginalScreenMode()
          Return the original ScreenMode, as used at NEWT initialization.
 int getReferenceCount()
           
protected  int[] getScreenModeFirstImpl()
          To be implemented by the native specification.
Is called within a thread safe environment.
Is called only to collect the ScreenModes, usually at startup setting up modes.

WARNING: must be synchronized with ScreenModeUtil.NUM_SCREEN_MODE_PROPERTIES, ie com.jogamp.newt.util.ScreenModeUtil#streamIn(com.jogamp.common.util.ArrayHashSet, com.jogamp.common.util.ArrayHashSet, com.jogamp.common.util.ArrayHashSet, com.jogamp.common.util.ArrayHashSet, int[], int)

Note: Additional 1st element is native mode id.
protected  int[] getScreenModeNextImpl()
          To be implemented by the native specification.
Is called within a thread safe environment.
Is called only to collect the ScreenModes, usually at startup setting up modes.

WARNING: must be synchronized with ScreenModeUtil.NUM_SCREEN_MODE_PROPERTIES, ie com.jogamp.newt.util.ScreenModeUtil#streamIn(com.jogamp.common.util.ArrayHashSet, com.jogamp.common.util.ArrayHashSet, com.jogamp.common.util.ArrayHashSet, com.jogamp.common.util.ArrayHashSet, int[], int)

Note: Additional 1st element is native mode id.
 List getScreenModes()
          Return a list of available ScreenModes.
protected  IntIntHashMap getScreenModesIdx2NativeIdx()
          ScreenModeStatus bridge to native implementation
protected  ArrayHashSet getScreenModesOrig()
          ScreenModeStatus bridge to native implementation
 int getWidth()
           
 int hashCode()
          return precomputed hashCode from FQN Screen.getFQName()
 boolean isNativeValid()
           
 int removeReference()
          See Display.removeReference()
 void removeScreenModeListener(ScreenModeListener sml)
           
 void screenModeChanged(ScreenMode sm, boolean success)
          called after the screen mode has been changed
 void screenModeChangeNotify(ScreenMode sm)
          called before the screen mode will be changed
 boolean setCurrentScreenMode(ScreenMode screenMode)
          Set the current ScreenMode.
protected  boolean setCurrentScreenModeImpl(ScreenMode screenMode)
          To be implemented by the native specification.
Is called within a thread safe environment.
protected  void setScreenSize(int w, int h)
           
 String toString()
           
 
Methods inherited from class com.jogamp.newt.Screen
equals, getActiveScreenNumber, getAllScreens, getFirstScreenOf, getLastScreenOf
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG_TEST_SCREENMODE_DISABLED

protected static final boolean DEBUG_TEST_SCREENMODE_DISABLED

display

protected DisplayImpl display

screen_idx

protected int screen_idx

fqname

protected String fqname

hashCode

protected int hashCode

aScreen

protected AbstractGraphicsScreen aScreen

refCount

protected int refCount

width

protected int width

height

protected int height

usrWidth

protected static int usrWidth

usrHeight

protected static int usrHeight
Constructor Detail

ScreenImpl

public ScreenImpl()
Method Detail

create

public static Screen create(Display display,
                            int idx)

hashCode

public int hashCode()
Description copied from class: Screen
return precomputed hashCode from FQN Screen.getFQName()

Specified by:
hashCode in class Screen

createNative

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

This method is usually invoke by Screen.addReference()

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

Specified by:
createNative in class Screen
Throws:
NativeWindowException - if the native creation failed.

destroy

public final void destroy()
Description copied from class: Screen
Manually trigger the destruction, incl. native destruction.

This method is usually invoke by Screen.removeReference()

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

Specified by:
destroy in class Screen

addReference

public final int addReference()
                       throws NativeWindowException
Description copied from class: Screen
See Display.addReference()

Specified by:
addReference in class Screen
Throws:
NativeWindowException - if the native creation failed.
See Also:
Screen.removeReference(), #setDestroyWhenUnused(boolean), #getDestroyWhenUnused()

removeReference

public final int removeReference()
Description copied from class: Screen
See Display.removeReference()

Specified by:
removeReference in class Screen
See Also:
Screen.addReference(), #setDestroyWhenUnused(boolean), #getDestroyWhenUnused()

getReferenceCount

public final int getReferenceCount()
Specified by:
getReferenceCount in class Screen
Returns:
number of references by Window

createNativeImpl

protected abstract void createNativeImpl()

closeNativeImpl

protected abstract void closeNativeImpl()

getFQName

public final String getFQName()
Specified by:
getFQName in class Screen
Returns:
the screen fully qualified Screen name, which is a key of Display.getFQName() + Screen.getIndex().

setScreenSize

protected void setScreenSize(int w,
                             int h)

getDisplay

public final Display getDisplay()
Specified by:
getDisplay in class Screen
Returns:
the associated Display

getIndex

public final int getIndex()
Specified by:
getIndex in class Screen
Returns:
this Screen index of all Screens of Screen.getDisplay().

getGraphicsScreen

public final AbstractGraphicsScreen getGraphicsScreen()
Specified by:
getGraphicsScreen in class Screen

isNativeValid

public final boolean isNativeValid()
Specified by:
isNativeValid in class Screen

getWidth

public final int getWidth()
Specified by:
getWidth in class Screen
Returns:
the current screen width

getHeight

public final int getHeight()
Specified by:
getHeight in class Screen
Returns:
the current screen height

toString

public String toString()
Overrides:
toString in class Object

getScreenModes

public final List getScreenModes()
Description copied from class: Screen
Return a list of available ScreenModes.

Specified by:
getScreenModes in class Screen
Returns:
a shallow copy of the internal immutable ScreenModes, or null if not implemented for this native type Display.getType().

getOriginalScreenMode

public ScreenMode getOriginalScreenMode()
Description copied from class: Screen
Return the original ScreenMode, as used at NEWT initialization.

Specified by:
getOriginalScreenMode in class Screen
Returns:
null if functionality not implemented, otherwise the original ScreenMode which is element of the list Screen.getScreenModes().

getCurrentScreenMode

public ScreenMode getCurrentScreenMode()
Description copied from class: Screen
Return the current ScreenMode.

Specified by:
getCurrentScreenMode in class Screen
Returns:
null if functionality not implemented, otherwise the current ScreenMode which is element of the list Screen.getScreenModes().

setCurrentScreenMode

public boolean setCurrentScreenMode(ScreenMode screenMode)
Description copied from class: Screen
Set the current ScreenMode.

Specified by:
setCurrentScreenMode in class Screen
Parameters:
screenMode - to be made current, must be element of the list Screen.getScreenModes().
Returns:
true if successful, otherwise false

screenModeChangeNotify

public void screenModeChangeNotify(ScreenMode sm)
Description copied from interface: ScreenModeListener
called before the screen mode will be changed

Specified by:
screenModeChangeNotify in interface ScreenModeListener

screenModeChanged

public void screenModeChanged(ScreenMode sm,
                              boolean success)
Description copied from interface: ScreenModeListener
called after the screen mode has been changed

Specified by:
screenModeChanged in interface ScreenModeListener

addScreenModeListener

public final void addScreenModeListener(ScreenModeListener sml)
Specified by:
addScreenModeListener in class Screen
Parameters:
sml - ScreenModeListener to be added for ScreenMode change events

removeScreenModeListener

public final void removeScreenModeListener(ScreenModeListener sml)
Specified by:
removeScreenModeListener in class Screen
Parameters:
sml - ScreenModeListener to be removed from ScreenMode change events

getScreenModesOrig

protected final ArrayHashSet getScreenModesOrig()
ScreenModeStatus bridge to native implementation


getScreenModesIdx2NativeIdx

protected final IntIntHashMap getScreenModesIdx2NativeIdx()
ScreenModeStatus bridge to native implementation


getScreenModeFirstImpl

protected int[] getScreenModeFirstImpl()
To be implemented by the native specification.
Is called within a thread safe environment.
Is called only to collect the ScreenModes, usually at startup setting up modes.

WARNING: must be synchronized with ScreenModeUtil.NUM_SCREEN_MODE_PROPERTIES, ie com.jogamp.newt.util.ScreenModeUtil#streamIn(com.jogamp.common.util.ArrayHashSet, com.jogamp.common.util.ArrayHashSet, com.jogamp.common.util.ArrayHashSet, com.jogamp.common.util.ArrayHashSet, int[], int)

Note: Additional 1st element is native mode id.


getScreenModeNextImpl

protected int[] getScreenModeNextImpl()
To be implemented by the native specification.
Is called within a thread safe environment.
Is called only to collect the ScreenModes, usually at startup setting up modes.

WARNING: must be synchronized with ScreenModeUtil.NUM_SCREEN_MODE_PROPERTIES, ie com.jogamp.newt.util.ScreenModeUtil#streamIn(com.jogamp.common.util.ArrayHashSet, com.jogamp.common.util.ArrayHashSet, com.jogamp.common.util.ArrayHashSet, com.jogamp.common.util.ArrayHashSet, int[], int)

Note: Additional 1st element is native mode id.


getCurrentScreenModeImpl

protected ScreenMode getCurrentScreenModeImpl()
To be implemented by the native specification.
Is called within a thread safe environment.


setCurrentScreenModeImpl

protected boolean setCurrentScreenModeImpl(ScreenMode screenMode)
To be implemented by the native specification.
Is called within a thread safe environment.



Copyright 2010 JogAmp Community.