MityDSP Documentation Index

tcGuiFramework

Introduction

The tcGuiFramework class provides the top level management of the GGUI library created widgets and views. On construction, tcGuiFramework class parses a provided GGUI skins directory and XML skins file and creates all of the defined widgets and views. Once the widgets have been created the tcGuiFramework class then spawns a GUI thread which periodically handles invalidation requests and HMI input events such as mouse buttons or keystrokes. The tcGuiFramework class and GUI thread should be considered the primary "owners" of the provided tcGuiDisplay hardware object, as it coordinates with it's managed widgets all repaint and animation events.

See also:
MityDSP::tcGuiFramework Class Reference
guiFramework.h

Example

This is an example of initializing the GGUI library using the tcGuiFramework management class. This example includes initialization of the hardware display class and touchscreen as well as the loading of three font descriptor sets.

 //---------------------------------------------------------------
 // this section is used to load font files (.bit and .wid) files 
 // generated from the FontGen and DDFontMake tools...
 #define BIT8FONT_HEIGHT      13
 #define BIT8FONT_MAXWIDTH    8
 #define BYTES_PER_BIT8FONT  \
     (BIT8FONT_HEIGHT * ((BIT8FONT_MAXWIDTH + 7) / 8))
 
 #define BIT10FONT_HEIGHT     15
 #define BIT10FONT_MAXWIDTH   8
 #define BYTES_PER_BIT10FONT  \
     (BIT10FONT_HEIGHT * ((BIT10FONT_MAXWIDTH + 7) / 8))
 
 #define BIT12FONT_HEIGHT       19
 #define BIT12FONT_MAXWIDTH     16
 #define BYTES_PER_BIT12FONT  \
     (BIT12FONT_HEIGHT * ((BIT12FONT_MAXWIDTH + 7) / 8))
 
 unsigned char Font8Bitmaps[CHARS_PER_FONT][BYTES_PER_BIT8FONT] =
 {
     #include "Bits8.bit"
 };
 int Font8Width[CHARS_PER_FONT] =
 {
     #include "Bits8.wid"
 };
 unsigned char Font10Bitmaps[CHARS_PER_FONT][BYTES_PER_BIT10FONT] =
 {
     #include "Bits10.bit"
 };
 int Font10Width[CHARS_PER_FONT] =
 {
     #include "Bits10.wid"
 };
 unsigned char Font12Bitmaps[CHARS_PER_FONT][BYTES_PER_BIT12FONT] =
 {
     #include "Bits12.bit"
 };
 int Font12Width[CHARS_PER_FONT] =
 {
     #include "Bits12.wid"
 };
 //-----------------------------------------------------------------
 extern tsDspRomFsNode GGUI_FILE_SYSTEM[];   

 some_class_initializer()
 {
    int   i;
    void *lpDisplayScreens[DISPLAY_SCREENS];

    // instantiate the interface to the FPGA DMA controller
    mpDisplayDma = new tcDspFpgaDma((void *)DISPLAY_DMA_BASE);

    // create interface to QVGA display, and provide DMA access and channel
    mpQvgaDisplay = new tcDspQvga16((void *)QVGA_DISPLAY_BASE,
                                    mpDisplayDma, tcDspFpgaDma::eeChannel1, true );
    mhTouchSemaphore = SEM_create(0, NULL);                                
                                    
    // create touch screen interface...
    mpTouchScreen = new tcDspTouchScreen((void *)TOUCHSCREEN_BASE,
                                         mpQvgaDisplay->GetWidthPixels(),
                                         mpQvgaDisplay->GetHeightPixels(),
                                         mhTouchSemaphore,
                                         true); /* must rotate for sharp display */
    

    // create frame buffers in heap, ensuring 4-byte alignment
    for (i=0; i<DISPLAY_SCREENS; i++)
    {
        // make sure DMA lands on an even 4 32-bit word boundary
        lpDisplayScreens[i] = new int [(mpQvgaDisplay->GetFrameBufferBytes() / sizeof(int)) + 3];
        lpDisplayScreens[i] = (void *)((unsigned int)(lpDisplayScreens[i]) & 0xFFFFFFF0);
        memset(lpDisplayScreens[i], NULL, mpQvgaDisplay->GetFrameBufferBytes());
    }

    tcDspFont* lpFont = new tcDspFont("medium", START_CHAR, CHARS_PER_FONT,
                                 BYTES_PER_MEDFONT, MEDFONT_HEIGHT,
                                 MedFontWidth, &MedFontBitmaps[0][0]);

    // create display instance
    mpDisplay = new tcGuiDspDisplay(mpQvgaDisplay, DISPLAY_SCREENS, lpDisplayScreens, lpFont, true);

    // create some fonts for use with the display
    tcBench::tsFontDecl laFontDecls[3];
    laFontDecls[0].FontName     = "8Bit"; 
    laFontDecls[0].StartChar    = START_CHAR;
    laFontDecls[0].NumChars     = CHARS_PER_FONT; 
    laFontDecls[0].BytesPerFont = BYTES_PER_BIT8FONT;
    laFontDecls[0].FontHeight   = BIT8FONT_HEIGHT; 
    laFontDecls[0].CharWidths   = Font8Width; 
    laFontDecls[0].bitmap       = &Font8Bitmaps[0][0];

    laFontDecls[1].FontName     = "10Bit"; 
    laFontDecls[1].StartChar    = START_CHAR;
    laFontDecls[1].NumChars     = CHARS_PER_FONT; 
    laFontDecls[1].BytesPerFont = BYTES_PER_BIT10FONT;
    laFontDecls[1].FontHeight   = BIT10FONT_HEIGHT; 
    laFontDecls[1].CharWidths   = Font10Width; 
    laFontDecls[1].bitmap       = &Font10Bitmaps[0][0];

    laFontDecls[2].FontName     = "12Bit"; 
    laFontDecls[2].StartChar    = START_CHAR;
    laFontDecls[2].NumChars     = CHARS_PER_FONT; 
    laFontDecls[2].BytesPerFont = BYTES_PER_BIT12FONT;
    laFontDecls[2].FontHeight   = BIT12FONT_HEIGHT; 
    laFontDecls[2].CharWidths   = Font12Width; 
    laFontDecls[2].bitmap       = &Font12Bitmaps[0][0];

    // build the GGUI framework.  This loads the XML file and constructs
    // all of the underlying widgets and spawns the main GUI thread.
    mpFrameWork = new tcGuiFramework( laFontDecls, 3, mpDisplay, GGUI_FILE_SYSTEM, 8);
    
    // spawn a utility thread to generate mouse events from the MityDSP touchscreen
    mpFrameWork->AddTouchscreenHandler(mpTouchScreen);
    
    // these classes are application specific, and are used to handle each view and
    // widget events from the associated view.
    mpNumEntry = new tcNumEntry(mpFrameWork);
    mpAboutScreen = new tcAboutScreen(mpFrameWork);
    mpMainScreen = new tcMainScreen(mpFrameWork, mpITTConfig, mpFaultScreen);

    // Tell the Framework to show the MAINSCREEN view defined in the XML file
    mpFrameWork->ShowView("MAINSCREEN");

    // at this point the GUI is active and widget callbacks will begin firing...
    

 } 

  
Generated on Fri Sep 23 16:34:05 2011 for MityDSP Skinnable Graphics User Interface (GGUI) by  Doxygen Version 1.6.1
Copyright © 2009, Critical Link LLC, All rights reserved.