/home/jonas/tidevel/adt/Advanced Dialogs/lib/AdvDialogs.h

Go to the documentation of this file.
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 // Header File
00021 // Created 26.01.05; 13:18:51
00022 
00023 
00024 #ifndef _ADVDIALOGS_H 
00025 #define _ADVDIALOGS_H
00026 
00027 
00037 // Neccessary header files from TIGCCLIB
00038 #include <alloc.h>                                                              // Routines for dynamic memory allocation
00039 #include <asmtypes.h>                                                           // Common type definitions known to ASM programmers
00040 #include <compat.h>                                                             // Various calc-dependent and AMS-dependent pseudo-constants
00041 #include <ctype.h>                                                              // Routines for checking and changing character types
00042 #include <graph.h>                                                              // Common (non-windowed) graphic routines
00043 #include <intr.h>                                                               // Routines for creating interrupt handlers
00044 #include <kbd.h>                                                                // Keyboard handling routines
00045 #include <string.h>                                                             // ANSI-compatible string manipulation routines
00046 #include <system.h>                                                             // System routines (for accessing system timers, queues, etc.)
00047 
00048 
00049 // Start of text
00050 #define TXTSTART 35
00051 
00052 #define NEXTTAB -2
00053 
00054 // Just a short macro to make working with grayscales easier :)
00055 #define GRAYPLANES GrayGetPlane(DARK_PLANE), GrayGetPlane(LIGHT_PLANE)
00056 
00057 
00058 
00059 /*_________Enumerations and Text_________*/
00060 
00061 
00063 enum _inputModes
00064 {
00066         INPUT_STR,
00068         INPUT_INT
00069 };
00070 
00072 enum _textAttributes
00073 {
00075         TXT_STANDARD,
00077         TXT_ALIGNRIGHT,
00079         TXT_CENTERED
00080 };
00081 
00083 enum _buttonTypes
00084 {
00086         B_NONE = 0,
00088         B_OK,
00090         B_ESC,
00092         B_YES,
00094         B_NO,
00095 };
00096 
00097 
00098 /*_______________Typedefs________________*/
00099 
00101 typedef unsigned char uchar;
00102 
00103 
00104 
00105 /*_______________Structures______________*/
00106 
00108 typedef struct _advel
00109 {
00111         uchar element;
00113         char text[50];
00115         uchar color;
00117         char *inputbuffer;
00119         const char **itemlist;
00121         short *selected;
00123         short inputsize;
00125         uchar flag;
00126 }
00127 ADVEL;
00128 
00130 typedef struct _advbitmap
00131 {
00133         short x;
00135         short y;
00137         BITMAP *data;
00138 }
00139 ADVBITMAP;
00140 
00142 typedef struct _advtab
00143 {
00145         ADVEL elements[6];
00147         ADVBITMAP *bitmaps[6];
00149         uchar numbitmaps;
00151         uchar numelements;
00153         char title[40];
00154 }
00155 ADVTAB;
00156 
00158 typedef struct _advdialog
00159 {
00161         ADVTAB tabs[6];
00163         uchar numtabs;
00165         char title[50];
00167         short left_x;
00169         short top_y;
00171         short right_x;
00173         short bottom_y;
00175         uchar buttons[2];
00177         BOOL savescreen;
00179         INT_HANDLER inthandler;
00180 }
00181 ADVDIALOG;
00182 
00183 
00184 
00185 /*________________Globals________________*/
00186 
00188 extern BOOL AD_CHECKED[6][6];
00189 
00190 
00191 
00192 /*___________Dialog functions____________*/
00193 
00205 ADVDIALOG *AdvDlgNew(short width, short height, const char *title, BOOL savescreen);
00206 
00213 void AdvDlgAddTab(ADVDIALOG *dialog, uchar tab, const char *title);
00214 
00225 void AdvDlgAddText(ADVDIALOG *dialog, uchar tab, uchar line, const char *text, uchar attr, uchar color);
00226 
00239 void AdvDlgAddInputBox(ADVDIALOG *dialog, uchar tab, uchar line, const char *text, char *buffer, short maxsize, uchar mode, uchar color);
00240 
00250 void AdvDlgAddCheckBox(ADVDIALOG *dialog, uchar tab, uchar line, const char *text, BOOL checked, uchar color);
00251 
00263 void AdvDlgAddDropDown(ADVDIALOG *dialog, uchar tab, uchar line, const char *text, const char **itemlist, short numitems, short *selected, uchar color);
00264 
00272 void AdvDlgAddButton(ADVDIALOG *dialog, uchar pos, uchar button);
00273 
00285 char AdvDlgAddBitmap(ADVDIALOG *dialog, uchar tab, short x, short y, ADVBITMAP *bitmap);
00286 
00294 ADVBITMAP *AdvDlgBitmapNew(short width, short height, const unsigned char *lpdata, const unsigned char *dpdata);
00295 
00302 BOOL AdvDlgDo(ADVDIALOG *dialog, INT_HANDLER tempint1);
00303 
00310 void AdvDlgFree(ADVDIALOG *dialog);
00311 
00312 
00324 short AdvDlgMessageBox(const char *title, const char *msg, uchar textcolor, uchar button, INT_HANDLER tempint1);
00325 
00326 
00327 
00328 /*_________ProgressBar functions_________*/
00329 
00337 void AdvDlgProgressBar(const char *title, const char *msg, short steps);
00338 
00346 void AdvDlgProgressUp(void);
00347 
00348 
00349 
00350 /*___________Utility functions___________*/
00351 
00359 void SaveScreen(void);
00360 
00370 void GrayDrawColorString(short x, short y, const char *str, uchar color, uchar mode);
00371 
00379 void RestoreScreen(void);
00380 
00385 void ClearKbdQueue(void);
00386 
00391 void GetKey(void *kbq, short *key);
00392 
00393 
00394 
00395 /*___________Misc Definitions____________*/
00396 
00397 // The Version number
00398 #define ADVDLG_VERSION_STR "1.05"
00399 
00400 
00401 #endif
00402 
00403 
00404 

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