/* Advanved Dialogs v0.91 Copyright (C) 2005 Jonas Gehring Advanved Dialogs is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Advanved 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 General Public License for more details. You should have received a copy of the GNU General Public License along with Advanved Dialogs; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Header File // Created 26.01.05; 13:18:51 #ifndef ADVDIALOGS_H #define ADVDIALOGS_H /**************************************************** * Please see the file "doc\documentation.htm" * * in the .zip-package for information * * about how to use Advanced Dialogs!! * ****************************************************/ // Neccessary header files from TIGCCLIB #include // Routines for dynamic memory allocation #include // Common type definitions known to ASM programmers #include // Various calc-dependent and AMS-dependent pseudo-constants #include // Routines for checking and changing character types #include // Common (non-windowed) graphic routines #include // Routines for creating interrupt handlers #include // Keyboard handling routines #include // ANSI-compatible string manipulation routines #include // System routines (for accessing system timers, queues, etc.) // Start and end of text #define TXTSTART 35 #define TXTEND 126 // Just a short macro to make working with grayscales easier :) #define GRAYPLANES GrayGetPlane(LIGHT_PLANE), GrayGetPlane(DARK_PLANE) /*_________Enumerations and Text_________*/ // Describes valid buttons for an advanced dialog enum buttons {B_OK = 0, B_ESC, B_YES, B_NO, B_NONE}; // Describes valid input modes enum inputs {INPUT_STR, INPUT_INT}; // Describes vaild text attributes enum textattr {TXT_STANDARD, TXT_CENTERED}; // Messages for the buttons const char *bttext[4] = {"OK", "ESC", "YES", "NO"}; // Describes valid Dialog elements enum elementnames {AD_NONE, AD_TEXT, AD_INPUT, AD_CHECKBOX}; /*_______________Structures______________*/ typedef struct AdvDlgElement { short element; // Element char text[50]; // Text char *inputbuffer; // Buffer (for input only) short inputsize; // Maximal (chars or numbers) (for InputBox only) short inputmode; // Mode (chars or numbers) (for InputBox only) BOOL checked; // Checked (for CheckBox only) short attr; // Attribute (for Text only) } AD_EL; /*________________Globals________________*/ // Temporary screen buffer void *tscr1, *tscr2; // CheckBox indicators BOOL AD_CHECKED[8]; /*___________Dialog functions____________*/ // Show a small message box void AdvDlgMessage(const char *title, const char *msg, short button); // Activates a CheckBox short AdvDlgCheckBox(short number); // Activates an InputBox short AdvDlgInputBox(short number); // Initializes a Dialog BOOL AdvDlgInit(short width, short height, const char *title, short button1, short button2, BOOL flag, INT_HANDLER auto_int_1); // Adds an element to a dialog BOOL AdvDlgAdd(short element, const char *text, char *inputbuffer, short inputsize, short inputmode, BOOL checked, short attr); // Draws an element of a Dialog void AdvDlgDraw(short number); // Draws the basic things (window, buttons, title) void AdvDlgDrawBasic(void); // Runs a Dialog BOOL AdvDlgDo(void); /*_________ProgressBar functions_________*/ // Initializes a progress bar void AdvDlgProgressBar(const char *title, const char *msg, short steps); // Progresses the progress bar void AdvDlgProgressUp(); /*___________Utility functions___________*/ // Save grayscale screen contents void SaveScreen(void); // Restore grayscale screen contents void RestoreScreen(void); // Clears the keyboard queue void ClearKbdQueue(void); /*___________Misc Definitions____________*/ // The Version number #define ADVDLG_VERSION_STR "v0.91" // These pseudo-constants make sure the dialog is centered // on a TI92+/V200 display as well #define CENTER_XL(x) ((LCD_WIDTH-x)/2) #define CENTER_YT(y) ((LCD_HEIGHT-y)/2) #define CENTER_XR(x) ((LCD_WIDTH+x)/2) #define CENTER_YB(y) ((LCD_HEIGHT+y)/2) #endif