Exemple #1
0
// 获取Layout的实际位置
int CDuiLayout::GetLayoutPos(LayoutItemInfo* pLayoutInfo)
{
	if(pLayoutInfo == NULL)
	{
		return 0;
	}

	// 如果已经设置了实际的值,就用设置的值
	if(pLayoutInfo->nPos != -1)
	{
		return pLayoutInfo->nPos;
	}

	// 返回预置参数设置的值
	int nPos = 0;
	if(m_nLayoutType == LAYOUT_TYPE_HORIZONTAL)
	{
		nPos = PositionItem2Value(pLayoutInfo->pos, 0, m_rc.Height());
	}else
	if(m_nLayoutType == LAYOUT_TYPE_VERTICAL)
	{
		nPos = PositionItem2Value(pLayoutInfo->pos, 0, m_rc.Width());
	}

	return nPos;
}
// 设置位置信息(指定父对象位置)
BOOL CControlBase::SetPositionWithParent(CRect rectParent)
{
	if(m_strPos.IsEmpty())
	{
		return FALSE;
	}

	DUI_POSITION pos;

	pos.nCount = 0;
	LPCTSTR pszValue = m_strPos;
	while(pos.nCount < 4 && pszValue)
	{
		pszValue=ParsePosition(pszValue, pos.Item[pos.nCount++]);
	}

    if (2 == pos.nCount || 4 == pos.nCount)
    {
		if(4 == pos.nCount)
		{
			CRect rect;
			rect.left = PositionItem2Value(pos.Left, rectParent.left, rectParent.right);
			rect.top = PositionItem2Value(pos.Top, rectParent.top, rectParent.bottom);
			rect.right = PositionItem2Value(pos.Right, rectParent.left, rectParent.right);
			rect.bottom = PositionItem2Value(pos.Bottom, rectParent.top, rectParent.bottom);
			SetRect(rect);
		}else
		if(2 == pos.nCount)
		{
			CRect rect;
			rect.left = PositionItem2Value(pos.Left, rectParent.left, rectParent.right);
			rect.top = PositionItem2Value(pos.Top, rectParent.top, rectParent.bottom);
			if(m_nWidth != 0)
			{
				rect.right = rect.left + m_nWidth;
			}else
			{
				rect.right = PositionItem2Value(pos.Left, rectParent.left, rectParent.right);
			}
			if(m_nHeight != 0)
			{
				rect.bottom = rect.top + m_nHeight;
			}else
			{
				rect.bottom = PositionItem2Value(pos.Top, rectParent.top, rectParent.bottom);
			}
			SetRect(rect);
		}
    }else
	{
        pos.nCount = 0;
		return FALSE;
	}

	return TRUE;
}
Exemple #3
0
void RichEditBkImg::CalcPosition(POSITION_ITEM * pItemsPos, int nPosCount)
{
    if (nPosCount == 0 || !m_pObjectHost)
    {
        return;
    }

    CRect rcHost=m_pObjectHost->GetAdjustedRect();

    // left
    m_rcObj.left = PositionItem2Value(pItemsPos[PI_LEFT], rcHost.left, rcHost.right, TRUE);

    // top
    m_rcObj.top = PositionItem2Value(pItemsPos[PI_TOP], rcHost.top, rcHost.bottom, FALSE);

    // right
    if (pItemsPos[PI_RIGHT].pit == PIT_SIZE)
    {
        m_rcObj.right = m_rcObj.left + (LONG)pItemsPos[PI_RIGHT].nPos;
    }
    else
    {
        m_rcObj.right = PositionItem2Value(pItemsPos[PI_RIGHT], rcHost.left, rcHost.right, TRUE);
    }

    // bottom
    if (pItemsPos[PI_BOTTOM].pit == PIT_SIZE)
    {
        m_rcObj.bottom = m_rcObj.top + (LONG)pItemsPos[PI_BOTTOM].nPos;
    }
    else
    {
        m_rcObj.bottom = PositionItem2Value(pItemsPos[PI_BOTTOM], rcHost.top, rcHost.bottom, FALSE);
    }
    m_bDirty = FALSE;
}
Exemple #4
0
// 从XML设置位置信息属性
HRESULT CControlBase::OnAttributePosChange(const CStringA& strValue, BOOL bLoading)
{
    if (strValue.IsEmpty()) return E_FAIL;

	m_strPos = strValue;

	DUIDLG_POSITION dlgpos;

	dlgpos.nCount=0;
	LPCSTR pszValue=strValue;
	while(dlgpos.nCount<4 && pszValue)
	{
		pszValue=ParsePosition(pszValue,dlgpos.Item[dlgpos.nCount++]);
	}

    if (2 == dlgpos.nCount || 4 == dlgpos.nCount)
    {
		if(4 == dlgpos.nCount)
		{
			CRect rectParent = CRect(0,0,0,0);
			CDuiObject* pParent = GetParent();
			if(pParent)
			{
				rectParent = pParent->GetRect();
			}
			CRect rect;
			rect.left = PositionItem2Value(dlgpos.Left, rectParent.left, rectParent.right);
			rect.top = PositionItem2Value(dlgpos.Top, rectParent.top, rectParent.bottom);
			rect.right = PositionItem2Value(dlgpos.Right, rectParent.left, rectParent.right);
			rect.bottom = PositionItem2Value(dlgpos.Bottom, rectParent.top, rectParent.bottom);
			SetRect(rect);
		}
		else if(2 == dlgpos.nCount)
		{
			//m_uPositionType = (m_uPositionType & ~SizeX_Mask) | SizeX_FitContent;
			//m_uPositionType = (m_uPositionType & ~SizeY_Mask) | SizeY_FitContent;
			CRect rectParent = CRect(0,0,0,0);
			CDuiObject* pParent = GetParent();
			if(pParent)
			{
				rectParent = pParent->GetRect();
			}
			CRect rect;
			rect.left = PositionItem2Value(dlgpos.Left, rectParent.left, rectParent.right);
			rect.top = PositionItem2Value(dlgpos.Top, rectParent.top, rectParent.bottom);
			if(m_nWidth != 0)
			{
				rect.right = rect.left + m_nWidth;
			}else
			{
				rect.right = PositionItem2Value(dlgpos.Left, rectParent.left, rectParent.right);
			}
			if(m_nHeight != 0)
			{
				rect.bottom = rect.top + m_nHeight;
			}else
			{
				rect.bottom = PositionItem2Value(dlgpos.Top, rectParent.top, rectParent.bottom);
			}
			SetRect(rect);
		}
    }
    else
        dlgpos.nCount = 0;

    return bLoading?S_FALSE:S_OK;
}
// 消息处理
LRESULT CControlBase::OnMessage(UINT uID, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if(m_bTaskMsg)
	{
		// 如果设置了任务方式发消息的属性,则添加一个任务消息
		CString strControlName = GetName();
		CString strAction = GetAction();
		CDlgBase* pParentDlg = GetParentDialog();
		DuiSystem::Instance()->AddDuiActionTask(uID, uMsg, wParam, lParam, strControlName, strAction, pParentDlg);
		return 0;
	}

	if(m_strAction.Find(_T("dlg:")) == 0)	// 动作:打开一个对话框,有内存泄漏,改为通过DuiSystem创建和管理
	{
		if(uMsg == MSG_BUTTON_UP)	// 鼠标放开事件才处理
		{
			CString strXmlFile = m_strAction;
			strXmlFile.Delete(0, 4);
			DuiSystem::ShowDuiDialog(strXmlFile, GetParentDialog());
		}
	}else
	if(m_strAction.Find(_T("popup:")) == 0)	// 动作:打开一个Popup对话框
	{
		if(uMsg == MSG_BUTTON_UP)	// 鼠标放开事件才处理
		{
			/*UINT nIDTemplate = 0;
			CDlgBase* pParentDlg = GetParentDialog();
			if(pParentDlg != NULL)
			{
				nIDTemplate = pParentDlg->GetIDTemplate();
			}
			CDlgPopup* pPopup = new CDlgPopup;
			pPopup->SetParent(this);
			CString strXmlFile = m_strAction;
			strXmlFile.Delete(0, 6);
			pPopup->SetXmlFile(_T("xml:") +strXmlFile );
			CRect rc = pControlBase->GetRect();
			rc.OffsetRect(-95, rc.Height());
			ClientToScreen(&rc);
			pPopup->Create(this, rc, WM_SKIN);
			pPopup->ShowWindow(SW_SHOW);*/
		}
	}else
	if(m_strAction.Find(_T("menu:")) == 0)	// 动作:打开一个菜单
	{
		CDuiMenu *pDuiMenu = new CDuiMenu(DuiSystem::GetDefaultFont(), 12);	// 可以考虑改为通过DuiSystem创建和管理
		pDuiMenu->SetAutoClose(FALSE);
		pDuiMenu->SetParent(this);
		CPoint point;
		CRect rc = GetRect();
		// 计算菜单的显示位置
		if(m_posMenu.nCount >= 2)
		{
			// 使用设置的菜单位置
			int nMenuX = PositionItem2Value(m_posMenu.Left, rc.left, rc.right);
			int nMenuY = PositionItem2Value(m_posMenu.Top, rc.top, rc.bottom);
			point.SetPoint(nMenuX, nMenuY);
		}else
		{
			// 如果没有设置位置信息,则默认按照控件底部开始显示,水平方向中间对齐
			point.SetPoint(rc.left + rc.Width() / 2, rc.bottom);
		}
		CDlgBase* pParentDlg = GetParentDialog();
		if(pParentDlg != NULL)
		{
			pParentDlg->ClientToScreen(&point);
		}
		CString strXmlFile = m_strAction;
		strXmlFile.Delete(0, 5);
		if(pDuiMenu->LoadXmlFile(strXmlFile, pParentDlg, point, WM_DUI_MENU))
		{
			if(m_posMenu.nCount >= 4)
			{
				// 如果菜单pos有4个值,第三个值为负数表示菜单向左侧显示,第四个值为负数表示菜单向上显示
				CRect rcMenu;
				pDuiMenu->GetWindowRect(&rcMenu);
				int nOffsetX = 0;
				int nOffsetY = 0;
				if(m_posMenu.Right.bMinus)
				{
					nOffsetX = -rcMenu.Width();
				}
				if(m_posMenu.Bottom.bMinus)
				{
					nOffsetY = -rcMenu.Height();
				}
				rcMenu.OffsetRect(nOffsetX, nOffsetY);
				pDuiMenu->MoveWindow(rcMenu);
			}
			pDuiMenu->ShowWindow(SW_SHOW);
			pDuiMenu->SetAutoClose(TRUE);
		}
	}else
	if(m_strAction.Find(_T("link:")) == 0)	// 动作:打开一个页面链接
	{
		if(uMsg == MSG_BUTTON_UP)	// 鼠标放开事件才处理
		{
			CString strLink = m_strAction;
			strLink.Delete(0, 5);
			if(!strLink.IsEmpty())
			{
				ShellExecute(NULL, TEXT("open"), strLink, NULL,NULL,SW_NORMAL);
			}
		}
	}else
	if(m_strAction.Find(_T("run:")) == 0)	// 动作:执行一个进程
	{
		if(uMsg == MSG_BUTTON_UP)	// 鼠标放开事件才处理
		{
			CString strProcess = m_strAction;
			strProcess.Delete(0, 4);
			strProcess.MakeLower();
			if(!strProcess.IsEmpty())
			{
				strProcess.MakeLower();
				BOOL bForceAdmin = FALSE;
				if(strProcess.Find(_T("admin@")) == 0)
				{
					bForceAdmin = TRUE;
					strProcess.Delete(0, 6);
				}
				BOOL bWaitProcess = FALSE;
				if(strProcess.Find(_T("&")) == (strProcess.GetLength()-1))
				{
					bWaitProcess = TRUE;
					strProcess.Delete(strProcess.GetLength()-1, 1);
				}
				if(strProcess.Find(_T(".exe")) == -1)
				{
					strProcess = DuiSystem::Instance()->GetString(strProcess);
				}
				if(strProcess.Find(_T("{platpath}")) == 0)
				{
					strProcess.Delete(0, 10);
					strProcess = DuiSystem::GetExePath() + strProcess;
				}
				CString strCmdLine = _T("");
				int nPos = strProcess.Find(_T("|"));
				if(nPos != -1)
				{
					strCmdLine = strProcess;
					strCmdLine.Delete(0, nPos+1);
					strProcess = strProcess.Left(nPos);
				}
				DuiSystem::PathCanonicalize(strProcess);	// 路径标准化
				DuiSystem::ExecuteProcess(strProcess, strCmdLine, bForceAdmin, bWaitProcess);
			}
		}
	}else
	if(m_strAction.Find(ACTION_CLOSE_WINDOW) == 0)	// 动作:关闭指定的窗口
	{
		if(uMsg == MSG_BUTTON_UP)	// 鼠标放开事件才处理
		{
			CString strWndName = m_strAction;
			strWndName.Delete(0, 13);
			if(!strWndName.IsEmpty())
			{
				CDlgBase* pDlg = DuiSystem::Instance()->GetDuiDialog(strWndName);
				if(pDlg != NULL)
				{
					//pDlg->DoClose();
					pDlg->PostMessage(WM_QUIT, 0, 0);
				}
			}
		}
	}else
	{
		// 首先判断如果是几个默认按钮,则直接做相应的处理
		CDlgBase* pParentDlg = GetParentDialog();
		if(IsThisObject(BT_OK, NAME_BT_OK))
		{
			if((MSG_BUTTON_UP == uMsg) && (pParentDlg != NULL)) { pParentDlg->DoOK(); }
		}else
		if(IsThisObject(BT_CANCEL, NAME_BT_CANCEL))
		{
			if((MSG_BUTTON_UP == uMsg) && (pParentDlg != NULL)) { pParentDlg->DoCancel(); }
		}else
		if(IsThisObject(BT_YES, NAME_BT_YES))
		{
			if((MSG_BUTTON_UP == uMsg) && (pParentDlg != NULL)) { pParentDlg->DoYes(); }
		}else
		if(IsThisObject(BT_NO, NAME_BT_NO))
		{
			if((MSG_BUTTON_UP == uMsg) && (pParentDlg != NULL)) { pParentDlg->DoNo(); }
		}else
		{
			// 调用控件的DUI事件处理对象
			return CallDuiHandler(uMsg, wParam, lParam);
		}
	}

	return 0;
}
Exemple #6
0
// 刷新所有Tab页
void CDuiTabCtrl::RefreshItems()
{
	// 重新计算每个tab页的位置,并刷新界面
	int nXPos = m_rc.left + m_nTabLeftPading;
	int nYPos = m_rc.top;

	for(size_t i = 0; i < m_vecItemInfo.size(); i++)
	{
		TabItemInfo &itemInfoTemp = m_vecItemInfo.at(i);
		if(!itemInfoTemp.bVisible)
		{
			// 隐藏的tab页坐标设置为0
			itemInfoTemp.rc.SetRect(0,0,0,0);
			if(i < m_vecRcSeperator.size())
			{
				CRect &rc = m_vecRcSeperator.at(i);
				rc.SetRect(0,0,0,0);
			}			
			continue;
		}

		int nItemWidth = itemInfoTemp.rc.Width();
		int nItemHeight = itemInfoTemp.sizeImage.cy;

		if(m_nTabItemWidth == 0)
		{
			// 如果tabctrl没有设置每个tab页的宽度,则以第一个tab页的图片宽度为准
			m_nTabItemWidth = nItemWidth;
		}
		if(m_nTabCtrlHeight == 0)
		{
			// 如果tabctrl没有设置高度,则以第一个tab页的图片高度为准
			m_nTabCtrlHeight = nItemHeight;
		}

		itemInfoTemp.rc.SetRect(nXPos, nYPos, nXPos + m_nTabItemWidth, nYPos + m_nTabCtrlHeight);

		nXPos += m_nTabItemWidth;

		if(i < m_vecItemInfo.size() - 1 && m_pImageSeperator != NULL)
		{
			CRect &rc = m_vecRcSeperator.at(i);
			rc.SetRect(nXPos, nYPos, nXPos + m_sizeSeperator.cx, nYPos + m_sizeSeperator.cy);
			nXPos += m_sizeSeperator.cx;
		}

		// 设置Tab页签按钮的位置
		if(m_pImageTabBtn != NULL)
		{
			int nLeft = m_nTabLeftPading + (m_nTabItemWidth * i);
			int nTop = 3;

			// 计算Tab页签按钮的显示位置
			if(m_posTabBtn.nCount >= 2)
			{
				// 使用设置的Tab页签按钮位置
				int nTabBtnX = PositionItem2Value(m_posTabBtn.Left, 0, m_nTabItemWidth);
				int nTabBtnY = PositionItem2Value(m_posTabBtn.Top, 0, m_nTabCtrlHeight);
				nLeft += nTabBtnX;
				nTop += nTabBtnY;
			}else
			{
				// 如果没有设置位置信息,则设置默认的位置为靠tab页签右上角
				nLeft += (m_nTabItemWidth - m_sizeTabBtn.cx - 3);
				nTop += 3;
			}

			itemInfoTemp.rcButton.SetRect(nLeft, nTop, nLeft + m_sizeTabBtn.cx, nTop + m_sizeTabBtn.cy);
		}
	}

	// 如果删除了最后一个页面,需要重新计算当前页面的索引
	if(m_nDownItem >= (int)m_vecItemInfo.size())
	{
		m_nDownItem = -1;
		if(m_vecItemInfo.size() > 0)
		{
			for(size_t i = (int)m_vecItemInfo.size()-1; i >= 0; i--)
			{
				TabItemInfo &itemInfoTemp = m_vecItemInfo.at(i);
				if(itemInfoTemp.bVisible && !itemInfoTemp.bOutLink)
				{
					m_nDownItem = i;
					break;
				}
			}
		}
	}
	if(m_nHoverItem >= (int)m_vecItemInfo.size())
	{
		m_nHoverItem = -1;
	}

	// 刷新显示当前页
	for(size_t i = 0; i < m_vecItemInfo.size(); i++)
	{
		TabItemInfo &itemInfo = m_vecItemInfo.at(i);
		if(itemInfo.pControl != NULL)
		{
			if(i == m_nDownItem)
			{
				itemInfo.pControl->SetVisible(TRUE);
				SetWindowFocus();
			}else
			{
				itemInfo.pControl->SetVisible(FALSE);
			}
		}
	}

	UpdateControl(true);
}
Exemple #7
0
BOOL CDuiTabCtrl::InsertItem(int nItem, TabItemInfo &itemInfo)
{
	if(m_vecItemInfo.size() > 0)
	{
		CRect rc;
		m_vecRcSeperator.push_back(rc);
	}
	if(nItem <= -1 || nItem >= (int)m_vecItemInfo.size())
	{
		m_vecItemInfo.push_back(itemInfo);
	}
	else
	{
		m_vecItemInfo.insert(m_vecItemInfo.begin() + nItem, itemInfo);
	}

	int nXPos = m_rc.left + m_nTabLeftPading;
	int nYPos = m_rc.top;
	int nXTabBtnPos = m_nTabLeftPading;

	for(size_t i = 0; i < (int)m_vecItemInfo.size(); i++)
	{
		TabItemInfo &itemInfoTemp = m_vecItemInfo.at(i);
		int nItemWidth = itemInfoTemp.rc.Width();
		int nItemHeight = itemInfoTemp.sizeImage.cy;

		if(m_nTabItemWidth == 0)
		{
			// 如果tabctrl没有设置每个tab页的宽度,则以第一个tab页的图片宽度为准
			m_nTabItemWidth = nItemWidth;
		}
		if(m_nTabCtrlHeight == 0)
		{
			// 如果tabctrl没有设置高度,则以第一个tab页的图片高度为准
			m_nTabCtrlHeight = nItemHeight;
		}

		// 设置tab页签的位置
		itemInfoTemp.rc.SetRect(nXPos, nYPos, nXPos + m_nTabItemWidth, nYPos + m_nTabCtrlHeight);

		// 设置Tab页签按钮的位置
		if(m_pImageTabBtn != NULL)
		{
			int nLeft = nXTabBtnPos;
			int nTop = 3;

			// 计算Tab页签按钮的显示位置
			if(m_posTabBtn.nCount >= 2)
			{
				// 使用设置的Tab页签按钮位置
				int nTabBtnX = PositionItem2Value(m_posTabBtn.Left, 0, m_nTabItemWidth);
				int nTabBtnY = PositionItem2Value(m_posTabBtn.Top, 0, m_nTabCtrlHeight);
				nLeft += nTabBtnX;
				nTop += nTabBtnY;
			}else
			{
				// 如果没有设置位置信息,则设置默认的位置为靠tab页签右上角
				nLeft += (m_nTabItemWidth - m_sizeTabBtn.cx - 3);
				nTop += 3;
			}

			itemInfoTemp.rcButton.SetRect(nLeft, nTop, nLeft + m_sizeTabBtn.cx, nTop + m_sizeTabBtn.cy);
		}

		nXPos += m_nTabItemWidth;
		nXTabBtnPos += m_nTabItemWidth;

		if(i < m_vecItemInfo.size() - 1 && m_pImageSeperator != NULL)
		{
			CRect &rc = m_vecRcSeperator.at(i);
			rc.SetRect(nXPos, nYPos, nXPos + m_sizeSeperator.cx, nYPos + m_sizeSeperator.cy);
			nXPos += m_sizeSeperator.cx;
			nXTabBtnPos += m_sizeSeperator.cx;
		}

		itemInfoTemp.buttonState = enBSNormal;
		
		/*
		if(itemInfoTemp.pControl != NULL)
		{
			CRect rc = itemInfoTemp.pControl->GetRect();
			rc.top += itemInfoTemp.sizeImage.cy;
			itemInfoTemp.pControl->SetRect(rc);
			//itemInfoTemp.pControl->UpdateControl();
		}*/
	}

	// 调整tab页签的宽度
	SetItemWidth(m_nTabItemMaxWidth, m_nTabItemMinWidth);

	UpdateControl(true);
	return true;
}
Exemple #8
0
    int SwndLayoutBuilder::CalcPosition(SWindow *pWnd,const CRect & rcContainer,CRect & rcWindow, const SwndLayout * pSwndLayout/*=NULL*/)
    {
        int nRet=0;
        
        if(pSwndLayout == NULL) pSwndLayout = pWnd->GetLayout();

        if(pSwndLayout->nCount==4)
        {//指定了4个坐标
            if(IsWaitingPos(rcWindow.left))
                rcWindow.left=PositionItem2Value(pWnd,pSwndLayout->pos[PI_LEFT],rcContainer.left,rcContainer.right,TRUE);
            if(rcWindow.left==POS_WAIT) nRet++;

            if(IsWaitingPos(rcWindow.top))
                rcWindow.top=PositionItem2Value(pWnd,pSwndLayout->pos[PI_TOP],rcContainer.top,rcContainer.bottom,FALSE);
            if(rcWindow.top==POS_WAIT) nRet++;

            if(IsWaitingPos(rcWindow.right))
            {
                if(pSwndLayout->pos[PI_RIGHT].pit == PIT_SIZE)
                {
                    if(!IsWaitingPos(rcWindow.left))
                    {
                        if(pSwndLayout->pos[PI_RIGHT].cMinus == -1)
                        {
                            CSize szWnd=pWnd->GetDesiredSize(&rcContainer);
                            rcWindow.right = rcWindow.left + szWnd.cx;
                        }else
                        {
                            rcWindow.right = rcWindow.left + (int)pSwndLayout->pos[PI_RIGHT].nPos;
                        }
                    }
                }else
                {
                    rcWindow.right=PositionItem2Value(pWnd,pSwndLayout->pos[PI_RIGHT],rcContainer.left,rcContainer.right,TRUE);
                }
            }
            if(rcWindow.right==POS_WAIT) nRet++;

            if(IsWaitingPos(rcWindow.bottom ))
            {
                if(pSwndLayout->pos[PI_BOTTOM].pit == PIT_SIZE)
                {
                    if(!IsWaitingPos(rcWindow.top))
                    {
                        if(pSwndLayout->pos[PI_BOTTOM].cMinus  == -1)
                        {
                            CSize szWnd=pWnd->GetDesiredSize(&rcContainer);
                            rcWindow.bottom = rcWindow.top + szWnd.cy;
                        }else
                        {
                            rcWindow.bottom = rcWindow.top + (int)pSwndLayout->pos[PI_BOTTOM].nPos;
                        }
                    }
                }else
                {
                    rcWindow.bottom=PositionItem2Value(pWnd,pSwndLayout->pos[PI_BOTTOM],rcContainer.top,rcContainer.bottom,FALSE);
                }
            }
            if(rcWindow.bottom==POS_WAIT) nRet++;
        }else 
        {
            CPoint pt = pWnd->m_rcWindow.TopLeft();
            if(pSwndLayout->nCount==2)
            {//指定了两个坐标
                if(IsWaitingPos(pt.x)) pt.x=PositionItem2Value(pWnd,pSwndLayout->pos[PI_LEFT],rcContainer.left,rcContainer.right,TRUE);
                if(pt.x==POS_WAIT) nRet++;
                if(IsWaitingPos(pt.y)) pt.y=PositionItem2Value(pWnd,pSwndLayout->pos[PI_TOP],rcContainer.top,rcContainer.bottom,FALSE);
                if(pt.y==POS_WAIT) nRet++;
            }else //if(nCount==0)
            {
                if(IsWaitingPos(pt.x) && pSwndLayout->IsFitParent(PD_X))
                {
                    pt.x=rcContainer.left;
                }
                if(IsWaitingPos(pt.y) && pSwndLayout->IsFitParent(PD_Y))
                {
                    pt.y=rcContainer.top;
                }
                //自动排版
                SWindow *pSibling=GetRefSibling(pWnd,GSW_PREVSIBLING);
                if(!pSibling)
                {//没有兄弟窗口,从父窗口左上角开始
                    if(IsWaitingPos(pt.x)) pt.x=rcContainer.left;
                    if(IsWaitingPos(pt.y)) pt.y=rcContainer.top;
                }else
                {
                    CRect rcSib = pSibling->m_rcWindow;
                    if(IsWaitingPos(pt.x))
                    {
                        if(!IsWaitingPos(rcSib.right))
                        {
                            SWindow *pParent = pWnd->GetParent();
                            SASSERT(pParent);
                            pt.x=rcSib.right+pParent->m_style.m_bySepSpace;
                        }else
                        {
                            pt.x=POS_WAIT,nRet++;
                        }
                    }
                    if(IsWaitingPos(pt.y))
                    {
                        if(!IsWaitingPos(rcSib.top))
                        {
                            pt.y=rcSib.top;
                        }else
                        {
                            pt.y=POS_WAIT,nRet++;
                        }
                    }
                }
            }
            if(nRet==0)
                rcWindow=CRect(pt,CalcSize(pWnd,rcContainer,pSwndLayout));
            else 
                rcWindow.left=pt.x,rcWindow.top=pt.y;
        }

        if(nRet==0)
        {//没有坐标等待计算了
            rcWindow.NormalizeRect();
            //处理窗口的偏移(offset)属性
            CSize sz = rcWindow.Size();
            CPoint ptOffset;
            ptOffset.x = (LONG)(sz.cx * pSwndLayout->fOffsetX);
            ptOffset.y = (LONG)(sz.cy * pSwndLayout->fOffsetY);
            rcWindow.OffsetRect(ptOffset);
        }
        return nRet;
    }