本文整理汇总了C++中Allocation::getTop方法的典型用法代码示例。如果您正苦于以下问题:C++ Allocation::getTop方法的具体用法?C++ Allocation::getTop怎么用?C++ Allocation::getTop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Allocation
的用法示例。
在下文中一共展示了Allocation::getTop方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleMousePress
bool CursorCtrl::handleMousePress( MouseEvent& e )
{
if( e.isLeft() && ( e.isNoKey() || e.isAlt() ) ||
e.isRight() && e.isShift() )
{
Allocation a;
allocation( a );
ViewAreaMdl* area = d_view->getArea();
if( d_do[ DimX ] && d_do[ DimY ] && area->getDimCount() == 2 )
{
PPM x = area->toPpm( e.getX(), a.getLeft(), DimX );
PPM y = area->toPpm( e.getY(), a.getTop(), DimY );
d_view->getModel()->setPos( d_view->getDim( DimX ), x,
d_view->getDim( DimY ), y, d_mouseVeto );
}else if( d_do[ DimX ] && area->inUse( DimX ) )
{
PPM x = area->toPpm( e.getX(), a.getLeft(), DimX );
d_view->getModel()->setPos( d_view->getDim( DimX ), x, d_mouseVeto );
}else if( d_do[ DimY ] && area->inUse( DimY ) )
{
PPM y = area->toPpm( e.getY(), a.getTop(), DimY );
d_view->getModel()->setPos( d_view->getDim( DimY ), y, d_mouseVeto );
}
return d_swallow; // Der Click soll nicht immer gefressen werden.
}else
return false;
}
示例2: draw
void draw(Canvas & c, const Allocation & a)
{
Lexi::Twips x = a.getLeft() + a.getWidth() / 10;
c.drawLine( x, a.getTop(), x, a.getBottom(), g_color );
Lexi::Twips y = a.getTop() + a.getHeight() / 10;
c.drawLine( x, y, a.getRight(), y, g_color );
}
示例3: execute
void execute()
{
Allocation rect;
getAllocation( rect );
try
{
Allocation a = d_model->getAllocation();
Viewport* v = getHandler()->getViewport();
assert( v );
Viewport::pushCursor( Viewport::CurWait );
if( rect.getWidth() != 0 && rect.getHeight() != 0 )
{
v->captureDamage();
PpmRange rx, ry;
rx.first = d_model->toPpm( rect.getLeft(), a.getLeft(), DimX );
rx.second = d_model->toPpm( rect.getRight(), a.getLeft(), DimX );
ry.first = d_model->toPpm( rect.getTop(), a.getTop(), DimY );
ry.second = d_model->toPpm( rect.getBottom(), a.getTop(), DimY );
d_target->setRange( rx, ry );
v->commitDamage();
}else
{
d_target->centerPoint( d_model->toPpm( rect.getLeft(), a.getLeft(), DimX ),
d_model->toPpm( rect.getTop(), a.getTop(), DimY ) );
}
v->damageAll();
Viewport::popCursor();
}catch( ... )
{
qDebug( "Exception in _OverviewCmd" );
}
Command::execute();
}
示例4: getViewArea
void SpinLineView2::draw( Canvas& v, const Allocation& a )
{
Canvas& c = v;
ViewAreaMdl* area = getViewArea();
SpinSpace::Iterator pos, _end = d_model->end();
SpinSpace::Element e;
Twips y, x;
char buf[ 16 ];
for( pos = d_model->begin(); pos != _end; ++pos )
{
d_model->fetch( pos, e );
if( !e.isGhost() )
{
y = area->toTwip( e.d_point[DimY]->getShift( d_model->getSpec() ),
a.getTop(), DimY );
c.drawLine( a.getLeft(), y, a.getRight(), y, d_clr );
e.d_point[DimY]->getLabel().format( buf, sizeof(buf) );
QFont f;
f.setPointSize( s_ps / TwipsPerPoint );
c.drawText( a.getLeft(), y, buf, &f, d_clr );
if( d_verti )
{
x = area->toTwip( e.d_point[DimX]->getShift( d_model->getSpec() ),
a.getLeft(), DimX );
c.drawLine( x, a.getTop(), x, a.getBottom(), d_clr );
e.d_point[DimX]->getLabel().format( buf, sizeof(buf) );
c.drawText( x + g_w, a.getBottom() - g_w, buf, &f, d_clr );
}
}
}
}
示例5: draw
void ResidueParamView::draw( Canvas& v, const Allocation& a )
{
if( !d_show )
return;
Canvas& c = v;
ViewAreaMdl* area = getViewArea();
Twips y;
QString str;
DisPar val;
if( d_resi )
{
Root::SymbolSet ss = d_resi->getAllDisPar();
Root::SymbolSet::const_iterator pos;
for( pos = ss.begin(); pos != ss.end(); ++pos )
{
val = d_resi->getDisPar( (*pos) );
if( val.isValid() )
{
y = area->toTwip( val.d_mean + val.d_dev, a.getTop(), DimY );
c.drawLine( a.getLeft(), y, a.getRight(), y, d_clr );
str.sprintf( "+ %s", (*pos).data() );
QFont f;
f.setPointSize( s_pointSize / TwipsPerPoint );
c.drawText( a.getLeft(), y, str, &f, d_clr );
y = area->toTwip( val.d_mean - val.d_dev, a.getTop(), DimY );
c.drawLine( a.getLeft(), y, a.getRight(), y, d_clr );
str.sprintf( "- %s", (*pos).data() );
c.drawText( a.getLeft(), y, str, &f, d_clr );
}
}
} else if( d_type )
{
const ResidueType::AtomMap& ss = d_type->getAtoms();
ResidueType::AtomMap::const_iterator pos;
for( pos = ss.begin(); pos != ss.end(); ++pos )
{
val = (*pos).second->getDisPar();
if( val.isValid() )
{
y = area->toTwip( val.d_mean + val.d_dev, a.getTop(), DimY );
c.drawLine( a.getLeft(), y, a.getRight(), y, d_clr );
str.sprintf( "+ %s", (*pos).first.data() );
QFont f;
f.setPointSize( s_pointSize / TwipsPerPoint );
c.drawText( a.getLeft(), y, str, &f, d_clr );
y = area->toTwip( val.d_mean - val.d_dev, a.getTop(), DimY );
c.drawLine( a.getLeft(), y, a.getRight(), y, d_clr );
str.sprintf( "- %s", (*pos).first.data() );
c.drawText( a.getLeft(), y, str, &f, d_clr );
}
}
}
}
示例6: execute
void execute()
{
Allocation r;
getAllocation( r );
ViewAreaMdl* mdl = d_view->getBuf()->getViewArea();
Allocation a = mdl->getAllocation();
PpmCube c;
c.assign( 2, PpmRange() );
c[ DimX ].first = mdl->toPpm( r.getLeft(), a.getLeft(), DimX );
c[ DimX ].second = mdl->toPpm( r.getRight(), a.getLeft(), DimX );
c[ DimY ].first = mdl->toPpm( r.getTop(), a.getTop(), DimY );
c[ DimY ].second = mdl->toPpm( r.getBottom(), a.getTop(), DimY );
d_view->selectPeak( c );
notifySelection( d_view );
Command::execute();
}
示例7: draw
void OverviewCtrl::draw(Canvas & c, const Allocation & a)
{
const PpmRange& rx = d_target->getRange( DimX );
const PpmRange& ry = d_target->getRange( DimY );
GlyphCommander::draw( c, a );
ViewAreaMdl* area = d_mdl->getViewArea();
Coord left = area->toTwip( rx.first, a.getLeft(), DimX );
Coord right = area->toTwip( rx.second, a.getLeft(), DimX );
Coord top = area->toTwip( ry.first, a.getTop(), DimY );
Coord bottom = area->toTwip( ry.second, a.getTop(), DimY );
c.drawLine( left, top, right, top, g_yellow );
c.drawLine( left, top, left, bottom, g_yellow );
c.drawLine( left, bottom, right, bottom, g_yellow );
c.drawLine( right, top, right, bottom, g_yellow );
}
示例8: invalidate
void Border::invalidate(Viewport & v, const Allocation & a)
{
Twips t = a.getTop();
Twips l = a.getLeft();
Twips h = a.getHeight();
Twips w = a.getWidth();
Twips d = d_thickness;
// Zeichne einen Rahmen um a herum nach innen ausdehnend um thickness.
v.damage( Allocation( l, t, w, d ) ); // oben
v.damage( Allocation( l, t, d, h ) ); // links
v.damage( Allocation( l + w - d, t, d, h ) ); // rechts
v.damage( Allocation( l, t + h - d, w, d ) ); // unten
}
示例9: draw
void SpecViewer::draw(Canvas & c, const Allocation & a)
{
d_area->allocate( a );
c.clip( a ); // RISK: clip
Layer::draw( c, a );
c.popClip();
// Zeichne nun bei Bedarf das Fokusrechteck
if( d_focus )
{
// NOTE: mit dieser Variante verschwindet right/bottom meist
// Irgendwer macht Rundungsfehler, ev. Tile.
c.drawRect( a.getLeft(), a.getTop(), a.getWidth() - s_off,
a.getHeight() - s_off, g_color );
}
}
示例10: handleMousePress
bool handleMousePress( Viewport& v, const Allocation& a, const MouseEvent& e )
{
if( e.isLeft() && d_agent->getCurDim() != -1 )
{
d_phi = d_agent->getPhi();
d_psi = d_agent->getPsi();
if( e.getX() < ( a.getLeft() + a.getWidth() / 10 ) )
d_dim = DimY;
else if( e.getY() < ( a.getTop() + a.getHeight() / 10 ) )
d_dim = DimX;
else
d_dim = DimUndefined;
v.grab( this );
return true;
}else
return false;
}
示例11: handleMousePress
bool PointSelectCtrl::handleMousePress( Viewport& v, const Allocation& a, const MouseEvent& e )
{
if( e.isLeft() && e.isShift() && !e.isAlt() && !e.isCtrl() )
{
return installCommand( new _SelectPointCmd( this, d_view ) ); // && d_swallow;
}else if( e.isLeft() && e.isNoKey() )
{
ViewAreaMdl* mdl = d_view->getViewArea();
d_view->selectPeak( mdl->toPpm( e.getX(), a.getLeft(), DimX ),
mdl->toPpm( e.getY(), a.getTop(), DimY ) );
// Nicht immer true zurück, damit Cursor funktioniert.
notifySelection( d_view, SpinPointView::PairIdLabelSysOrResi );
return d_swallow;
}
// else
return false;
}
示例12: execute
void execute()
{
Allocation rect;
getAllocation( rect );
if( rect.getWidth() != 0 && rect.getHeight() != 0 )
{
Allocation a = d_model->getAllocation();
Viewport* p = getController()->getViewport();
assert( p );
p->pushCursor( Viewport::CurWait );
p->captureDamage();
if( d_do[ DimY ] && d_model->inUse( DimY ) &&
d_do[ DimX ] && d_model->inUse( DimX ) )
{
PpmRange rx;
rx.first = d_model->toPpm( rect.getLeft(), a.getLeft(), DimX );
rx.second = d_model->toPpm( rect.getRight(), a.getLeft(), DimX );
PpmRange ry;
ry.first = d_model->toPpm( rect.getTop(), a.getTop(), DimY );
ry.second = d_model->toPpm( rect.getBottom(), a.getTop(), DimY );
d_model->setRange( rx, ry );
}else if( d_do[ DimX ] && d_model->inUse( DimX ) )
{
PpmRange rx;
rx.first = d_model->toPpm( rect.getLeft(), a.getLeft(), DimX );
rx.second = d_model->toPpm( rect.getRight(), a.getLeft(), DimX );
d_model->setRange( DimX, rx );
}else if( d_do[ DimY ] && d_model->inUse( DimY ) )
{
PpmRange ry;
ry.first = d_model->toPpm( rect.getTop(), a.getTop(), DimY );
ry.second = d_model->toPpm( rect.getBottom(), a.getTop(), DimY );
d_model->setRange( DimY, ry );
}
p->commitDamage();
p->popCursor();
d_model->redraw(p);
}
Command::execute();
}
示例13: draw
void Border::draw( Canvas& v, const Allocation& a)
{
Canvas& c = v;
Twips t = a.getTop();
Twips l = a.getLeft();
Twips h = a.getHeight();
Twips w = a.getWidth();
Twips d = d_thickness;
// Zeichne einen Rahmen um a herum nach innen ausdehnend um thickness.
c.fillRect( l, t, w, d, d_color ); // oben
c.fillRect( l, t, d, h, d_color ); // links
c.fillRect( l + w - d, t, d, h, d_color ); // rechts
c.fillRect( l, t + h - d, w, d, d_color ); // unten
Glyph* g = getBody();
if( g != nil )
{
Allocation interior( a );
allocateBody( g, d_thickness, interior );
g->draw( v, interior);
}
}
示例14: interior
void SpecRuler2D::draw( Canvas& v, const Allocation& a)
{
if( d_model == 0 )
return;
assert( d_model->getDimCount() == 2 );
Canvas& c = v;
Twips t = a.getTop();
Twips l = a.getLeft();
Twips h = a.getHeight();
Twips w = a.getWidth();
Glyph* g = getBody();
if( g != nil )
{
Allocation interior( a );
allocateBody( g, interior );
g->draw( v, interior);
}
// Zeichne die horizontale Legende
ViewAreaMdl* area = d_model->getViewArea();
char buf[ 32 ];
char format[ 8 ];
Font::BoundingBox box;
double delta;
int stellen;
double start;
double p;
Twips x;
Twips y;
// Wir zeichnen immer von links nach rechts und oben nach unten.
if( d_show[ DimX ] )
{
const PpmRange& rh = d_model->getBuffer().getScale( DimX ).getRange();
//const Allotment& ax = a.getAllotment( DimX );
delta = ::fabs( area->toPpmDiff( 0, d_space[ DimX ], DimX ) );
start = calc( rh, delta, stellen );
// Zeichne die horizontale Legende
::sprintf( format, "%%0.%df", stellen );
y = t + h - d_height;
p = start;
while( rh.contains( p ) )
{
x = area->toTwip( p, DimX );
c.drawLine( x, y, x, y + d_large, d_color, d_thick );
::sprintf( buf, format, p );
box.stringBox( d_font, buf, c.getViewport() );
c.drawText( x - box.getWidth() / 2, y + d_large + box.getAscent(), buf, &d_font, d_color );
if( rh.isParallel() )
p += delta;
else
p -= delta;
}
double count = d_count[ DimX ];
if( delta > 1.0 )
count = delta;
if( rh.isParallel() )
{
p = start - delta;
delta = delta / count;
while( p < rh.second )
{
x = area->toTwip( p, DimX );
if( p >= rh.first )
c.drawLine( x, y, x, y + d_small, d_color, d_thick );
p += delta;
}
}else
{
p = start + delta;
delta = delta / count;
while( p > rh.second )
{
x = area->toTwip( p, DimX );
if( p <= rh.first )
c.drawLine( x, y, x, y + d_small, d_color, d_thick );
p -= delta;
}
}
}
if( d_show[ DimY ] )
{
const PpmRange& rv = d_model->getBuffer().getScale( DimY ).getRange();
//const Allotment& ay = a.getAllotment( DimY );
delta = ::fabs( area->toPpmDiff( 0, d_space[ DimY ], DimY ) );
start = calc( rv, delta, stellen );
// Zeichne die vertikale Legende
::sprintf( format, "%%0.%df", stellen );
x = l + w - d_width;
p = start;
while( rv.contains( p ) )
{
y = area->toTwip( p, DimY );
c.drawLine( x, y, x + d_large, y, d_color, d_thick );
::sprintf( buf, format, p );
//.........这里部分代码省略.........