Esempio n. 1
0
void CPrime95View::position (
	int	vnum,
	int	iview,
	BOOL	forceTile)
{
	CMainFrame *mainframe;
	CRect	frame_rect;
	int	frame_width, frame_height;
	BOOL handled = FALSE;

	if (!forceTile)
	{
		handled = getSubWindowPlacement(GetParent(), iview);
	}
	if (!handled)
	{
		mainframe = (CMainFrame *) AfxGetApp()->m_pMainWnd;
		mainframe->GetClientRect (&frame_rect);
		frame_height = frame_rect.bottom - frame_rect.top;
		frame_width = frame_rect.right - frame_rect.left;

		mainframe->m_wndStatusBar.GetClientRect (&frame_rect);
		frame_height -= frame_rect.bottom - frame_rect.top;

		frame_height -= 2;
		frame_width -= 2;

		GetParent()->MoveWindow (0,
					 vnum * frame_height / NumViews,
					 frame_width,
					 (vnum+1) * frame_height / NumViews -
					  vnum * frame_height / NumViews);
	}
}
Esempio n. 2
0
void CGameDoc::ResizeWindow(void)
{
	CMainFrame* pMain = (CMainFrame*) AfxGetMainWnd();

	CREATESTRUCT st;
	CREATESTRUCT& rst = st;

	pMain->PreCreateWindow(rst);

	rst.lpszName = _T("Game");
	rst.cx = (m_nRow + 1) * m_bmCell.cx + 180;
	rst.cy = (m_nCol + 1) * m_bmCell.cy + 100;

	CRect rect;
	pMain->GetClientRect(rect);
	pMain->MoveWindow(rect.left, rect.top, rst.cx, rst.cy);
}
Esempio n. 3
0
// Resize parent
void CSplitterFrame::UpdateParent()
{
    CRect rcParent;
    CRect rcMainFrame;
    CRect rcMainClientFrame;
    CPoint pt = GetAbsPosition();
    CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());


    CDlgTemplate &wndParent = *(CDlgTemplate*)GetParent();
    pMainFrame->GetClientRect(&rcMainClientFrame);
    pMainFrame->GetWindowRect(&rcMainFrame);

    pt.x -=rcMainFrame.left;
    pt.y -=rcMainFrame.top;

    wndParent.GetWindowRect(&rcParent);
    wndParent.ShowWindow(SW_HIDE);


    INDEX iWidth = rcParent.right - rcParent.left;
    INDEX iHeight = rcParent.bottom - rcParent.top;

    if(sp_bDockingEnabled) {
        pMainFrame->FloatControlBar(&wndParent,CPoint(rcParent.left,rcParent.top));
        // is splitter attached on left side
        if(sp_uiDockSide == AFX_IDW_DOCKBAR_LEFT) {
            SET_BAR_SIZE(wndParent,rcMainClientFrame.right - pt.x,iHeight);
            // is splitter attached on right side
        } else if(sp_uiDockSide == AFX_IDW_DOCKBAR_RIGHT) {
            SET_BAR_SIZE(wndParent,pt.x,iHeight);
            // is splitter attached on top side
        } else if(sp_uiDockSide == AFX_IDW_DOCKBAR_TOP) {
            SET_BAR_SIZE(wndParent,iWidth,iHeight + sp_ptStartPoint.y - pt.y);
            // is splitter attached on bottom side
        } else if(sp_uiDockSide == AFX_IDW_DOCKBAR_BOTTOM) {
            ASSERT(FALSE);
        }

        // Chose docking side
        INDEX iDockSide = 0;
        // is splitter attached on left side
        if(sp_uiDockSide==AFX_IDW_DOCKBAR_LEFT) {
            iDockSide = AFX_IDW_DOCKBAR_RIGHT;
            // is splitter attached on right side
        } else if(sp_uiDockSide==AFX_IDW_DOCKBAR_RIGHT) {
            iDockSide = AFX_IDW_DOCKBAR_LEFT;
            // is splitter attached on top side
        } else if(sp_uiDockSide==AFX_IDW_DOCKBAR_TOP) {
            iDockSide = AFX_IDW_DOCKBAR_BOTTOM;
            // is splitter attached on bottom side
        } else if(sp_uiDockSide==AFX_IDW_DOCKBAR_BOTTOM) {
            iDockSide = AFX_IDW_DOCKBAR_TOP;
        }
        pMainFrame->DockControlBar(&wndParent,iDockSide);
    } else {
        SET_BAR_SIZE(wndParent,300,300);
        // wndParent.SetWindowPos(&wndBottom,0,0,100,300,SWP_NOZORDER);
        //pMainFrame->FloatControlBar(&wndParent,CPoint(rcParent.left,rcParent.top));
        //pMainFrame->DockControlBar(&wndParent,AFX_IDW_DOCKBAR_BOTTOM);
    }



    wndParent.ShowWindow(SW_SHOW);
    wndParent.UpdateWindow();
}