#include <ggui/guiFramework.h>
Public Member Functions | |
tcGuiFramework (tcBench::tsFontDecl *apFontDecls, int anNumFontDecls, tcGuiDspDisplay *apDisplay, tsDspRomFsNode *apDirectory, int EventLoopPrio=5, int UpdateRateMs=100, tiGuiScreenManagerIface *apAppIface=NULL) | |
tcGuiFramework (tcGuiDspDisplay *apDisplay, const char *apDirectory, int EventLoopPrio=5, int UpdateRateMs=100, tiGuiScreenManagerIface *apAppIface=NULL) | |
bool | BuildBitmap (const char *apFilename, tcBitmap &arBitMap) |
~tcGuiFramework () | |
tcView * | GetView (const char *apViewName) |
tcGuiDspDisplay * | GetDisplay () const |
void | ShowView (const char *apViewName) |
void | SetHomeView (const char *apViewName) |
void | ShowHomeView () |
void | PostEvent (tcGuiEvent &event) |
void | AddTouchscreenHandler (tcDspTouchScreen *apScreen) |
void | AddRemoteFrameBuffer (tcRFBIface *apIface) |
bool | BuildBitmap (tsDspRomFsNode *apNode, tcBitmap &arBitMap) |
void | SetInactivityTimeout (int anTimeout) |
int | GetInactivityTimeout () const |
void | SetInactivityEnable (bool abState) |
void | EnableScreen (bool abOn) |
void | SetBaseColor (const tsRgb &arColor) |
Protected Member Functions | |
void | EventLoop (void) |
void | FlipScreen (void) |
void | TSHandler (tcDspTouchScreen *apScreen) |
Static Protected Member Functions | |
static void | DispatchEventLoop (void *apThis) |
static void | DispatchTSHandler (void *apThis, void *apScreen) |
Protected Attributes | |
tcGuiDspDisplay * | mpDisplay |
pointer to graphics display managed | |
int | mnUpdateRateMs |
update rate for event handling/animation | |
tcFrameBench * | mpBench |
pointer to ggui master bench object | |
int | mnLoopPrio |
default event loop priority | |
MBX_Handle | mhEventBox |
Event mail box. | |
int | mnTicksPerMs |
number of ticks per ms | |
tcRFBIface * | mpRFBIface |
remote frame buffer interface | |
char | maHomeView [snHomeViewStrLen+1] |
"home" view name | |
int | mnInactivityTimer |
Ms since last user action. | |
int | mnInactivityTimeout |
timeout for display turn off | |
bool | mbInactivityTimeoutEnable |
Enable the inactivity timeout for screen off. | |
tsRgb | msBaseColor |
Background color for things without bitmaps. | |
tiGuiScreenManagerIface * | mpAppIface |
Application interface. | |
Static Protected Attributes | |
static const int | snHomeViewStrLen = 127 |
Instances of this class provide framework management for the ggui graphics library.
tcGuiFramework::tcGuiFramework | ( | tcBench::tsFontDecl * | apFontDecls, | |
int | anNumFontDecls, | |||
tcGuiDspDisplay * | apDisplay, | |||
tsDspRomFsNode * | apFileSystem, | |||
int | EventLoopPrio = 5 , |
|||
int | UpdateRateMs = 100 , |
|||
tiGuiScreenManagerIface * | apAppIface = NULL | |||
) |
Main Constructor for GGUI framework handling.
Upon construction, a tcGuiFramework class will:
apFontDecls | a list of valid font declarations to register with the tcBench | |
anNumFontDecls | the length of the apFontDecls list | |
apDisplay | pointer to valid display screen/object that ggui will use for graphics | |
apFileSystem | pointer to ggui skins directory ROM filesystem objects | |
EventLoopPrio | thread priority that should be used to spawn Event Loop Thread | |
UpdateRateMs | Base update rate (in milliseconds) to use for simple animation of buttons, etc. | |
apAppIface | Application inteface for high level screen events. |
MityDSP::tcGuiFramework::tcGuiFramework | ( | tcGuiDspDisplay * | apDisplay, | |
const char * | apDirectory, | |||
int | EventLoopPrio = 5 , |
|||
int | UpdateRateMs = 100 , |
|||
tiGuiScreenManagerIface * | apAppIface = NULL | |||
) |
tcGuiFramework::~tcGuiFramework | ( | ) |
Desctructor, not typically reached
bool MityDSP::tcGuiFramework::BuildBitmap | ( | const char * | apFilename, | |
tcBitmap & | arBitMap | |||
) |
tcView * tcGuiFramework::GetView | ( | const char * | apViewName | ) |
This is utility method to allow external (non-framework) user classes to have access to a view (or a "screen") and it's objects. This class allows external objects to assign system callbacks, etc., to the ggui widgets without having to interface directly with the underlying tcBench objects.
apViewName | name of the view object requested |
tcGuiDspDisplay* MityDSP::tcGuiFramework::GetDisplay | ( | ) | const [inline] |
void tcGuiFramework::ShowView | ( | const char * | apViewName | ) |
Shows the specified view on the graphics display.
apViewName | desired view name to show |
void tcGuiFramework::SetHomeView | ( | const char * | apViewName | ) |
Sets the "Home" view for this framework. This is the view that gets shown when ShowHomeView() is called, making it an easy operation to go back to a sort of home or base view from any other view.
apViewName | desired view name to set as home |
void tcGuiFramework::ShowHomeView | ( | ) |
Shows the view that was previously set as the home view
void tcGuiFramework::PostEvent | ( | tcGuiEvent & | event | ) |
Post a GGUI event to the tcFramework Event Loop. This routine allows external device drivers to post mouse or keyboard events to the ggui framework without direct access to the tcBench object.
event | a valid tcGuiEvent |
void tcGuiFramework::AddTouchscreenHandler | ( | tcDspTouchScreen * | apScreen | ) |
This is a utility method that users may call to have the tcGuiFramework class manage / interpret events from a tcDspTocuhScreen and generate appropriate events (via PostEvent) to the tcGuiFramework event loop.
This routine will generate a thread with the name "GuiTouchHandler".
apScreen | pointer to tcDspTouchScreen device to manage. |
void MityDSP::tcGuiFramework::AddRemoteFrameBuffer | ( | tcRFBIface * | apIface | ) | [inline] |
bool tcGuiFramework::BuildBitmap | ( | tsDspRomFsNode * | apNode, | |
tcBitmap & | arBitMap | |||
) |
void MityDSP::tcGuiFramework::SetInactivityTimeout | ( | int | anTimeout | ) | [inline] |
int MityDSP::tcGuiFramework::GetInactivityTimeout | ( | ) | const [inline] |
void MityDSP::tcGuiFramework::SetInactivityEnable | ( | bool | abState | ) | [inline] |
void tcGuiFramework::EnableScreen | ( | bool | abOn | ) |
Explicitly enable/disable the screen. Typically used to wake up the screen in response to system event...
abOn | Set to true to enable the screen. |
void MityDSP::tcGuiFramework::SetBaseColor | ( | const tsRgb & | arColor | ) | [inline] |
void tcGuiFramework::DispatchEventLoop | ( | void * | apThis | ) | [static, protected] |
Internal method used dispatch the main event loop thread.
apThis | pointer to the active tcGuiFramework object. |
void tcGuiFramework::EventLoop | ( | void | ) | [protected] |
Main Event Loop
This method comprises of the tcGuiFramework main event loop thread. The event loop waits for incoming events (generated by animation time-outs or mouse clicks, etc.), processes them, and updates the screen accordingly.
void tcGuiFramework::FlipScreen | ( | void | ) | [protected] |
Flip the screen to show recently drawn data.
This routine is used to manage double (or triple) buffered screen areas in the event loop. Essentially, the visible screen is assigned to the active screen, and the contents of the active screen are copied to the next available screen buffer for future painting (allowing the use of invalid regions for optimized drawing). This screen buffer is then assigned to the active screen for future paint activity.
void tcGuiFramework::DispatchTSHandler | ( | void * | apThis, | |
void * | apScreen | |||
) | [static, protected] |
Static utility method to dispatch a TouchScreen Event handler.
apThis | pointer to valid tcGuiFramework object | |
apScreen | pointer to tcDspTouchScreen to Manage |
void tcGuiFramework::TSHandler | ( | tcDspTouchScreen * | apScreen | ) | [protected] |
tcDspTouchScreen Event Handler Method.
This method will monitor a provided touchscreen and generate appropriate ggui based mouse events (left button Up/Down, mouse move events) and hand them to the main tcGuiFramework Event Loop.
apScreen | pointer to tcDspTouchScreen to Manage |
tcGuiDspDisplay* MityDSP::tcGuiFramework::mpDisplay [protected] |
pointer to graphics display managed
int MityDSP::tcGuiFramework::mnUpdateRateMs [protected] |
update rate for event handling/animation
tcFrameBench* MityDSP::tcGuiFramework::mpBench [protected] |
pointer to ggui master bench object
int MityDSP::tcGuiFramework::mnLoopPrio [protected] |
default event loop priority
MBX_Handle MityDSP::tcGuiFramework::mhEventBox [protected] |
Event mail box.
int MityDSP::tcGuiFramework::mnTicksPerMs [protected] |
number of ticks per ms
tcRFBIface* MityDSP::tcGuiFramework::mpRFBIface [protected] |
remote frame buffer interface
const int MityDSP::tcGuiFramework::snHomeViewStrLen = 127 [static, protected] |
char MityDSP::tcGuiFramework::maHomeView[snHomeViewStrLen+1] [protected] |
"home" view name
int MityDSP::tcGuiFramework::mnInactivityTimer [protected] |
Ms since last user action.
int MityDSP::tcGuiFramework::mnInactivityTimeout [protected] |
timeout for display turn off
bool MityDSP::tcGuiFramework::mbInactivityTimeoutEnable [protected] |
Enable the inactivity timeout for screen off.
tsRgb MityDSP::tcGuiFramework::msBaseColor [protected] |
Background color for things without bitmaps.
Application interface.