Esempio n. 1
0
void
CmtWiListEngine::PaintContens(CmtContext *ctx) {
  //–исовать видимые элементы
  for( int32 i = mStart, j = 0; i < mCount && j < mView; i++, j++)
    PaintItem( ctx, j, i );
  //–исовать скроллер
  PaintScroll( ctx );
  }
Esempio n. 2
0
void CCheckListBoxItem::Paint(COwnerDrawListBox* pList, LPDRAWITEMSTRUCT pDrawItemStruct)
{
	// Get the DC and rectangle to use.
			
	CDC* pDC = CDC::FromHandle(pDrawItemStruct->hDC);
						
	if (pDC != NULL)
	{
		// Get the colors to use.

		COLORREF clForeground;
		COLORREF clBackground;
		COLORREF clCheckBorder;
		COLORREF clCheckBackground;
		COLORREF clCheck;
					
		ComputeColors(pList, pDC, pDrawItemStruct, clForeground, clBackground, clCheckBorder, clCheckBackground, clCheck);

		// Compute the bounding rectangles for the check box and the item.
					
		CRect crCheckBox;
		CRect crItem;
										
		ComputeBounds(pList, pDC, pDrawItemStruct, crCheckBox, crItem);
					
		// Draw the background.
					
		PaintBackground(pList, pDC, pDrawItemStruct, clBackground);
					
		// Draw the checkbox.
					
		PaintCheckBox(pList, pDC, pDrawItemStruct, crCheckBox, clCheckBorder, clCheckBackground, clCheck);
					
		// Draw the item.
					
		PaintItem(pList, pDC, pDrawItemStruct, crItem, clForeground, clBackground);
					
		// If the item has the focus, draw the focus indicator.
					
		if (IsFocused(pList, pDrawItemStruct))
		{
			PaintFocus(pList, pDC, pDrawItemStruct);
		}
	}
}
Esempio n. 3
0
void CHeadCtrol::OnPaint()
{
	CPaintDC dc(this); // device context for painting

	CRect clientRect;
	GetClientRect( &clientRect );

	CDC hdcMem;
	hdcMem.CreateCompatibleDC(NULL);
	CBitmap hBitmap;
	hBitmap.CreateCompatibleBitmap(&dc,clientRect.Width(),clientRect.Height());
	hdcMem.SelectObject(&hBitmap);

	PaintItem( &hdcMem ,clientRect);
	PaintRight( &hdcMem );
	PaintSortArrow( &hdcMem,m_currentSortInfo.first, m_currentSortInfo.second );

	dc.BitBlt(clientRect.TopLeft().x, clientRect.TopLeft().y,
		clientRect.Width(), clientRect.Height(),&hdcMem,0,0,SRCCOPY);
}
Esempio n. 4
0
//
/// Repaint the item entirely.
//
void
TCheckList::ODADrawEntire(DRAWITEMSTRUCT & drawInfo)
{
  PaintItem(drawInfo);
}
Esempio n. 5
0
//
// Repaint the item entirely.
//
void
TCheckList::ODASelect(DRAWITEMSTRUCT & drawInfo)
{
  PaintItem(drawInfo);
}
Esempio n. 6
0
//
/// Repaint the item entirely.
//
void
TCheckList::ODAFocus(DRAWITEMSTRUCT & drawInfo)
{
  PaintItem(drawInfo);
}
Esempio n. 7
0
void CGItemListArea::Paint (CG16bitImage &Dest, const RECT &rcRect)

//	Paint
//
//	Paint the area

	{
	//	Can't paint if we are not properly initialized

	if (m_pFonts == NULL)
		return;

	//	If there are no items here, then say so

	if (m_pListData == NULL || !m_pListData->IsCursorValid())
		{
		int x = rcRect.left + (RectWidth(rcRect) - m_pFonts->LargeBold.MeasureText(STR_NO_ITEMS)) / 2;
		int y = rcRect.top + (RectHeight(rcRect) - m_pFonts->LargeBold.GetHeight()) / 2;

		Dest.DrawText(x, y,
				m_pFonts->LargeBold,
				RGB_DISABLED_TEXT,
				STR_NO_ITEMS);

		m_iOldCursor = -1;
		}

	//	Otherwise, paint the list of items

	else
		{
		int iCursor = m_pListData->GetCursor();
		int iCount = m_pListData->GetCount();

		ASSERT(iCursor >= 0 && iCursor < m_Rows.GetCount());
		ASSERT(iCount == m_Rows.GetCount());

		//	If the cursor has changed, update the offset so that we
		//	have a smooth scroll.

		if (m_iOldCursor != -1 && m_iOldCursor != iCursor)
			{
			int cyDiff = (m_Rows[iCursor].cyHeight - m_Rows[m_iOldCursor].cyHeight) / 2;

			if (m_iOldCursor < iCursor)
				m_yOffset = m_Rows[m_iOldCursor].cyHeight + cyDiff;
			else
				m_yOffset = -(m_Rows[iCursor].cyHeight - cyDiff);
			}

		m_iOldCursor = iCursor;

		//	Figure out the ideal position of the cursor (relative to the
		//	rect).

		int yIdeal = m_yOffset + ((RectHeight(rcRect) - m_Rows[iCursor].cyHeight) / 2);

		//	Figure out the actual position of the cursor row (relative to the
		//	rect).

		int yCursor;

		//	If the cursor is in the top part of the list
		if (m_Rows[iCursor].yPos < yIdeal)
			yCursor = m_Rows[iCursor].yPos;

		//	If the total number of lines is less than the whole rect
		else if (m_cyTotalHeight < RectHeight(rcRect))
			yCursor = m_Rows[iCursor].yPos;

		//	If the cursor is in the bottom part of the list
		else if ((m_cyTotalHeight - m_Rows[iCursor].yPos) < (RectHeight(rcRect) - yIdeal))
			yCursor = (RectHeight(rcRect) - (m_cyTotalHeight - m_Rows[iCursor].yPos));

		//	The cursor is in the middle of the list
		else
			yCursor = yIdeal;

		//	Figure out the item position at which we start painting

		int iStart = FindRow(m_Rows[iCursor].yPos - yCursor);
		ASSERT(iStart != -1);
		if (iStart == -1)
			iStart = 0;

		int yStart = yCursor - (m_Rows[iCursor].yPos - m_Rows[iStart].yPos);

		//	Compute y offset of first row (so that we can handle clicks later)

		m_yFirst = yStart - m_Rows[iStart].yPos;

		//	Paint

		int y = rcRect.top + yStart;
		int iPos = iStart;
		bool bPaintSeparator = false;
		RECT rcItem;

		while (y < rcRect.bottom && iPos < m_Rows.GetCount())
			{
			//	Paint previous separator

			if (bPaintSeparator)
				{
				Dest.Fill(rcItem.left,
						rcItem.bottom - 1,
						RectWidth(rcItem),
						1,
						CG16bitImage::RGBValue(80,80,80));
				}
			else
				bPaintSeparator = true;

			//	Paint only if we have a valid entry. Sometimes we can
			//	start at an invalid entry because we're scrolling.

			if (iPos >= 0)
				{
				m_pListData->SetCursor(iPos);

				rcItem.top = y;
				rcItem.left = rcRect.left;
				rcItem.bottom = y + m_Rows[iPos].cyHeight;
				rcItem.right = rcRect.right;

				//	See if we need to paint the cursor

				bool bPaintCursor = (iPos == iCursor);

				//	Paint selection background (if selected)

				if (bPaintCursor)
					{
					Dest.FillTrans(rcItem.left,
							rcItem.top,
							RectWidth(rcItem),
							RectHeight(rcItem),
							m_pFonts->wSelectBackground,
							128);

					bPaintSeparator = false;
					}

				//	Paint item

				switch (m_iType)
					{
					case listCustom:
						PaintCustom(Dest, rcItem, bPaintCursor);
						break;

					case listItem:
						PaintItem(Dest, m_pListData->GetItemAtCursor(), rcItem, bPaintCursor);
						break;
					}
				}

			//	Next

			y += m_Rows[iPos].cyHeight;
			iPos++;
			}

		//	Done

		m_pListData->SetCursor(iCursor);
		}
	}