Exemplo n.º 1
0
BOOL CuDlgIpmTabCtrl::OnInitDialog() 
{
	CDialog::OnInitDialog();
	VERIFY (m_staticHeader.SubclassDlgItem (IDC_STATIC, this));
	m_staticHeader.SetImage (-1); // No Image for Now

	CWnd* pParent1 = GetParent();    // The view: CImView2
	ASSERT (pParent1);
	CdIpmDoc* pDoc = (CdIpmDoc*)((CView*)pParent1)->GetDocument();
	ASSERT (pDoc);
	if (!pDoc->GetCurrentProperty())
		return TRUE;

	//
	// When the document is Loaded ...
	try
	{
		CfIpmFrame* pFrame = (CfIpmFrame*)GetParentFrame();
		CvIpmLeft*  pIpmView1= (CvIpmLeft*)pFrame->GetLeftPane();
		CTreeCtrl& treeCtrl = pIpmView1->GetTreeCtrl();
		HTREEITEM  hSelected= treeCtrl.GetSelectedItem ();
		ASSERT (hSelected);
		if (!hSelected)
			return TRUE;
		CTreeItem* pItem = (CTreeItem*)treeCtrl.GetItemData (hSelected);
		CuPageInformation* pPageInfo = pDoc->GetCurrentProperty()->GetPageInfo();
		LPIPMUPDATEPARAMS pUps = pPageInfo->GetUpdateParam();
		pUps->nType   = pItem->GetType();
		pUps->pStruct = pItem->GetPTreeItemData()? pItem->GetPTreeItemData()->GetDataPtr(): NULL;
		pUps->pSFilter= pDoc->GetFilter();

		int nImage = -1, nSelectedImage = -1;
		CImageList* pImageList = treeCtrl.GetImageList (TVSIL_NORMAL);
		HICON hIcon = NULL;
		int nImageCount = pImageList? pImageList->GetImageCount(): 0;
		if (pImageList && treeCtrl.GetItemImage(hSelected, nImage, nSelectedImage))
		{
			if (nImage < nImageCount)
				hIcon = pImageList->ExtractIcon(nImage);
		}
		pPageInfo->SetImage  (hIcon);

		LoadPage (pDoc->GetCurrentProperty());
		m_bIsLoading = TRUE;
		if (m_pCurrentPage)
		{
			UINT nMask = IPMMASK_FONT|IPMMASK_SHOWGRID;
			m_pCurrentPage->SendMessage (WMUSRMSG_CHANGE_SETTING, (UINT)nMask, (LPARAM)&(pDoc->GetProperty()));
		}
	}
	catch (CMemoryException* e)
	{
		theApp.OutOfMemoryMessage ();
		m_pCurrentPage     = NULL;
		m_pCurrentProperty = NULL;
		e->Delete();
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 2
0
BOOL CuDlgIpmTabCtrl::ChangeTab()
{
	int nSel;
	CRect r;
	CWnd* pNewPage;
	CuPageInformation* pPageInfo;
	CWnd* pParent1 = GetParent(); // The view: CImView2
	ASSERT (pParent1);
	CfIpmFrame* pFrame = (CfIpmFrame*)GetParentFrame(); // The Frame Window
	ASSERT (pFrame);
	CdIpmDoc* pDoc  = (CdIpmDoc*)((CView*)pParent1)->GetDocument();
	ASSERT (pDoc);
	
	if (!pFrame->IsAllViewCreated())
		return FALSE;
	if (!m_pCurrentProperty)
		return FALSE;
	CWaitCursor doWaitCursor;
	m_cTab1.GetClientRect (r);
	m_cTab1.AdjustRect (FALSE, r);
	nSel = m_cTab1.GetCurSel();
	m_pCurrentProperty->SetCurSel(nSel);
	pPageInfo = m_pCurrentProperty->GetPageInfo();
	try
	{
		pNewPage  = GetPage (pPageInfo->GetDlgID (nSel));
	}
	catch (CMemoryException* e)
	{
		theApp.OutOfMemoryMessage();
		e->Delete();
		return FALSE;
	}
	catch (CResourceException* e)
	{
		AfxMessageBox (IDS_E_LOAD_RESOURCE);//"Fail to load resource"
		e->Delete();
		return FALSE;
	}
	if (m_pCurrentPage)
		m_pCurrentPage->ShowWindow (SW_HIDE);
	m_pCurrentPage = pNewPage;
	m_pCurrentPage->MoveWindow (r);
	m_pCurrentPage->ShowWindow(SW_SHOW);
	//
	// Properties:
	UINT nMask = IPMMASK_FONT|IPMMASK_SHOWGRID;
	m_pCurrentPage->SendMessage (WMUSRMSG_CHANGE_SETTING, (WPARAM)nMask, (LPARAM)&(pDoc->GetProperty()));
	//
	// Update Data:
	m_pCurrentPage->SendMessage (WM_USER_IPMPAGE_UPDATEING, (WPARAM)pDoc, (LPARAM)pPageInfo->GetUpdateParam());
	return TRUE;
}
Exemplo n.º 3
0
LONG CuDlgIpmTabCtrl::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
	//
	// lParam containts the hint about the change.
	// Its value can be FILTER_RESOURCE_TYPE, FILTER_NULL_RESOURCES, ...
	if (m_pCurrentPage)
	{
		CuPageInformation* pPageInfo = m_pCurrentProperty->GetPageInfo();
		ASSERT (pPageInfo);
		LPIPMUPDATEPARAMS pUps = pPageInfo->GetUpdateParam();
		pUps->nIpmHint = (int)lParam;
		m_pCurrentPage->SendMessage (WM_USER_IPMPAGE_UPDATEING, wParam, (LPARAM)pUps);
	}
	return 0L;
}