void Paint(Surface* pSurface) { if (m_pImageBkgnd) pSurface->BitBlt(WinPoint(0, 0), m_pImageBkgnd->GetSurface(), WinRect(m_ptImgOrigin.X(), m_ptImgOrigin.Y(), m_ptImgOrigin.X() + XSize(), m_ptImgOrigin.Y() + YSize())); // calc num Items to draw int iLastVisibleItem = LastVisibleItem(); int iLastItem = m_vItems.GetCount() - 1; if (iLastVisibleItem > iLastItem) iLastVisibleItem = iLastItem; // draw each Item WinRect rectPaint = WinRect(0, 0, m_nItemWidth, YSize()); WinRect rectItem = rectPaint; rectItem.bottom = rectItem.top; ZAssert(m_iTopItem >= 0); // count the number of slots for the first item which we are not drawing int nNumHiddenSlots = 0; if (m_vItems.GetCount() > 0) { while (m_iTopItem - nNumHiddenSlots > 0 && m_vItems[m_iTopItem - (nNumHiddenSlots + 1)] == m_vItems[m_iTopItem]) nNumHiddenSlots++; for (int iItem = m_iTopItem; iItem <= iLastVisibleItem; iItem += m_vItems[iItem]->GetItemHeight() - nNumHiddenSlots, nNumHiddenSlots = 0) { rectItem.top = rectItem.bottom; int nLinesLeft = (iLastVisibleItem - iItem) + 1; int nLines = m_vItems[iItem]->GetItemHeight() - nNumHiddenSlots; rectItem.bottom += m_nItemHeight * (nLines > nLinesLeft ? nLinesLeft : nLines); // draw highlight if selected bool bItemSel = (m_iSelItem == iItem); if (bItemSel && m_pImageBkgndSel) pSurface->BitBlt(rectItem.Min(), m_pImageBkgndSel->GetSurface(), rectItem); // draw item m_vItems[iItem]->DrawItem(pSurface, rectItem, bItemSel, nNumHiddenSlots); } } }
void Paint(Surface* psurface) { if (m_value != 0) { psurface->BitBlt( WinPoint(0, 0), m_psurface, WinRect(0, 0, m_value, YSize()) ); } if (m_value < m_valueFlash) { psurface->FillRect( WinRect( m_value, 0, m_valueFlash, YSize() ), m_colorFlash ); } }
void AABB::SetSize(const vec3& p){// this will not move the box, only scale it vec3 scalar(p.x/XSize(), p.y/YSize(), p.z/ZSize()); Max*=scalar; Min*=scalar; }
MouseResult Pane::HitTest(IInputProvider* pprovider, const Point& point, bool bCaptured) { bool bInside = !m_bHidden && point.X() >= 0 && point.X() < (float)XSize() && point.Y() >= 0 && point.Y() < (float)YSize(); if (m_ppaneCapture) { ZAssert(bCaptured); // // Is the mouse over the captured pane? // MouseResult mouseResult = m_ppaneCapture->HitTest( pprovider, point - Point::Cast(m_ppaneCapture->m_offset), true ); if (mouseResult.Test(MouseResultHit())) { m_ppaneHit = m_ppaneCapture; } else { m_ppaneHit = NULL; } // // Release Capture? // if (mouseResult.Test(MouseResultRelease())) { RemoveCapture(); return mouseResult; } // // Call MouseMove // m_ppaneCapture->MouseMove( pprovider, point - Point::Cast(m_ppaneCapture->m_offset), true, m_ppaneHit != NULL ); } else { // // // Which image are we over? // Pane* ppaneHit = NULL; // !!! if (bInside || m_ppaneHit != NULL) { if (bInside) { TRef<Pane> ppane; for(ppane = m_pchild; ppane!= NULL; ppane = ppane->m_pnext) { MouseResult mouseResult = ppane->HitTest( pprovider, point - Point::Cast(ppane->m_offset), false ); if (mouseResult.Test(MouseResultHit())) { // !!! some of the mdl files violate this // ZAssert(ppaneHit == NULL); if (ppaneHit == NULL) { ppaneHit = ppane; } } } } // // Call MouseMove, MouseEnter, or MouseLeave // if (m_ppaneHit != ppaneHit) { if (m_ppaneHit) { m_ppaneHit->MouseLeave(pprovider); } m_ppaneHit = ppaneHit; if (m_ppaneHit) { m_ppaneHit->MouseEnter( pprovider, point - Point::Cast(m_ppaneHit->m_offset) ); } } else if (m_ppaneHit) { m_ppaneHit->MouseMove( pprovider, point - Point::Cast(m_ppaneHit->m_offset), false, true ); } } if (bInside) { return MouseResultHit(); } else { return MouseResult(); } }