void CFWL_DateTimePickerImp::ShowMonthCalendar(FX_BOOL bActivate) {
  if (m_pWidgetMgr->IsFormDisabled()) {
    return DisForm_ShowMonthCalendar(bActivate);
  }
  if (IsMonthCalendarShowed() == bActivate) {
    return;
  }
  if (!m_pForm) {
    InitProxyForm();
  }
  if (bActivate) {
    CFX_RectF rtMonth;
    m_pMonthCal->GetWidgetRect(rtMonth);
    CFX_RectF rtAnchor;
    rtAnchor.Set(0, 0, m_pProperties->m_rtWidget.width,
                 m_pProperties->m_rtWidget.height);
    GetPopupPos(0, rtMonth.height, rtAnchor, rtMonth);
    m_pForm->SetWidgetRect(rtMonth);
    rtMonth.left = rtMonth.top = 0;
    m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible, !bActivate);
    m_pMonthCal->SetWidgetRect(rtMonth);
    m_pMonthCal->Update();
    m_pForm->DoModal();
  } else {
    m_pForm->EndDoModal();
  }
}
示例#2
0
void CXTPPopupControl::OnExpanding(BOOL bUpdateCurrent)
{
	//set Expanding state
	SetPopupState(xtpPopupStateExpanding);

	CPoint ptPopup = GetPopupPos();

	//reinit target rect
	m_stateTarget.rcPopup = CRect(CPoint(ptPopup.x - m_szPopup.cx, ptPopup.y - m_szPopup.cy), m_szPopup);
	m_stateTarget.nTransparency = m_nTransparency;

	//if updating flag is set
	if (bUpdateCurrent)
	{
		//reinit curent state object
		m_stateCurrent = m_stateTarget;

		//if no-animation mode
		if (m_popupAnimation == xtpPopupAnimationNone || m_uAnimationDelay <= 0)
		{
			//update view
			UpdateState(TRUE);
			//show popup
			OnShow();
			//return from proc
			return;
		}
		//if Fage animation mode
		else if (m_popupAnimation == xtpPopupAnimationFade)
		{
			//set target transparensy value
			m_stateCurrent.nTransparency = 0;
		}
		//if Slide animation mode
		if (m_popupAnimation == xtpPopupAnimationSlide)
		{
			//set rectangular of target
			m_stateCurrent.rcPopup = CRect(ptPopup.x - m_szPopup.cx, ptPopup.y, ptPopup.x, ptPopup.y);
		}
		//if Unfold animation mode
		else if (m_popupAnimation == xtpPopupAnimationUnfold)
		{
			//set rectangular of target
			m_stateCurrent.rcPopup = CRect(ptPopup, CSize(0));
		}
		//calc step
		m_nStep = max(1, m_uAnimationDelay/m_nAnimationInterval);
	}
	else
	{
		//calc step
		m_nStep = max(1, m_uAnimationDelay/m_nAnimationInterval - m_nStep);
	}

	//set expanding timer
	SetTimer(TID_EXPANDING, m_nAnimationInterval, NULL);

	//update view state
	UpdateState(TRUE);
}
示例#3
0
void CXTPPopupControl::OnCollapsing()
{
	//set COLLAPSING state
	SetPopupState(xtpPopupStateCollapsing);

	//if no-animation mode
	if (m_popupAnimation == xtpPopupAnimationNone || m_uAnimationDelay <= 0)
	{
		//close & destroy popup window
		Close();
		return;
	}
	//if Fage animation mode
	else if (m_popupAnimation == xtpPopupAnimationFade)
	{
		//set target transparensy value
		m_stateTarget.nTransparency = 0;
	}
	//if Slide animation mode
	else if (m_popupAnimation == xtpPopupAnimationSlide)
	{
		//set rectangular of target
		CPoint ptPopup = GetPopupPos();
		m_stateTarget.rcPopup = CRect(ptPopup.x - m_szPopup.cx, ptPopup.y, ptPopup.x, ptPopup.y);
	}
	//if Unfold animation mode
	else if (m_popupAnimation == xtpPopupAnimationUnfold)
	{
		//set rectangular of target
		CPoint ptPopup = GetPopupPos();
		m_stateTarget.rcPopup = CRect(ptPopup, CSize(0));
	}

	//calc step
	m_nStep = max(1, m_uAnimationDelay/m_nAnimationInterval);

	//set collapsing timer
	SetTimer(TID_COLLAPSING, m_nAnimationInterval, NULL);

	//update view state
	UpdateState(TRUE);
}
示例#4
0
void CXTPPopupControl::OnShow()
{
	//set SHOW state
	SetPopupState(xtpPopupStateShow);

	CPoint ptPopup = GetPopupPos();

	m_stateCurrent.rcPopup = CRect(CPoint(ptPopup.x - m_szPopup.cx, ptPopup.y - m_szPopup.cy), m_szPopup);
	m_stateCurrent.nTransparency = m_nTransparency;


	//start SHOW timer
	if (m_uShowDelay != (UINT)-1)
	{
		SetTimer(TID_SHOWDELAY, m_uShowDelay, NULL);
	}
}
void CFWL_DateTimePickerImp::DisForm_ShowMonthCalendar(FX_BOOL bActivate) {
  FX_BOOL bShowed = IsMonthCalendarShowed();
  if (bShowed == bActivate) {
    return;
  }
  if (bActivate) {
    CFX_RectF rtMonthCal;
    m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE);
    FX_FLOAT fPopupMin = rtMonthCal.height;
    FX_FLOAT fPopupMax = rtMonthCal.height;
    CFX_RectF rtAnchor(m_pProperties->m_rtWidget);
    rtAnchor.width = rtMonthCal.width;
    rtMonthCal.left = m_rtClient.left;
    rtMonthCal.top = rtAnchor.Height();
    GetPopupPos(fPopupMin, fPopupMax, rtAnchor, rtMonthCal);
    m_pMonthCal->SetWidgetRect(rtMonthCal);
    if (m_iYear > 0 && m_iMonth > 0 && m_iDay > 0) {
      m_pMonthCal->SetSelect(m_iYear, m_iMonth, m_iDay);
    }
    m_pMonthCal->Update();
  }
  m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible, !bActivate);
  if (bActivate) {
    CFWL_MsgSetFocus msg;
    msg.m_pDstTarget = m_pMonthCal.get();
    msg.m_pSrcTarget = m_pEdit.get();
    IFWL_WidgetDelegate* pDelegate = m_pEdit->SetDelegate(NULL);
    pDelegate->OnProcessMessage(&msg);
  }
  CFX_RectF rtInvalidate, rtCal;
  rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width,
                   m_pProperties->m_rtWidget.height);
  m_pMonthCal->GetWidgetRect(rtCal);
  rtInvalidate.Union(rtCal);
  rtInvalidate.Inflate(2, 2);
  Repaint(&rtInvalidate);
}