AUI_ERRCODE UITestWindow::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_surface; RECT rectInside = { 3, 26, (m_width - 4), (m_height - 4)}; RECT rectTitle = { 4, 4, (m_width - 4), 24 }; RECT rect = { 0, 0, m_width, m_height }; g_c3ui->TheBlitter()->ColorBlt( surface, &rect, RGB(191,191,191), 0 ); g_c3ui->TheBlitter()->ColorBlt( surface, &rectTitle, RGB(0,0,142), 0 ); g_c3ui->TheBlitter()->ColorBlt( surface, &rectInside, RGB(255,255,255), 0 ); AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }
aui_Window *aui_UI::BringWindowToTop( aui_Window *window ) { aui_Window *prevTopWindow = NULL; uint32 type = window->Type(); bool found = false; m_childListChanged = TRUE; ListPos position = m_childList->GetHeadPosition(); for ( sint32 j = m_childList->L(); j; j-- ) { ListPos curPosition = position; aui_Window *curWindow = (aui_Window *)m_childList->GetNext( position ); if ( !found ) { if ( window == curWindow ) return window; if ( type == curWindow->Type() ) { prevTopWindow = curWindow; m_childList->InsertBefore( curPosition, window ); found = true; } } else { if ( window == curWindow ) { m_childList->DeleteAt( curPosition ); AddDirtyRect( window->X(), window->Y(), window->X() + window->Width(), window->Y() + window->Height() ); break; } } } return prevTopWindow; }
AUI_ERRCODE aui_UI::RemoveChild( uint32 windowId ) { ListPos position = m_childList->GetHeadPosition(); for ( sint32 i = m_childList->L(); i; i-- ) { ListPos prevPos = position; aui_Window *window = (aui_Window *)m_childList->GetNext( position ); if ( window->Id() == windowId ) { window->DeleteSurfaceIfDynamic(); aui_Control *focus = aui_Control::GetKeyboardFocus(); if ( focus && window->GetChild( focus->Id() ) ) { focus->ReleaseKeyboardFocus(); focus->ReleaseMouseOwnership(); } window->Reset(); m_virtualFocus = NULL; position = window->ChildList()->GetHeadPosition(); for ( i = window->ChildList()->L(); i; i-- ) { aui_Control *control = (aui_Control *)window->ChildList()->GetNext( position ); control->HideTipWindow(); } window->SetParent( NULL ); m_childList->DeleteAt( prevPos ); AddDirtyRect( window->X(), window->Y(), window->X() + window->Width(), window->Y() + window->Height() ); m_childListChanged = TRUE; break; } } return AUI_ERRCODE_OK; }
AUI_ERRCODE aui_TipWindow::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_surface; RECT rect = { 0, 0, m_width, m_height }; g_ui->TheBlitter()->ColorBlt( surface, &rect, RGB(0,0,0), 0 ); primitives_FrameRect16(surface, &rect, g_colorSet->GetColor(COLOR_GRAY)); if ( surface == m_surface ) AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }
AUI_ERRCODE aui_UI::Invalidate( RECT *rect ) { if ( rect ) AddDirtyRect( rect ); else { FlushDirtyList(); m_dirtyList->AddRect( 0, 0, m_width, m_height ); } return AUI_ERRCODE_OK; }
void DisplayManager::InvalidateViewportRegion (WebRect* pDirty) { if (mViewRect.Overlaps(pDirty)) { WebRect padding; GetPaddingWidth(&padding); WebRect dirty(*pDirty); dirty.And(&mViewRect); DisplayManager* myManager = this->GetManager(); WEBC_BOOL addRect = (!mpParent && !myManager); #ifdef WEBC_BUFFER_SCROLLING if (mManagerFlags & MANAGER_FLAG_BUFFER_SCROLL) { addRect = WEBC_TRUE; } #endif if (addRect) { SetManagerFlag(MANAGER_FLAG_DIRTY); AddDirtyRect(&dirty); } if (mpParent) { dirty.Shift((mRect.left + padding.left) - mViewRect.left, (mRect.top + padding.top) - mViewRect.top); mpParent->InvalidateChild(this, &dirty); } else if (myManager) { dirty.Shift((mRect.left + padding.left) - mViewRect.left, (mRect.top + padding.top) - mViewRect.top); myManager->InvalidateViewportRegion(&dirty); } } }
void DisplayManager::SetViewport (WebRect *pViewRect) { if (!mViewRect.Equals(pViewRect)) { PresetWebRect oldRect(&mViewRect); mViewportChanged = WEBC_TRUE; mViewRect.Set(pViewRect); CorrectViewportPosition(); #ifdef WEBC_BUFFER_SCROLLING if (mManagerFlags & MANAGER_FLAG_BUFFER_SCROLL) { WebGraphics* gc = this->GetGraphics(); if (gc) { if (mScrollBuffer == 0) { mScrollBuffer = gc->CreateBuffer(mViewRect.Width() * 2, mViewRect.Height() * 2); } else { if (oldRect.Width() != mViewRect.Width() || oldRect.Height() != mViewRect.Height()) { mScrollBuffer = gc->ResizeBuffer(mScrollBuffer, mViewRect.Width() * 2, mViewRect.Height() * 2); AddDirtyRect(&mViewRect); SetManagerFlag(MANAGER_FLAG_DIRTY); return; } } if (mScrollBuffer) { // find non-overlapping regions if (mViewRect.Overlaps(&oldRect)) { PresetWebRect viewRect(&mViewRect); WebRect extraRect; int count = viewRect.Split(&oldRect, &extraRect); if (count > 0) { if (count > 1) { if (count > 2) { if (!extraRect.Empty()) { AddDirtyRect(&extraRect); } } if (!oldRect.Empty()) { AddDirtyRect(&oldRect); } } if (!viewRect.Empty()) { AddDirtyRect(&viewRect); } } } else { AddDirtyRect(&mViewRect); } SetManagerFlag(MANAGER_FLAG_DIRTY); } } } #endif } }
AUI_ERRCODE aui_UI::AddDirtyRect( RECT *rect ) { if ( !rect ) return AddDirtyRect( 0, 0, m_width, m_height ); return AddDirtyRect( rect->left, rect->top, rect->right, rect->bottom ); }