本文整理汇总了C++中View::Bounds方法的典型用法代码示例。如果您正苦于以下问题:C++ View::Bounds方法的具体用法?C++ View::Bounds怎么用?C++ View::Bounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::Bounds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawViews
/** Please be sure to call this should you ever
* override the default Draw() method.
*/
void Window::DrawViews( Rect frame )
{
/// \todo Only update the requested frame.
lock();
for ( int i = 0; i < CountChildren(); i++ )
{
View *view = ChildAt(i);
view->Draw( view->Bounds() );
view->DrawChildren( view->Bounds() );
}
unlock();
}
示例2: CurAlpha
int Control::CurAlpha(DisplayDirector* director)
{
// find out where the mouse is and make sure it's in the window
View* windowView = director->WindowView();
BPoint mousePoint = windowView->GetMousePoint();
if (!windowView->Bounds().BRect::Contains(mousePoint))
return 0;
// calculate the alpha
BRect rect = GetRect();
int xDistance = 0;
if (mousePoint.x < rect.left)
xDistance = (int) (rect.left - mousePoint.x);
else if (mousePoint.x > rect.right)
xDistance = (int) (mousePoint.x - rect.right);
int yDistance = 0;
if (mousePoint.y < rect.top)
yDistance = (int) (rect.top - mousePoint.y);
else if (mousePoint.y > rect.bottom)
yDistance = (int) (mousePoint.y - rect.bottom);
float distance = sqrt(xDistance * xDistance + yDistance * yDistance);
if (distance > visibleZone)
distance = visibleZone;
float visibility = (visibleZone - distance) / visibleZone;
return (int) (visibility * 255);
}