本文整理汇总了C++中CComQIPtr::GetBoundsBox方法的典型用法代码示例。如果您正苦于以下问题:C++ CComQIPtr::GetBoundsBox方法的具体用法?C++ CComQIPtr::GetBoundsBox怎么用?C++ CComQIPtr::GetBoundsBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComQIPtr
的用法示例。
在下文中一共展示了CComQIPtr::GetBoundsBox方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SelectItemsWithin
void CRender::SelectItemsWithin(const RectF &r)
{
CComPtr<boost::scoped_lock_ref_counted> lock;
CComPtr<IGraphItem> item;
CComPtr<IUnknown> unk;
CComQIPtr<IRenderer> ir;
RectF box;
IGraphItemVector results;
m_graph->GetChildren(results);
for(IGraphItemVector::iterator itr=results.begin(); itr!=results.end(); ++itr)
{
item=*itr;
unk=item->GetPropertyUnknown(0);
if(unk)
{
ir=static_cast<IRenderer*>(unk.p);
if(ir!=0)
{
ir->GetBoundsBox(box);
if(box.IntersectsWith(r))
ir->SetSelected(true, true);
}
}
}
}
示例2: EditNext
bool CItemEdit::EditNext(unsigned newindex)
{
bool bSuccess=IsWindow()!=0;
if(bSuccess)
{
CComQIPtr<IRenderer> ir;
m_gi=m_parent->GetChild(newindex);
ATLASSERT(m_gi);
bSuccess=m_gi!=0;
if(bSuccess)
{
m_index=newindex;
#ifdef _DEBUG
CComQIPtr<IGraphVertex> v=m_gi;
if(v!=0)
{
ATLASSERT(m_index==v->GetOrder());
}
#endif
ir=m_canvas->GetRenderer(m_gi);
ATLASSERT(ir);
bSuccess=ir!=0;
}
if(bSuccess)
{
RectF rc;
ir->GetBoundsBox(rc);
CRect irc=static_cast<CRect>(rc);
MoveWindow(&irc);
UpdateText();
}
}
return bSuccess;
}
示例3: getGraphExtent
RectF CRender::getGraphExtent(bool selectedOnly) const
{
RectF retVal;
bool first = true;
CComPtr<boost::scoped_lock_ref_counted> lock;
CComPtr<IGraphItem> item;
CComPtr<IUnknown> unk;
CComQIPtr<IListWindowRenderer> lw;
CComQIPtr<ILegacyRenderer> lv;
RectF rc;
IGraphItemVector results;
m_graph->GetChildren(results);
for(IGraphItemVector::iterator itr=results.begin(); itr!=results.end(); ++itr)
{
item=*itr;
CUniqueID id = item->GetID();
unk=item->GetPropertyUnknown(0);
if(unk!=0)
{
lv=unk.p;
if(lv!=0)
{
if (selectedOnly && !lv->IsSelected())
{
continue;
}
if (first)
{
lv->GetTitlePos(retVal);
first = false;
}
else
{
lv->GetTitlePos(rc);
retVal.Union(retVal, retVal, rc);
}
lv->GetIconPos(rc);
retVal.Union(retVal, retVal, rc);
lv->GetImagePos(rc);
retVal.Union(retVal, retVal, rc);
}
else
{
lw=unk.p;
if(lw!=0)
{
if (selectedOnly && !lw->IsSelected())
{
continue;
}
if (first)
{
lw->GetBoundsBox(retVal);
first = false;
}
else
{
lw->GetBoundsBox(rc);
retVal.Union(retVal, retVal, rc);
}
}
}
}
}
return retVal;
}
示例4: OnKeyDown
LRESULT CItemEdit::OnKeyDown(
UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled)
{
bHandled = FALSE;
switch(wParam)
{
case VK_ESCAPE:
{
RestoreState();
m_canvas->DestroyEditor();
}
break;
case VK_RETURN:
{
ChangeLabel(false);
RestoreState();
m_canvas->DestroyEditor();
}
break;
case VK_TAB:
case VK_UP:
case VK_DOWN:
{
if(m_parent!=0)
{
unsigned newidx=m_index;
bool bUp=wParam==VK_UP || (wParam==VK_TAB
&& (GetAsyncKeyState(VK_SHIFT)&0x8000)!=0);
if(bUp && m_index>0)
{
newidx--;
}
else if(!bUp)
{
newidx++;
}
bool gotonext=newidx!=m_index;
IGraphItem* next = NULL;
if(gotonext)
{
ChangeLabel(false);
m_canvas->Invalidate();
next=m_parent->GetChild(newidx);
gotonext=next!=0;
}
CComQIPtr<IListWindowRenderer> ilw;
if(gotonext)
{
ilw=m_canvas->GetRenderer(m_parent);
ATLASSERT(ilw);
gotonext=ilw!=0;
}
if(gotonext)
{
// prevent editing item covered by scrollbars and outside viewport
CComPtr<IRenderer> ir=m_canvas->GetRenderer(next);
ATLASSERT(ir);
RectF rc;
ir->GetBoundsBox(rc);
RectF vp;
m_canvas->GetViewport(vp);
gotonext=rc.x>=vp.x &&
rc.y>=vp.y &&
(rc.x+rc.Width)<=(vp.x+vp.Width) &&
(rc.y+rc.Height)<=(vp.y+vp.Height);
// prevent editing item covered outside its parent
if(gotonext)
{
RectF rcparent;
ilw->GetBoundsBox(rcparent);
gotonext=rc.x>=rcparent.x &&
rc.y>=rcparent.y &&
(rc.x+rc.Width)<=(rcparent.x+rcparent.Width) &&
(rc.y+rc.Height)<=(rcparent.y+rcparent.Height);
}
}
if(gotonext)
{
if(ilw->OnEditItem(next))
{
CWindow pwnd=GetParent();
pwnd.UpdateWindow(); // redraw to give it resize chance
EditNext(newidx);
}
else
m_gi=m_parent->GetChild(m_index);
bHandled = TRUE;
//.........这里部分代码省略.........