本文整理汇总了C++中Allocation::getWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ Allocation::getWidth方法的具体用法?C++ Allocation::getWidth怎么用?C++ Allocation::getWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Allocation
的用法示例。
在下文中一共展示了Allocation::getWidth方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pageView
void ScrollCtrl::pageView(KeyEvent & e, const Allocation& a )
{
PPM delta = 0;
Dimension dim = 0;
if( e.isPageUp() && e.isPlainKey() )
{
dim = DimY;
delta = -PPM( a.getHeight() ) * g_page / d_area->getTwipPerPpm( dim );
}else if( e.isPageDown() && e.isPlainKey() )
{
dim = DimY;
delta = PPM( a.getHeight() ) * g_page / d_area->getTwipPerPpm( dim );
}else if( e.isPageUp() && e.isCtrl() )
{
dim = DimX;
delta = -PPM( a.getWidth() ) * g_page / d_area->getTwipPerPpm( dim );
}else if( e.isPageDown() && e.isCtrl() )
{
dim = DimX;
delta = PPM( a.getWidth() ) * g_page / d_area->getTwipPerPpm( dim );
}
if( d_do[ dim ] && d_area->inUse( dim ) )
{
PpmRange r = d_area->getRange( dim );
r.move( delta * r.getSign() );
d_area->setRange( dim, r );
getViewport()->damageAll();
}
}
示例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: update
void update( const Allocation& a, Lexi::Twips w, Lexi::Twips h, bool all, bool shift )
{
if( d_dim == DimX || d_dim == DimUndefined )
d_phi = double( w ) * 360.0 * ( (shift)?3.0:1.0 ) /
double( a.getWidth() ) + d_phi;
if( d_dim == DimY || d_dim == DimUndefined )
d_psi = double( h ) * 360.0 * ( (shift)?3.0:1.0 ) /
double( a.getHeight() ) + d_psi;
d_agent->setPhiPsi( d_phi, d_psi, all );
}
示例5: 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
}
示例6: 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 );
}
}
示例7: 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();
}
示例8: 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;
}
示例9: 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);
}
}
示例10: 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 );
//.........这里部分代码省略.........