本文整理汇总了C++中ObjectList::first_object方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectList::first_object方法的具体用法?C++ ObjectList::first_object怎么用?C++ ObjectList::first_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectList
的用法示例。
在下文中一共展示了ObjectList::first_object方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnSetActive
BOOL CWCalendarView::OnSetActive()
{
// Open the document
if (!CWView::OnSetActive())
return FALSE;
// Show final text
m_strTopText.LoadString(IDS_WH_CALENDAR_FINAL);
UpdateData(FALSE);
// Use calendar style to edit the document
CCalendarDoc* pDoc = (CCalendarDoc*)m_pDoc;
CAL_PICTURE_STYLE PicStyle = ((CWCalendarPageContainer*)m_pContainer)->GetPictureStyle();
pDoc->GotoPage(1);
// Retrieve the bound for the current picture page & whole calendar
PBOX PicBound = pDoc->GetPicturePageBound(pDoc->CurrentPageIndex());
if (PicStyle == CAL_PICTURE_NONE)
{
// Remove picture page, front & back cover pages
// ASSUME there is only one picture page to begin with
pDoc->DocumentRecord()->delete_page(m_pDoc->GetPage(0));
pDoc->GotoPage(0);
pDoc->DocumentRecord()->delete_page(m_pDoc->GetPage(1));
pDoc->InvalidateLastKnownPage();
}
DWORD dwAtPage = pDoc->CurrentPageIndex(); // current working page
// Change the picture style
CalendarObject* pCalendarObject = pDoc->find_calendar_object(dwAtPage);
pDoc->SetPictureStyle(PicStyle);
pCalendarObject->SetPictureStyle(PicStyle);
// Retrieve a list of objects in the current page
ObjectList* pObjectList = pDoc->object_list();
PMGPageObject* pObject = (PMGPageObject*)pObjectList->first_object();
// If we're removing pictures, loop through objects and remove anything
// that's in the picture bound
PPNT bottom_dims, top_dims;
pDoc->GetPageDims(bottom_dims, top_dims);
if (PicStyle == CAL_PICTURE_NONE)
{
long nMove = (bottom_dims.y - top_dims.y);
while (pObject != NULL)
{
PBOX bound = ((RectPageObject*)pObject)->get_unrotated_bound();
PBOX intersect;
// If the bounds intersect, remove the object
// otherwise, shift it up for rescale
if (IntersectBox(&intersect, &bound, &PicBound))
{
PMGPageObject* pNextObject = (PMGPageObject*)pObject->next_object();
pObjectList->detach(pObject);
pObject->destroy();
delete pObject;
pObject = pNextObject;
}
else
{
// Move the object up
bound.y0 -= nMove;
bound.y1 -= nMove;
((RectPageObject*)pObject)->set_unrotated_bound(bound);
pObject->calc();
pObject = (PMGPageObject*)pObject->next_object();
}
}
}
pDoc->RecalcPageSize();
// May need to shift pictures over
if (PicStyle == CAL_PICTURE_LEFT)
{
PPNT new_bottom_dims, new_top_dims;
pDoc->GetPageDims(new_bottom_dims, new_top_dims);
PPNT Move;
Move.x = (new_bottom_dims.x - bottom_dims.x);
Move.y = (new_bottom_dims.y - bottom_dims.y);
// Apply changes to front, calendar, and back pages
for (int i = 0; i < (int)pDoc->NumberOfPages(); i++)
{
pDoc->GotoPage(i);
// Retrieve a list of objects in the current page
ObjectList* pObjectList = pDoc->object_list();
PMGPageObject* pObject = (PMGPageObject*)pObjectList->first_object();
while (pObject != NULL)
{
PBOX bound = ((RectPageObject*)pObject)->get_unrotated_bound();
PBOX intersect;
// If the bounds don't intersect, we need to move the object
if (!IntersectBox(&intersect, &bound, &PicBound))
{
bound.x0 += Move.x;
//.........这里部分代码省略.........