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 // Turn on grayscale graphics 00034 if (!GrayOn()) 00035 { 00036 return; 00037 } 00038 00039 ADVDIALOG *dialog = AdvDlgNew(140, 72, "Setup", TRUE); // Create dialog with title "Setup" 00040 char inputbuffer[35]; 00041 const char *items[5] = {"Option 1", "Option 2", "Option 3", "Option 4", "Unbelievable Option 5"}; 00042 short itemselect = 0; 00043 00044 memset(inputbuffer, 0, 35); 00045 00046 // Check if the creation was successful 00047 if (dialog == NULL) 00048 { 00049 GrayOff(); 00050 return; 00051 } 00052 00053 AdvDlgAddTab(dialog, 0, "Info"); // First tab: "Info" 00054 00055 AdvDlgAddText(dialog, 0, 0, "This is a demonstration of the", TXT_STANDARD, COLOR_BLACK); 00056 AdvDlgAddText(dialog, 0, 1, "TIGCC Library Advanced Dialogs", TXT_STANDARD, COLOR_BLACK); 00057 AdvDlgAddText(dialog, 0, 3, "Use [APPS] to switch between the tabs.", TXT_STANDARD, COLOR_BLACK); 00058 00059 AdvDlgAddTab(dialog, 1, "Personal"); // Second tab: "Personal" 00060 00061 AdvDlgAddInputBox(dialog, 1, 0, "Your name:", &inputbuffer[0], 19, INPUT_STR, COLOR_BLACK); 00062 AdvDlgAddInputBox(dialog, 1, 1, "Your age: ", &inputbuffer[20], 2, INPUT_INT, COLOR_BLACK); 00063 AdvDlgAddText(dialog, 1, 2, "You cannot log in without your ID!", TXT_CENTERED, COLOR_WHITE); 00064 AdvDlgAddInputBox(dialog, 1, 3, "Your ID: ", &inputbuffer[23], 8, INPUT_INT, COLOR_BLACK); 00065 00066 AdvDlgAddTab(dialog, 3, "Settings"); // Third tab: "Settings" 00067 00068 AdvDlgAddText(dialog, 3, 0, "Please choose your settings", TXT_STANDARD, COLOR_BLACK); 00069 AdvDlgAddCheckBox(dialog, 3, 1, "Auto log-in", FALSE, COLOR_BLACK); 00070 AdvDlgAddCheckBox(dialog, 3, 2, "Save settings", FALSE, COLOR_BLACK); 00071 AdvDlgAddDropDown(dialog, 3, 3, "Default options:", items, 5, &itemselect, COLOR_BLACK); 00072 AdvDlgAddCheckBox(dialog, 3, 4, "Use default theme", TRUE, COLOR_BLACK); 00073 00074 AdvDlgAddTab(dialog, 2, "About"); // Fourth tab: "About" 00075 00076 AdvDlgAddText(dialog, 2, 0, "Advanced Dialogs", TXT_CENTERED, COLOR_BLACK); 00077 AdvDlgAddText(dialog, 2, 1, "- "ADVDLG_VERSION_STR" -", TXT_CENTERED, COLOR_BLACK); 00078 AdvDlgAddText(dialog, 2, 3, "visit our website:", TXT_CENTERED, COLOR_BLACK); 00079 AdvDlgAddText(dialog, 2, 4, "http://www.boolsoft.org", TXT_CENTERED, COLOR_WHITE); 00080 00081 // Finally, we're adding some buttons 00082 AdvDlgAddButton(dialog, 0, B_OK); 00083 AdvDlgAddButton(dialog, 1, B_ESC); 00084 00085 // Execute the dialg 00086 AdvDlgDo(dialog, DUMMY_HANDLER); 00087 00088 // Free the dialog; you can also simply call "free(dialog)" 00089 AdvDlgFree(dialog); 00090 00091 GrayOff(); 00092 ClearKbdQueue(); 00093 00094 // Final message 00095 ST_helpMsg("http://www.boolsoft.org"); 00096 } 00097