本文整理汇总了C++中DocView::viewWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ DocView::viewWidget方法的具体用法?C++ DocView::viewWidget怎么用?C++ DocView::viewWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocView
的用法示例。
在下文中一共展示了DocView::viewWidget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDelta
gfx::Point MoveThing::getDelta(Context* context) const
{
gfx::Point delta(0, 0);
DocView* view = static_cast<UIContext*>(context)->activeView();
if (!view)
return delta;
DocumentPreferences& docPref = Preferences::instance().document(view->document());
Editor* editor = view->editor();
gfx::Rect vp = view->viewWidget()->viewportBounds();
gfx::Rect gridBounds = docPref.grid.bounds();
int pixels = 0;
switch (units) {
case Pixel:
pixels = 1;
break;
case TileWidth:
pixels = gridBounds.w;
break;
case TileHeight:
pixels = gridBounds.h;
break;
case ZoomedPixel:
pixels = editor->zoom().apply(1);
break;
case ZoomedTileWidth:
pixels = editor->zoom().apply(gridBounds.w);
break;
case ZoomedTileHeight:
pixels = editor->zoom().apply(gridBounds.h);
break;
case ViewportWidth:
pixels = vp.h;
break;
case ViewportHeight:
pixels = vp.w;
break;
}
switch (direction) {
case Left: delta.x = -quantity * pixels; break;
case Right: delta.x = +quantity * pixels; break;
case Up: delta.y = -quantity * pixels; break;
case Down: delta.y = +quantity * pixels; break;
}
return delta;
}