Пример #1
0
BOOL CMyFrameWnd::OnCreateClient(LPCREATESTRUCT lpcs,CCreateContext* pContext){

#if 0  // 创建动态切分窗口 
	//1 指定所需要的视图类
	CCreateContext cxt;
	cxt.m_pNewViewClass = RUNTIME_CLASS(CMyView);
	//2 创建动态切分
	m_wndSplit.Create(this,2,2,CSize(200,200),&cxt);	
#else  //静态切分窗口的创建
	//1 创建静态切分
	m_wndSplit.CreateStatic(this,2,1);
	//这里最后参数填写的是默认id,即充满与客户区窗口
	m_wndSplit.CreateView(0,0,RUNTIME_CLASS(CHtmlView),CSize(200,200),pContext);
//	m_wndSplit.CreateView(1,0,RUNTIME_CLASS(CHtmlView),CSize(200,200),pContext);

	m_wndSplit2.CreateStatic(&m_wndSplit,1,2,WS_CHILD|WS_VISIBLE,
		m_wndSplit.IdFromRowCol(1,0));
	m_wndSplit2.CreateView(0,0,RUNTIME_CLASS(CMyView),CSize(100,100),pContext);
	m_wndSplit2.CreateView(0,1,RUNTIME_CLASS(CMyView),CSize(100,100),pContext);
	
	m_wndSplit2.SetColumnInfo(0,200,10);
	/*
	for(int i=0;i<3;++i){
		for(int j=0;j<3;++j)
		m_wndSplit.CreateView(i,j,RUNTIME_CLASS(CEditView),CSize(200,200),pContext);
	}
	*/
	//2 获取创建好的视图
	CHtmlView* pHtmlView = (CHtmlView*) m_wndSplit.GetPane(0,0);
	pHtmlView -> Navigate("D:/");
#endif
	return true;	
}
Пример #2
0
void CvIpmLeft::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	CdIpmDoc* pDoc = (CdIpmDoc*)GetDocument();
	ASSERT (pDoc);
	if (!pDoc)
		return;
	CaIpmProperty& property = pDoc->GetProperty();

	BOOL bSetToDefaultPercentage = FALSE; //UKS
	BOOL bRegularStaticSet = TRUE;
	int nHint = (int)lHint;
	switch (nHint)
	{
	case 1: // Invoked by CdIpmDoc::Initiate()
		GetTreeCtrl().SendMessage (WM_SETFONT, (WPARAM)property.GetFont(), MAKELPARAM(TRUE, 0));
		if (bSetToDefaultPercentage) 
		{
			CRect rcClient;
			CfIpmFrame* pFrame = (CfIpmFrame*)GetParentFrame();
			ASSERT (pFrame);
			CSplitterWnd* pSplit = (CSplitterWnd *)pFrame->GetSplitterWnd();
			ASSERT (pSplit);
			pFrame->GetClientRect (rcClient);
			pSplit->SetColumnInfo(0, (int) (0.4 * (double)rcClient.Width()), 10);
			pSplit->RecalcLayout();
		}

		// Create regular static set, if needed
		if (bRegularStaticSet) 
		{
			CuTMServerStatic    *pItem1 = new CuTMServerStatic   (pDoc->GetPTreeGD());
			CuTMLockinfoStatic  *pItem3 = new CuTMLockinfoStatic (pDoc->GetPTreeGD());
			CuTMLoginfoStatic   *pItem4 = new CuTMLoginfoStatic  (pDoc->GetPTreeGD());
			CuTMAllDbStatic     *pItem5 = new CuTMAllDbStatic    (pDoc->GetPTreeGD());
			CuTMActiveUsrStatic *pItem6 = new CuTMActiveUsrStatic(pDoc->GetPTreeGD());
			CuTMReplAllDbStatic *pItem7 = new CuTMReplAllDbStatic(pDoc->GetPTreeGD());

			HTREEITEM hItem1 = pItem1->CreateTreeLine();
			HTREEITEM hItem2 = pItem3->CreateTreeLine();
			HTREEITEM hItem3 = pItem4->CreateTreeLine();
			HTREEITEM hItem4 = pItem5->CreateTreeLine();
			HTREEITEM hItem5 = pItem6->CreateTreeLine();
			HTREEITEM hItem6 = pItem7->CreateTreeLine();
			ASSERT (hItem1 && hItem2 && hItem3 && hItem4 && hItem5 && hItem6);
			CTreeCtrl& cTree = GetTreeCtrl();
			cTree.SelectItem(hItem1);
		}
		break;
	default:
		break;
	}
}
Пример #3
0
void CDbeventView::OnInitialUpdate() 
{
    CView::OnInitialUpdate();
    CDbeventDoc* pDoc        = (CDbeventDoc*)GetDocument();
    CSplitterWnd*  pSplitter = (CSplitterWnd*)GetParent ();
    CDbeventFrame* pFrame    = (CDbeventFrame*)pSplitter->GetParent();
    
    ASSERT (pDoc);

    // toolbar caption according to doc caption
    CString docTitle = pDoc->GetTitle();
    pFrame->GetDialogBar()->SetWindowText(docTitle);

    if (pDoc->IsLoadedDoc()) {
      // frame window placement
      BOOL bResult = pFrame->SetWindowPlacement(pDoc->GetWPLJ());
      ASSERT (bResult);

      // splitbar placement
      int cxCur = pDoc->GetSplitterCxCur();
      int cxMin = pDoc->GetSplitterCxMin();
      pSplitter->SetColumnInfo(0, cxCur, cxMin);
      pSplitter->RecalcLayout();

      // set full state of all toolbars in the frame
      CDockState& ToolbarsState = pDoc->GetToolbarState();
      pFrame->SetDockState(ToolbarsState);
    
      // Set frame toolbar visibility state according to load info
      if (pDoc->m_bToolbarVisible)
        SetToolbarVisible(pFrame, TRUE);      // force immediate update
      else
        SetToolbarInvisible(pFrame, TRUE);    // force immediate update
    }
    else
    {
        //
        // The left pane (Register DBEvent pane) is 30% of the Frame Client erea.
        CRect rcClient;
        pFrame->GetClientRect (rcClient);
        pSplitter->SetColumnInfo(0, (int) (0.3 * (double)rcClient.Width()), 10);
        pSplitter->RecalcLayout();
    }
    //
    // Initialize the MaxLine Edit Box
    CuDbeDlgBar* pDlgBar = pFrame->GetDialogBar ();
    CEdit* pEdit = pDlgBar->GetEditMaxLine();
    if (pEdit && IsWindow (pEdit->m_hWnd))
    {
        CString strFormat;
        strFormat.Format ("%d", pDoc->m_nMaxLine);
        pEdit->SetLimitText  (4);
        pEdit->SetWindowText (strFormat);
    }
    //
    // Initialize the Sys DBEvent Check Box.
    CButton* pButton = pDlgBar->GetSysDBEventButton ();
    pButton->SetCheck (pDoc->m_bSysDBEvent);
    //
    // Initialize the Popup On Raise Check Box.
    pButton = pDlgBar->GetPopupButton ();
    pButton->SetCheck (pDoc->m_bPopupOnRaise);
    //
    // Initialize the Clear First Check Box.
    pButton = pDlgBar->GetClearFirstButton ();
    pButton->SetCheck (pDoc->m_bClearFirst);

    //
    // Initialize the ComboBox of Databases.
    CString strNone;
    CComboBox* pCombo =  pDlgBar->GetComboDatabase ();
    if (strNone.LoadString (IDS_DATABASE_NONE) == 0)
        strNone = "<None>";
    pCombo->AddString (strNone);
    if (pDoc->m_strDBName == "" || pDoc->m_strDBName == strNone)
    {
        pCombo->SetCurSel (0);
        return;
    }
    pCombo->AddString (pDoc->m_strDBName);
    pCombo->SelectString (-1, pDoc->m_strDBName);
}