static void DlgOpen( gui_window *parent, const char *title, int rows, int cols, gui_control_info *controls_info, int num_controls, GUICALLBACK *rtn, void *extra, bool sys ) { gui_coord charuse; gui_coord charspace; gui_text_metrics metrics; DlgControl.title = title; DlgControl.call_back = rtn; DlgControl.extra = extra; DlgControl.parent = parent; GUIGetDlgTextMetrics( &metrics ); charspace.x = metrics.max.x; charspace.y = metrics.max.y; #ifdef __OS2_PM__ // brutal hack to get OS/2 and Windows dialogs to look the same. charuse.x = ( 5 * metrics.avg.x ) / 4; charuse.y = ( 3 * metrics.avg.y ) / 2; #else charuse.x = metrics.avg.x; charuse.y = ( 7 * metrics.avg.y ) / 4; #endif GUITruncToPixel( &charuse ); DlgSetSize( parent, &DlgControl, rows, cols, &charuse ); DlgSetCtlSizes( controls_info, num_controls, &charuse, &charspace ); if( sys || DlgModal ) { GUICreateSysModalDialog( &DlgControl, num_controls, controls_info ); } else { GUICreateDialog( &DlgControl, num_controls, controls_info ); } }
void WDialog::doDialog( WWindow *parent ) { /*****************************************/ WRect r; gui_create_info create_info; autoPosition( r ); gui_window *hparent = NULL; if( parent != NULL ) { hparent = parent->handle(); } const char *ctext = _text; create_info.text = (char *)ctext; create_info.rect.x = r.x(); create_info.rect.y = r.y(); create_info.rect.width = r.w(); create_info.rect.height = r.h(); create_info.scroll = GUI_NOSCROLL; create_info.style = GUI_NONE; create_info.parent = hparent; create_info.num_menus = 0; create_info.menu = NULL; create_info.num_attrs = 0; create_info.colours = NULL; create_info.call_back = DlgProc; create_info.extra = this; create_info.icon = NULL; GUICreateDialog( &create_info, 0, NULL ); }