void CXTPDatePickerItemMonth::ByFontAdjustLayout(CRect rcClient)
{
	CWindowDC dc(CWnd::GetDesktopWindow());
	CSize szDay(m_pControl->m_pPaintManager->CalcDayRect(&dc));
	CSize szHeader(m_pControl->m_pPaintManager->CalcMonthHeaderRect(&dc));
	CSize szWeekText(m_pControl->m_pPaintManager->CalcDayOfWeekRect(&dc));
	CSize szWeekNumber(m_pControl->m_pPaintManager->CalcWeekNumbersRect(&dc));

	m_rcMonth = rcClient;
	// calc header rect
	m_rcHeader = m_rcMonth;
	m_rcHeader.bottom = m_rcHeader.top + szHeader.cy;
	//m_rcHeader.right = m_rcHeader.left + szHeader.cx;

	// calc days of week rect
	m_rcDaysOfWeek = m_rcMonth;
	m_rcDaysOfWeek.top = m_rcHeader.bottom;
	//m_rcDaysOfWeek.bottom = m_rcDaysOfWeek.top + 18; // TODO: change to font height
	m_rcDaysOfWeek.bottom = m_rcDaysOfWeek.top + szWeekText.cy;

	// draw week numbers
	m_rcWeekNumbers = m_rcMonth;
	m_rcWeekNumbers.top = m_rcDaysOfWeek.bottom;
	//m_rcWeekNumbers.right = m_rcWeekNumbers.left + 18; // TODO: change to font width
	m_rcWeekNumbers.right = m_rcWeekNumbers.left + szWeekNumber.cx;

	// calc triangles rect
	m_rcLeftScroll = m_rcHeader;
	m_rcRightScroll = m_rcHeader;
	m_rcLeftScroll.right = m_rcHeader.left+ szWeekNumber.cx + 3;
	m_rcRightScroll.left = m_rcHeader.right - szWeekNumber.cx - 3;

	// calc days display params
	m_rcDaysArea = m_rcMonth;
	m_rcDaysArea.top = m_rcDaysOfWeek.bottom;
	m_rcDaysArea.left = m_rcWeekNumbers.right;
	m_rcDaysArea.right -= m_rcWeekNumbers.Width();

	CRect rcDay;
	int nIndex = 0;
	for (int nWeek = 0; nWeek < XTP_MAX_WEEKS; nWeek++)
	{
		for (int nDay = 0; nDay < XTP_WEEK_DAYS; nDay++)
		{
			CXTPDatePickerItemDay* pDay = GetDay(nIndex);
			nIndex++;

			rcDay.left = m_rcDaysArea.left + nDay * szDay.cx + 1;
			rcDay.top = m_rcDaysArea.top + nWeek * szDay.cy;
			rcDay.right = rcDay.left + szDay.cx ;
			rcDay.bottom = rcDay.top + szDay.cy;
			pDay->SetRect(rcDay);
		}
	}

}
Example #2
0
void CDxDatePickerMonth::AutoAdjustLayout(CRect rcClient)
{
    m_rcMonth = rcClient;
    // calc header rect
    m_rcHeader = m_rcMonth;
    m_rcHeader.left  += 2;
    m_rcHeader.right -= 2;
    m_rcHeader.bottom = m_rcHeader.top + 18; // TODO: change to font height

    // calc days of week rect
    m_rcDaysOfWeek = m_rcMonth;
    m_rcDaysOfWeek.top = m_rcHeader.bottom;
    m_rcDaysOfWeek.bottom = m_rcDaysOfWeek.top + 18; // TODO: change to font height

    // draw week numbers
    m_rcWeekNumbers = m_rcMonth;
    m_rcWeekNumbers.top = m_rcDaysOfWeek.bottom;
    m_rcWeekNumbers.right = m_rcWeekNumbers.left + 18; // TODO: change to font width

    // calc triangles rect
    m_rcLeftScroll = m_rcHeader;
    m_rcRightScroll = m_rcHeader;
    int nScrollWidth = min(m_rcWeekNumbers.Width(), m_rcHeader.Width() / 8);
    m_rcHeader.left += nScrollWidth;
    m_rcHeader.right -= nScrollWidth;
    m_rcLeftScroll.right = m_rcHeader.left;
    m_rcRightScroll.left = m_rcHeader.right;

    // calc days display params
    m_rcDaysArea = m_rcMonth;
    m_rcDaysArea.top = m_rcDaysOfWeek.bottom;
    m_rcDaysArea.left = m_rcWeekNumbers.right;
    m_rcDaysArea.right -= m_rcWeekNumbers.Width();

    // calc simple day rect sizes
    CSize szDay(m_rcDaysArea.Width() / XTP_WEEK_DAYS, m_rcDaysArea.Height() / XTP_MAX_WEEKS);

    // calc rects for all days
    CRect rcDay;
    int nIndex = 0;
    for (int nWeek = 0; nWeek < XTP_MAX_WEEKS; nWeek++)
    {
        for (int nDay = 0; nDay < XTP_WEEK_DAYS; nDay++)
        {
            CDxDatePickerDay* pDay = GetDay(nIndex);
            nIndex++;

            rcDay.left = m_rcDaysArea.left + nDay * szDay.cx + 1;
            rcDay.top = m_rcDaysArea.top + nWeek * szDay.cy;
            rcDay.right = rcDay.left + szDay.cx;
            rcDay.bottom = rcDay.top + szDay.cy;
            pDay->SetRect(rcDay);
        }
    }
}
Example #3
0
void SVResString::loadMonitorviewStrings(MAPNODE &objNode)
{
    string szDelAsk(""), szRefreshTime(""), szColRefresh(""), szEditTip(""), 
        szRefreshTip(""), szOperateTip(""), szMonitorTitle(""),
        szAdd(""), szListviewTip(""), szIconviewTip(""), szBackParent(""), 
        szBackParentTip(""), szDay(""), szHour(""), szMinute(""), szMonitorsDisable(""),
        szMonitorsEnable(""), szForver(""), szTemprary(""), 
        szEnableTip(""), szDisableTip(""), szDelSelTip(""), szNoMonitor(""), 
        szCopySelTip(""), szPastTip("");

    FindNodeValue(objNode, "IDS_Delete_Monitor_Confirm",    szDelAsk);              // 是否删除所选监测器
    FindNodeValue(objNode, "IDS_Refresh_Time",              szRefreshTime);         // 刷新时间
    FindNodeValue(objNode, "IDS_Refresh_Tip",               szColRefresh);          // 刷新
    FindNodeValue(objNode, "IDS_Monitor_Edit_Tip",          szEditTip);             // 编辑
    FindNodeValue(objNode, "IDS_Monitor_Refresh_Tip",       szRefreshTip);          // 刷新所选监测器
    FindNodeValue(objNode, "IDS_Disable_Enable_Tip",        szOperateTip);          // 禁用/启用
    FindNodeValue(objNode, "IDS_Monitor_List_Title",        szMonitorTitle);        // 监测器列表
    FindNodeValue(objNode, "IDS_Add_Monitor",               szAdd);                 // 添加监测器
    FindNodeValue(objNode, "IDS_List_View_Tip",             szListviewTip);         // 列表视图
    FindNodeValue(objNode, "IDS_Icon_View_Tip",             szIconviewTip);         // 图标视图
    FindNodeValue(objNode, "IDS_Operate_Back_Parent",       szBackParent);          // 返回上一级
    FindNodeValue(objNode, "IDS_Operate_Back_Parent_Tip",   szBackParentTip);       // 返回上一级组
    FindNodeValue(objNode, "IDS_Day",                       szDay);                 // 天
    FindNodeValue(objNode, "IDS_Hour",                      szHour);                // 小时
    FindNodeValue(objNode, "IDS_Minute",                    szMinute);              // 分钟
    FindNodeValue(objNode, "IDS_Monitor_Can_not_Disable",   szMonitorsDisable);     // 所选监测器已全部禁用不能再次禁用
    FindNodeValue(objNode, "IDS_Monitor_Can_not_Enable",    szMonitorsEnable);      // 所选监测器已全部启用不能再次启用
    FindNodeValue(objNode, "IDS_Monitor_Disable_Forver",    szForver);              // 监测器被永久禁止
    FindNodeValue(objNode, "IDS_Monitor_Disable_Temprary",  szTemprary);            // 监测器被临时禁止
    FindNodeValue(objNode, "IDS_Enable_Monitor_Tip",        szEnableTip);           // 启用所有选择的监测器
    FindNodeValue(objNode, "IDS_Disable_Monitor_Tip",       szDisableTip);          // 禁止所有选择的监测器
    FindNodeValue(objNode, "IDS_Delete_Select_Monitor_Tip", szDelSelTip);           // 是否删除所有选择的监测器
    FindNodeValue(objNode, "IDS_MONITOR_LIST_IS_NULL",      szNoMonitor);           // 监测器列表为空
    FindNodeValue(objNode, "IDS_Copy",                      szCopySelTip);          // 拷贝
    FindNodeValue(objNode, "IDS_Past",                      szPastTip);             // 粘贴
    
    m_lsResource["IDS_Delete_Monitor_Confirm"] = szDelAsk;
    m_lsResource["IDS_Refresh_Time"] = szRefreshTime;
    m_lsResource["IDS_Refresh_Tip"] = szColRefresh;
    m_lsResource["IDS_Monitor_Edit_Tip"] = szEditTip;
    m_lsResource["IDS_Monitor_Refresh_Tip"] = szRefreshTip;
    m_lsResource["IDS_Disable_Enable_Tip"] = szOperateTip;
    m_lsResource["IDS_Monitor_List_Title"] = szMonitorTitle;
    m_lsResource["IDS_Add_Monitor"] = szAdd;
    m_lsResource["IDS_List_View_Tip"] = szListviewTip;
    m_lsResource["IDS_Icon_View_Tip"] = szIconviewTip;
    m_lsResource["IDS_Operate_Back_Parent"] = szBackParent;
    m_lsResource["IDS_Operate_Back_Parent_Tip"] = szBackParentTip;
    m_lsResource["IDS_Day"] = szDay;
    m_lsResource["IDS_Hour"] = szHour;
    m_lsResource["IDS_Minute"] = szMinute;
    m_lsResource["IDS_Monitor_Can_not_Disable"] = szMonitorsDisable;
    m_lsResource["IDS_Monitor_Can_not_Enable"] = szMonitorsEnable;
    m_lsResource["IDS_Monitor_Disable_Forver"] = szForver;
    m_lsResource["IDS_Monitor_Disable_Temprary"] = szTemprary;
    m_lsResource["IDS_Enable_Monitor_Tip"] = szEnableTip;
    m_lsResource["IDS_Disable_Monitor_Tip"] = szDisableTip;
    m_lsResource["IDS_Delete_Select_Monitor_Tip"] = szDelSelTip;
    m_lsResource["IDS_MONITOR_LIST_IS_NULL"] = szNoMonitor;
    m_lsResource["IDS_Copy"] = szCopySelTip;
    m_lsResource["IDS_Past"] = szPastTip;
}