示例#1
0
void CRowListView::OnViewFullRowDetails()
{
	if ((GetViewType() != LVS_REPORT) || !GetFullRowSel())
	{
		SetFullRowSel(TRUE);
		if (GetViewType() != LVS_REPORT)
			SetViewType(LVS_REPORT);
	}
}
示例#2
0
void CRowListView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
	UINT uFlags = 0;
	int nHitItem = GetListCtrl().HitTest(point, &uFlags);

	if (uFlags & LVHT_ONITEM)
	{
		// double click works only if we don't have state icons,
		// or if we are in icon or small icon view
		if (!m_bStateIcons || GetViewType() == LVS_ICON ||
			GetViewType()==LVS_SMALLICON)
		{
			CheckItem(nHitItem);
		}
	}

	CListViewEx::OnLButtonDblClk(nFlags, point);
}
void CBioAPISampleMFCView::OnUpdateViewSmallIcons(CCmdUI* pCmdUI)
{
	pCmdUI->SetCheck(GetViewType() == LVS_SMALLICON);
}
void CBioAPISampleMFCView::OnViewFullRowDetails()
{
	if (GetViewType() != LVS_REPORT)
		SetViewType(LVS_REPORT);
}
void CBioAPISampleMFCView::OnViewList()
{
	if (GetViewType() != LVS_LIST)
		SetViewType(LVS_LIST);
}
void CBioAPISampleMFCView::OnViewLargeIcons()
{
	if (GetViewType() != LVS_ICON)
		SetViewType(LVS_ICON);
}
void CBioAPISampleMFCView::OnViewSmallIcons()
{
	if (GetViewType() != LVS_SMALLICON)
		SetViewType(LVS_SMALLICON);
}
示例#8
0
void CRowListView::OnViewSmallIcons()
{
	if (GetViewType() != LVS_SMALLICON)
		SetViewType(LVS_SMALLICON);
}
void CBioAPISampleMFCView::OnUpdateViewDetails(CCmdUI* pCmdUI)
{
	pCmdUI->SetCheck(GetViewType() == LVS_REPORT );
}
示例#10
0
void CRowListView::OnUpdateViewFullRowDetails(CCmdUI* pCmdUI)
{
	pCmdUI->SetCheck((GetViewType() == LVS_REPORT) && GetFullRowSel());
}
示例#11
0
void CRowListView::OnUpdateViewList(CCmdUI* pCmdUI)
{
	pCmdUI->SetCheck(GetViewType() == LVS_LIST);
}
示例#12
0
void CRowListView::OnUpdateViewLargeIcons(CCmdUI* pCmdUI)
{
	pCmdUI->SetCheck(GetViewType() == LVS_ICON);
}
示例#13
0
void CRowListView::OnUpdateViewSmallIcons(CCmdUI* pCmdUI)
{
	pCmdUI->SetCheck(GetViewType() == LVS_SMALLICON);
}
示例#14
0
void CRowListView::OnViewList()
{
	if (GetViewType() != LVS_LIST)
		SetViewType(LVS_LIST);
}
示例#15
0
void CRowListView::OnViewLargeIcons()
{
	if (GetViewType() != LVS_ICON)
		SetViewType(LVS_ICON);
}
void CBioAPISampleMFCView::OnUpdateViewLargeIcons(CCmdUI* pCmdUI)
{
	pCmdUI->SetCheck(GetViewType() == LVS_ICON);
}
void CBioAPISampleMFCView::OnUpdateViewList(CCmdUI* pCmdUI)
{
	pCmdUI->SetCheck(GetViewType() == LVS_LIST);
}
示例#18
0
void CRowListView::OnUpdateViewClientWidthSel(CCmdUI* pCmdUI)
{
	pCmdUI->SetCheck(m_bClientWidthSel);
	pCmdUI->Enable((GetViewType() == LVS_REPORT) && GetFullRowSel());
}
示例#19
0
bool ff::ViewWindow::UsesSharedTarget() const
{
	return GetViewType() == ViewType::DOCUMENT &&
		_mainWindow->GetDocumentViewTarget() != nullptr &&
		!_mainWindow->IsFullWindowTarget();
}
void CXTPCalendarController::OnEvent_DatePicker(XTP_NOTIFY_CODE Event, WPARAM wParam, LPARAM /*lParam*/)
{
    wParam;

    switch (Event)
    {
    case XTP_NC_DATEPICKERBEFOREGOMODAL:
        if (m_pDatePickerCtrl && m_pCalendarCtrl)
        {
            OnEvent_CalendarView(XTP_NC_CALENDARVIEWWASCHANGED, 0, 0);
        }
        break;
    case XTP_NC_DATEPICKERBUTTONCLICKED:
        DBG_TRACE_DP_NF(_T("OnEvent: DatePickerButtonClicked - ID = %u.     {CalendarController}. \n"), wParam);
        break;
    case XTP_NC_DATEPICKERMONTHCHANGED:
        m_DayInfoCache.UpActivePriority();
        break;
    case XTP_NC_DATEPICKERSELECTIONCHANGED:
        DBG_TRACE_DP_NF(_T("OnEvent: XTP_NC_DATEPICKERSELECTIONCHANGED.     {CalendarController}. \n"));
        if (m_pDatePickerCtrl && m_pCalendarCtrl && m_pCalendarCtrl->GetActiveView())
        {
            BOOL bFastMode = m_pCalendarCtrl->m_bSwitchToDayViewIfPickedSingleDay;
            BOOL bChanged = FALSE;

            COleDateTime dtFrom;
            COleDateTime dtTo;
            if (m_pDatePickerCtrl->GetSelRange(dtFrom, dtTo))
            {
                int nFirstDayOfWeekIndex = m_pDatePickerCtrl->GetFirstDayOfWeek();
                int nFirstDayOfWeek = dtFrom.GetDayOfWeek();
                BOOL bWeekStart = (nFirstDayOfWeekIndex == nFirstDayOfWeek);

                CXTPCalendarControl::CUpdateContext updateContext(m_pCalendarCtrl);

                int nSelRangeDays = CXTPCalendarUtils::GetTotalDays(dtTo - dtFrom) + 1;
                // count selected days
                int nSelDays = 0;
                COleDateTimeSpan spDay(1, 0, 0, 0);
                for (COleDateTime dtDay = dtFrom; dtDay <= dtTo; dtDay += spDay)
                {
                    if (m_pDatePickerCtrl->IsSelected(dtDay))
                        nSelDays++;
                }
                BOOL bDaysCont = (nSelRangeDays == nSelDays);
//LOGIC TO SELECT VIEW TYPE <<
                // Day view
                int eViewMode = XTP_SAFE_GET2(m_pCalendarCtrl, GetActiveView(), GetViewType(), xtpCalendarDayView);

                if (eViewMode == xtpCalendarTimeLineView)
                {
                    CXTPCalendarTimeLineView* pView = (CXTPCalendarTimeLineView* ) m_pCalendarCtrl->GetActiveView();
                    if (pView)
                    {
                        pView->SetStartViewDate(dtFrom);
                        if (nSelRangeDays == 1)
                            pView->SetTimeScaleID(xtpTSPID_Day);
                        else if (nSelRangeDays <= 5)
                            pView->SetTimeScaleID(xtpTSPID_WorkWeek);
                        else if (nSelRangeDays <= 7)
                            pView->SetTimeScaleID(xtpTSPID_Week);
                        else
                            pView->SetTimeScaleID(xtpTSPID_Month);
                    }

                    return;
                }

                if (nSelRangeDays <= nXTPMaxDayViewDays ||
                        !bDaysCont || !bWeekStart && nSelRangeDays <= 8)
                {
                    m_bAdjustingView = TRUE;

                    // to save WorkWeek view mode

                    //if (eViewMode != xtpCalendarWorkWeekView || nSelDays != 1)
                    if (bFastMode &&
                            ((eViewMode != xtpCalendarWorkWeekView)
                             && (eViewMode != xtpCalendarFullWeekView))
                            || nSelDays != 1)
                        eViewMode = xtpCalendarDayView;

                    if (eViewMode == xtpCalendarMonthView)
                    {
                        CXTPCalendarMonthView* pMonthView = DYNAMIC_DOWNCAST(CXTPCalendarMonthView, m_pCalendarCtrl->GetActiveView());
                        if (pMonthView)
                        {
                            pMonthView->SelectDay(dtFrom);
                            CXTPCalendarControl::CViewChangedContext viewChanged(m_pCalendarCtrl, xtpCalendarViewChangedLock);
                            COleDateTime dtBegin = dtFrom;
                            // Calculate weeks count
                            COleDateTime dtWeekFromBegin = pMonthView->GetGrid()->ShiftDateToCell_00(dtFrom);
                            COleDateTime dtWeekToEnd = pMonthView->GetGrid()->ShiftDateToCell_00(dtTo);
                            dtWeekToEnd += COleDateTimeSpan(7, 0, 0, 0);
                            int nSelectedWeeksRange = CXTPCalendarUtils::GetTotalDays(dtWeekToEnd - dtWeekFromBegin);

                            int nWeeks = nSelectedWeeksRange / 7;
                            nWeeks = max(XTP_CALENDAR_MONTHVIEW_SHOW_WEEKS_MIN, nWeeks);
                            nWeeks = min(XTP_CALENDAR_MONTHVIEW_SHOW_WEEKS_MAX, nWeeks);

                            pMonthView->GetGrid()->SetBeginDate(dtBegin);
                            pMonthView->GetGrid()->SetWeeksCount(nWeeks);

                            m_pCalendarCtrl->Populate();
                        }
                    }
                    else if ((eViewMode == xtpCalendarWorkWeekView)
                             || (eViewMode == xtpCalendarFullWeekView)
                             || (eViewMode == xtpCalendarWeekView))
                    {
                        CXTPCalendarDayView* pDayView = DYNAMIC_DOWNCAST(CXTPCalendarDayView, m_pCalendarCtrl->GetActiveView());
                        if (pDayView)
                        {
                            pDayView->UnselectAllEvents();

                            COleDateTime dtWWStart;
                            m_pCalendarCtrl->GetWorkDayStartTime(dtWWStart);
                            dtWWStart = CXTPCalendarUtils::UpdateDate(dtWWStart, dtFrom);

                            pDayView->SetSelection(dtWWStart, dtWWStart + pDayView->GetCellDuration());
                        }
                        else
                        {
                            CXTPCalendarWeekView* pWeekView = DYNAMIC_DOWNCAST(CXTPCalendarWeekView, m_pCalendarCtrl->GetActiveView());
                            if (pWeekView)
                            {
                                pWeekView->SelectDay(dtFrom);
                                pWeekView->SetBeginDate(dtFrom);
                                m_pCalendarCtrl->Populate();
                            }
                        }
                    }

                    //*** switch calendar view
                    m_pCalendarCtrl->SwitchActiveView((XTPCalendarViewType)eViewMode);
                    //***

                    CXTPCalendarDayView* pDayView = DYNAMIC_DOWNCAST(CXTPCalendarDayView, m_pCalendarCtrl->GetActiveView());

                    // DayView - set visible days
                    if (pDayView && eViewMode == xtpCalendarDayView)
                    {
                        COleDateTime dtSelStart, dtSelEnd;
                        BOOL bAllDay = FALSE;
                        BOOL bSel = pDayView->GetSelection(&dtSelStart, &dtSelEnd, &bAllDay);
                        if (bSel)
                        {
                            COleDateTimeSpan spSel = dtSelEnd - dtSelStart;
                            COleDateTimeSpan spSelMin = pDayView->GetCellDuration();
                            if (spSel < spSelMin)
                                bSel = FALSE;
                        }
                        if (!bSel)
                        {
                            m_pCalendarCtrl->GetWorkDayStartTime(dtSelStart);
                            dtSelEnd = dtSelStart + pDayView->GetCellDuration();
                            bAllDay = FALSE;
                        }
                        dtSelStart = CXTPCalendarUtils::UpdateDate(dtSelStart, dtFrom);
                        dtSelEnd = CXTPCalendarUtils::UpdateDate(dtSelEnd, dtFrom);

                        pDayView->ShowDay(dtFrom);

                        pDayView->SetSelection(dtSelStart, dtSelEnd, bAllDay);

                        // add other selected days to calendar view
                        for (COleDateTime dtDay(dtFrom + spDay); dtDay <= dtTo; dtDay += spDay)
                        {
                            if (m_pDatePickerCtrl->IsSelected(dtDay))
                                pDayView->AddDay(dtDay); // add it to Calendar View
                        }
                        m_pCalendarCtrl->Populate();
                    }
                    m_bAdjustingView = FALSE;

                    bChanged = TRUE;
                }
                // Week view
                else if (nSelRangeDays == 7 && bDaysCont)
                {
                    COleDateTime dtBegin = dtFrom;

                    m_bAdjustingView = TRUE;

                    if (m_pCalendarCtrl->m_bMultiColumnWeekMode)
                        m_pCalendarCtrl->SwitchActiveView(xtpCalendarFullWeekView);
                    else
                        m_pCalendarCtrl->SwitchActiveView(xtpCalendarWeekView);

                    CXTPCalendarWeekView* pWeekView = DYNAMIC_DOWNCAST(CXTPCalendarWeekView, m_pCalendarCtrl->GetActiveView());
                    if (pWeekView)
                    {
                        pWeekView->SetBeginDate(dtBegin);

                        m_pCalendarCtrl->Populate();
                    }
                    else if (m_pCalendarCtrl->m_bMultiColumnWeekMode)
                    {
                        CXTPCalendarDayView* pWeekDayView = DYNAMIC_DOWNCAST(CXTPCalendarDayView, m_pCalendarCtrl->GetActiveView());
                        if (pWeekDayView)
                        {
                            pWeekDayView->ShowDays(dtBegin, dtTo);

                            m_pCalendarCtrl->Populate();
                        }
                    }
                    m_bAdjustingView = FALSE;

                    bChanged = TRUE;
                }
                // Month view
                else
                {
                    ASSERT(nSelRangeDays == nSelDays && nSelRangeDays > 7);

                    m_bAdjustingView = TRUE;

                    m_pCalendarCtrl->SwitchActiveView(xtpCalendarMonthView);
                    CXTPCalendarMonthView* pMonthView = DYNAMIC_DOWNCAST(CXTPCalendarMonthView, m_pCalendarCtrl->GetActiveView());
                    if (pMonthView)
                    {
                        CXTPCalendarControl::CViewChangedContext viewChanged(m_pCalendarCtrl, xtpCalendarViewChangedLock);
                        COleDateTime dtBegin = dtFrom;
                        // Calculate weeks count
                        COleDateTime dtWeekFromBegin = pMonthView->GetGrid()->ShiftDateToCell_00(dtFrom);
                        COleDateTime dtWeekToEnd = pMonthView->GetGrid()->ShiftDateToCell_00(dtTo);
                        dtWeekToEnd += COleDateTimeSpan(7, 0, 0, 0);
                        int nSelectedWeeksRange = CXTPCalendarUtils::GetTotalDays(dtWeekToEnd - dtWeekFromBegin);

                        int nWeeks = nSelectedWeeksRange / 7;
                        nWeeks = max(XTP_CALENDAR_MONTHVIEW_SHOW_WEEKS_MIN, nWeeks);
                        nWeeks = min(XTP_CALENDAR_MONTHVIEW_SHOW_WEEKS_MAX, nWeeks);

                        pMonthView->GetGrid()->SetBeginDate(dtBegin);
                        pMonthView->GetGrid()->SetWeeksCount(nWeeks);

                        m_pCalendarCtrl->Populate();
                    }
                    m_bAdjustingView = FALSE;

                    bChanged = TRUE;
                }
//LOGIC TO SELECT VIEW TYPE <<
                if (bChanged)
                {
                    OnEvent_CalendarView(XTP_NC_CALENDARVIEWWASCHANGED, 0, XTP_CC_DONT_SCROLL_DP);

                    if (m_pDatePickerCtrl->IsModal())
                    {
                        m_pCalendarCtrl->Invalidate(FALSE);
                        m_pCalendarCtrl->RedrawControl();
                    }
                }
            }
        }
        break;
    default:
        ASSERT(FALSE);
    }
}