本文整理汇总了C++中View::Frame方法的典型用法代码示例。如果您正苦于以下问题:C++ View::Frame方法的具体用法?C++ View::Frame怎么用?C++ View::Frame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::Frame方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConvertToWindow
Rect View::ConvertToWindow( Rect box )
{
Rect sam = box;
View *parent = this; // I am my own parent.
while ( parent != NULL )
{
sam.left += parent->Frame().left;
sam.right += parent->Frame().left;
sam.bottom += parent->Frame().top;
sam.top += parent->Frame().top;
parent = parent->GetParent();
}
return sam;
}
示例2: MouseEvent
void Window::MouseEvent( int what, int x, int y, unsigned int buttons )
{
// Backwards, as added.
lock();
for ( int i = CountChildren() - 1; i >= 0; i-- )
{
View *view = ChildAt(i);
if ( view->Frame().Contains( x,y ) )
{
int nx = x - view->Frame().left;
int ny = y - view->Frame().top;
SetActiveView( view );
view->MouseEvent( what, nx, ny, buttons );
break;
}
}
unlock();
}
示例3: ConvertFromWindow
Point View::ConvertFromWindow( Point p )
{
Point sam = p;
View *parent = this; // I am my own parent.
while ( parent != NULL )
{
sam.x -= parent->Frame().left;
sam.y -= parent->Frame().top;
parent = parent->GetParent();
}
return sam;
}
示例4: lock
View *Window::ChildAt( int x, int y )
{
lock();
for ( int i = CountChildren() - 1; i >= 0; i-- )
{
View *view = ChildAt(i);
if ( view->Frame().Contains( x,y ) )
{
unlock();
return view;
}
}
unlock();
return NULL;
}
示例5: oldBounds
void
View::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
{
if (x == 0 && y == 0)
return;
fFrame.right += x;
fFrame.bottom += y;
if (fVisible && dirtyRegion) {
IntRect oldBounds(Bounds());
oldBounds.right -= x;
oldBounds.bottom -= y;
BRegion* dirty = fWindow->GetRegion();
if (!dirty)
return;
dirty->Set((clipping_rect)Bounds());
dirty->Include((clipping_rect)oldBounds);
if (!(fFlags & B_FULL_UPDATE_ON_RESIZE)) {
// the dirty region is just the difference of
// old and new bounds
dirty->Exclude((clipping_rect)(oldBounds & Bounds()));
}
InvalidateScreenClipping();
if (dirty->CountRects() > 0) {
if ((fFlags & B_DRAW_ON_CHILDREN) == 0) {
// exclude children, they are expected to
// include their own dirty regions in ParentResized()
for (View* child = FirstChild(); child;
child = child->NextSibling()) {
if (!child->IsVisible())
continue;
IntRect previousChildVisible(
child->Frame() & oldBounds & Bounds());
if (dirty->Frame().Intersects(previousChildVisible)) {
dirty->Exclude((clipping_rect)previousChildVisible);
}
}
}
ConvertToScreen(dirty);
dirtyRegion->Include(dirty);
}
fWindow->RecycleRegion(dirty);
}
// layout the children
for (View* child = FirstChild(); child; child = child->NextSibling())
child->ParentResized(x, y, dirtyRegion);
// view bitmap
resize_frame(fBitmapDestination, fBitmapResizingMode, x, y);
// at this point, children are at their new locations,
// so we can rebuild the clipping
// TODO: when the implementation of Hide() and Show() is
// complete, see if this should be avoided
RebuildClipping(false);
}
示例6: MouseEvent
void View::MouseEvent( int what, int x, int y, unsigned int buttons )
{
// Backwards, as added.
lock();
for ( int i = CountChildren() - 1; i >= 0; i-- )
{
View *view = ChildAt(i);
if ( view->Frame().Contains( x,y ) )
{
int nx = x - view->Frame().left;
int ny = y - view->Frame().top;
if ( GetWindow() != NULL ) GetWindow()->SetActiveView( view );
view->MouseEvent( what, nx, ny, buttons );
unlock();
return;
}
}
unlock();
// Otherwise...
switch( what )
{
case MOUSE_DOWN:
MouseDown( x, y, buttons );
break;
case MOUSE_UP:
if ( hasFlag( HAS_POPUPMENU ) == false )
{
MouseUp( x, y, buttons );
break;
}
// Only the right mouse button.
if ( m_buttons != RIGHT_MOUSE_BUTTON )
{
MouseUp( x, y, buttons );
break;
}
if ( m_popupMenu == NULL ) m_popupMenu = Popup();
if ( m_popupMenu == NULL ) return;
m_popupMenu->MoveTo( x - m_popupMenu->Frame().Width() / 2,
y - m_popupMenu->Frame().Height() / 2 );
m_popupMenu->Show();
break;
case MOUSE_MOVED:
MouseMoved( x, y, buttons );
break;
}
m_buttons = buttons;
}