public abstract class GuiPrimitivesImpl extends java.lang.Object implements GuiPrimitives
This interface is for GUI-specific features. It is intended to be specific to a given UI-modality (GUI in this case). No driver-specific implementation classes or features should be present. For example, no Swing-specific feature usage is allowed.
The actual GUI processing does not heavily utilize the pluggable OutputPrimitives
interface. In other words, the interactive UI processing GUI is not switched in and out like
in ChUI. For this reason, the core output processing in ChUI is driven using the primitives
approach, but in GUI we simply honor the minimum implementation in this class. The majority
of this class is really about providing access to and management of the core window structure.
The primitives implementation is secondary, but the functionality is best implemented here.
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.Integer,EmulatedWindowState> |
emulators
Registry of window emulators.
|
protected EmulatedWindowState |
ews
Current GUI emulator.
|
Constructor and Description |
---|
GuiPrimitivesImpl()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clearArea(int left,
int top,
int right,
int bottom,
Color color)
Clear specified area at the screen.
|
void |
deregisterWindow(int windowId)
Deregister this window from the driver.
|
ScreenBitmap |
getScreenBitmap()
Get the screen bitmap for the current window.
|
EmulatedWindowState |
getWindowEmulator()
Get the currently selected window emulator.
|
EmulatedWindowState |
getWindowEmulator(int windowId)
Returns the window emulator registered for the supplied window id.
|
int |
getWindowId()
Get the ID of the window currently selected.
|
boolean |
hasWindowEmulator(int windowId)
Check if window has an emulator for the given window id.
|
void |
refresh(NativeRectangle rect)
Refresh specified area.
|
void |
registerWindow(int windowId,
EmulatedWindowState ews)
Register a new window with the driver.
|
void |
releaseWindow()
On a device which allows multiple windows to be created, this allows releasing the window to
allow drawing from other threads.
|
int |
screenHeight()
Get the screen height, in character units.
|
int |
screenWidth()
Get the screen width, in character units.
|
void |
selectWindow(int windowId)
On a GUI interface multiple windows can be created.
|
void |
setScreenBitmap(ScreenBitmap bitmap)
Set the active screen bitmap for the current window.
|
void |
shutdown()
Perform shutdown.
|
abstract void |
sync()
Synchronize screen.
|
protected EmulatedWindowState ews
private java.util.Map<java.lang.Integer,EmulatedWindowState> emulators
public void clearArea(int left, int top, int right, int bottom, Color color)
clearArea
in interface OutputPrimitives
left
- Left coordinate of the area.top
- Top coordinate of the area.right
- Right coordinate of the area.bottom
- Bottom coordinate of the area.color
- Color.public void refresh(NativeRectangle rect)
This is a no-op.
refresh
in interface OutputPrimitives
rect
- Area to refresh.public int screenWidth()
screenWidth
in interface OutputPrimitives
public int screenHeight()
screenHeight
in interface OutputPrimitives
public abstract void sync()
Driver level implementation of this method should force flushing internal low-level buffers to screen. This method requires implementation only if operating system or hardware uses internal buffering for the terminal output. Otherwise this method can do nothing.
sync
in interface OutputPrimitives
public void setScreenBitmap(ScreenBitmap bitmap)
setScreenBitmap
in interface OutputPrimitives
bitmap
- The screen bitmap.public ScreenBitmap getScreenBitmap()
getScreenBitmap
in interface OutputPrimitives
public int getWindowId()
getWindowId
in interface OutputPrimitives
public EmulatedWindowState getWindowEmulator()
getWindowEmulator
in interface GuiPrimitives
public EmulatedWindowState getWindowEmulator(int windowId)
getWindowEmulator
in interface GuiPrimitives
windowId
- A valid window id.java.lang.RuntimeException
- When no window emulator is registered for the supplied window id.public boolean hasWindowEmulator(int windowId)
hasWindowEmulator
in interface GuiPrimitives
windowId
- Window ID.true
if window has an associated emulator, true
otherwise.public void registerWindow(int windowId, EmulatedWindowState ews)
registerWindow
in interface GuiPrimitives
windowId
- The window ID.ews
- New emulated window state to register.public void deregisterWindow(int windowId)
deregisterWindow
in interface GuiPrimitives
windowId
- The window ID.public void selectWindow(int windowId)
selectWindow
in interface GuiPrimitives
windowId
- Window ID.public void releaseWindow()
releaseWindow
in interface GuiPrimitives
public void shutdown()
shutdown
in interface GuiPrimitives