| home
| contents
| previous
| next page
| send comment
| send link
| add bookmark |
dialog.h
/*-------------------------------------------------------------------------*
DIALOG.H
class definition for dialog creation and input module
by: Stephen R. Schmitt
*-------------------------------------------------------------------------*/
// dialog control types
#define PUSH_CTRL 1
#define EDIT_CTRL 2
#define TEXT_CTRL 3
#define LIST_CTRL 4
#define CBOX_CTRL 5
// standard dialog button controls
#define CANCEL_BTN 1
#define OK_BTN 2
#define HELP_BTN 4
#define YES_BTN 8
#define NO_BTN 16
#define LOW_BLOCK 220
#define HIGH_BLOCK 223
#define MAX_CTRLS 16
typedef struct
{
int ctrl; // control type
int x; // start col relative to dialog box
int y; // start row relative to dialog box
int key; // alt+key to select
int code; // value to return on activation
int check; // check box state
char *text; // of control, use # to indicate alt key
char *data; // string to be returned
int len; // length of data input box
int cur; // cursor location relative to beg
int insert; // insert-overwrite indicator
char *list; // list of strings
int wdth; // width of list
int size; // number of items in list
int item; // item selected
int top; // first item in display
}
CONTROL;
class dialog
{
int x; // col of upper left corner
int y; // row of upper left corner
int dy; // height of dialog box
int dx; // width of dialog box
int fore; // foreground color
int back; // background color
char *title; // title of dialog box
int count; // number of controls
int format_message( char *, char *, int, int );
int button_message( int, int, int );
void button_shadow( int, int, int );
void normal_button( int );
void write_edit_message( int, int, int );
void write_edit_box( int, int );
void normal_edit( int );
void select_edit( int );
void write_list_message( int, int, int );
void write_list_box( int, int, int );
void normal_list( int );
void select_list( int );
void normal_cbox( int );
void select_cbox( int );
void normal_text( int );
void update_edit_data( int, int );
void update_list_item( int, int );
int init_dialog();
public:
CONTROL ctrl[MAX_CTRLS]; // array of control structures
int make_text_ctrl( int, int, char * );
int make_push_ctrl( int, int, int, int, char * );
int make_edit_ctrl( int, int, int, int, char *, char *, int );
int make_list_ctrl( int, int, int, int, char *, char *, int, int );
int make_cbox_ctrl( int, int, int, int, char * );
void make_dialog( char *, int, int, int, int );
int shift_tab_select( int );
int tab_select( int );
void select_button( int );
void pushed_button( int );
void init_edit( int );
void change_list( int, char *, int, int );
int alt_key_select( int, int );
void set_cbox( int );
void clear_cbox( int );
void disable_cbox( int );
int return_cbox( int );
void normal_control( int );
void select_control( int );
void update_control( int, int );
void update_text( int, char * );
int paint_dialog();
void erase_dialog();
void paint_border( int, int, int, int );
int ctrl_code( int i ){ return( ctrl[i].code ); };
char *edit_ctrl_data( int i ){ return( ctrl[i].data ); };
int list_ctrl_item( int i ){ return( ctrl[i].item ); };
};
| home
| contents
| previous
| next page
| send comment
| send link
| add bookmark |
Copyright © 2004, Stephen R. Schmitt