Exemple #1
0
HDWP ResizeToolbar(HWND hwnd, HDWP hdwp, int width, int vPos, int height, int cControls, const ToolbarButton *buttons, int controlVisibility)
{
	HWND hCtrl;
	int i;
	int lPos = 0;
	int rPos = width;
	for (i = 0; i < cControls; i++) {
		if (!buttons[i].alignment && (controlVisibility & (1 << i))) {
			lPos += buttons[i].spacing;
			hCtrl = GetDlgItem(hwnd, buttons[i].controlId);
			if (NULL != hCtrl) /* Wine fix. */
				hdwp = DeferWindowPos(hdwp, hCtrl, 0, lPos, vPos, buttons[i].width, height, SWP_NOZORDER);
			lPos += buttons[i].width;
		}
	}
	for (i = cControls - 1; i >= 0; i--) {
		if (buttons[i].alignment && (controlVisibility & (1 << i))) {
			rPos -= buttons[i].spacing + buttons[i].width;
			hCtrl = GetDlgItem(hwnd, buttons[i].controlId);
			if (NULL != hCtrl) /* Wine fix. */
				hdwp = DeferWindowPos(hdwp, hCtrl, 0, rPos, vPos, buttons[i].width, height, SWP_NOZORDER);
		}
	}
	return hdwp;
}
Exemple #2
0
//隐藏列表按钮
void CGameFrameDlg::OnBnClickedHideList()
{
	CString strFile,strTemp;
	CTime tmCur = CTime::GetCurrentTime();
	CString strTime = tmCur.Format("%m%d");
	strFile.Format("log\\%sOnBnClickedHideList.log",strTime);

	strTemp.Format("%s", "OnBnClickedHideList()");
	WriteLog(strFile, strTemp);

	static bool bHideList=true;
	int cx,cy;
	CRect rect;
	GetClientRect(rect);
	cx=rect.Width();
	cy=rect.Height();
	if(bHideList)
	{
		if (m_VorSplitter.GetSafeHwnd()) 
		{
			UINT uSplitPos=cx-12;
			//		SafeMoveWindow(&m_VorSplitter,uSplitPos,GetTitleHight(),SPLIT_WIDE,cy-GetTitleHight());

			HDWP hDwp=BeginDeferWindowPos(32);
			DeferWindowPos(hDwp,m_VorSplitter,NULL,uSplitPos, 0,SPLIT_WIDE,cy, uFlags);
			EndDeferWindowPos(hDwp);
			RectifyControl(cx,cy);

			strTemp.Format("bHideList cx=%d,cy=%d", cx,cy);
			WriteLog(strFile, strTemp);
			//			FixControlStation(cx,cy);
		}
		//		m_BtExpression.ShowWindow(SW_HIDE);
		//		m_BtSend.ShowWindow(SW_HIDE);
	}
	else
	{
		if (m_VorSplitter.GetSafeHwnd()) 
		{
			//UINT uSplitPos=__max(cx*2/3-SPLIT_WIDE,350);
			//UINT uSplitPos=__max(cx*17/24-SPLIT_WIDE,350);
			UINT uSplitPos = cx - INFO_WIDTH - BUTTON_WIDE - 1;
			//		SafeMoveWindow(&m_VorSplitter,uSplitPos,GetTitleHight(),SPLIT_WIDE,cy-GetTitleHight());
			HDWP hDwp=BeginDeferWindowPos(32);
			DeferWindowPos(hDwp,m_VorSplitter,NULL,uSplitPos,0,SPLIT_WIDE,cy, uFlags);
			EndDeferWindowPos(hDwp);

			m_VorSplitter.InitSplitBar(cx*3/5,cx-250,false);
			//			FixControlStation(cx,cy);
			RectifyControl(cx,cy);
			strTemp.Format("cx=%d,cy=%d", cx,cy);
			WriteLog(strFile, strTemp);

		}
		//	m_BtExpression.ShowWindow(SW_SHOW);
		//	m_BtSend.ShowWindow(SW_SHOW);
	}
	bHideList=!bHideList;
	return;
}
Exemple #3
0
void CMonitorWnd::OnSize(UINT nType, int cx, int cy) 
{
	if ( nType != SIZE_INTERNAL ) CChildWnd::OnSize( nType, cx, cy );

	CRect rc;
	GetClientRect( &rc );
	
	if ( rc.Width() < 32 || rc.Height() < 32 ) return;
	
	HDWP hDWP = BeginDeferWindowPos( 4 );
	
	DeferWindowPos( hDWP, wndPanel.GetSafeHwnd(), NULL,
		rc.left, rc.top, PANEL_WIDTH, rc.Height(), SWP_NOZORDER );
	
	DeferWindowPos( hDWP, m_wndHeaderBar.GetSafeHwnd(), NULL,
		rc.left + PANEL_WIDTH, rc.top, rc.Width() - PANEL_WIDTH, BAR_HEIGHT, SWP_NOZORDER );
	
	DeferWindowPos( hDWP, m_wndChild.GetSafeHwnd(), NULL,
		rc.left + PANEL_WIDTH, rc.top + BAR_HEIGHT, rc.Width() - PANEL_WIDTH,
		rc.Height() - BAR_HEIGHT * 2, SWP_NOZORDER );
	
	DeferWindowPos( hDWP, m_wndBottom.GetSafeHwnd(), NULL,
		rc.left + PANEL_WIDTH, rc.bottom - BAR_HEIGHT, rc.Width() - PANEL_WIDTH, BAR_HEIGHT, SWP_NOZORDER );
	
	EndDeferWindowPos( hDWP );
}
Exemple #4
0
void CChatWnd::OnSize(UINT nType, int cx, int cy)
{
    if ( nType != 1982 ) CPanelWnd::OnSize( nType, cx, cy );

    CRect rc;
    GetClientRect( &rc );

    if ( rc.Width() < m_nUsersSize + SPLIT_SIZE )
    {
        m_nUsersSize = max( 0, rc.Width() - SPLIT_SIZE );
    }

    HDWP hDWP = BeginDeferWindowPos( 4 );

    DeferWindowPos( hDWP, m_wndView, NULL, rc.left, rc.top,
                    rc.Width() - m_nUsersSize - SPLIT_SIZE, rc.Height() - TOOLBAR_HEIGHT - EDIT_HEIGHT, SWP_NOZORDER );

    DeferWindowPos( hDWP, m_wndUsers, NULL, rc.left + rc.Width() - m_nUsersSize, rc.top,
                    m_nUsersSize, rc.Height() - TOOLBAR_HEIGHT - EDIT_HEIGHT, SWP_NOZORDER );

    DeferWindowPos( hDWP, m_wndToolBar, NULL,
                    rc.left, rc.bottom - TOOLBAR_HEIGHT - EDIT_HEIGHT,
                    rc.Width(), TOOLBAR_HEIGHT, SWP_NOZORDER );

    DeferWindowPos( hDWP, m_wndEdit, NULL, rc.left, rc.bottom - EDIT_HEIGHT,
                    rc.Width(), EDIT_HEIGHT, SWP_NOZORDER );

    EndDeferWindowPos( hDWP );

    m_wndUsers.SetColumnWidth( 0, m_nUsersSize - GetSystemMetrics( SM_CXVSCROLL ) );
}
void CEasySkinManager::OnSize( UINT nType, int cx, int cy )
{
	CEasySkinDialog::OnSize(nType, cx, cy);

	//移动准备
	HDWP hDwp=BeginDeferWindowPos(64);
	UINT uFlags=SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOZORDER;

	if ( m_enWndStyle != en_Wnd_None )
	{
		DeferWindowPos(hDwp,m_btClose,NULL,cx-41,0,0,0,uFlags|SWP_NOSIZE);

		if ( m_enWndStyle != en_Wnd_CloseBox )
		{
			if( m_enWndStyle != en_Wnd_MinimizeBox )
				DeferWindowPos(hDwp,m_btMax,NULL,cx-69,0,0,0,uFlags|SWP_NOSIZE);

			DeferWindowPos(hDwp,m_btMin,NULL,cx-69-(m_enWndStyle==en_Wnd_Normal?28:0),0,0,0,uFlags|SWP_NOSIZE);
		}
	}

	//结束调整
	//LockWindowUpdate();
	EndDeferWindowPos(hDwp);
	//UnlockWindowUpdate();

	//设置圆角
	CRgn rgn;
	rgn.CreateRoundRectRgn(0,0,cx,cy,4,4);
	SetWindowRgn(rgn,FALSE);

	//更新界面
	Invalidate(FALSE);
}
void mxTab_resizeChild (HWND hwnd)
{
	TC_ITEM ti;

	int index = TabCtrl_GetCurSel (hwnd);
	if (index >= 0)
	{
		ti.mask = TCIF_PARAM;
		TabCtrl_GetItem (hwnd, index, &ti);
		mxWidget *widget = (mxWidget *) ti.lParam;
		if (widget)
		{
			RECT rc, rc2;

			GetWindowRect (hwnd, &rc);
			ScreenToClient (GetParent (hwnd), (LPPOINT) &rc.left);
			ScreenToClient (GetParent (hwnd), (LPPOINT) &rc.right);

			TabCtrl_GetItemRect (hwnd, index, &rc2);

			int ex = GetSystemMetrics (SM_CXEDGE);
			int ey = GetSystemMetrics (SM_CYEDGE);
			rc.top += (rc2.bottom - rc2.top) + 3 * ey;
			rc.left += 2 * ex;
			rc.right -= 2 * ex;
			rc.bottom -= 2 * ey;
			HDWP hdwp = BeginDeferWindowPos (2);
			DeferWindowPos (hdwp, hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
			DeferWindowPos (hdwp, (HWND) widget->getHandle (), HWND_TOP, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW);
			EndDeferWindowPos (hdwp);
		}
	}
}
Exemple #7
0
void CPlayerWnd::OnSize(UINT nType, int cx, int cy) 
{
	if ( nType != SIZE_INTERNAL ) CChildWnd::OnSize( nType, cx, cy );

	CRect rc;
	GetClientRect( &rc );
	
	if ( rc.Width() < 32 || rc.Height() < 32 ) return;
	
	HDWP hDWP = BeginDeferWindowPos( 3 );
	
	DeferWindowPos( hDWP, wndPanel.GetSafeHwnd(), NULL,
		rc.left, rc.top, PANEL_WIDTH, rc.Height(), SWP_NOZORDER );
	
	DeferWindowPos( hDWP, m_wndHeaderBar.GetSafeHwnd(), NULL,
		rc.left + PANEL_WIDTH, rc.top, rc.Width() - PANEL_WIDTH, BAR_HEIGHT, SWP_NOZORDER );
	
	DeferWindowPos( hDWP, m_wndBottom.GetSafeHwnd(), NULL,
		rc.left + PANEL_WIDTH, rc.bottom - BAR_HEIGHT, rc.Width() - PANEL_WIDTH, BAR_HEIGHT, SWP_NOZORDER );
	
	EndDeferWindowPos( hDWP );
	
	if ( ! m_bPlaying ) return;
	
	CRect rect(
		rc.left + PANEL_WIDTH, rc.top + BAR_HEIGHT,
		rc.right, rc.bottom - BAR_HEIGHT );
	
	m_wndPlayer.PutIntoWindow( m_hWnd, rect );
}
void CDialogResizeHelper::OnSize(UINT, CSize newSize)
{
	if (m_thisWnd != NULL) {
		HDWP hWinPosInfo = BeginDeferWindowPos( m_table.get_size() + (m_sizeGrip != NULL ? 1 : 0) );
		for(t_size n = 0; n < m_table.get_size(); ++n) {
			CRect rc;
			if (_EvalRect(n, newSize, rc)) {
				hWinPosInfo = DeferWindowPos(hWinPosInfo, m_thisWnd.GetDlgItem(m_table[n].id), 0, rc.left,rc.top,rc.Width(),rc.Height(),SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS);
			}
		}
		if (m_sizeGrip != NULL)
		{
			RECT rc, rc_grip;
			if (m_thisWnd.GetClientRect(&rc) && m_sizeGrip.GetWindowRect(&rc_grip)) {
				DWORD flags = SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOCOPYBITS;
				if (IsZoomed(m_thisWnd)) flags |= SWP_HIDEWINDOW;
				else flags |= SWP_SHOWWINDOW;
				hWinPosInfo = DeferWindowPos(hWinPosInfo, m_sizeGrip, NULL, rc.right - (rc_grip.right - rc_grip.left), rc.bottom - (rc_grip.bottom - rc_grip.top), 0, 0, flags );
			}
		}
		EndDeferWindowPos(hWinPosInfo);
		//RedrawWindow(m_thisWnd, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN);
	}
	SetMsgHandled(FALSE);
}
void CInteractionAreaDialog::RepositionControls() {
    if (m_bIsInitialized) {
        CRect rcWin;
        GetWindowRect(&rcWin);

        CRect rcOK;
        m_btnOK.GetWindowRect(&rcOK);
        CRect rcCancel;
        m_btnCancel.GetWindowRect(&rcCancel);
        CRect rcBack;
        m_stBottom.GetWindowRect(&rcBack);
        

        CRect rcControl;
        rcControl = rcOK;
        rcControl.top = rcWin.bottom - m_iButtonVOffset - rcOK.Height();
        rcControl.bottom = rcWin.bottom - m_iButtonVOffset;
        
        rcControl.left = rcOK.left;
        rcControl.right = rcOK.right;
        ScreenToClient(&rcControl);
        //m_btnOK.MoveWindow(&rcControl, TRUE);

        CRect rcControl1;
        rcControl1 = rcCancel;
        rcControl1.top = rcWin.bottom - m_iButtonVOffset - rcCancel.Height();
        rcControl1.bottom = rcWin.bottom - m_iButtonVOffset;
        
        rcControl1.left = rcCancel.left;
        rcControl1.right = rcCancel.right;
        ScreenToClient(&rcControl1);
        //m_btnCancel.MoveWindow(&rcControl, TRUE);

        CRect rcControl2;
        rcControl2 = rcBack;
        rcControl2.top = rcWin.bottom - m_iBackVOffset - rcBack.Height();
        rcControl2.bottom = rcWin.bottom - m_iBackVOffset;
        
        rcControl2.left = rcBack.left;
        rcControl2.right = rcBack.right;
        ScreenToClient(&rcControl2);
        //m_stBottom.MoveWindow(&rcControl, TRUE);
         

        HDWP hDefer = BeginDeferWindowPos(3);
        UINT uFlags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER;
        if(hDefer)
            DeferWindowPos(hDefer, m_btnOK.m_hWnd, NULL, rcControl.left, rcControl.top, rcControl.Width(), rcControl.Height(), uFlags);
        if(hDefer)
            DeferWindowPos(hDefer, m_btnCancel.m_hWnd, NULL, rcControl1.left, rcControl1.top, rcControl1.Width(), rcControl1.Height(), uFlags);
        if(hDefer)
            DeferWindowPos(hDefer, m_stBottom.m_hWnd, NULL, rcControl2.left, rcControl2.top, rcControl2.Width(), rcControl2.Height(), uFlags);
        

        EndDeferWindowPos(hDefer);

        InvalidateRect(&rcControl2);
    }
}
Exemple #10
0
void size_windows()
{
	if (!/*g_minimised*/IsIconic(g_main_window) && !ui_initialising)
	{		
		RECT rc_main_client;
		GetClientRect(g_main_window, &rc_main_client);
		
		HDWP dwp = BeginDeferWindowPos(7);
		if (dwp)
		{
			
			int status_height = 0;
			if (g_status) 
			{

				//uSendMessage(g_status, WM_SETREDRAW, FALSE, 0);
				uSendMessage(g_status,WM_SIZE,0,0);
				RECT rc_status;
				GetWindowRect(g_status, &rc_status);
				
				status_height += rc_status.bottom-rc_status.top;
				
				//dwp = DeferWindowPos(dwp, g_status, 0, 0, rc_main_client.bottom-status_height, rc_main_client.right-rc_main_client.left, status_height, SWP_NOZORDER|SWP_NOREDRAW);
				
			}
			if (g_status_pane.get_wnd()) 
			{
				int cy = g_status_pane.get_ideal_height();
				RedrawWindow(g_status_pane.get_wnd(), 0, 0, RDW_INVALIDATE);
				dwp = DeferWindowPos(dwp, g_status_pane.get_wnd(), 0, 0, rc_main_client.bottom-status_height-cy, rc_main_client.right-rc_main_client.left, cy, SWP_NOZORDER);
				status_height += cy;
			}
			int rebar_height=0;
			
			if (g_rebar) 
			{
				RECT rc_rebar;
				GetWindowRect(g_rebar, &rc_rebar);
				rebar_height = rc_rebar.bottom-rc_rebar.top;
			}
			if (g_layout_window.get_wnd())
				dwp = DeferWindowPos(dwp, g_layout_window.get_wnd(), 0, 0, rebar_height, rc_main_client.right-rc_main_client.left, rc_main_client.bottom-rc_main_client.top-rebar_height-status_height, SWP_NOZORDER);
			if (g_rebar) 
			{
				dwp = DeferWindowPos(dwp, g_rebar, 0, 0, 0, rc_main_client.right-rc_main_client.left, rebar_height, SWP_NOZORDER);
			}
			
			EndDeferWindowPos(dwp);

			if (g_status)
			{
				status_bar::set_part_sizes(status_bar::t_parts_none);
			}
			
			
		}
	}
}
Exemple #11
0
static VOID CALLBACK
MainWndResize(PVOID Context,
              WORD cx,
              WORD cy)
{
    RECT rcClient = {0};
    RECT rcStatus = {0};
    HDWP dwp;
    PMAIN_WND_INFO Info = (PMAIN_WND_INFO)Context;

    /* Calculate the MDI client rectangle */
    rcClient.right = cx;
    rcClient.bottom = cy;

    if (Info->hStatus != NULL)
    {
        GetWindowRect(Info->hStatus,
                      &rcStatus);
        rcClient.bottom -= (rcStatus.bottom - rcStatus.top);
    }


    dwp = BeginDeferWindowPos(2);
    if (dwp != NULL)
    {
        /* Update the MDI client */
        if (Info->hMdiClient != NULL)
        {
            dwp = DeferWindowPos(dwp,
                                 Info->hMdiClient,
                                 NULL,
                                 rcClient.left,
                                 rcClient.top,
                                 rcClient.right - rcClient.left,
                                 rcClient.bottom - rcClient.top,
                                 SWP_NOZORDER);
            if (dwp == NULL)
                return;
        }

        /* Update the status bar */
        if (Info->hStatus != NULL)
        {
            dwp = DeferWindowPos(dwp,
                                 Info->hStatus,
                                 NULL,
                                 0,
                                 cy - (rcStatus.bottom - rcStatus.top),
                                 cx,
                                 rcStatus.bottom - rcStatus.top,
                                 SWP_NOZORDER);
            if (dwp == NULL)
                return;
        }

        EndDeferWindowPos(dwp);
    }
}
Exemple #12
0
void CTestClockDlg::OnSize(UINT nType, int cx, int cy)
{
    if (m_bInit == TRUE)
    {
        SetRadius(cx, cy);
        SetCenterPoint(cx, cy);
        SetGradationPoints();

        m_nHourGradSize = MulDiv(DEFAULT_HOUR_GRAD_SIZE, m_nRadius, m_nRadiusOrg);
        m_nMinuteGradSize = MulDiv(DEFAULT_MINUTE_GRAD_SIZE, m_nRadius, m_nRadiusOrg);
        m_nSecondHandSize = MulDiv(DEFAULT_SECOND_HAND_SIZE, m_nRadius, m_nRadiusOrg);
        m_nCenterPointSize = MulDiv(DEFAULT_CENTER_POINT_SIZE, m_nRadius, m_nRadiusOrg);

        SetClockHandPoints();

        // Set position of the 'OK' and 'Cancel' button

        CRect rect;
        CRect rectBtnOk;
        CRect rectBtnOkToMove;
        CRect rectBtnCancel;
        CRect rectBtnCancelToMove;

        GetClientRect(rect);
        ClientToScreen(rect);

        m_btnOk.GetWindowRect(rectBtnOk);
        ScreenToClient(rectBtnOk);

        m_btnCancel.GetWindowRect(rectBtnCancel);
        ScreenToClient(rectBtnCancel);

        rectBtnOkToMove.right = rect.Width() - m_marginBtnOk.right;
        rectBtnOkToMove.bottom = rect.Height() - m_marginBtnOk.bottom;
        rectBtnOkToMove.left = rectBtnOkToMove.right - rectBtnOk.Width();
        rectBtnOkToMove.top = rectBtnOkToMove.bottom - rectBtnOk.Height();

        rectBtnCancelToMove.right = rect.Width() - m_marginBtnCancel.right;
        rectBtnCancelToMove.bottom = rect.Height() - m_marginBtnCancel.bottom;
        rectBtnCancelToMove.left = rectBtnCancelToMove.right - rectBtnCancel.Width();
        rectBtnCancelToMove.top = rectBtnCancelToMove.bottom - rectBtnCancel.Height();

        HDWP hdwp = ::BeginDeferWindowPos(2);
        if (hdwp)
            hdwp = DeferWindowPos(hdwp, m_btnOk.GetSafeHwnd(), HWND_TOP, rectBtnOkToMove.left, rectBtnOkToMove.top, rectBtnOkToMove.Width(), rectBtnOkToMove.Height(), SWP_NOZORDER);
        if (hdwp)
            DeferWindowPos(hdwp, m_btnCancel.GetSafeHwnd(), HWND_TOP, rectBtnCancelToMove.left, rectBtnCancelToMove.top, rectBtnCancelToMove.Width(), rectBtnCancelToMove.Height(), SWP_NOZORDER);
        if (hdwp)
            EndDeferWindowPos(hdwp);

        Invalidate();
        UpdateWindow();
    }

    CDialog::OnSize(nType, cx, cy);
}
Exemple #13
0
VOID EtwDiskNetworkLayoutGraphs(
    _In_ PET_DISKNET_CONTEXT Context
    )
{
    HDWP deferHandle;
    RECT clientRect;
    RECT panelRect;
    RECT margin = { PH_SCALE_DPI(13), PH_SCALE_DPI(13), PH_SCALE_DPI(13), PH_SCALE_DPI(13) };
    RECT innerMargin = { PH_SCALE_DPI(10), PH_SCALE_DPI(20), PH_SCALE_DPI(10), PH_SCALE_DPI(10) };
    LONG between = PH_SCALE_DPI(3);
    ULONG graphWidth;
    ULONG graphHeight;

    PhLayoutManagerLayout(&Context->LayoutManager);

    Context->DiskGraphState.Valid = FALSE;
    Context->NetworkGraphState.Valid = FALSE;

    GetClientRect(Context->WindowHandle, &clientRect);

    // Limit the rectangle bottom to the top of the panel.
    GetWindowRect(Context->PanelHandle, &panelRect);
    MapWindowPoints(NULL, Context->WindowHandle, (PPOINT)&panelRect, 2);
    clientRect.bottom = panelRect.top + 10; // +10 removing extra spacing

    graphWidth = clientRect.right - margin.left - margin.right;
    graphHeight = (clientRect.bottom - margin.top - margin.bottom - between * 2) / 2;

    deferHandle = BeginDeferWindowPos(4);

    deferHandle = DeferWindowPos(deferHandle, Context->DiskGroupBox, NULL, margin.left, margin.top, graphWidth, graphHeight, SWP_NOACTIVATE | SWP_NOZORDER);
    deferHandle = DeferWindowPos(
        deferHandle,
        Context->DiskGraphHandle,
        NULL,
        margin.left + innerMargin.left,
        margin.top + innerMargin.top,
        graphWidth - innerMargin.left - innerMargin.right,
        graphHeight - innerMargin.top - innerMargin.bottom,
        SWP_NOACTIVATE | SWP_NOZORDER
        );

    deferHandle = DeferWindowPos(deferHandle, Context->NetworkGroupBox, NULL, margin.left, margin.top + graphHeight + between, graphWidth, graphHeight, SWP_NOACTIVATE | SWP_NOZORDER);
    deferHandle = DeferWindowPos(
        deferHandle,
        Context->NetworkGraphHandle,
        NULL,
        margin.left + innerMargin.left,
        margin.top + graphHeight + between + innerMargin.top,
        graphWidth - innerMargin.left - innerMargin.right,
        graphHeight - innerMargin.top - innerMargin.bottom,
        SWP_NOACTIVATE | SWP_NOZORDER
        );

    EndDeferWindowPos(deferHandle);
}
Exemple #14
0
static void ResizeWnd(int cx, int cy)
{
    HDWP hdwp = BeginDeferWindowPos(2);
    RECT rt = {0, 0, cx, cy};

    cx = g_pChildWnd->nSplitPos + SPLIT_WIDTH/2;
    DeferWindowPos(hdwp, g_pChildWnd->hTreeWnd, 0, rt.left, rt.top, g_pChildWnd->nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
    DeferWindowPos(hdwp, g_pChildWnd->hListWnd, 0, rt.left+cx  , rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
    EndDeferWindowPos(hdwp);
}
void CNetworkMonitorBox::OnSize(UINT nType, int cx, int cy) 
{
	CTaskBox::OnSize( nType, cx, cy );
	
	HDWP hDWP = BeginDeferWindowPos( 2 );
	
	DeferWindowPos( hDWP, m_wndStart, NULL, BOX_MARGIN, 7, 55, 23, SWP_NOZORDER );
	DeferWindowPos( hDWP, m_wndClock, NULL, BOX_MARGIN + 61, 7, 13 * 8, 23, SWP_NOZORDER );
	
	EndDeferWindowPos( hDWP );
}
void CNetworkTaskBox::OnSize(UINT nType, int cx, int cy) 
{
	CTaskBox::OnSize( nType, cx, cy );
	
	HDWP hDWP = BeginDeferWindowPos( 2 );
	
	DeferWindowPos( hDWP, m_wndChan, NULL, BOX_MARGIN, 27,
		cx - BOX_MARGIN * 2, 80, SWP_NOZORDER );
	
	DeferWindowPos( hDWP, m_wndPlay, NULL, BOX_MARGIN, 80,
		cx - BOX_MARGIN * 2 - 80, 80, SWP_NOZORDER );
	DeferWindowPos( hDWP, m_wndStart, NULL, cx - 80, 79, 72, 24, SWP_SHOWWINDOW|SWP_NOZORDER );
	
	EndDeferWindowPos( hDWP );
}
Exemple #17
0
void CChildWnd::SizeListAndBar(CWnd* pList, CWnd* pBar)
{
	CRect rc;
	GetClientRect( &rc );
	rc.bottom -= Settings.Skin.ToolbarHeight;

	HDWP hPos = BeginDeferWindowPos( 2 );
	DeferWindowPos( hPos, pList->GetSafeHwnd(), NULL,
		rc.left, rc.top, rc.Width(), rc.Height(),
		SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER );
	DeferWindowPos( hPos, pBar->GetSafeHwnd(), NULL,
		rc.left, rc.bottom, rc.Width(), Settings.Skin.ToolbarHeight,
		SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER );
	EndDeferWindowPos( hPos );
}
Exemple #18
0
//初始化函数
BOOL CChessManual::OnInitDialog()
{
	__super::OnInitDialog();

	//设置标题
	SetWindowText(TEXT("国际象棋棋谱:"));

	//移动窗口
	CImageHandle ImageHandeBack(&m_ImageBack);
	SetWindowPos(NULL,0,0,m_ImageBack.GetWidth(),m_ImageBack.GetHeight(),SWP_NOZORDER|SWP_NOMOVE);

	//获取大小
	CRect rcClient;
	GetClientRect(&rcClient);

	//创建控件
	const CSize & BoradSize=m_ChessBorad.GetChessBoradSize();
	m_ChessBorad.Create(NULL,NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,10);

	//设置按钮
	HINSTANCE hInstance=AfxGetInstanceHandle();
	m_btOpen.SetButtonImage(IDB_MANUAL_BT_OPEN,hInstance,false);
	m_btPreserve.SetButtonImage(IDB_MANUAL_BT_PRESERVE,hInstance,false);
	m_btReLoad.SetButtonImage(IDB_MANUAL_BT_RELOAD,hInstance,false);
	m_btFirst.SetButtonImage(IDB_MANUAL_BT_FIRST,hInstance,false);
	m_btBefore.SetButtonImage(IDB_MANUAL_BT_BEFORE,hInstance,false);
	m_btNext.SetButtonImage(IDB_MANUAL_BT_NEXT,hInstance,false);
	m_btLast.SetButtonImage(IDB_MANUAL_BT_LAST,hInstance,false);
	m_btCancel.SetButtonImage(IDB_MANUAL_BT_CLOSE,hInstance,false);

	//计算位置
	CRect rcButton;
	m_btOpen.GetWindowRect(&rcButton);
	int nXButtonSpace=(rcClient.Width()-rcButton.Width()*8-40)/9;
	int nYPos=rcClient.Height()-rcButton.Height()-30;

	//移动按钮
	HDWP hDwp=BeginDeferWindowPos(8);
	const UINT uFlags=SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS|SWP_NOSIZE;
	DeferWindowPos(hDwp,m_btOpen,NULL,20+nXButtonSpace,nYPos,0,0,uFlags);
	DeferWindowPos(hDwp,m_btPreserve,NULL,20+nXButtonSpace*2+rcButton.Width(),nYPos,0,0,uFlags);
	DeferWindowPos(hDwp,m_btReLoad,NULL,20+nXButtonSpace*3+rcButton.Width()*2,nYPos,0,0,uFlags);
	DeferWindowPos(hDwp,m_btFirst,NULL,20+nXButtonSpace*4+rcButton.Width()*3,nYPos,0,0,uFlags);
	DeferWindowPos(hDwp,m_btBefore,NULL,20+nXButtonSpace*5+rcButton.Width()*4,nYPos,0,0,uFlags);
	DeferWindowPos(hDwp,m_btNext,NULL,20+nXButtonSpace*6+rcButton.Width()*5,nYPos,0,0,uFlags);
	DeferWindowPos(hDwp,m_btLast,NULL,20+nXButtonSpace*7+rcButton.Width()*6,nYPos,0,0,uFlags);
	DeferWindowPos(hDwp,m_btCancel,NULL,20+nXButtonSpace*8+rcButton.Width()*7,nYPos,0,0,uFlags);
	EndDeferWindowPos(hDwp);

	//移动控件
	m_ChessBorad.MoveWindow(29,29,BoradSize.cx,BoradSize.cy);
	m_ManualList.MoveWindow(BoradSize.cx+37,32,rcClient.Width()-BoradSize.cx-66,BoradSize.cy-8);

	//更新棋谱
	OnReLoad();

	return TRUE;
}
HDWP CScheduleTableCfgDlg::vUpdateWindowPosition(int nXPos, int nYPos)
{
    HDWP handleWP = NULL;

    for (VecAutoSize::iterator itr = m_VecAutoSize.begin();  itr != m_VecAutoSize.end();  ++itr)
    {
        if (itr->wndHandle != NULL)
        {
            CRect rectWndPos(itr->wndRect);
            int nCalXPos = int(nXPos * itr->fToXPos);
            int nCalYPos = int(nYPos * itr->fToYPos);

            int nCalRightPos = int(nXPos * itr->fSizeX);
            int nCalBottomPos = int(nYPos * itr->fSizeY);

            rectWndPos.OffsetRect(nCalXPos, nCalYPos);
            rectWndPos.right = rectWndPos.right + nCalRightPos;
            rectWndPos.bottom = rectWndPos.bottom + nCalBottomPos;
            UINT uFlags = vChangeWindowPos(handleWP, itr->wndHandle, itr->fSizeX, itr->fSizeY, rectWndPos);

            DeferWindowPos(handleWP, itr->wndHandle, NULL, rectWndPos.left, rectWndPos.top, rectWndPos.Width(), rectWndPos.Height(), uFlags);
        }
    }

    return handleWP;
}
Exemple #20
0
//调整界面
void CGameParrentDlg::RectifyControl(int nWidth, int nHeight)
{
	//状态判断
	if (m_bInitDialog==false) return;

	//改对话框要改
	//变量定义
	const int iXExc=0;//GetXExcursionPos();
	const int iYExc=0;//GetYExcursionPos();
	const UINT uFlags=SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS;

	//锁定屏幕
	LockWindowUpdate();

	//移动控件
	HDWP hDwp=BeginDeferWindowPos(3);
	DeferWindowPos(hDwp,m_pGameFrameView->GetSafeHwnd(),NULL,iXExc,iYExc,nWidth-2*iXExc,nHeight-iYExc,uFlags);
	EndDeferWindowPos(hDwp);

	//重画界面
	Invalidate(FALSE);
	UpdateWindow();

	//解除锁定
	UnlockWindowUpdate();

	return;
}
void CBaseDialog::OnSize(UINT nType, int cx, int cy) 
{
	CDialog::OnSize(nType, cx, cy);

	int iXDelta = cx - m_szInitial.cx;
	int iYDelta = cy - m_szInitial.cy;
	HDWP hDefer = NULL;
	for (MovingChildren::iterator p = m_MovingChildren.begin();  p != m_MovingChildren.end();  ++p)
	{
		if (p->m_hWnd != NULL)
		{
			CRect rcNew(p->m_rcInitial);
			rcNew.OffsetRect(int(iXDelta * p->m_dXMoveFrac), int(iYDelta * p->m_dYMoveFrac));
			rcNew.right += int(iXDelta * p->m_dXSizeFrac);
			rcNew.bottom += int(iYDelta * p->m_dYSizeFrac);
			if (hDefer == NULL)
				hDefer = BeginDeferWindowPos(m_MovingChildren.size());
			UINT uFlags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER;
			if ((p->m_dXSizeFrac != 0.0) || (p->m_dYSizeFrac != 0.0))
				uFlags |= SWP_NOCOPYBITS;
			DeferWindowPos(hDefer, p->m_hWnd, NULL, rcNew.left, rcNew.top, rcNew.Width(), rcNew.Height(), uFlags);
		}
	}
	if (hDefer != NULL)
		EndDeferWindowPos(hDefer);

}
Exemple #22
0
void SPLASH::Show()
{
  //get size of hSplashWnd (width and height)
  int x,y;
  int pwidth,pheight;
  int tx,ty;
  HDWP windefer;
  RECT rect,prect;
  GetClientRect(hSplashWnd,&rect);
  x=rect.right;y=rect.bottom;
  //get parent screen coordinates
  GetWindowRect(this->hParentWindow,&prect);

  //center splash window on parent window
  pwidth=prect.right-prect.left;
  pheight=prect.bottom - prect.top;



  tx=(pwidth/2) - (x/2);
  ty=(pheight/2) - (y/2);

  tx+=prect.left;
  ty+=prect.top;


  windefer=BeginDeferWindowPos(1);
  DeferWindowPos(windefer,hSplashWnd,HWND_NOTOPMOST,tx,ty,50,50,SWP_NOSIZE|SWP_SHOWWINDOW|SWP_NOZORDER);
  EndDeferWindowPos(windefer);

  ShowWindow(hSplashWnd,SW_SHOWNORMAL);
  UpdateWindow(hSplashWnd);
  this->SHOWING = TRUE;
}
Exemple #23
0
void childresize_resize(HWND hwndDlg, ChildWndResizeItem *list, int num)
{
	RECT r;
	GetClientRect(hwndDlg,&r);
	int x;
	HDWP hdwp=BeginDeferWindowPos(num);
	for (x = 0; x < num; x ++) if (list[x].type&0xf0000) {
		RECT r2;
		if (list[x].type&0xF000)  r2.left=r.right-list[x].rinfo.left;
		else r2.left=list[x].rinfo.left;

		if (list[x].type&0x0F00)  r2.top=r.bottom-list[x].rinfo.top;
		else r2.top=list[x].rinfo.top;

		if (list[x].type&0x00F0)  r2.right=r.right-list[x].rinfo.right;
		else r2.right=list[x].rinfo.right;

		if (list[x].type&0x000F)  r2.bottom=r.bottom-list[x].rinfo.bottom;
		else r2.bottom=list[x].rinfo.bottom;

		HWND h=GetDlgItem(hwndDlg,list[x].id);
		DeferWindowPos(hdwp, h, NULL, r2.left,r2.top,r2.right-r2.left,r2.bottom-r2.top, SWP_NOZORDER|SWP_NOACTIVATE);
	};
	EndDeferWindowPos(hdwp);
}
Exemple #24
0
void CAutoSplitter::MoveControls(int dx, int dy)
{
	HDWP hDWP=BeginDeferWindowPos(GetSize());
	for (int i=0; i<GetSize(); i++)
		{
		CAutoSizeControl* pControl=GetAt(i);

		RECT rcControl;
		GetWindowRect(pControl->m_hWndControl, &rcControl);

		DWORD dwFlags=pControl->m_dwFlags;

		// Work out new rectangle
		if (dwFlags & ASF_TOP)
			rcControl.top+=dy;
		if (dwFlags & ASF_BOTTOM)
			rcControl.bottom+=dy;
		if (dwFlags & ASF_LEFT)
			rcControl.left+=dx;
		if (dwFlags & ASF_RIGHT)
			rcControl.right+=dx;

		ScreenToClient(m_hWndParent, (LPPOINT)&rcControl.left);
		ScreenToClient(m_hWndParent, (LPPOINT)&rcControl.right);

		hDWP=DeferWindowPos(hDWP, pControl->m_hWndControl, NULL, 
				rcControl.left, rcControl.top,
				rcControl.right-rcControl.left,
				rcControl.bottom-rcControl.top, SWP_NOZORDER|SWP_NOACTIVATE);
		}
	EndDeferWindowPos(hDWP);
}
Exemple #25
0
void UpdateWindowSize(DialogData* pdd, const int cx, const int cy, HWND hwnd) {
    const int nDeltaX = cx - pdd->sizeClient.dx;
    const int nDeltaY = cy - pdd->sizeClient.dy;

    HDWP hdwp = BeginDeferWindowPos(pdd->nItemCount);
    for (int i = 0; i < pdd->nItemCount; i++) {
        const DialogSizerSizingItem* psd = pdd->psd + i;
        HWND hwndChild = GetDlgItem(hwnd, psd->uControlID);
        RectI rect = MapRectToWindow(WindowRect(hwndChild), HWND_DESKTOP, hwnd);

        // Adjust the window horizontally
        if (psd->uSizeInfo & DS_MoveX)
            rect.x += nDeltaX;
        // Adjust the window vertically
        if (psd->uSizeInfo & DS_MoveY)
            rect.y += nDeltaY;
        // Size the window horizontally
        if (psd->uSizeInfo & DS_SizeX)
            rect.dx += nDeltaX;
        // Size the window vertically
        if (psd->uSizeInfo & DS_SizeY)
            rect.dy += nDeltaY;

        DeferWindowPos(hdwp, hwndChild, nullptr, rect.x, rect.y, rect.dx, rect.dy, SWP_NOACTIVATE | SWP_NOZORDER);
    }
    EndDeferWindowPos(hdwp);

    pdd->sizeClient = SizeI(cx, cy);
    // If we have a sizing grip enabled then adjust it's position
    pdd->UpdateGripper();
}
Exemple #26
0
static void LayoutTransfers(HWND hwnd, struct TFtPageData *dat)
{
	int top = 0;
	RECT rc;
	GetClientRect(hwnd, &rc);

	dat->scrollPos = GetScrollPos(hwnd, SB_VERT);
	dat->height = rc.bottom - rc.top;

	if (dat->wnds->realCount) {
		HDWP hdwp = BeginDeferWindowPos(dat->wnds->realCount);
		top -= dat->scrollPos;
		for (int i = 0; i < dat->wnds->realCount; ++i) {
			int height = dat->wnds->items[i]->rc.bottom - dat->wnds->items[i]->rc.top;
			hdwp = DeferWindowPos(hdwp, dat->wnds->items[i]->hwnd, NULL, 0, top, rc.right, height, SWP_NOZORDER);
			top += height;
		}
		top += dat->scrollPos;
		EndDeferWindowPos(hdwp);
	}

	dat->dataHeight = top;

	SCROLLINFO si = { 0 };
	si.cbSize = sizeof(si);
	si.fMask = SIF_DISABLENOSCROLL | SIF_PAGE | SIF_RANGE;
	si.nPage = dat->height;
	si.nMin = 0;
	si.nMax = dat->dataHeight;
	SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
}
void CMsgSignalSelect::OnSize(UINT nType, int cx, int cy)
{
    CDialog::OnSize(nType, cx, cy);

    int iXDelta = cx - m_szInitial.cx;
    int iYDelta = cy - m_szInitial.cy;
    HDWP hDefer = NULL;
    for (MovingChildren::iterator p = m_MovingChildren.begin();  p != m_MovingChildren.end();  ++p)
    {
        if (p->m_hWnd != NULL)
        {
            CRect rcNew(p->m_rcInitial);
            rcNew.OffsetRect(int(iXDelta * p->m_dXMoveFrac), int(iYDelta * p->m_dYMoveFrac));
            rcNew.right += int(iXDelta * p->m_dXSizeFrac);
            rcNew.bottom += int(iYDelta * p->m_dYSizeFrac);
            if (hDefer == NULL)
            {
                hDefer = BeginDeferWindowPos(m_MovingChildren.size());
            }
            UINT uFlags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER;
            if ((p->m_dXSizeFrac != 0.0) || (p->m_dYSizeFrac != 0.0))
            {
                uFlags |= SWP_NOCOPYBITS;
            }
            DeferWindowPos(hDefer, p->m_hWnd, NULL, rcNew.left, rcNew.top, rcNew.Width(), rcNew.Height(), uFlags);
        }
    }
    if (hDefer != NULL)
    {
        EndDeferWindowPos(hDefer);
    }

    //if (m_hGripper != NULL)
    //   ::ShowWindow(m_hGripper, (nType == SIZE_MAXIMIZED) ? SW_HIDE : SW_SHOW);
}
Exemple #28
0
void CBaseDialog::OnSize(UINT/* nType*/, int cx, int cy)
{
	HRESULT hRes = S_OK;
	HDWP hdwp = NULL;

	WC_D(hdwp, BeginDeferWindowPos(1));

	if (hdwp)
	{
		int iHeight = GetStatusHeight();
		int iNewCY = cy - iHeight;
		RECT rcStatus = { 0 };
		::GetClientRect(m_hWnd, &rcStatus);
		if (rcStatus.bottom - rcStatus.top > iHeight)
		{
			rcStatus.top = rcStatus.bottom - iHeight;
		}
		// Tell the status bar it needs repainting
		::InvalidateRect(m_hWnd, &rcStatus, false);

		if (m_lpFakeSplitter && m_lpFakeSplitter->m_hWnd)
		{
			DeferWindowPos(hdwp, m_lpFakeSplitter->m_hWnd, NULL, 0, 0, cx, iNewCY, SWP_NOZORDER);
		}

		WC_B(EndDeferWindowPos(hdwp));
	}
} // CBaseDialog::OnSize
Exemple #29
0
HDWP MyResizeWindow(HDWP hDwp, HWND hwndDlg, HWND hwndControl,
	int nHorizontalOffset, int nVerticalOffset,
	int nWidthOffset, int nHeightOffset)
{
	POINT pt;
	RECT rcinit;

	if (NULL == hwndDlg) /* Wine fix. */
		return hDwp;
	// get current bounding rectangle
	GetWindowRect(hwndControl, &rcinit);

	// get current top left point
	pt.x = rcinit.left;
	pt.y = rcinit.top;
	ScreenToClient(hwndDlg, &pt);

	// resize control
	return DeferWindowPos(hDwp, hwndControl, NULL,
		pt.x + nHorizontalOffset,
		pt.y + nVerticalOffset,
		rcinit.right - rcinit.left + nWidthOffset,
		rcinit.bottom - rcinit.top + nHeightOffset,
		SWP_NOZORDER);


}
void CDialogResizeHelper::OnSize(UINT, CSize newSize)
{
	if (m_thisWnd != NULL) {
		HDWP hWinPosInfo = BeginDeferWindowPos( m_table.get_size() + (m_sizeGrip != NULL ? 1 : 0) );
		for(t_size n = 0; n < m_table.get_size(); ++n) {
			CRect rcOrig;
			const Param & e = m_table[n];
			CWindow wndItem = m_thisWnd.GetDlgItem(e.id);
			if (m_origRects.query(e.id, rcOrig) && wndItem != NULL) {
				int dest_x = rcOrig.left, dest_y = rcOrig.top, 
					dest_cx = rcOrig.Width(), dest_cy = rcOrig.Height();

				int delta_x = newSize.cx - m_rcOrigClient.right,
					delta_y = newSize.cy - m_rcOrigClient.bottom;

				dest_x += pfc::rint32( e.snapLeft * delta_x );
				dest_cx += pfc::rint32( (e.snapRight - e.snapLeft) * delta_x );
				dest_y += pfc::rint32( e.snapTop * delta_y );
				dest_cy += pfc::rint32( (e.snapBottom - e.snapTop) * delta_y );
				
				DeferWindowPos(hWinPosInfo, wndItem, 0,dest_x,dest_y,dest_cx,dest_cy,SWP_NOZORDER);
			}
		}
		if (m_sizeGrip != NULL)
		{
			RECT rc, rc_grip;
			if (m_thisWnd.GetClientRect(&rc) && m_sizeGrip.GetWindowRect(&rc_grip)) {
				DeferWindowPos(hWinPosInfo, m_sizeGrip, NULL, rc.right - (rc_grip.right - rc_grip.left), rc.bottom - (rc_grip.bottom - rc_grip.top), 0, 0, SWP_NOZORDER | SWP_NOSIZE);
			}
		}
		EndDeferWindowPos(hWinPosInfo);
	}
	SetMsgHandled(FALSE);
}