Ejemplo n.º 1
0
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();
}
Ejemplo n.º 2
0
void WAutoDialog::updateExtents( const char *t, int *w, int *h ) {
    /****************************************************************/

    if( getTextExtentX( t ) > *w ) {
        *w = getTextExtentX( t );
    }
    if( getTextExtentY( t ) > *h ) {
        *h = getTextExtentY( t );
    }
}
Ejemplo n.º 3
0
WFlashPage::WFlashPage( WWindow* parent, WHotSpots* hs, int idx, const char* title, const char* text[], int interval )
    : WWindow( parent, title, WStyleSimpleFrame | WStylePopup )
    , _idx( idx )
    , _width( 0 )
    , _height( 0 )
    , _hotSpot( hs )
    , _flashTimer( NULL )
//-------------------------------------------------------------------------
{
    if( text ) {
        for( int i=0; text[i]; i++ ) {
            int w = getTextExtentX( text[i] );
            if( _width < w ) _width = w;
            _height += getTextExtentY( text[i] );
            _text.add( new WString( text[i] ) );
        }
    }
    init( interval, title );
}
Ejemplo n.º 4
0
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 );
    }
}