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 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 ); } }