Esempio n. 1
0
/* struct used to describe string broken into segments that can be displayed
 * one per line */
typedef struct string_info {
    char        *text;
    int         length;
} string_info;

#define TEXT_ROW        1
#define TEXT_START_COL  2
#define ICON_ROW        1
#define BUTTON_ROW      3
#define BUTTON_WIDTH    7

/* control definition for each control that can be in the dialog */
static control_pairs MessageControls[] = {
 {  DLG_BUTTON( NULL,           GUI_RET_ABORT,  0, 0, BUTTON_WIDTH ),   ABORT       },
 {  DLG_BUTTON( NULL,           GUI_RET_CANCEL, 0, 0, BUTTON_WIDTH ),   CANCEL      },
 {  DLG_BUTTON( NULL,           GUI_RET_IGNORE, 0, 0, BUTTON_WIDTH ),   IGNORE      },
 {  DLG_BUTTON( NULL,           GUI_RET_NO,     0, 0, BUTTON_WIDTH ),   NO          },
 {  DLG_DEFBUTTON( NULL,        GUI_RET_OK,     0, 0, BUTTON_WIDTH ),   OK          },
 {  DLG_BUTTON( NULL,           GUI_RET_RETRY,  0, 0, BUTTON_WIDTH ),   RETRY       },
 {  DLG_BUTTON( NULL,           GUI_RET_YES,    0, 0, BUTTON_WIDTH ),   YES         },
 {  DLG_STRING( "!",                            0, 0, 1 ),              EXCLAMATION },
 {  DLG_STRING( "?",                            0, 0, 1 ),              QUESTION    },
 {  DLG_STRING( "i",                            0, 0, 1 ),              INFORMATION },
 {  DLG_STRING( NULL,                           0, 0, 5 ),              STOP        }
};
#define NUM_CONTROL_TYPES ( sizeof( MessageControls ) / sizeof( control_pairs ) )

/* static text controls used for displaying message */
static gui_control_info StaticMessage = DLG_STRING( NULL, TEXT_START_COL, TEXT_ROW, 0 );
Esempio n. 2
0
enum {
    CTL_CMD_OK = 100,
    CTL_CMD_CANCEL,
    CTL_CMD_EDIT,
    CTL_CMD_HISTORY,
    CTL_CMD_CHECK,
};

#define DLG_CMD_ROWS    12
#define DLG_CMD_COLS    35

static gui_control_info Controls[] = {
    DLG_EDIT( "",             CTL_CMD_EDIT,     1,  0, 29 ),
    DLG_LIST_BOX( NULL,       CTL_CMD_HISTORY,  1,  2, 29, 5 ),

    DLG_BUTTON( "&OK",        CTL_CMD_OK,       2,  7, 12 ),
    DLG_DEFBUTTON( "&Cancel", CTL_CMD_CANCEL,   18, 7, 28 ),
    DLG_CHECK( "C&heck Me",   CTL_CMD_CHECK,    1,  9, 28 ),
};

#define NUM_CONTROLS ArraySize( Controls )

static char *Stuff[] = { "stuff1", "stuff2", "stuff3" };

static void DoCmd( char *cmd )
{
    Say( cmd );
}


extern bool CmdEvent( gui_window * gui, gui_event gui_ev, void * param )
Esempio n. 3
0
#define BOX_WIDTH2      25

#define DIR_START       27

// if dlgControls is modified then make sure the function InitDlgControls
// matches it
static gui_control_info dlgControls[] =
{
/*  0 */ DLG_STRING(    NULL, 2, 0, 11 ),
/*  1 */ DLG_STRING(    NULL, DIR_START, 0, DIR_START+12 ),
/*  2 */ DLG_EDIT(      NULL, CTL_EDIT, 2, 1, BOX_WIDTH+3 ),
/*  3 */ DLG_DYNSTRING( NULL, CTL_DIR_NAME, DIR_START, 1, DLG_FILE_COLS-1 ),
/*  4 */ DLG_LIST_BOX(  NULL, CTL_FILE_LIST,    2, 3, 2+BOX_WIDTH, 9 ),
/*  5 */ DLG_LIST_BOX(  NULL, CTL_DIR_LIST,     DIR_START, 3, DIR_START+BOX_WIDTH2, 9 ),
/*  6 */ DLG_DEFBUTTON( NULL, CTL_OK,   (DIR_START+BOX_WIDTH2+4), 4, (DIR_START+BOX_WIDTH2+14) ),
/*  7 */ DLG_BUTTON(    NULL, CTL_CANCEL,       (DIR_START+BOX_WIDTH2+4), 6, (DIR_START+BOX_WIDTH2+14) ),
/*  8 */ DLG_STRING(    NULL, 2, 11, 20 ),
/*  9 */ DLG_COMBO_BOX( NULL, CTL_FILE_TYPES, 2,12,2+BOX_WIDTH+3,15 ),
#if !defined( __UNIX__ ) && !defined( __NETWARE__ )
/* 10 */ DLG_STRING(    NULL, DIR_START+2, 11, DIR_START+8 ),
/* 11 */ DLG_COMBO_BOX( NULL, CTL_DRIVES, DIR_START+2,12,DIR_START+BOX_WIDTH,15 )
#endif
};

static bool     ControlsInitialized = false;

#define FILE_LIST_INDEX         4
#define DIR_LIST_INDEX          5
#define FILE_TYPES_INDEX        9
#define DRIVE_LIST_INDEX        11