void ListPage::PartialDraw(short int iOldSel, short int iOldFirstInView) { Rect r = ItemsRect(); short int iDiff = m_firstItemInView - iOldFirstInView; if (iDiff !=0) { if (abs(iDiff)>1) { Draw(); return; } int iH = (CountItemsInView()-1) * m_itemHeight; int ySrc = r.y; int yDst = r.y; if (iDiff == 1) ySrc += m_itemHeight; else yDst += m_itemHeight; TAP_Osd_Copy(m_osdRegionIndex, m_osdRegionIndex, r.x, ySrc, r.w, iH, r.x, yDst, false); } DrawItem(r, m_selectedItem); DrawItem(r, iOldSel); DrawFooterAndScrollBar(); TAP_Osd_Copy(m_osdRegionIndex, GetTAPScreenRegion(), 0, 0, m_rcList.w, m_rcList.h, m_rcList.x, m_rcList.y, false); }
static void PaintTopRow(HDC hDC, HDC arrow, MENUITEM *items, MENUITEM *selected, int x, int y, HFONT font, int fontHeight) { MENUITEM *orig = items; int orig_x = x; SIZE xx; xx.cx =40; while (items) { GetTextExtentPoint32W(hDC, items->text, wcslen(items->text), &xx); xx.cx += 16; DrawItem(hDC, items->text, selected == items, COLOR_BTNFACE, x, y, xx.cx, fontHeight); x += xx.cx; items = items->next; } DrawItem(hDC, L"<---->", FALSE, COLOR_WINDOW, x, y, xx.cx, fontHeight); items = orig; x = orig_x; while (items) { SIZE xx; if (items->expanded) PaintColumn(hDC, arrow, items->popup, selected, x, y+fontHeight, font, fontHeight); GetTextExtentPoint32W(hDC, items->text, wcslen(items->text), &xx); xx.cx += 16; x += xx.cx; items = items->next; } }
/* -------------------------------------------------------------------- * FUNCTION NAME: Draw * DESCRIPTION : Draws Combobox on console, will check whether to draw * One label or the entire combobox using _isOpen. * RETURN : None. * NOTES : Polymorphic function - inherited from Widget. * -------------------------------------------------------------------- */ void ComboBox::Draw(COORD CursorPosition, const HANDLE& console) { if (!_comboNames.size()) return; if (!_isSorted) { SortArray(); } strVecItr itr = _comboNames.begin(); if (!_isOpen) { _isOpen = true; CursorPosition = GetCoord(); clearWidget(CursorPosition, console, GetLongestString() + 6, _comboNames.size()*HEIGHT_OF_CELL); while (itr->index != _selected) itr++; DrawItem(CursorPosition, console, itr, true); } else { while (itr != _comboNames.end()) { _isOpen = false; if (itr->index == _selected) DrawItem(CursorPosition, console, itr, true); else DrawItem(CursorPosition, console, itr, false); CursorPosition.Y += 2; ++itr; } } }
/* bool TLView::ItemPosOnScreen(TLItem* item) { } */ long TLView::DrawTrack(wxDC& dc, long yoffset, TLTrack* track) { gg_tl_dat start, end, delta_start; for ( TLItemList::Node *node = track->GetFirst(); node; node = node->GetNext() ) { TLItem *current = node->GetData(); if ( !ItemVisible( current ) ) continue; start = current->GetPosition() - m_PositionVisible; delta_start = 0; if ( start < 0 ) { delta_start = start; start = 0; } end = current->GetEndPosition() - m_PositionVisible; if ( end > VisibleLength() ) end = VisibleLength(); long left = (long) ( start / GetRealZoom() ) + VIEW_LEFT_BORDER; long delta_left = (long) ( delta_start / GetRealZoom() ); long top = yoffset - m_YscrollPosition; long width = (long) ( ( end - start ) / GetRealZoom() ); long height = track->GetHeight(); DrawItem( dc, current, left, delta_left, top, width, height ); for ( int i = 1; i < current->GetExtended(); i++ ) { DrawItem( dc, current, ( ( current->GetPosition() - m_PositionVisible ) / GetRealZoom() ) + VIEW_LEFT_BORDER + ( i * ( current->GetLen() / GetRealZoom() ) ), 0, top, ( current->GetLen() / GetRealZoom() ), height ); } } return yoffset + track->GetHeight() + m_TrackDrawDist; }
void CInformationPanel::CRecordItem::Draw(HDC hdc,const RECT &Rect) { if (m_fRecording) { TCHAR szText[256]; int Length; unsigned int RecordSec=(unsigned int)(m_RecordTime/1000); Length=StdUtil::snprintf(szText,lengthof(szText), TEXT("● %d:%02d:%02d"), RecordSec/(60*60),(RecordSec/60)%60,RecordSec%60); if (m_WroteSize>=0) { unsigned int Size= (unsigned int)(m_WroteSize/(ULONGLONG)(1024*1024/100)); Length+=StdUtil::snprintf(szText+Length,lengthof(szText)-Length, TEXT(" / %d.%02d MB"), Size/100,Size%100); } if (m_DiskFreeSpace>=0) { unsigned int FreeSpace= (unsigned int)(m_DiskFreeSpace/(ULONGLONG)(1024*1024*1024/100)); StdUtil::snprintf(szText+Length,lengthof(szText)-Length, TEXT(" / %d.%02d GB空き"), FreeSpace/100,FreeSpace%100); } DrawItem(hdc,Rect,szText); } else { DrawItem(hdc,Rect,TEXT("■ <録画していません>")); } }
void CMDITabsDialogBar::OnPaint() { CPaintDC dc(this); // device context for painting // prepare dc HGDIOBJ hOldFont = dc.SelectObject(g_PaintManager->m_FontBoldBC); DRAWITEMSTRUCT dis; dis.CtlType = ODT_TAB; dis.CtlID = GetDlgCtrlID(); dis.hwndItem = GetSafeHwnd(); dis.hDC = dc.GetSafeHdc(); dis.itemAction = ODA_DRAWENTIRE; // draw the rest of the border CRect rClient, rPage; GetClientRect(&dis.rcItem); rPage = dis.rcItem; AdjustRect(FALSE, rPage); dis.rcItem.top = rPage.top - 2; DrawMainBorder(&dis); // paint the tabs first and then the borders int nTab = GetItemCount(); int nSel = GetCurSel(); if (!nTab) // no pages added return; while (nTab--) { if (nTab != nSel) { dis.itemID = nTab; dis.itemState = 0; VERIFY(GetItemRect(nTab, &dis.rcItem)); DrawItem(&dis); //DrawItemBorder(&dis); } } // now selected tab if (nSel != -1) { dis.itemID = nSel; dis.itemState = ODS_SELECTED; VERIFY(GetItemRect(nSel, &dis.rcItem)); DrawItem(&dis); //DrawItemBorder(&dis); } dc.SelectObject(hOldFont); }
void DrawMenu() { const struct menu * const menu = menu_current(); FillMyBuffer(STARTING_ROW,PHONE_IDLE_BUFFER_ROWS,0x00); DrawCommonMenuIcons(); DrawItem(&(menu->items[0]), BUTTON_ICON_A_F_ROW,LEFT_BUTTON_COLUMN); DrawItem(&(menu->items[1]), BUTTON_ICON_B_E_ROW,LEFT_BUTTON_COLUMN); DrawItem(&(menu->items[2]), BUTTON_ICON_C_D_ROW,LEFT_BUTTON_COLUMN); DrawItem(&(menu->items[3]), BUTTON_ICON_A_F_ROW,RIGHT_BUTTON_COLUMN); DrawItem(&(menu->items[4]), BUTTON_ICON_B_E_ROW,RIGHT_BUTTON_COLUMN); }
/* -------------------------------------------------------------------- * FUNCTION NAME: Draw_Color * DESCRIPTION : Draws Combobox on console, will be used to change color * On hover * RETURN : None. * NOTES : Polymorphic function - inherited from Widget. * -------------------------------------------------------------------- */ void ComboBox::Draw_Color(COORD CursorPosition,const HANDLE& console) { strVecItr itr = _comboNames.begin(); while (itr != _comboNames.end()) { _isOpen = false; if (itr->index == _current) DrawItem(CursorPosition, console, itr, true); else DrawItem(CursorPosition, console, itr, false); CursorPosition.Y += 2; ++itr; } }
void AGameplayDebuggingHUDComponent::DrawEQSItemDetails(int32 ItemIdx, class UGameplayDebuggingComponent *DebugComponent) { #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST) && WITH_EQS const float PosY = DefaultContext.CursorY + 1.0f; float PosX = DefaultContext.CursorX; const int32 EQSIndex = DebugComponent->EQSLocalData.Num() > 0 ? FMath::Clamp(DebugComponent->CurrentEQSIndex, 0, DebugComponent->EQSLocalData.Num() - 1) : INDEX_NONE; auto& CurrentLocalData = DebugComponent->EQSLocalData[EQSIndex]; const EQSDebug::FItemData& ItemData = CurrentLocalData.Items[ItemIdx]; PrintString(DefaultContext, FColor::White, ItemData.Desc, PosX, PosY); PosX += ItemDescriptionWidth; FString ScoreDesc = FString::Printf(TEXT("%.2f"), ItemData.TotalScore); PrintString(DefaultContext, FColor::Yellow, ScoreDesc, PosX, PosY); PosX += ItemScoreWidth; FCanvasTileItem ActiveTileItem(FVector2D(0, PosY + 15.0f), GWhiteTexture, FVector2D(0, 2.0f), FLinearColor::Yellow); FCanvasTileItem BackTileItem(FVector2D(0, PosY + 15.0f), GWhiteTexture, FVector2D(0, 2.0f), FLinearColor(0.1f, 0.1f, 0.1f)); const float BarWidth = 80.0f; const int32 NumTests = ItemData.TestScores.Num(); float TotalWeightedScore = 0.0f; for (int32 Idx = 0; Idx < NumTests; Idx++) { TotalWeightedScore += ItemData.TestScores[Idx]; } for (int32 Idx = 0; Idx < NumTests; Idx++) { const float ScoreW = ItemData.TestScores[Idx]; const float ScoreN = ItemData.TestValues[Idx]; FString DescScoreW = FString::Printf(TEXT("%.2f"), ScoreW); FString DescScoreN = (ScoreN == UEnvQueryTypes::SkippedItemValue) ? TEXT("SKIP") : FString::Printf(TEXT("%.2f"), ScoreN); FString TestDesc = DescScoreW + FString(" {LightBlue}") + DescScoreN; float Pct = (TotalWeightedScore > KINDA_SMALL_NUMBER) ? (ScoreW / TotalWeightedScore) : 0.0f; ActiveTileItem.Position.X = PosX; ActiveTileItem.Size.X = BarWidth * Pct; BackTileItem.Position.X = PosX + ActiveTileItem.Size.X; BackTileItem.Size.X = FMath::Max(BarWidth * (1.0f - Pct), 0.0f); DrawItem(DefaultContext, ActiveTileItem, ActiveTileItem.Position.X, ActiveTileItem.Position.Y); DrawItem(DefaultContext, BackTileItem, BackTileItem.Position.X, BackTileItem.Position.Y); PrintString(DefaultContext, FColor::Green, TestDesc, PosX, PosY); PosX += TestScoreWidth; } #endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST) && WITH_EQS }
static void PaintColumn(HDC hDC, HDC arrow, MENUITEM *items, MENUITEM *selected, int x, int y, HFONT font, int fontHeight) { MENUITEM *orig = items; int width = CalculateMenuWidth(hDC, items) + 28; int pos = y; BOOL submenu = FALSE; while (items) { DrawItem(hDC, items->text, selected == items,COLOR_BTNFACE, x, pos, width, fontHeight); if (items->popup) { if (items->expanded) submenu = TRUE; BitBlt(hDC, x + width - 10, pos + (fontHeight - 8)/2, 8,8,arrow, 0, 0, SRCCOPY); } pos += fontHeight; items = items->next; } if (submenu) { items = orig; pos = y; while (items) { if (items->popup && items->expanded) { PaintColumn(hDC, arrow, items->popup, selected, x+width, pos, font, fontHeight); } pos += fontHeight; items = items->next; } } else { DrawItem(hDC, L"<---->", FALSE, COLOR_WINDOW, x, pos, width, fontHeight); items = orig; pos = y; while (items) { if (items->expanded) { DrawItem(hDC, L"<---->", FALSE, COLOR_WINDOW, x+width, pos, width, fontHeight); } pos += fontHeight; items = items->next; } } }
bool PopupMenu::SetSelected( int n ) { if ( n == selected ) { return true; } if ( n < 0 || n > list.count() || IsSplit( n ) ) { return false; } if ( sub.ptr() ) { sub.clear(); } int old = selected; selected = n; GC gc( this ); DrawItem( gc, old ); DrawItem( gc, selected ); return true; }
void CPmwStatusBar::DoPaint(CDC* pDC) { INHERITED::DoPaint(pDC); if (m_nCount > 1) { DRAWITEMSTRUCT dis; memset(&dis, 0, sizeof(dis)); dis.hwndItem = GetSafeHwnd(); dis.hDC = pDC->m_hDC; for (dis.itemID = 1; dis.itemID <= 3; dis.itemID++) { UINT uStyle; int nWidth; // Get the pane info to get the ID. GetPaneInfo(dis.itemID, dis.CtlID, uStyle, nWidth); // Get the item rect. GetItemRect(dis.itemID, &dis.rcItem); // If we need to draw this item, do it now. if (::RectVisible(pDC->m_hDC, &dis.rcItem)) { DrawItem(&dis); } } } }
void ScrolledListView::Draw(BRect updateRect) { // figure out which items we're drawing float itemHeight = ItemHeight(); int32 firstItem = (int) (updateRect.top / itemHeight); if (firstItem < 0) firstItem = 0; int32 lastItem = (int) ((updateRect.bottom + itemHeight - 1) / itemHeight); int32 numItems = NumItems(); if (lastItem >= numItems) lastItem = numItems - 1; // draw BRect itemRect = Bounds(); itemRect.top = firstItem * itemHeight; itemRect.bottom = itemRect.top + itemHeight - 1; for (int32 i=firstItem; i <= lastItem; i++) { // draw item DrawItem(i, itemRect, i == selection); // bump itemRect itemRect.top = itemRect.bottom + 1; itemRect.bottom = itemRect.top + itemHeight - 1; } // clear any left-over area if (itemRect.top < updateRect.bottom) { itemRect.bottom = updateRect.bottom; FillRect(itemRect, B_SOLID_LOW); } }
void CDuiListBox::RedrawItem(int iItem) { if(!IsVisible(TRUE)) return; CRect rcClient; GetClient(&rcClient); int iFirstVisible = GetTopIndex(); int nPageItems=(rcClient.Height()+m_nItemHei-1)/m_nItemHei+1; if(iItem>=iFirstVisible && iItem<GetCount() && iItem<iFirstVisible+nPageItems) { CRect rcItem(0,0,rcClient.Width(),m_nItemHei); rcItem.OffsetRect(0,m_nItemHei*iItem-m_ptOrigin.y); rcItem.OffsetRect(rcClient.TopLeft()); CDCHandle dc=GetDuiDC(&rcItem,OLEDC_PAINTBKGND); DuiDCPaint duiDC; BeforePaint(dc,duiDC); DuiSendMessage(WM_ERASEBKGND,(WPARAM)(HDC)dc); DrawItem(dc,rcItem,iItem); AfterPaint(dc,duiDC); ReleaseDuiDC(dc); } }
BOOL CComboBox::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult) { switch (message) { case WM_DRAWITEM: ASSERT(pResult == NULL); // no return value expected DrawItem((LPDRAWITEMSTRUCT)lParam); break; case WM_MEASUREITEM: ASSERT(pResult == NULL); // no return value expected MeasureItem((LPMEASUREITEMSTRUCT)lParam); break; case WM_COMPAREITEM: ASSERT(pResult != NULL); // return value expected *pResult = CompareItem((LPCOMPAREITEMSTRUCT)lParam); break; case WM_DELETEITEM: ASSERT(pResult == NULL); // no return value expected DeleteItem((LPDELETEITEMSTRUCT)lParam); break; default: return CWnd::OnChildNotify(message, wParam, lParam, pResult); } return TRUE; }
void COutlook2Ctrl::DrawItems(CDC * pDC, COL2Folder * oFolder, CRect & rect) { if (rect.bottom - m_iItemHeight < rect.top) return; CFont * of = (CFont *) pDC->SelectObject(&ftItems); for (int t = 0; t < oFolder->m_Items.GetSize(); t++) { if (t != 0) rect.top += 7; COL2Item * i = (COL2Item *) oFolder->m_Items.GetAt(t); if (i->csName != _T("")) { i->rcItem.SetRect(rect.left+1,rect.top, rect.right-1, rect.top + m_iItemHeight); rect.top += m_iItemHeight; } else { i->rcItem.SetRect(rect.left+1,rect.top+1, rect.right-1, rect.top + 3); rect.top += 8; } DrawItem(pDC, oFolder, i); DrawSubItems(pDC, oFolder, i, rect); if (rect.top >= rect.bottom - m_iItemHeight) break; } pDC->SelectObject(of); }
void CCheckListBoxEx::PreDrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { if (!m_ilCheck.GetSafeHandle()) { CCheckListBox::PreDrawItem(lpDrawItemStruct); return; } DRAWITEMSTRUCT drawItem; memcpy(&drawItem, lpDrawItemStruct, sizeof(DRAWITEMSTRUCT)); if ((((LONG)drawItem.itemID) >= 0) && ((drawItem.itemAction & (ODA_DRAWENTIRE | ODA_SELECT)) != 0)) { CDC* pDC = CDC::FromHandle(drawItem.hDC); COLORREF newBkColor = GetSysColor(COLOR_WINDOW); BOOL fDisabled = !IsWindowEnabled() || !IsEnabled(drawItem.itemID); if ((drawItem.itemState & ODS_SELECTED) && !fDisabled) newBkColor = GetSysColor(COLOR_HIGHLIGHT); COLORREF oldBkColor = pDC->SetBkColor(newBkColor); int nCheck = GetCheck(drawItem.itemID); m_ilCheck.Draw(pDC, nCheck, CPoint(drawItem.rcItem.left, drawItem.rcItem.top), ILD_TRANSPARENT); pDC->SetBkColor(oldBkColor); } drawItem.rcItem.left = drawItem.rcItem.left + m_nImageHeight + 2; DrawItem(&drawItem); }
void RadialPlot::DrawItems(wxBitmap *bmp) { wxMemoryDC onto; onto.SelectObject(*bmp); wxSize s = onto.GetSize(); wxPoint center(s.x/ 2, s.y / 2); if (s.x > s.y) { s.x = s.y; } else { s.y = s.x; } for (unsigned int i = maxLevel +1; i > 0 ; i--) { for (unsigned int j = 0; j < numItems; j++) { if (items[j].level == i - 1) { DrawItem(&onto, items[j], center, s.x); } } } }
void DrawMenuFrame(Menu *menu, int items) { int a; Node *mi; XClearWindow(disp,menu->win); DrawBevel(menu->win,0,0,menu->width-1,menu->height-1,MENUBORDERW,\ TheScreen.MenuLightGC,TheScreen.MenuShadowGC); if(menu->name) { DrawBevel(menu->win,MENUBORDERW,MENUBORDERW,menu->width-MENUBORDERW-1,\ menu->ItemHeight+MENUBORDERW-1,MENUBORDERW,\ TheScreen.MenuShadowGC,TheScreen.MenuLightGC); XDrawString(disp,menu->win,TheScreen.MenuTextGC,MENUXOFS+2*MENUBORDERW,MENUYOFS+\ 2*MENUBORDERW+menu->font->ascent,menu->name,strlen(menu->name)); } mi=NULL; while((mi=NodeNext(menu->Items,mi))){ MenuItem *item; item=mi->data; if(item->type != I_LINE) { if(items) DrawItem(item, 0); } else { int h; h=item->y; for(a=0;a<MENUBORDERW;a++) { XDrawLine(disp,menu->win,TheScreen.MenuShadowGC,a+1,h-1-a,menu->width-a,h-1-a); XDrawLine(disp,menu->win,TheScreen.MenuLightGC,a,a+h,menu->width-a-2,a+h); } } } }
void CSListCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult) { NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR); // Take the default processing unless we set this to something else below. *pResult = CDRF_DODEFAULT; // First thing - check the draw stage. If it's the control's prepaint // stage, then tell Windows we want messages for every item. if (pLVCD->nmcd.dwDrawStage == CDDS_PREPAINT) { *pResult = CDRF_NOTIFYITEMDRAW; } else if (pLVCD->nmcd.dwDrawStage == CDDS_ITEMPREPAINT) { // This is the notification message for an item. We'll request // notifications before each subitem's prepaint stage. *pResult = CDRF_NOTIFYSUBITEMDRAW; } else if (pLVCD->nmcd.dwDrawStage == (CDDS_ITEMPREPAINT | CDDS_SUBITEM)) { // This is the prepaint stage for a subitem. Here's where we set the // item's text and background colors. Our return value will tell // Windows to draw the subitem itself, but it will use the new colors // we set here. CDC* pDC = CDC::FromHandle(pLVCD->nmcd.hdc); DrawItem(static_cast<int> (pLVCD->nmcd.dwItemSpec), pLVCD->iSubItem, pDC); *pResult = CDRF_SKIPDEFAULT; // We've painted everything. } }
BOOL CListBox::OnChildNotify( UINT message, WPARAM wParam, LPARAM lParam, LRESULT *pResult ) /**********************************************/ { switch( message ) { case WM_CHARTOITEM: *pResult = CharToItem( LOWORD( wParam ), HIWORD( wParam ) ); return( TRUE ); case WM_COMPAREITEM: *pResult = CompareItem( (LPCOMPAREITEMSTRUCT)lParam ); return( TRUE ); case WM_DELETEITEM: DeleteItem( (LPDELETEITEMSTRUCT)lParam ); return( TRUE ); case WM_DRAWITEM: DrawItem( (LPDRAWITEMSTRUCT)lParam ); return( TRUE ); case WM_MEASUREITEM: MeasureItem( (LPMEASUREITEMSTRUCT)lParam ); return( TRUE ); case WM_VKEYTOITEM: *pResult = VKeyToItem( LOWORD( wParam ), HIWORD( wParam ) ); return( TRUE ); } return( FALSE ); }
void wxSVGCanvas::DrawImage(wxSVGImageElement* element, wxSVGMatrix* matrix, const wxCSSStyleDeclaration* style, const wxSVGRect* rect, wxProgressDialog* progressDlg) { wxSVGCanvasImage* canvasItem = (wxSVGCanvasImage*) CreateItem(element, NULL, progressDlg); if (style == NULL) style = &element->GetStyle(); if (style->GetDisplay() == wxCSS_VALUE_INLINE) { if (canvasItem->GetSvgImage() != NULL) { wxSVGGElement* gElem = new wxSVGGElement(); gElem->Translate(canvasItem->m_x, canvasItem->m_y); wxSVGSVGElement* svgElem = canvasItem->GetSvgImage(); svgElem->SetWidth(canvasItem->m_width); svgElem->SetHeight(canvasItem->m_height); gElem->AddChild(svgElem); RenderElement(gElem, rect, matrix, style, element->GetOwnerSVGElement(), element->GetViewportElement(), progressDlg); gElem->RemoveChild(gElem->GetFirstChild()); delete gElem; } else DrawItem(*canvasItem, *matrix, *style, *element->GetOwnerSVGElement()); } if (IsItemsCached()) element->SetCanvasItem(canvasItem); else delete canvasItem; }
void CGraphListCtrl::DrawItem(CDC* pDC ) { for(int i = 0; i < m_arrayItem.GetSize(); i ++) { DrawItem(i, pDC); } }
///////////////////////////////////////////////////////////////////////////// // CLayerSettingDlg message handlers void CLayerSettingDlg::OnDrawItem(int nItem, CDC* pdc, CRect& rect) { ASSERT(nItem >= 0); unsigned long ulMask = 1; ulMask = ulMask << nItem; BOOL bVisible, bLock; if( (m_ulLockLayer & ulMask) != 0) { //锁定层 bLock = TRUE; } else { //未锁定层 bLock = FALSE; } if( (m_ulVisibleLayer & ulMask) != 0) { //可见层 bVisible = TRUE; } else { //不可见层 bVisible = FALSE; } DrawItem(pdc, rect, bVisible, bLock, nItem); };
void SListBoxEx::OnPaint(IRenderTarget * pRT) { SPainter duiDC; BeforePaint(pRT,duiDC); CRect rcClient; GetClientRect(&rcClient); pRT->PushClipRect(&rcClient,RGN_AND); int iFirstVisible=m_ptOrigin.y/m_nItemHei; int nPageItems=(m_rcClient.Height()+m_nItemHei-1)/m_nItemHei+1; CRect rcClip,rcInter; pRT->GetClipBox(&rcClip); for(int iItem = iFirstVisible; iItem<GetItemCount() && iItem <iFirstVisible+nPageItems; iItem++) { CRect rcItem(0,0,m_rcClient.Width(),m_nItemHei); rcItem.OffsetRect(0,m_nItemHei*iItem-m_ptOrigin.y); rcItem.OffsetRect(m_rcClient.TopLeft()); rcInter.IntersectRect(&rcClip,&rcItem); if(!rcInter.IsRectEmpty()) DrawItem(pRT,rcItem,iItem); } pRT->PopClip(); AfterPaint(pRT,duiDC); }
void GfxWidget::DrawItems( void ) { unsigned short row = toprow / ItemHeight(); unsigned short num = row * gfx_per_row; // first visible item short xoff = bounds.x, yoff = bounds.y + row * ItemHeight() - toprow, img; surface->DrawBack( bounds ); while ( (img = GetImage(num)) != -1 ) { if ( num == current ) { Rect hilite( xoff, yoff, gfx_w, ItemHeight() ); hilite.Clip( bounds ); surface->FillRectAlpha( hilite, surface->GetFGPen() ); } DrawItem( img, xoff, yoff ); xoff += gfx_w; if ( xoff + gfx_w >= bounds.x + bounds.w ) { xoff = bounds.x; yoff += ItemHeight(); if ( yoff >= bounds.y + bounds.h ) break; } ++num; } }
void Window_Item::Refresh() { std::vector<int> party_items; data.clear(); Main_Data::game_party->GetItems(party_items); for (size_t i = 0; i < party_items.size(); ++i) { if (this->CheckInclude(party_items[i])) { data.push_back(party_items[i]); } } if (CheckInclude(0)) { data.push_back(0); } item_max = data.size(); CreateContents(); if (index > 0 && index >= item_max) { --index; } contents->Clear(); for (int i = 0; i < item_max; ++i) { DrawItem(i); } }
void CDuiHeaderCtrl::DrawDraggingState(DWORD dwDragTo) { CRect rcClient; GetClient(&rcClient); CDCHandle dc=GetDuiDC(rcClient,OLEDC_PAINTBKGND); DuiDCPaint duidc; BeforePaint(dc,duidc); CRect rcItem(rcClient.left,rcClient.top,rcClient.left,rcClient.bottom); int iDragTo=LOWORD(dwDragTo); int iDragFrom=LOWORD(m_dwHitTest); CDuiArray<int> items; for(int i=0;i<m_arrItems.GetCount();i++) { if(i!=iDragFrom) items.Add(i); } items.InsertAt(iDragTo,iDragFrom); m_pSkinItem->Draw(dc,rcClient,0); for(int i=0;i<items.GetCount();i++) { rcItem.left=rcItem.right; rcItem.right=rcItem.left+m_arrItems[items[i]].cx; if(items[i]!=iDragFrom) DrawItem(dc,rcItem,m_arrItems.GetData()+items[i]); } AfterPaint(dc,duidc); ReleaseDuiDC(dc); }
void WINAPI duListBox::DrawObject(HDC hDC) { duRect rcListBox; Plugin_GetRect(this, &rcListBox); rcListBox.OffsetRect(-rcListBox.left, -rcListBox.top); duStyleGroup *pStyleGroup = (duStyleGroup *)GetResObj(GetStyle(), DU_RES_STYLEGROUP); if (pStyleGroup) pStyleGroup->Draw(hDC, &rcListBox, GetState(), GetText(), GetAlpha()); pStyleGroup = (duStyleGroup *)GetResObj(m_szItemStyle, DU_RES_STYLEGROUP); if (pStyleGroup == NULL) return; duRect rcItem; rcItem.SetRectEmpty(); rcItem.right = rcListBox.Width(); rcItem.OffsetRect(0, -m_nYOffset); ListBoxItem *pItem = NULL; int i; int nItemCount = GetItemCount(); for (i = 0;i < nItemCount; i++) { pItem = m_vtItem[i]; rcItem.top = rcItem.bottom; rcItem.bottom = rcItem.top + m_nItemHeight; DrawItem(pItem, hDC, pStyleGroup, rcItem); } }
static void DrawBuyEquipmentForm() { FormPtr frmP = FrmGetActiveForm(); int i; RectangularShortcuts( frmP, BuyEquipmentBButton ); for (i=0; i<MAXWEAPONTYPE+MAXSHIELDTYPE+MAXGADGETTYPE; ++i) { RectangularButton( frmP, BuyEquipmentBuy0Button + i ); if (i < MAXWEAPONTYPE) { if (BASEWEAPONPRICE( i ) <= 0) FrmHideObject( frmP, FrmGetObjectIndex( frmP, BuyEquipmentBuy0Button + i ) ); else FrmShowObject( frmP, FrmGetObjectIndex( frmP, BuyEquipmentBuy0Button + i ) ); } else if (i < MAXWEAPONTYPE + MAXSHIELDTYPE) { if (BASESHIELDPRICE( i-MAXWEAPONTYPE ) <= 0) FrmHideObject( frmP, FrmGetObjectIndex( frmP, BuyEquipmentBuy0Button + i ) ); else FrmShowObject( frmP, FrmGetObjectIndex( frmP, BuyEquipmentBuy0Button + i ) ); } else { if (BASEGADGETPRICE( i-MAXWEAPONTYPE-MAXSHIELDTYPE ) <= 0) FrmHideObject( frmP, FrmGetObjectIndex( frmP, BuyEquipmentBuy0Button + i ) ); else FrmShowObject( frmP, FrmGetObjectIndex( frmP, BuyEquipmentBuy0Button + i ) ); } } FrmDrawForm( frmP ); for (i=0; i<MAXWEAPONTYPE; ++i) DrawItem( Weapontype[i].Name, 17+i*13, BASEWEAPONPRICE( i ) ); for (i=0; i<MAXSHIELDTYPE; ++i) DrawItem( Shieldtype[i].Name, 17+(i+MAXWEAPONTYPE)*13, BASESHIELDPRICE( i ) ); for (i=0; i<MAXGADGETTYPE; ++i) DrawItem( Gadgettype[i].Name, 17+(i+MAXWEAPONTYPE+MAXSHIELDTYPE)*13, BASEGADGETPRICE( i ) ); DisplayTradeCredits(); }