Esempio n. 1
0
void CDiasStatusBar::OnRButtonUp (UINT nFlags, CPoint point) {
	if (GetCapture() != this) {
		ReleaseCapture ();
		return;
	}
	ReleaseCapture ();

	CRect rect1, rect2;
	GetItemRect (2, rect1);
	GetItemRect (3, rect2);

	uvar32_64 n, count = 0;
	CaImMenu menu;
	CaImMenuItem** ppItems;
	menu.CreatePopupMenu ();

	GetItemRect (2, rect1);
	GetItemRect (3, rect2);
	if (rect1.PtInRect (point) || rect2.PtInRect (point)) {
		count = theApp.GeomScales.GetCount ();
		ppItems = new CaImMenuItem*[count];
		for (n = 0; n < count; ++n) {
			ppItems[n] = new CaImMenuItem (theApp.GeomScales[n].GetName() + "\t(" + theApp.GeomScales[n].GetUnits () + ")",
				(theApp.GeomScales[aimActive].GetPos () == n) ? AMIS_CHECKED : 0);
			menu.AppendMenu (MF_STRING | MF_ENABLED | MF_OWNERDRAW, ID_TOOLS_GEOMSCALE_1 + n, (LPCTSTR)ppItems[n]);
		}
		menu.CheckMenuRadioItem (0, n, theApp.GeomScales[aimActive].GetPos (), MF_BYPOSITION);
	}
	GetItemRect (4, rect1);
	GetItemRect (5, rect2);
	if (rect1.PtInRect (point) || rect2.PtInRect (point)) {
		count = theApp.DensScales.GetCount ();
		ppItems = new CaImMenuItem*[count];
		for (n = 0; n < count; ++n) {
			ppItems[n] = new CaImMenuItem (theApp.DensScales[n].GetName() + "\t(" + theApp.DensScales[n].GetUnits () + ")",
				(theApp.DensScales[aimActive].GetPos () == n) ? AMIS_CHECKED : 0);
			menu.AppendMenu (MF_STRING | MF_ENABLED | MF_OWNERDRAW, ID_TOOLS_GEOMSCALE_1 + n, (LPCTSTR)ppItems[n]);
		}
		menu.CheckMenuRadioItem (0, n, theApp.DensScales[aimActive].GetPos (), MF_BYPOSITION);
	}

	GetWindowRect (rect2);
	menu.TrackPopupMenu (TPM_LEFTALIGN, point.x + rect2.left, point.y + rect2.top, this);

	for (n = 0; n < count; ++n)
		delete ppItems[n];
	if (count > 0)
		delete [] ppItems;
}
Esempio n. 2
0
void CWndLog::CalcCoordsForCurSel()
{
	int iCurSel = GetSelectionMark ();
	if (iCurSel == -1)
	{
		POSITION pos = GetFirstSelectedItemPosition ();
		if (pos)
			iCurSel = GetNextSelectedItem (pos);
	}

	if (iCurSel != -1)
	{
		RECT rc;
		GetItemRect (iCurSel, &rc, LVIR_BOUNDS);
		m_rbPt.x = rc.left + 30;
		m_rbPt.y = rc.top;
	}
	else
		m_rbPt.x = m_rbPt.y = 30;
}
Esempio n. 3
0
BOOL CToolBarWithCombo::CreateComboBox(CComboBox& comboBox, UINT nIndex, UINT nID, 
								int nWidth, int nDropHeight)
{
	// Create the combo box
	SetButtonInfo(nIndex, nID, TBBS_SEPARATOR, nWidth);

	CRect rect;
	GetItemRect(nIndex, &rect);
	rect.top = 1;
	rect.bottom = rect.top + nDropHeight;
	if (!comboBox.Create(
			CBS_DROPDOWN|WS_VISIBLE|WS_TABSTOP|WS_VSCROLL,
			rect, this, nID))
	{
		TRACE("Failed to create combo-box\n");
		return FALSE;
	}

	return TRUE;
}
Esempio n. 4
0
//************************************************************************
void CHeaderView::BiselaBoton(CRect rcWin,CGDI* pDC)
{
	CPen cp;
	CPen cps;
	CPen cpw;

	cp.CreatePen(PS_SOLID,1, m_clrFace);
	cps.CreatePen(PS_SOLID,1, CDrawLayer::GetRGBSemiShadow());
	cpw.CreatePen(PS_SOLID,1, m_clrLight);
	/***************************************************
	pDC->Draw3dRect(rcWin,m_clrLight,m_clrShadow);
	rcWin.DeflateRect(1,1);
	pDC->Draw3dRect(rcWin,m_clrFace,m_clrFace);
	***************************************************/

	int iNumItems=GetItemCount();
	int iContx=0;
	for (int i =0; i < iNumItems; i++)
	{
		CRect recItem;
		GetItemRect(i, recItem);
		iContx+=recItem.Width();
		//quitamos todas las lineas
		recItem.DeflateRect(1,1);
		pDC->SelectObject(&cpw);
		pDC->MoveTo(iContx-2,rcWin.top+1);
		pDC->LineTo(iContx-2,rcWin.bottom-1);
		pDC->SelectObject(&cps);
		pDC->MoveTo(iContx-1,rcWin.top+1);
		pDC->LineTo(iContx-1,rcWin.bottom-1);
		pDC->SelectObject(&cpw);
		pDC->MoveTo(iContx,rcWin.top+1);
		pDC->LineTo(iContx,rcWin.bottom-1);
		
	}

	cp.DeleteObject();
	cps.DeleteObject();
	cpw.DeleteObject();
	
}
// TODO: make sure that moved items maintain their selection state
int ExListViewCtrl::moveItem(int oldPos, int newPos) {
	TCHAR buf[512];
	LVITEM lvi;
	lvi.iItem = oldPos;
	lvi.iSubItem = 0;
	lvi.mask = LVIF_IMAGE | LVIF_INDENT | LVIF_PARAM | LVIF_STATE;
	GetItem(&lvi);
	TStringList l;

	for(int j = 0; j < GetHeader().GetItemCount(); j++) {
		GetItemText(oldPos, j, buf, 512);
		l.push_back(buf);
	}

	SetRedraw(FALSE);

	if(oldPos < newPos) {
		lvi.iItem = newPos + 1;
	} else {
		lvi.iItem = newPos;
	}
	int i = InsertItem(&lvi);
	int m = 0;
	for(TStringIter k = l.begin(); k != l.end(); ++k, m++) {
		SetItemText(i, m, k->c_str());
	}
	EnsureVisible(i, FALSE);

	if(i < oldPos)
		DeleteItem(oldPos + 1);
	else
		DeleteItem(oldPos);

	SetRedraw(TRUE);

	RECT rc;
	GetItemRect(i, &rc, LVIR_BOUNDS);
	InvalidateRect(&rc);

	return i;
}
Esempio n. 6
0
CListBox* CPlayerListCtrl::ShowInPlaceListBox(int nItem, int nCol, CAtlList<CString>& lstItems, int nSel)
{
    CRect rect;
    if (!PrepareInPlaceControl(nItem, nCol, rect)) {
        return nullptr;
    }

    DWORD dwStyle = WS_BORDER | WS_CHILD | WS_VISIBLE | WS_VSCROLL/*|WS_HSCROLL*/ | LBS_NOTIFY;
    CListBox* pListBox = DEBUG_NEW CInPlaceListBox(nItem, nCol, lstItems, nSel);
    pListBox->Create(dwStyle, rect, this, IDC_LIST1);

    CRect ir;
    GetItemRect(m_nItemClicked, &ir, LVIR_BOUNDS);

    pListBox->SetItemHeight(-1, ir.Height());

    CDC* pDC = pListBox->GetDC();
    CFont* pWndFont = GetFont();
    pDC->SelectObject(pWndFont);
    int width = GetColumnWidth(nCol);
    POSITION pos = lstItems.GetHeadPosition();
    while (pos) {
        int w = pDC->GetTextExtent(lstItems.GetNext(pos)).cx + 16;
        if (width < w) {
            width = w;
        }
    }
    ReleaseDC(pDC);

    CRect r;
    pListBox->GetWindowRect(r);
    ScreenToClient(r);
    r.top = ir.bottom;
    r.bottom = r.top + pListBox->GetItemHeight(0) * (pListBox->GetCount() + 1);
    r.right = r.left + width;
    pListBox->MoveWindow(r);

    m_fInPlaceDirty = false;

    return pListBox;
}
void CDragDropTreeCtrl::OnBeginDrag(NMHDR* pNMHDR, LRESULT* pResult)
{
    *pResult = 0;
    NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;

    HTREEITEM hItem = pNMTreeView->itemNew.hItem;

    // Create a drag image. If the assertion fails, you probably forgot
    // to assign an image list to the control with SetImageList. Create-
    // DragImage will not work if the control hasn't been assigned an
    // image list!
    m_pImageList = CreateDragImage(hItem);
    ASSERT(m_pImageList != NULL);

    if (m_pImageList != NULL)
    {
        // Compute the coordinates of the "hot spot"--the location of the
        // cursor relative to the upper left corner of the item rectangle.
        CRect rect;
        GetItemRect(hItem, rect, TRUE);
        CPoint point(pNMTreeView->ptDrag.x, pNMTreeView->ptDrag.y);
        CPoint hotSpot = point;
        hotSpot.x -= rect.left;
        hotSpot.y -= rect.top;

        // Convert the client coordinates in "point" to coordinates relative
        // to the upper left corner of the control window.
        CPoint client(0, 0);
        ClientToScreen(&client);
        GetWindowRect(rect);
        point.x += client.x - rect.left;
        point.y += client.y - rect.top;

        // Capture the mouse and begin dragging.
        SetCapture();
        m_pImageList->BeginDrag(0, hotSpot);
        m_pImageList->DragEnter(this, point);
        m_hDragItem = hItem;
        m_bDragging = TRUE;
    }
}
void SmartListCtrl::updateItemInternal( int index, const AssetInfo& inf, bool removeFromCache )
{
	if ( !provider_ || index < 0 )
		return;

	if ( removeFromCache )
	{
		listCacheBig_.cacheRemove( inf.text(), inf.longText() );
		listCacheSmall_.cacheRemove( inf.text(), inf.longText() );
	}
	CRect clRect;
	GetClientRect( &clRect );
	CRect rect;
	GetItemRect( index, &rect, LVIR_BOUNDS );
	if ( rect.right >= 0 && rect.bottom >= 0 &&
		rect.left <= clRect.right && rect.top <= clRect.bottom )
	{
		RedrawItems( index, index );
		RedrawWindow( rect, NULL, 0 );
	}
}
void CNewHeaderCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
	if (m_nCheckColumn >= 0)
	{
		CRect rcItem;
		int nItems = GetItemCount();
		for (int i = 0; i < nItems; ++i)
		{
			GetItemRect(i, &rcItem);
			rcItem.right = rcItem.left + 16;
			if (i == m_nCheckColumn && rcItem.PtInRect(point))
			{
				m_bAllCheck = !m_bAllCheck;
				Invalidate(FALSE);
				::PostMessage(::GetParent(::GetParent(m_hWnd)), WM_LIST_HEADER_CHECK_CHANGED, i, m_bAllCheck);
				return;
			}
		}
	}
	CHeaderCtrl::OnLButtonDown(nFlags, point);
}
Esempio n. 10
0
static BOOL ClearSelection(LPBRTABLE lpNode, 
                           LPSTR lpData, LEVEL_TYPE level)
{
    selinfo *si = (selinfo *) lpData;
    COLORREF rgb = GetBrowserSelectionColor(si->hDC);
    RECT rect;
    
    GetItemRect(si->lpBrData, lpNode, level, &rect);
    
    if (BRITEM_FLAGS(lpNode) & SELECTED_ITEM)
    {
        ColorNode(si->hDC, GetSysColor(COLOR_WINDOW), rgb,
                  rect.left, rect.top, rect.right, rect.bottom);
        if (ITEMID_BRITEM(lpNode) == BrSelection.idObj)
            BrSelection.idObj = NULLID;
        BrSelection.wCount--;
        BRITEM_FLAGS(lpNode) &= ~SELECTED_ITEM;
    }
    
    return TRUE;
}
Esempio n. 11
0
bool CSideBar::AddItems(const SideBarItem *pItemList,int NumItems)
{
	if (pItemList==NULL || NumItems<=0)
		return false;

	size_t OldSize=m_ItemList.size();
	m_ItemList.resize(OldSize+NumItems);
	::CopyMemory(&m_ItemList[OldSize],pItemList,NumItems*sizeof(SideBarItem));

	if (m_Tooltip.IsCreated()) {
		for (int i=0;i<NumItems;i++) {
			if (pItemList[i].Command!=ITEM_SEPARATOR) {
				RECT rc;

				GetItemRect((int)OldSize+i,&rc);
				m_Tooltip.AddTool((UINT)OldSize+i,rc);
			}
		}
	}
	return true;
}
Esempio n. 12
0
void CuEditableListCtrlDuplicateDbSelectLocation::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	int   index, iColumnNumber;
	int   iItem   = -1, iSubItem = -1;
	int   iNumMin = 0;
	int   iNumMax = 400;
	CRect rect, rCell;
	UINT  flags;
	
	index = HitTest (point, &flags);
	if (index < 0)
		return;
	GetItemRect (index, rect, LVIR_BOUNDS);
	if (!GetCellRect (rect, point, rCell, iColumnNumber))
		return;
	
	rCell.top    -= 2;
	rCell.bottom += 2;
	HideProperty();
	EditValue (index, iColumnNumber, rCell);
}
Esempio n. 13
0
void ecConfigToolView::Refresh (wxTreeItemId h)
{
    if(h)
    {
        // TODO Not sure if we need this
#if 0
        AdjustItemImage(h);
        // Invalidate the labels of the affected items
        CRect rect;		
        GetItemRect(h, rect, TRUE );
        rect.left+=m_TreeXOffsetAdjustment;
        InvalidateRect(rect);
        // Do the same for the cell view
        CRect rcBuddyClient;
        CConfigTool::GetCellView()->GetClientRect(rcBuddyClient);
        rect.left=rcBuddyClient.left;
        rect.right=rcBuddyClient.right;
        CConfigTool::GetCellView()->InvalidateRect(rect);
#endif
    }
}
Esempio n. 14
0
bool CListViewCtrlEx::_PtInSubItemLink( const POINT &pt, int nItem, int& nSubItem )
{
    if( nItem>=0 && nItem<_super::GetItemCount() )
    {
        TListItem *pItem = _GetItemData(nItem);
        if (!pItem)
            return false;

        if ( pItem->dwFlags & LISTITEM_TITLE )
        {
            for ( int i = 0; i < pItem->subItems.size(); i++)
            {
                const TListSubItem&	subItem = pItem->subItems[i];
                if ( subItem.type == SUBITEM_LINK)
                {
                    CRect	rcItem;
                    CRect	rcLink = subItem.rcOffset;
                    GetItemRect(nItem,rcItem, LVIR_BOUNDS);
                    rcLink.OffsetRect(rcItem.left, rcItem.top);
                    if ( rcLink.PtInRect(pt) )
                    {
                        nSubItem = i;
                        return true;
                    }
                }
            }
        }
        else if(nSubItem>=0 && nSubItem<pItem->subItems.size())
        {
            const TListSubItem &subItem = pItem->subItems[nSubItem];
            if( subItem.type==SUBITEM_LINK )
            {
                // Check if in LINK Rect
                RECT rcLink = {0};
                return _GetSubItemLinkRect(nItem, nSubItem, subItem.str, rcLink) && PtInRect(&rcLink, pt);
            }
        }
    }
    return false;
}
Esempio n. 15
0
HRESULT CMenuToolbarBase::PopupSubMenu(UINT iItem, UINT index, IShellMenu* childShellMenu, BOOL keyInitiated)
{
    // Calculate the submenu position and exclude area
    RECT rc = { 0 };

    if (!GetItemRect(index, &rc))
        return E_FAIL;
    
    POINT a = { rc.left, rc.top };
    POINT b = { rc.right, rc.bottom };

    ClientToScreen(&a);
    ClientToScreen(&b);

    POINTL pt = { a.x, b.y };
    RECTL rcl = { a.x, a.y, b.x, b.y };

    if (m_initFlags & SMINIT_VERTICAL)
    {
        // FIXME: Hardcoding this here feels hacky.
        if (IsAppThemed())
        {
            pt.x = b.x - 1;
            pt.y = a.y - 1;
        }
        else
        {
            pt.x = b.x - 3;
            pt.y = a.y - 3;
        }
    }

    // Display the submenu
    m_isTrackingPopup = TRUE;

    m_menuBand->_ChangePopupItem(this, iItem);
    m_menuBand->_OnPopupSubMenu(childShellMenu, &pt, &rcl, keyInitiated);

    return S_OK;
}
Esempio n. 16
0
int CPlayerListCtrl::GetBottomIndex() const
{
	CRect r;
	GetClientRect(r);

	int nBottomIndex = GetTopIndex() + GetCountPerPage() - 1;

	if(nBottomIndex >= GetItemCount()) 
	{
		nBottomIndex = GetItemCount() - 1;
	}
	else if(nBottomIndex < GetItemCount())
	{
		CRect br;
		GetItemRect(nBottomIndex, br, LVIR_BOUNDS);

		if(br.bottom < r.bottom)
			nBottomIndex++;
	}

	return(nBottomIndex);
}
Esempio n. 17
0
void CMyListCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	// TODO: Add your message handler code here and/or call default
	CRect rect;
	//////////////////////////////////////////////////
	if(m_nCurSelected!=-1)
	{
		GetItemRect(m_nCurSelected,&rect,LVIR_BOUNDS);
		this->InvalidateRect(&rect);
	}
	//////////////////////////////////////////////////
	switch(nChar)
	{
	case 40://↓
		m_nCurSelected++;
		if(m_nCurSelected>=this->GetItemCount())
			m_nCurSelected--;
		break;
	case 38://↑
		m_nCurSelected--;
		if(m_nCurSelected<0)
			m_nCurSelected++;
		break;
	case 39://→
		m_nCurSelCol++;
		if(m_nCurSelCol>=this->GetHeaderCtrl()->GetItemCount())
			m_nCurSelCol--;
		break;
	case 37://←
		m_nCurSelCol--;
		if(m_nCurSelCol<0)
			m_nCurSelCol++;
		break;
	}
	this->GetItemRect(m_nCurSelected,&rect,LVIR_BOUNDS);
	this->InvalidateRect(&rect);

	CListCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
}
Esempio n. 18
0
//------------------------------------------------------------------------------
void CNetscapeStatusBar::DrawSecureStatus(HDC hdc)
{
 	int idx = CommandToIndex( IDS_SECURITY_STATUS );
 	if (idx < 0) 
        return;

	UINT nID, nStyle;
	int cxWidth;
	GetPaneInfo(idx, nID, nStyle, cxWidth);
	BOOL bSecure = !(nStyle & SBPS_DISABLED);
    
  	RECT rect; 
  	GetItemRect( idx, &rect );

  	HDC hdcBitmap = ::CreateCompatibleDC( hdc );
  	HBITMAP hbmOld = (HBITMAP)::SelectObject( hdcBitmap, sm_hbmpSecure );

  	FEU_TransBlt( hdc, rect.left+1, rect.top+1, sm_sizeSecure.cx, sm_sizeSecure.cy, hdcBitmap, bSecure ? sm_sizeSecure.cx : 0, 0,WFE_GetUIPalette(GetParentFrame()) );

  	::SelectObject( hdcBitmap, hbmOld );
  	VERIFY( ::DeleteDC( hdcBitmap ));
}
Esempio n. 19
0
   /// <summary>Shrinks to fit.</summary>
   void  SuggestionList::ShrinkToFit()
   {
      try
      {
         // Check if less than 1 page of items
         if (GetCountPerPage() > (int)Content.size() && !Content.empty())
         {
            ClientRect wnd(this);
            CRect rc(0,0,0,0);

            // Calculate item height
            if (!GetItemRect(0, &rc, LVIR_LABEL) || !rc.Height())
               throw Win32Exception(HERE, L"Unable to retrieve item height");

            // Resize
            SetWindowPos(nullptr,-1,-1, wnd.Width(), rc.Height()*Content.size(), SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
         }
      }
      catch (ExceptionBase& e) { 
         Console.Log(HERE, e);
      }
   }
BOOL EXWaitingTreeCtrl::GetItemImageRect(HTREEITEM hItem, LPRECT pRect)
{
	if (GetImageList(TVSIL_NORMAL) == NULL)
		return FALSE;	// no images

	CRect rc;
	// get item rect
	if (!GetItemRect(hItem, &rc, TRUE))
		return FALSE;

	int cx = GetSystemMetrics(SM_CXSMICON);
	int cy = GetSystemMetrics(SM_CYSMICON);

	// move onto the icon space
	int margin = (rc.Height()-cy)/2;
	rc.OffsetRect(-cx-3 , margin);
	rc.right = rc.left + cx;	// make it square
	rc.bottom = rc.top + cy;	// make it square

	*pRect = rc;
	return TRUE;
}
Esempio n. 21
0
void KGListCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
	int nResult  = false;
	int nRetCode = false;

	int   nItem   = HitTest(point);
	CRect rect;
	int   nRigPos = 0;
	KG_PROCESS_ERROR(nItem != -1);
	LPKGLISTITEM pHitItem = (LPKGLISTITEM)GetItemData(nItem);
	KG_PROCESS_ERROR(pHitItem);
	GetItemRect(nItem, &rect, LVIR_BOUNDS);
	nRigPos = rect.left + rect.Height() * (pHitItem->nTitleLever + 1);
	KG_PROCESS_ERROR(point.x < nRigPos);
	nRetCode = Expand(pHitItem);
	KG_PROCESS_ERROR(pHitItem->arryItemText.GetCount() == 1);
	KG_PROCESS_ERROR(nRetCode);

	nResult = true;
Exit0:
	return CListCtrl::OnLButtonDown(nFlags, point);
}
Esempio n. 22
0
void CuEditableListCtrlGenericDerived::OnRButtonDown(UINT nFlags, CPoint point) 
{
	int   index, iColumnNumber;
	int   iItem   = -1, iSubItem = -1;
	int   iNumMin = 0;
	int   iNumMax = 400;
	CRect rect, rCell;
	UINT  flags;
	
	index = HitTest (point, &flags);
	if (index < 0)
		return;
	GetItemRect (index, rect, LVIR_BOUNDS);
	if (!GetCellRect (rect, point, rCell, iColumnNumber))
		return;
	rCell.top    -= 2;
	rCell.bottom += 2;
	HideProperty();
	if (iColumnNumber != 1 && iColumnNumber != 3)
		return;
	EditValue (index, iColumnNumber, rCell);
}
BOOL CClosableTabCtrl::OnCommand(WPARAM wParam, LPARAM lParam)
{
	if (wParam == MP_REMOVE)
	{
		if (m_ptCtxMenu.x != -1 && m_ptCtxMenu.y != -1)
		{
			int iTabs = GetItemCount();
			for (int i = 0; i < iTabs; i++)
			{
				CRect rcItem;
				GetItemRect(i, rcItem);
				if (rcItem.PtInRect(m_ptCtxMenu))
				{
					GetParent()->SendMessage(UM_CLOSETAB, (WPARAM)i);
					break;
				}
			}
			return TRUE;
		}
	}
	return CTabCtrl::OnCommand(wParam, lParam);
}
Esempio n. 24
0
/////////////////////////////////////////////////////////////////////////////
// handle selection
/////////////////////////////////////////////////////////////////////////////
void CCustomListCtrl::OnClick(NMHDR* pNMHDR, LRESULT* pResult) 
{
	int i;
	int nRes = RES_BLANK;
	CRect rect;
	CPoint point;

	//get current mouse position
	GetCursorPos(&point);
	ScreenToClient(&point);

	//reset the selection
	m_nSelection = -1;

	//run throuch each item
	for(i = 0; i < GetItemCount(); i++)
	{
		GetItemRect(i, &rect, LVIR_ICON);

		//check it
		if(TRUE == rect.PtInRect(point))
		{
			m_nSelection = i;
			break;
		}
	}

	//get the item data
	if(-1 != m_nSelection)
	{
		nRes = GetItemData(m_nSelection);
	}

	//set it in the view
	VIEW->setResource(nRes);

	//redraw
	Invalidate();
}
Esempio n. 25
0
BOOL CMyListBox::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default	

#if 1
		pDC = GetDC();
		//CString d="ctlcolor";
		//MessageBox(d,NULL,MB_OK);
	for(int i = 0;i<GetCount();i++)
	{
		CRect eachrc;
		CBrush brush;
		CString str;
		GetItemRect(i,eachrc);
		
		CDC dcMemory;
		dcMemory.CreateCompatibleDC(pDC);


		// Select the bitmap into the in-memory DC
		CBitmap* pOldBitmap = dcMemory.SelectObject(&m_BackScreenBitmap);

		pDC->BitBlt(0, 0+i*eachrc.Height(), bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory, 0, 0, SRCCOPY);	
		pDC->SelectObject(pOldBitmap);

		//pDC->FillRect(eachrc,&brush);

		GetText(i,str);
		pDC->SetBkMode(TRANSPARENT);

		pDC->SelectObject(GetFont());
		pDC->SelectObject(&myfont);
		pDC->DrawText(str,&eachrc,DT_VCENTER | DT_SINGLELINE);

	}
#endif
	return true;//
	//return CListBox::OnEraseBkgnd(pDC);
}
Esempio n. 26
0
//*****************************************************************************
//
// Function Name: RGridCtrl::OnItemAdded( int nIndex )
//
// Description:   Helper function for performing all the necessary 
//                updates to the control each time an item is added.
//
// Returns:		   None
//
// Exceptions:	   None
//
//*****************************************************************************
void RGridCtrlBase::OnItemAdded( int nIndex )
{
	if (0 == nIndex)
	{
		// Measure the item.  This is only 
		// necessary on the first addition.
		UpdateMetrics() ;
	}

	// Update the scroll bars as necessary.
	UpdateScrollBars() ;

	//
	// Determine if the current selection needs moved.
	//
	if (GetCurSel() >= nIndex)
	{
		SetCurSel( GetCurSel() + 1 ) ;
	}

	//
	// Determine if the display needs updated
	//
	CRect rect ;

	if (LB_ERR != GetItemRect( nIndex, rect ))
	{
		InvalidateRect( rect, TRUE ) ;
	}

/*	int nItemRow = nIndex / m_nNumCols ;
	int nTopRow  = GetTopIndex() / m_nNumCols ;

	if (nItemRow <= nTopRow + m_cxVisibleRows)
	{
		InvalidateRect( NULL ) ;
	}
*/
}
Esempio n. 27
0
void CPlayerToolBar::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
    LPNMTBCUSTOMDRAW pTBCD = reinterpret_cast<LPNMTBCUSTOMDRAW>(pNMHDR);
    LRESULT lr = CDRF_DODEFAULT;
    switch (pTBCD->nmcd.dwDrawStage) {
        case CDDS_PREERASE:
            m_volctrl.Invalidate();
            lr = CDRF_DODEFAULT;
            break;
        case CDDS_PREPAINT: {
            // paint the control background, this is needed for XP
            CDC dc;
            dc.Attach(pTBCD->nmcd.hdc);
            RECT r;
            GetClientRect(&r);
            dc.FillSolidRect(&r, ::GetSysColor(COLOR_BTNFACE));
            dc.Detach();
        }
        lr |= CDRF_NOTIFYITEMDRAW;
        break;
        case CDDS_ITEMPREPAINT:
            // notify we want to paint after the system's paint cycle
            lr |= CDRF_NOTIFYPOSTPAINT;
            lr |= CDRF_NOTIFYITEMDRAW;
            break;
        case CDDS_ITEMPOSTPAINT:
            // paint over the duplicated separator
            CDC dc;
            dc.Attach(pTBCD->nmcd.hdc);
            RECT r;
            GetItemRect(11, &r);
            dc.FillSolidRect(&r, GetSysColor(COLOR_BTNFACE));
            dc.Detach();
            lr |= CDRF_SKIPDEFAULT;
            break;
    }

    *pResult = lr;
}
Esempio n. 28
0
int CClickList::HitTestEx(const CPoint &Point, int &Col) const
{
	Col = 0;

    // Make sure that the ListView is in LVS_REPORT
    if (LVS_REPORT != (GetWindowLong(m_hWnd, GWL_STYLE) & LVS_TYPEMASK))
		return HitTest(Point, NULL);

    // Get the top and bottom row visible
    int row = GetTopIndex();
    int bottom = row + GetCountPerPage();
    if (bottom > GetItemCount())
		bottom = GetItemCount();
    
    // Get the number of columns
    CHeaderCtrl *pHeader = const_cast<CClickList *>(this)->GetHeaderCtrl();
	if (NULL == pHeader)
		return -1;

    // Loop through the visible rows
	CRect rect;
	int nColumnCount = pHeader->GetItemCount(), colnum, colwidth;
    for (; row <= bottom; row++) {
		// Get bounding rect of item and check whether point falls in it.
		GetItemRect(row, &rect, LVIR_BOUNDS);

		if (rect.PtInRect(Point)) // Now find the column
			for (colnum = 0; colnum < nColumnCount; colnum++) {
				colwidth = GetColumnWidth(colnum);
				if (Point.x >= rect.left && Point.x <= rect.left + colwidth) {
					Col = colnum;
					return row;
				}
				rect.left += colwidth;
			}
    }

    return -1;
}
Esempio n. 29
0
void CSkinComboBox_ListBox::OnRButtonUp(UINT nFlags, CPoint point)
{
	CRect rcItem(0,0,0,0);

	int nIndex = -1;

	for (int i =0; i<GetCount(); i++)
	{
		GetItemRect(i, &rcItem);

		if(rcItem.PtInRect(point))
		{
			if ( m_hOwnerWnd != NULL ) nIndex = i;
		
			break;
		}
	}

	::PostMessage(m_hOwnerWnd,WM_CBO_LIST_RBUTTONUP,nIndex,0);

	__super::OnRButtonUp(nFlags, point);
}
Esempio n. 30
0
/* Return the item index of the point locate in */
int CDropListBox::PointTest(CPoint point)
{
	int i = GetTopIndex(), nCount = GetCount(), nResult;
	if(i == LB_ERR)
	{
		return LB_ERR;
	}

	CRect rect;
	for(; i < nCount; i++)
	{
		if((nResult = GetItemRect(i, &rect)) == LB_ERR)
		{
			return LB_ERR;
		}
		if(PtInRect(&rect, point))
		{
			return i;
		}
	}
	return LB_ERR;
}