コード例 #1
0
ファイル: View.cpp プロジェクト: mmanley/Antares
void
View::SetViewBitmap(ServerBitmap* bitmap, IntRect sourceRect,
                    IntRect destRect, int32 resizingMode, int32 options)
{
    if (fViewBitmap != NULL) {
        Overlay* overlay = _Overlay();

        if (bitmap != NULL) {
            // take over overlay token from current overlay (if it has any)
            Overlay* newOverlay = bitmap->Overlay();

            if (overlay != NULL && newOverlay != NULL)
                newOverlay->TakeOverToken(overlay);
        } else if (overlay != NULL)
            overlay->Hide();

        fViewBitmap->ReleaseReference();
    }

    // the caller is allowed to delete the bitmap after setting the background
    if (bitmap != NULL)
        bitmap->AcquireReference();

    fViewBitmap = bitmap;
    fBitmapSource = sourceRect;
    fBitmapDestination = destRect;
    fBitmapResizingMode = resizingMode;
    fBitmapOptions = options;

    _UpdateOverlayView();
}
コード例 #2
0
ファイル: View.cpp プロジェクト: mmanley/Antares
bool
View::RemoveChild(View* view)
{
    if (view == NULL || view->fParent != this) {
        printf("View::RemoveChild(%p - %s) - View is not child of "
               "this (%p) view!\n", view, view ? view->Name() : NULL, this);
        return false;
    }

    view->fParent = NULL;

    if (fLastChild == view)
        fLastChild = view->fPreviousSibling;
    // view->fNextSibling would be NULL

    if (fFirstChild == view )
        fFirstChild = view->fNextSibling;
    // view->fPreviousSibling would be NULL

    // connect child before and after view
    if (view->fPreviousSibling)
        view->fPreviousSibling->fNextSibling = view->fNextSibling;

    if (view->fNextSibling)
        view->fNextSibling->fPreviousSibling = view->fPreviousSibling;

    // view has no siblings anymore
    view->fPreviousSibling = NULL;
    view->fNextSibling = NULL;

    if (view->IsVisible()) {
        Overlay* overlay = view->_Overlay();
        if (overlay != NULL)
            overlay->Hide();

        RebuildClipping(false);
    }

    if (fWindow) {
        view->DetachedFromWindow();

        if (fVisible && view->IsVisible()) {
            // trigger redraw
            IntRect clippedFrame = view->Frame();
            ConvertToVisibleInTopView(&clippedFrame);
            BRegion* dirty = fWindow->GetRegion();
            if (dirty) {
                dirty->Set((clipping_rect)clippedFrame);
                fWindow->MarkContentDirtyAsync(*dirty);
                fWindow->RecycleRegion(dirty);
            }
        }
    }

    return true;
}
コード例 #3
0
ファイル: View.cpp プロジェクト: mmanley/Antares
void
View::UpdateVisibleDeep(bool parentVisible)
{
    bool wasVisible = fVisible;

    fVisible = parentVisible && !fHidden;
    for (View* child = FirstChild(); child; child = child->NextSibling())
        child->UpdateVisibleDeep(fVisible);

    // overlay handling

    Overlay* overlay = _Overlay();
    if (overlay == NULL)
        return;

    if (fVisible && !wasVisible)
        _UpdateOverlayView();
    else if (!fVisible && wasVisible)
        overlay->Hide();
}