moka.x
Class GEM

java.lang.Object
  extended bymoka.lang.Object
      extended bymoka.event.EventListener
          extended bymoka.x.Component
              extended bymoka.x.Container
                  extended bymoka.x.GEM

public class GEM
extends Container

The GEM (Graphic Environment Manager) class implements the methods used to manage the Graphic Environment.

Since:
MDK1.0a

Field Summary
 short cursorSpeedX
          The horizontal speed of the cursor.
 short cursorSpeedY
          The vertical speed of the cursor.
 short cursorVisible
          Is the cursor visible ? Should be only read.
 short cursorX
          The cursor x position.
 short cursorY
          The cursor y position.
static GEM gem
          The instance of the Graphic Environment Manager.
static short LCD_HEIGHT
          Height of the screen in pixels (100 on TI-89, 128 on TI-92 Plus or V200).
static short LCD_LINE_BYTES
          Number of bytes in the visible part of a screen line (20 on TI-89, 30 on TI-92 Plus or V200).
static short LCD_WIDTH
          Width of the screen in pixels (160 on TI-89, 240 on TI-92 Plus or V200).
 EventListener minListen
          The event listener notified when a frame is minimized.
protected  moka.x.void_p port
          The virtual screen buffer.
 boolean started
          Is the Graphic Environment started ? Should be only read.
 EventListener startListen
          The event listener notified when the Graphic Environment starts.
 short systemFont
          The ssytem font.
static short USABLE_HEIGHT
          The usable height of the screen (94 on TI-89, 122 on TI-92 Plus or V200)
static moka.x.SCR_RECT_p vScrRect
          The virtual screen SCR_RECT.
 
Fields inherited from class moka.x.Container
child, tail
 
Fields inherited from class moka.x.Component
enabled, height, listen, mnemonic, next, parent, prev, visible, width, x, y
 
Constructor Summary
GEM()
           
 
Method Summary
protected  void clean()
          Disposes of all ressources used by the Graphic Environment.
 void finalize()
          Free the memory and system ressources used by this GEM.
 short getFontHeight()
          Returns the current system font height.
static short getFontHeight(short font)
          Returns the specified font height.
 short getFontWidth()
          Returns the current system font width.
static short getFontWidth(short font)
          Returns the specified font width.
 void onDrag(Component sender)
          Called when a DragEvent occurs to drag and drop a component.
 void onMinimize(Frame sender)
          Called when a MinimizedEvent is triggered.
 void onPaint()
          Called when a PaintEvent occurs to refresh the screen.
 void onRefresh()
          Called when an UpdateEvent occurs.
 void register(Interrupt item)
          Registers the specified interrupt.
 void run()
          This method is looping when the GEM is started.
 void setBackground()
          Sets the current screen state as background.
 void setCursorVisible(boolean b)
          Sets the visibility of the cursor.
 void setFont(short font)
          Sets the system font.
 void setStarted(boolean b)
          Starts or stops this GEM.
 void showModal(Frame frame)
          This method is called when a Frame is showed in modal mode.
 void unregister(Interrupt item)
          Unregisters the specified interrupt.
 short useCursor()
          Gives the user the control of the cursor.
 
Methods inherited from class moka.x.Container
add, checkMnemonic, empty, paintChildren, paintForeground, remove, repaintChildren, toFront, use
 
Methods inherited from class moka.x.Component
bottom, center, eventTriggered, isCursorOver, left, move, paint, right, setBounds, setEnabled, setHeight, setMnemonic, setVisible, setWidth, setX, setY, top
 
Methods inherited from class moka.event.EventListener
eventTriggered
 
Methods inherited from class moka.lang.Object
equals, getClassName, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

port

protected moka.x.void_p port
The virtual screen buffer.


gem

public static GEM gem
The instance of the Graphic Environment Manager. Should be only read.


LCD_HEIGHT

public static short LCD_HEIGHT
Height of the screen in pixels (100 on TI-89, 128 on TI-92 Plus or V200).


LCD_LINE_BYTES

public static short LCD_LINE_BYTES
Number of bytes in the visible part of a screen line (20 on TI-89, 30 on TI-92 Plus or V200).


LCD_WIDTH

public static short LCD_WIDTH
Width of the screen in pixels (160 on TI-89, 240 on TI-92 Plus or V200).


USABLE_HEIGHT

public static short USABLE_HEIGHT
The usable height of the screen (94 on TI-89, 122 on TI-92 Plus or V200)


vScrRect

public static moka.x.SCR_RECT_p vScrRect
The virtual screen SCR_RECT.


started

public boolean started
Is the Graphic Environment started ? Should be only read.


cursorX

public short cursorX
The cursor x position. Should be only read.


cursorY

public short cursorY
The cursor y position. Should be only read.


cursorVisible

public short cursorVisible
Is the cursor visible ? Should be only read.


cursorSpeedX

public short cursorSpeedX
The horizontal speed of the cursor.


cursorSpeedY

public short cursorSpeedY
The vertical speed of the cursor.


systemFont

public short systemFont
The ssytem font. Should be only read.


startListen

public EventListener startListen
The event listener notified when the Graphic Environment starts.


minListen

public EventListener minListen
The event listener notified when a frame is minimized.

Constructor Detail

GEM

public GEM()
Method Detail

finalize

public void finalize()
Free the memory and system ressources used by this GEM.

Overrides:
finalize in class Component

onRefresh

public void onRefresh()
Called when an UpdateEvent occurs. An update event occurs when a visible component contained in this container has changed its appearance.

Overrides:
onRefresh in class Container

clean

protected void clean()
Disposes of all ressources used by the Graphic Environment.

Overrides:
clean in class Container

setStarted

public void setStarted(boolean b)
Starts or stops this GEM. While the GEM is started, the execution flow become even driven instead of linear i.e. that instructions are executed when events or interrupts occur instead of being executed sequentially. When the GEM is stopped, the execution flow continues were it was.

Parameters:
b - true if the Graphic Environment should be started, false if the Graphic Environment should be stopped.

onPaint

public void onPaint()
Called when a PaintEvent occurs to refresh the screen. All the components are painted. A PaintEvent occurs when the aspect of any component is altered.

Overrides:
onPaint in class Container

setCursorVisible

public void setCursorVisible(boolean b)
Sets the visibility of the cursor.

Parameters:
b - true if the cursor should be visible, false otherwise.

useCursor

public short useCursor()
Gives the user the control of the cursor.

Returns:
The last key read from the keyboard.

register

public void register(Interrupt item)
Registers the specified interrupt.

Parameters:
item - the interrupt to be registered.

unregister

public void unregister(Interrupt item)
Unregisters the specified interrupt.

Parameters:
item - the interrupt to be unregistered.

run

public void run()
This method is looping when the GEM is started.


showModal

public void showModal(Frame frame)
This method is called when a Frame is showed in modal mode.

Parameters:
frame - The frame to show in modal mode.

onDrag

public void onDrag(Component sender)
Called when a DragEvent occurs to drag and drop a component. A DragEvent occurs when a component needs to be moved by the user.

Parameters:
sender - the object who triggered the DragEvent.

setFont

public void setFont(short font)
Sets the system font.

Parameters:
font - the new system font.

getFontHeight

public static short getFontHeight(short font)
Returns the specified font height.

Parameters:
font - the specified font
Returns:
the specified font height

getFontWidth

public static short getFontWidth(short font)
Returns the specified font width.

Parameters:
font - the specified font
Returns:
the specified font width

getFontHeight

public short getFontHeight()
Returns the current system font height.

Returns:
the current system font height

getFontWidth

public short getFontWidth()
Returns the current system font width.

Returns:
the current system font width

onMinimize

public void onMinimize(Frame sender)
Called when a MinimizedEvent is triggered. A MinimizeEvent is triggered when a user wants to minimize a frame.


setBackground

public void setBackground()
Sets the current screen state as background.

Since:
MDK2.11