////////////////////////////////////////////////////////// // CUIToolkit.h // // // // Curses-based UI toolkit. Encapsulates and builds // // curses into a limited but useful dialog box-based // // text-mode GUI. Provides functions for displaying // // informational dialog boxes, string-prompt dialog // // boxes, and list selection dialog boxes. // // // // AUTHOR: Lucas Scharf, 3/20/1998 - 3/30/1998 // // // // REVISIONS: DATE, REASON // // AUTHOR FOR EACH (if different) // // VERSION: 2.00 // ////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////// // Multiple Inclusion Protection // ////////////////////////////////////////////////////////// #ifndef CUITOOLKIT_H #define CUITOOLKIT_H ////////////////////////////////////////////////////////// // Other Header Files // ////////////////////////////////////////////////////////// #include "Constants.h" #include ////////////////////////////////////////////////////////// // Public Data Types // ////////////////////////////////////////////////////////// //-- Stack info -- typedef struct WindowStackItemTag { /* The stack will be implimented as a circular double-linked list. This will improve the efficiency of the screen refresh. Most of the time, though, the stack metaphor will be enforced.*/ WINDOW *WindowPtr; //Pointer to the window WindowStackItemTag *LinkPrevious, //Link to the previous item in the stack *LinkNext; //Link to the next item in the stack } WindowStackItem; //-- ListPrompt item info -- typedef struct CUIListItemTag{ /* This will be implimented as a circular double-linked list. This proves to be the most efficient and convenient underlying representation for the menu data */ char Title[StringLength+1]; //Title of the list item char Flag; //Flag for the type of list item void *MoreInfoPtr; //Pointer to more info about the listitem CUIListItemTag *LinkNext, //Link to next item in the list *LinkPrevious; //Link to previous item in the list } CUIListItem; typedef CUIListItem *CUIListItemPtr; //Pointer type to CUILIstItem ////////////////////////////////////////////////////////// // Public Function Prototypes // ////////////////////////////////////////////////////////// //-- Init & De-Init -- void CUIInit(); void CUIShutdown(); //-- Create & Destroy Windows -- void CUICreateWindow(int Xpos, int Ypos, int Xsize, int Ysize); bool CUIDestroyWindow(); //-- Refresh Screen -- void CUIRedrawScreen(); //-- Modify Background -- void CUIWriteText(int Xpos, int Ypos, char Text[]); //-- Simple Dialog Boxes -- void CUIDialogOk(char Text[], char Title[]); void CUIDisplayFile(char FileName[]); void CUIDialogStringPrompt(char Text[], char Title[], char UserResponse[], int NumChars); //-- List Prompt & Helpers -- void CUIListPrompt(CUIListItemPtr ListHeadPtr, CUIListItemPtr &ItemSelected, char Title[], int &LastKey); void CUICreateList(CUIListItemPtr &ListHeadPtr); void CUIDestroyList(CUIListItemPtr &ListHeadPtr); void CUIAddItem(CUIListItemPtr &ListHeadPtr, CUIListItem NewItem); void CUIRemoveItem(CUIListItemPtr &ListHeadPtr, CUIListItemPtr ItemToDeletePtr); //-- String Info -- int LenLongestLine(const char AString[]); int NumLines(const char AString[]); #endif