static LWPanelID get_panel( void ) { LWPanControlDesc desc; LWPanelID panel; LWValue ival = { LWT_INTEGER }; LWControl *ctl[ 9 ]; int i; if( !( panel = PAN_CREATE( panf, "Panels Control Test" ))) return NULL; ctl[ 0 ] = BUTTON_CTL( panf, panel, "Edit" ); ctl[ 1 ] = BUTTON_CTL( panf, panel, "Slider" ); ctl[ 2 ] = BUTTON_CTL( panf, panel, "Choice" ); ctl[ 3 ] = BUTTON_CTL( panf, panel, "Tree" ); ctl[ 4 ] = BUTTON_CTL( panf, panel, "Color" ); ctl[ 5 ] = BUTTON_CTL( panf, panel, "File" ); ctl[ 6 ] = BUTTON_CTL( panf, panel, "Draw" ); ctl[ 7 ] = BOOL_CTL( panf, panel, "Boolean" ); ctl[ 8 ] = BOOLBUTTON_CTL( panf, panel, "Bool Button" ); CON_SETEVENT( ctl[ 0 ], event, open_editpan ); CON_SETEVENT( ctl[ 1 ], event, open_sliderpan ); CON_SETEVENT( ctl[ 2 ], event, open_choicepan ); CON_SETEVENT( ctl[ 3 ], event, open_treepan ); CON_SETEVENT( ctl[ 4 ], event, open_colorpan ); CON_SETEVENT( ctl[ 5 ], event, open_filepan ); CON_SETEVENT( ctl[ 6 ], event, open_drawpan ); /* align */ for ( i = 0; i < 9; i++ ) { ival.intv.value = 100 - CON_LW( ctl[ i ] ); ctl[ i ]->set( ctl[ i ], CTL_X, &ival ); } return panel; }
static int print_ui( char *outname, int *range, int *mode, int *cols, char *comment ) { char *rlist[] = { "Current Page", "Entire File", NULL }; char *mlist[] = { "Write", "Append", NULL }; char *tlist[] = { " ", NULL }; LWPanelID panel; LWControl *ctl[ 8 ]; int i, x, y, dy, ok; if( !( panel = PAN_CREATE( panf, "Print to File" ))) return 0; ctl[ 0 ] = FILE_CTL( panf, panel, "File", 40 ); ctl[ 1 ] = HCHOICE_CTL( panf, panel, "Range", rlist ); ctl[ 2 ] = HCHOICE_CTL( panf, panel, "Mode", mlist ); ctl[ 3 ] = TEXT_CTL( panf, panel, "Columns", tlist ); ctl[ 4 ] = BOOLBUTTON_CTL( panf, panel, "Position" ); ctl[ 5 ] = BOOLBUTTON_CTL( panf, panel, "Buffer" ); ctl[ 6 ] = BOOLBUTTON_CTL( panf, panel, "Printable" ); ctl[ 7 ] = STR_CTL( panf, panel, "Comment", 40 ); for ( i = 0; i < 4; i++ ) { ival.intv.value = 100 - CON_LW( ctl[ i ] ); ctl[ i ]->set( ctl[ i ], CTL_X, &ival ); } x = CON_HOTX( ctl[ 2 ] ); y = CON_Y( ctl[ 2 ] ); dy = y - CON_Y( ctl[ 1 ] ); y += dy; MOVE_CON( ctl[ 4 ], x, y ); x += CON_W( ctl[ 4 ] ); MOVE_CON( ctl[ 5 ], x, y ); x += CON_W( ctl[ 5 ] ); MOVE_CON( ctl[ 6 ], x, y ); x = 100 - CON_LW( ctl[ 7 ] ); y += dy; MOVE_CON( ctl[ 7 ], x, y ); PAN_SETH( panf, panel, y + dy ); SET_STR( ctl[ 0 ], outname, 256 ); SET_INT( ctl[ 1 ], *range ); SET_INT( ctl[ 2 ], *mode ); SET_INT( ctl[ 4 ], ( *cols & 1 )); SET_INT( ctl[ 5 ], ( *cols & 2 )); SET_INT( ctl[ 6 ], ( *cols & 4 )); SET_STR( ctl[ 7 ], comment, 256 ); ok = panf->open( panel, PANF_BLOCKING | PANF_CANCEL ); if ( ok ) { GET_STR( ctl[ 0 ], outname, 256 ); GET_INT( ctl[ 1 ], *range ); GET_INT( ctl[ 2 ], *mode ); GET_INT( ctl[ 4 ], i ); if ( i ) *cols |= 1; else *cols &= ~1; GET_INT( ctl[ 5 ], i ); if ( i ) *cols |= 2; else *cols &= ~2; GET_INT( ctl[ 6 ], i ); if ( i ) *cols |= 4; else *cols &= ~4; GET_STR( ctl[ 7 ], comment, 256 ); } PAN_KILL( panf, panel ); return ok; }