示例#1
0
void CPageContainer::ActivatePage(int i)
{
	if (i == current) return ;

	CPageSite	*site = pages[i];

	if (current != -1) DeactivatePage(current);
	current = i;

	// select specified tab
	form->tabs.SetCurSel(i);

	// resize parent
	form->ResizeToFit(site->size);

	// now display the page
	CRect	rc_client;
	form->tabs.GetClientRect(&rc_client);
	form->tabs.AdjustRect(FALSE, &rc_client);

	// show the page
	site->Activate(form->tabs, rc_client);

	form->Invalidate();
}
示例#2
0
// Activate the page with the specified dialog resource
void CNewWizDialog::SetActivePageByResource(UINT nResourceID)
{
	CNewWizPage* pPage = GetPageByResourceID(nResourceID);
	if (pPage == NULL) return;

	if (!DeactivatePage()) return;

	ActivatePage(pPage);
}
示例#3
0
void CPageContainer::Clear()
{
	if (current != -1) DeactivatePage(current);

	// release all pages
	for (int i=0; i<pages.GetCount(); i++) {
		CPageSite	*site = pages[i];

		// make it go away
		site->CloseSite();
		delete site;
	}
	pages.RemoveAll();
	current = -1;

	// kick all pages in the tab control
	form->tabs.DeleteAllItems();
}
示例#4
0
// Set first page as active page
BOOL CNewWizDialog::SetFirstPage()
{
  CNewWizPage* pPage = GetFirstPage();

	if (!DeactivatePage()) return FALSE;

	EnableBack(FALSE);
	
	if (m_PageList.GetCount() > 1)
	{
		EnableFinish(FALSE);
		EnableNext(TRUE);
	}
	else // wizard has only one page
	{
		EnableFinish(TRUE);
		EnableNext(FALSE);
	}

	if (ActivatePage(pPage)) return TRUE;
	return FALSE;
}
示例#5
0
// returns TRUE if the new page is activated
BOOL CNewWizDialog::ActivatePage(CNewWizPage* pPage)
{
	ASSERT(m_nPlaceholderID != 0);
  ASSERT(pPage != NULL);
	ASSERT(::IsWindow(m_hWnd));

	// if the page has not been created, then create it
	if (pPage->m_bCreated == FALSE)
	{
		if (pPage->Create(pPage->m_nDialogID, this) == FALSE) return FALSE;
		pPage->m_bCreated = TRUE;
		pPage->m_pParent = this;

	  if (pPage->OnCreatePage() == FALSE) return FALSE;
	}

	// deactivate the current page
	if (!DeactivatePage()) return FALSE;

  CRect rect;
  CWnd *pWnd = GetDlgItem(m_nPlaceholderID);
  ASSERT(pWnd != NULL);
  ASSERT(IsWindow(pWnd->m_hWnd) != FALSE);

  pWnd->GetWindowRect(&rect);
  ScreenToClient(&rect);
  pPage->SetWindowPos(NULL, rect.left, rect.top, 0, 0, 
                       SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE );
  pPage->EnableWindow(TRUE);

  pPage->ShowWindow(SW_SHOW);
  pPage->InvalidateRect(NULL);
  pPage->UpdateWindow();
  pPage->OnSetActive();
  pPage->m_bActive = TRUE;
	return TRUE;
}