DrawableComposite::DrawableComposite()
    : bounds (Point<float>(), Point<float> (100.0f, 0.0f), Point<float> (0.0f, 100.0f)),
      updateBoundsReentrant (false)
{
    setContentArea (RelativeRectangle (RelativeCoordinate (0.0),
                                       RelativeCoordinate (100.0),
                                       RelativeCoordinate (0.0),
                                       RelativeCoordinate (100.0)));
}
void DrawableComposite::resetContentAreaAndBoundingBoxToFitChildren()
{
    const Rectangle<float> activeArea (getDrawableBounds());

    setContentArea (RelativeRectangle (RelativeCoordinate (activeArea.getX()),
                                       RelativeCoordinate (activeArea.getRight()),
                                       RelativeCoordinate (activeArea.getY()),
                                       RelativeCoordinate (activeArea.getBottom())));
    resetBoundingBoxToContentArea();
}
Beispiel #3
0
void
ConsoleWindow::reshape( ) { 

    DisplayWindow::reshape();

    UIRect &bw = _baseWindow;
    
    //these are all relative to basewindow coordinates! 
    double pad = _marginSize;
    double pad2 = 2.0 * _marginSize;

    double cspan =  max ( 1.5 * bw.h() - pad2, min ( 1.2, 0.4 * bw.w() ) );

    _cubeWindow.moveto ( pad, -pad );
    _cubeWindow.resize ( cspan - pad2 , bw.h() - pad2 );

    _contentWindow.moveto ( _cubeWindow.right() + pad2 , _cubeWindow.top() );
    _contentWindow.resize (  bw.w() - ( cspan + pad2 ) , _cubeWindow.h() );

    if ( _content ) setContentArea();


    _vScrollBar.moveto ( _contentWindow.right(), _contentWindow.top() );
    _vScrollBar.resize ( pad2, _contentWindow.h() );
    
    _hScrollBar.moveto ( _contentWindow.left(), _contentWindow.bottom() );
    _hScrollBar.resize ( pad , _contentWindow.w()  );

    _sizeBox.moveto ( -pad , - bw.h() + pad  );
    _sizeBox.resize ( pad2, pad2 );

    _curLabel.moveto ( cspan + pad, pad * 1.5 );
    _curLabel.resize ( pad2 * 3.0, pad * 3.0 );
    _curLabel.setLabel("current face");
    _curLabel.fitLabel();
    _curDisplay.moveto ( cspan - pad * 1.5, pad * 1.5 );
    _curDisplay.resize ( pad * 3.0 , pad * 3.0 );


    _prevLabel.resize ( pad2 * 3.0, pad2 );
    _prevLabel.setLabel( "previous face" );
    _prevLabel.fitLabel();
    _prevLabel.moveto ( cspan - ( _prevLabel.w()  + pad ) , - bw.h() + pad );

    _prevDisplay.moveto ( cspan - pad * 1.5, -bw.h() + pad * 1.25 );
    _prevDisplay.resize ( pad * 3.0 , pad * 2.5 );
    _prevDisplay.setLabel("0");

    double timex = cspan + 0.5 * ( bw.w() - cspan );

    _timeDisplay.moveto ( timex + pad, pad );
    _timeDisplay.resize ( pad2 * 3.0, pad2 );
    _timeLabel.resize ( pad * 3.0 , pad * 3.0 );
    _timeLabel.fitLabel ( );
    _timeLabel.moveto ( timex - ( pad + _timeLabel.w() * 0.5 ) , pad * 1.5 );
    _timeDisplay.setx( _timeLabel.right() - pad * 0.5 );

    double kdim = min ( _cubeWindow.h() * 0.25 , _cubeWindow.w() * 0.125 ); 
    for ( int i = 0 ; i < 6; i++ ) { //resize 
        _cubeSides[i].resize( kdim, kdim  );
    }

    //this is always the same. 
    //depending on the current face, each
    //cubeside will move to one of these positions...


    _cubePos[ Audicle::UP ]    = Point2D (  kdim,           0 );
    _cubePos[ Audicle::DOWN ]  = Point2D (  kdim, -2.0 * kdim );
    _cubePos[ Audicle::LEFT ]  = Point2D (  0,          -kdim );
    _cubePos[ Audicle::RIGHT ] = Point2D (  2.0 * kdim, -kdim );
    _cubePos[ Audicle::BACK ]  = Point2D (  3.0 * kdim, -kdim );
    _cubePos[ Audicle::CUR ]  = Point2D (  kdim,       -kdim );


    setCubes();

  
}