adsmpl.c

This example shows how to setup a simple dialog

00001 /*
00002         Advanved Dialogs v1.05 - Example program
00003         Copyright (C) 2005-2007 Jonas Gehring
00004 
00005         Advanced Dialogs is free software; you can redistribute it and/or modify
00006         it under the terms of the GNU Lesser General Public License as published by
00007         the Free Software Foundation; either version 2 of the License, or
00008         (at your option) any later version.
00009 
00010         Advanced Dialogs is distributed in the hope that it will be useful,
00011         but WITHOUT ANY WARRANTY; without even the implied warranty of
00012         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013         GNU Lesser General Public License for more details.
00014 
00015         You should have received a copy of the GNU Lesser General Public License
00016         along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 
00020 // C Source File
00021 // Created 14.03.2005; 22:27:21
00022 
00023 
00024 #include <tigcclib.h>                                   // Include all standard header files
00025 
00026 #include "extgraph.h"                                   // Include ExtGraph v2.00beta5 by TI-Chess Team
00027 #include "AdvDialogs.h"                                 // Powered by Advanced Dialogs v1.05
00028       
00029 
00030 // Main Function
00031 void _main(void)
00032 {
00033         LCD_BUFFER *screen;
00034         ADVDIALOG *dialog;
00035 
00036         // Allocate space for the LCD buffer
00037         if (((screen = malloc(sizeof(LCD_BUFFER))) == NULL))
00038         {
00039                 return;
00040         }
00041         
00042         LCD_save(screen);                                               // Save LCD contents
00043 
00044         ClrScr();                                                               // Clear LCD contents
00045 
00046         if (!GrayOn())                                                  // Turn on grayscale graphics
00047         {
00048                 free(screen);
00049                 return;
00050         }
00051         
00052         memset(GrayGetPlane(DARK_PLANE), 0xFF, sizeof(LCD_BUFFER));             // Make the screen dark gray
00053 
00054         // Create dialog
00055         dialog = AdvDlgNew(100, 55, "Advanced Dialogs", FALSE);
00056         
00057         // Add dialog components
00058         AdvDlgAddText(dialog, 0, 0, "Advanced Dialogs "ADVDLG_VERSION_STR, TXT_CENTERED, COLOR_BLACK);
00059         AdvDlgAddText(dialog, 0, 2, "by saubue", TXT_CENTERED, COLOR_BLACK);
00060         AdvDlgAddText(dialog, 0, 3, "powered by ExtGraph", TXT_CENTERED, COLOR_BLACK);
00061         
00062         // Add buttons
00063         AdvDlgAddButton(dialog, 1, B_OK);
00064         
00065         // Execute dialog
00066         AdvDlgDo(dialog, DUMMY_HANDLER);
00067         
00068         AdvDlgFree(dialog);
00069         
00070         // Restore contents
00071         ClearGrayScreen();
00072         GrayOff();
00073         LCD_restore(screen);
00074         free(screen);
00075         ST_helpMsg("http://www.boolsoft.org");
00076 }
00077 

Generated on Thu Oct 4 19:42:03 2007 for Advanced Dialogs by  doxygen 1.5.1