adsmpl.c

This example shows how to setup a simple dialog

/*
        Advanved Dialogs v1.0.7 - Example program
        Copyright (C) 2005-2008 Jonas Gehring

        Advanced Dialogs is free software; you can redistribute it and/or modify
        it under the terms of the GNU Lesser General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.

        Advanced Dialogs is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU Lesser General Public License for more details.

        You should have received a copy of the GNU Lesser General Public License
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/


// C Source File
// Created 14.03.2005; 22:27:21


#include <tigcclib.h>                                   // Include all standard header files

#include <extgraph.h>                                   // Include ExtGraph v2.00beta5 by TI-Chess Team
#include <AdvDialogs.h>                                 // Powered by Advanced Dialogs v1.0.7
      

// Main Function
void _main(void)
{
        LCD_BUFFER *screen;
        ADVDIALOG *dialog;

        // Allocate space for the LCD buffer
        if (((screen = malloc(sizeof(LCD_BUFFER))) == NULL))
        {
                return;
        }
        
        LCD_save(screen);                                               // Save LCD contents

        ClrScr();                                                               // Clear LCD contents

        if (!GrayOn())                                                  // Turn on grayscale graphics
        {
                free(screen);
                return;
        }
        
        memset(GrayGetPlane(DARK_PLANE), 0xFF, sizeof(LCD_BUFFER));             // Make the screen dark gray

        // Create dialog
        dialog = AdvDlgNew(100, 55, "Advanced Dialogs", FALSE);
        
        // Add dialog components
        AdvDlgAddText(dialog, 0, 0, "Advanced Dialogs "ADVDLG_VERSION_STR, TXT_CENTERED, COLOR_BLACK);
        AdvDlgAddText(dialog, 0, 2, "by saubue", TXT_CENTERED, COLOR_BLACK);
        AdvDlgAddText(dialog, 0, 3, "powered by ExtGraph", TXT_CENTERED, COLOR_BLACK);
        
        // Add buttons
        AdvDlgAddButton(dialog, 1, B_OK);
        
        // Execute dialog
        AdvDlgDo(dialog, DUMMY_HANDLER);
        
        AdvDlgFree(dialog);
        
        // Restore contents
        ClearGrayScreen();
        GrayOff();
        LCD_restore(screen);
        free(screen);
        ST_helpMsg("http://www.boolsoft.org");
}


Generated on Wed Nov 5 09:46:56 2008 for Advanced Dialogs by  doxygen 1.5.7.1