本文整理汇总了C++中GetItemRect函数的典型用法代码示例。如果您正苦于以下问题:C++ GetItemRect函数的具体用法?C++ GetItemRect怎么用?C++ GetItemRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetItemRect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReleaseCapture
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;
}
示例2: GetSelectionMark
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;
}
示例3: SetButtonInfo
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;
}
示例4: GetItemRect
//************************************************************************
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();
}
示例5: GetItem
// 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;
}
示例6: CInPlaceListBox
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;
}
示例7: CreateDragImage
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;
}
}
示例8: GetClientRect
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 );
}
}
示例9: GetItemCount
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);
}
示例10: ClearSelection
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;
}
示例11: GetItemRect
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;
}
示例12: AdjustItemImage
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
}
}
示例13: _GetItemData
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;
}
示例14: PopupSubMenu
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;
}
示例15: GetClientRect
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);
}