/home/jonas/tidevel/adt/Advanced Dialogs/source/MessageBox.c

00001 /*
00002         Advanved Dialogs v1.05
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 23.11.2005; 03:30:30
00022 
00023 
00024 #include <extgraph.h>                                                   // ExtGraph by TI-Chess Team
00025 
00026 #include "AdvDialogs.h"                                                 // This should be obvious ;)
00027 #include "Internal.h"                                                   // This header should not be included in programs using Advanced Dialogs
00028 
00029 
00030 // Show a small message box
00031 short AdvDlgMessageBox(const char *title, const char *msg, uchar textcolor, uchar button, INT_HANDLER tempint1)
00032 {
00033         void *kbq = kbd_queue();
00034         short key;
00035         const short CX = (LCD_WIDTH - 160) >> 1;
00036         const short CY = (LCD_HEIGHT - 100) >> 1;               
00037         
00038         // Temporarily reinstall the original AUTO_INT_1
00039         if (tempint1 != DUMMY_HANDLER)
00040         {
00041                 GraySetInt1Handler(tempint1);
00042         }
00043         
00044         SaveScreen();
00045         
00046         // Clear keyboard queue
00047         //ClearKbdQueue();
00048         
00049         // Draw dialog box
00050         GrayDrawRect(30+CX, 42+CY, 130+CX, 65+CY, COLOR_LIGHTGRAY, RECT_FILLED);
00051         GrayDrawRect(30+CX, 35+CY, 130+CX, 41+CY, COLOR_BLACK, RECT_FILLED);
00052         GrayFastDrawLine(31+CX, 66+CY, 131+CX, 66+CY, COLOR_BLACK);
00053         GrayFastDrawLine(131+CX, 36+CY, 131+CX, 66+CY, COLOR_BLACK);
00054 
00055         // Add title
00056         GrayDrawStrExt(0, 36+CY, title, A_XOR | A_CENTERED, F_4x6);
00057 
00058         // Add message
00059         GrayDrawColorString(TXTSTART+CX, 45+CY, msg, textcolor, TXT_STANDARD);
00060         
00061         // Add button
00062         if (button != B_NONE)
00063         {
00064                 GraySprite16_RPLC_R(106+CX, 55+CY, 9, &gbutton[0], &gbutton[9], GRAYPLANES);
00065                 GrayDrawStrExt(109-((strlen(bttext[button])-2)*2)+CX, 57+CY, bttext[button], A_NORMAL,  F_4x6);
00066         }
00067 
00068         GetKey(kbq, &key);
00069         
00070         // Set AUTO_INT_1 to dummy again
00071         if (tempint1 != DUMMY_HANDLER)
00072         {
00073                 GraySetInt1Handler(DUMMY_HANDLER);
00074         }
00075         
00076         // Clear keyboard queue
00077         //ClearKbdQueue();
00078         
00079         RestoreScreen();
00080         
00081         return key;
00082 }
00083 
00084 
00085 

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