void VAbout::initialize() { int fw = WSystemMetrics::dialogFrameWidth(); int fh = WSystemMetrics::dialogFrameHeight(); int wid = 0; int yoff = fh; for( int i=0; _viperDesc[i] != NULL; i++ ) { int w = getTextExtentX( _viperDesc[i] ); int h = getTextExtentY( _viperDesc[i] ); if( w > 0 ) { if( wid < w ) wid = w; WText* t1 = new WText( this, WRect(fw, yoff, w, h), _viperDesc[i] ); // WText* t1 = new WText( this, WRect(fw, yoff, w, h), _viperDesc[i], TextStyleCentre ); yoff += h * 5/4; t1->show(); } } wid += fw * 2; static const char ok[] = { "OK" }; int w = getTextExtentX( ok ) * 3; int h = getTextExtentY( ok ) * 3/2; int xoff = (wid - w) / 2; WDefPushButton* bOk = new WDefPushButton( this, WRect( xoff, yoff, w, h), "OK" ); yoff += h * 5/4; bOk->onClick( this, (cbw)&VAbout::okButton ); bOk->show(); shrink(); centre(); show(); bOk->setFocus(); }
void WInputDialog::initialize() { /*******************************/ WPoint avg; WPoint max; textMetrics( avg, max ); int sp = max.x(); int x = WSystemMetrics::dialogFrameWidth(); int y = WSystemMetrics::dialogFrameHeight(); int p_w = 0; int p_h = 0; updateExtents( _promptText, &p_w, &p_h ); p_w += avg.x() / 2; p_h += avg.y() / 2; int r_w = 32 * avg.x(); int r_h = max.y() + 2*max.y() / 3; updateExtents( *_reply, &r_w, &r_h ); _prompt = new WText( this, WRect( x, y + (r_h - p_h)/2, p_w, p_h ), _promptText ); _prompt->show(); _input = new WEditBox( this, WRect( x + p_w + sp, y, r_w, r_h ), *_reply ); _input->show(); y += p_h + max.y(); int b_w = 0; int b_h = 0; updateExtents( BrowseText, &b_w, &b_h ); updateExtents( CancelText, &b_w, &b_h ); updateExtents( OKText, &b_w, &b_h ); b_w += avg.x() * 2; b_h += avg.y() / 2; WDefPushButton *bOk = new WDefPushButton( this, WRect( x, y, b_w, b_h ), OKText ); bOk->onClick( this, (cbw)&WInputDialog::okButton ); bOk->show(); x += b_w + max.x(); WPushButton *bCancel = new WPushButton( this, WRect( x, y, b_w, b_h ), CancelText ); bCancel->onClick( this, (cbw)&WInputDialog::cancelButton ); bCancel->show(); x += b_w + max.x(); if( _browseDialog ) { WPushButton *bBrowse = new WPushButton( this, WRect( x, y, b_w, b_h ), BrowseText ); bBrowse->onClick( this, (cbw)&WInputDialog::browseButton ); bBrowse->show(); } shrink(); centre(); _input->select(); _input->setFocus(); show(); }
void WFlashPage::init( int interval, const char *title ) { WPoint hotSize; _hotSpot->hotSpotSize( _idx, hotSize ); if( _width < hotSize.x() ) _width = hotSize.x(); _height += hotSize.y(); if( interval == INTERVAL_OK_BUTTON ) { static const char ok[] = { "OK" }; int w = getTextExtentX( ok ) * 3; int h = getTextExtentY( ok ) * 3/2; int xoff = (_width - w) / 2; int yoff = _height + h / 2; WDefPushButton* bOk = new WDefPushButton( this, WRect( xoff, yoff, w, h), ok ); bOk->onClick( this, (cbw)&WFlashPage::okButton ); bOk->setFocus(); bOk->show(); _height += 2*h; } else { if( _width - hotSize.x() ) { _height += WSystemMetrics::captionSize(); } } WOrdinal wheight = _height; if( title ) { wheight += WSystemMetrics::captionSize(); } WOrdinal wwidth = _width; move( 0, 0 ); size( wwidth, wheight ); centre(); show(); update(); // force the paint method. if( interval > 0 ) { _flashTimer = new WTimer( this, (cbt)&WFlashPage::flashTimer ); _flashTimer->start( (WORD)interval, 1 ); } }
void WAutoDialog::initialize() { /******************************/ WText *t; WPoint avg; WPoint max; int i; setSystemFont( FALSE ); int x = WSystemMetrics::dialogFrameWidth(); int y = WSystemMetrics::dialogFrameHeight(); textMetrics( avg, max ); int t_w = 0; int t_h = 0; int icount = _prompts->count(); for( i = 0; i < icount; i++ ) { updateExtents( _prompts->cStringAt( i ), &t_w, &t_h ); } int b_w = 50 * avg.x() / 4; int b_h = 14 * avg.y() / 8; int p_w = _editwidth * avg.x(); int p_h = max.y(); t_w += avg.x() / 2; t_h += avg.y() / 2; p_w += avg.x() / 2; p_h += 2*max.y() / 3; int sp = max.x(); for( i = 0; i < icount; i++ ) { WString s( _prompts->cStringAt( i ) ); bool bro = FALSE; char* p = strchr( (char *)s.gets(), '=' ); if( p != NULL ) { // this code depends on internals of WString! *p = '\0'; p++; if( *p == '=' ) { bro = TRUE; p++; } } t = new WText( this, WRect( x, y + (p_h - t_h)/2, t_w, t_h ), s ); t->show(); WEditBox* e = new WEditBox( this, WRect( x + t_w + sp, y, p_w, p_h ), p ); e->show(); _inputs.add( e ); if( bro ) { WPushButton* bBrowse = new WPushButton( this, WRect( x + t_w + p_w + 2*sp, y, b_w, b_h ), BrowseText ); bBrowse->onClick( this, (cbw)&WAutoDialog::browseButton ); bBrowse->setTagPtr( e ); bBrowse->show(); } y += t_h + t_h / 2; } WDefPushButton* bOk = new WDefPushButton( this, WRect( x, y, b_w, b_h ), OKText ); bOk->onClick( this, (cbw)&WAutoDialog::okButton ); bOk->show(); WPushButton* bCancel = new WPushButton( this, WRect( x + b_w + sp, y, b_w, b_h ), CancelText ); bCancel->onClick( this, (cbw)&WAutoDialog::cancelButton ); bCancel->show(); shrink(); centre(); WEditBox* e = (WEditBox *)_inputs[0]; e->select(); e->setFocus(); show(); }
void VEditDlg::initialize() { int sx; int sy; WPoint average; WPoint max; WGroupBox *gbox; WText *t1; WText *t3; WText *t4; WText *t5; WText *t6; WText *t7; const int rb_hite = 10; //height of a radio button // const int space = 10; const int button_width = 50; const int button_hite = 14; setSystemFont( false ); this->textMetrics( average, max ); sx = average.x() / 4; sy = average.y() / 8; t1 = new WText( this, WRect( 5*sx, 5*sy, 132*sx, 9*sy ), "Enter editor file name:" ); t1->show(); _editorName = new WEditBox( this, WRect( 5*sx, 17*sy, 139*sx, 13*sy ) ); _editorName->select(); _editorName->show(); _parmBoxText = new WText( this, WRect( 5*sx, 33*sy, 132*sx, 9*sy ), "Enter editor parameters:" ); _parmBoxText->show(); _editorParms = new WEditBox( this, WRect( 5*sx, 45*sy, 139*sx, 13*sy ) ); _editorParms->select(); _editorParms->show(); WPushButton* bBrowse = new WPushButton( this, WRect( 155*sx, 16*sy, button_width * sx, button_hite * sy ), "&Browse..." ); bBrowse->onClick( this, (cbw)&VEditDlg::browseButton ); bBrowse->show(); WDefPushButton* bOk; bOk = new WDefPushButton( this, WRect( 26*sx, 117*sy, button_width * sx, button_hite * sy ), "&OK" ); bOk->onClick( this, (cbw)&VEditDlg::okButton ); bOk->show(); WPushButton* bCancel = new WPushButton( this, WRect( 82*sx, 117*sy, button_width * sx, button_hite * sy ), "&Cancel" ); bCancel->onClick( this, (cbw)&VEditDlg::cancelButton ); bCancel->show(); WPushButton* bDefault = new WPushButton( this, WRect( 138*sx, 117*sy, button_width * sx, button_hite * sy ), "&Default" ); bDefault->onClick( this, (cbw)&VEditDlg::defaultButton ); bDefault->show(); _exeButton = new WRadioButton( this, WRect( 13*sx, 74*sy, 60*sx, rb_hite * sy ), "Executable", RStyleGroupFirst ); _exeButton->show(); _exeButton->onClick( this, (cbw)&VEditDlg::exeButton ); _dllButton = new WRadioButton( this, WRect( 13*sx, 87*sy, 60*sx, rb_hite * sy ), "DLL", RStyleGroupFirst ); _dllButton->show(); _dllButton->onClick( this, (cbw)&VEditDlg::dllButton ); gbox = new WGroupBox( this, WRect( 5*sx, 61*sy, 139*sx, 42 * sy ), "Editor type: " ); gbox->show(); t3 = new WText( this, WRect( 155*sx, 45*sy, 65*sx, 9*sy ), "Parameter" ); t3->show(); t4 = new WText( this, WRect( 155*sx, 54*sy, 65*sx, 9*sy ), "Macros:" ); t4->show(); t5 = new WText( this, WRect( 155*sx, 67*sy, 65*sx, 9*sy ), "%f - filename" ); t5->show(); t6 = new WText( this, WRect( 155*sx, 76*sy, 65*sx, 9*sy ), "%r - row" ); t6->show(); t7 = new WText( this, WRect( 155*sx, 85*sy, 65*sx, 9*sy ), "%c - column" ); t7->show(); _editorName->setText( _fn ); _editorParms->setText( _parms ); if( _isDll ) { _dllButton->setCheck( true ); _editorParms->setText( "" ); _editorParms->enable( false ); _parmBoxText->enable( false ); } else { _exeButton->setCheck( true ); } size( (WOrdinal)225*sx, (WOrdinal)155*sy ); centre(); show(); _editorName->setFocus(); }
void VCompDialog::initialize() { int sx; int sy; WPoint average; WPoint max; const int rb_hite = 10; //height of a radio button const int space = 10; const int button_width = 50; const int button_hite = 14; setSystemFont( FALSE ); this->textMetrics( average, max ); sx = average.x() / 4; sy = average.y() / 8; WText* t1 = new WText( this, WRect( 7*sx, 2*sy, 164*sx, 9*sy ), "Target name:" ); t1->show(); _eName = new WEditBox( this, WRect( 7*sx, 12*sy, 250*sx, 13*sy ), *_fn ); _eName->select(); _eName->show(); WPushButton* bBrowse = new WPushButton( this, WRect( 265*sx, 11*sy, button_width * sx, button_hite * sy ), "&Browse..." ); bBrowse->onClick( this, (cbw)&VCompDialog::browseButton ); bBrowse->show(); WText* t2 = new WText( this, WRect( 167*sx, 31*sy, 86*sx, 9*sy ), "Image Type:" ); t2->show(); WRadioButton *button; WRadioButton *checkedbutton; int icount; WStyle style; MTarget *curtarg; int i; bool singletarg; curtarg = NULL; if( _comp != NULL ) { WPickList& targets = _config->targets(); icount = targets.count(); for( i=0; i < icount; i++ ) { curtarg = (MTarget *)targets[i]; if( curtarg->mask() == _comp->mask() ) break; } if( i == icount ) curtarg = NULL; } WVList &list = _config->targetOSs(); icount = list.count(); if( icount == 1 ) { // use a static field instead of a radio button when there is // only one target installed singletarg = TRUE; i = 0; _cur_os = *(WString *)list[0]; WText* t3 = new WText( this, WRect( 11*sx, 41*sy, 135*sx, rb_hite * sy ), _cur_os.gets() ); t3->show(); } else { singletarg = FALSE; for( i=0; i < icount; i ++ ) { if( i == 0 ) { if( icount == 1 ) { style = RStyleRadioButton; } else { style = RStyleGroupFirst; } } else if( i == icount - 1 ) { style = RStyleGroupLast; } else { style = RStyleRadioButton; } button = new WRadioButton( this, WRect( 11*sx, ( 41 + rb_hite * i ) * sy, 135*sx, rb_hite * sy ), ( (WString *)list[i] )->gets(), style ); button->show(); button->onClick( this, (cbw)&VCompDialog::osButton ); if( curtarg == NULL ) { if( i == 0 ) { checkedbutton = button; } } else { if( curtarg->targetOS() == *(WString *)list[i] ) { checkedbutton = button; } } } } WGroupBox *gbox; if( i < 5 ) i = 5; int boxtop = 29; int boxhite = i * rb_hite + 20; int boxbottom = boxtop + boxhite; gbox = new WGroupBox( this, WRect( 7*sx, boxtop * sy, 146*sx, boxhite * sy ), "Target Environment" ); gbox->show(); _imagelist = new WListBox( this, WRect( 166*sx, 44*sy, 150*sx, ( boxbottom - 44 ) * sy ), LStyleNoIntegral ); _imagelist->onDblClick( this, (cbw)&VCompDialog::okButton ); _imagelist->show(); WDefPushButton* bOk; boxbottom += space; bOk = new WDefPushButton( this, WRect( 105*sx, boxbottom * sy, button_width * sx, button_hite * sy ), "&OK" ); bOk->onClick( this, (cbw)&VCompDialog::okButton ); bOk->show(); WPushButton* bCancel; bCancel = new WPushButton( this, WRect( 186*sx, boxbottom * sy, button_width * sx, button_hite * sy ), "&Cancel" ); bCancel->onClick( this, (cbw)&VCompDialog::cancelButton ); bCancel->show(); if( singletarg ) { updateCurOs(); } else { checkedbutton->setCheck( TRUE ); } if( curtarg != NULL ) { icount = _tgList.count(); MTarget *tmptarg; for( i=0; i < icount; i++ ) { tmptarg = (MTarget *)_tgList[i]; if( curtarg->imageName() == tmptarg->imageName() ) { _imagelist->select( i ); break; } } } int xsize = 330 * sx; int ysize = WSystemMetrics::dialogFrameWidth() * 2 + WSystemMetrics::captionSize() + ( boxbottom + button_hite + space ) * sy; size( (WOrdinal)xsize, (WOrdinal) ysize ); centre(); show(); _eName->setFocus(); }