OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fwl/cfwl_datetimepicker.h" | 7 #include "xfa/fwl/cfwl_datetimepicker.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 } | 198 } |
199 | 199 |
200 void CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, | 200 void CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, |
201 uint32_t dwStylesExRemoved) { | 201 uint32_t dwStylesExRemoved) { |
202 m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 202 m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
203 } | 203 } |
204 | 204 |
205 void CFWL_DateTimePicker::DrawDropDownButton(CFX_Graphics* pGraphics, | 205 void CFWL_DateTimePicker::DrawDropDownButton(CFX_Graphics* pGraphics, |
206 IFWL_ThemeProvider* pTheme, | 206 IFWL_ThemeProvider* pTheme, |
207 const CFX_Matrix* pMatrix) { | 207 const CFX_Matrix* pMatrix) { |
208 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_Spin) == | |
209 FWL_STYLEEXT_DTP_Spin) { | |
210 return; | |
211 } | |
212 | |
213 CFWL_ThemeBackground param; | 208 CFWL_ThemeBackground param; |
214 param.m_pWidget = this; | 209 param.m_pWidget = this; |
215 param.m_iPart = CFWL_Part::DropDownButton; | 210 param.m_iPart = CFWL_Part::DropDownButton; |
216 param.m_dwStates = m_iBtnState; | 211 param.m_dwStates = m_iBtnState; |
217 param.m_pGraphics = pGraphics; | 212 param.m_pGraphics = pGraphics; |
218 param.m_rtPart = m_rtBtn; | 213 param.m_rtPart = m_rtBtn; |
219 if (pMatrix) | 214 if (pMatrix) |
220 param.m_matrix.Concat(*pMatrix); | 215 param.m_matrix.Concat(*pMatrix); |
221 pTheme->DrawBackground(¶m); | 216 pTheme->DrawBackground(¶m); |
222 } | 217 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 dwAdd |= FWL_STYLEEXT_EDT_VFar; | 296 dwAdd |= FWL_STYLEEXT_EDT_VFar; |
302 break; | 297 break; |
303 } | 298 } |
304 default: { | 299 default: { |
305 dwAdd |= FWL_STYLEEXT_EDT_VNear; | 300 dwAdd |= FWL_STYLEEXT_EDT_VNear; |
306 break; | 301 break; |
307 } | 302 } |
308 } | 303 } |
309 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_EditJustified) | 304 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_EditJustified) |
310 dwAdd |= FWL_STYLEEXT_EDT_Justified; | 305 dwAdd |= FWL_STYLEEXT_EDT_Justified; |
311 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_EditDistributed) | |
312 dwAdd |= FWL_STYLEEXT_EDT_Distributed; | |
313 | 306 |
314 m_pEdit->ModifyStylesEx(dwAdd, FWL_STYLEEXT_EDT_HAlignMask | | 307 m_pEdit->ModifyStylesEx(dwAdd, FWL_STYLEEXT_EDT_HAlignMask | |
315 FWL_STYLEEXT_EDT_HAlignModeMask | | 308 FWL_STYLEEXT_EDT_HAlignModeMask | |
316 FWL_STYLEEXT_EDT_VAlignMask); | 309 FWL_STYLEEXT_EDT_VAlignMask); |
317 } | 310 } |
318 | 311 |
319 void CFWL_DateTimePicker::ProcessSelChanged(int32_t iYear, | 312 void CFWL_DateTimePicker::ProcessSelChanged(int32_t iYear, |
320 int32_t iMonth, | 313 int32_t iMonth, |
321 int32_t iDay) { | 314 int32_t iDay) { |
322 m_iYear = iYear; | 315 m_iYear = iYear; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 return; | 553 return; |
561 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) | 554 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) |
562 SetFocus(true); | 555 SetFocus(true); |
563 if (!m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) | 556 if (!m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) |
564 return; | 557 return; |
565 | 558 |
566 if (IsMonthCalendarVisible()) { | 559 if (IsMonthCalendarVisible()) { |
567 ShowMonthCalendar(false); | 560 ShowMonthCalendar(false); |
568 return; | 561 return; |
569 } | 562 } |
570 if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_TimeFormat)) | 563 ShowMonthCalendar(true); |
571 ShowMonthCalendar(true); | |
572 | 564 |
573 m_bLBtnDown = true; | 565 m_bLBtnDown = true; |
574 RepaintRect(m_rtClient); | 566 RepaintRect(m_rtClient); |
575 } | 567 } |
576 | 568 |
577 void CFWL_DateTimePicker::OnLButtonUp(CFWL_MessageMouse* pMsg) { | 569 void CFWL_DateTimePicker::OnLButtonUp(CFWL_MessageMouse* pMsg) { |
578 if (!pMsg) | 570 if (!pMsg) |
579 return; | 571 return; |
580 | 572 |
581 m_bLBtnDown = false; | 573 m_bLBtnDown = false; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 if (DisForm_IsMonthCalendarVisible()) | 609 if (DisForm_IsMonthCalendarVisible()) |
618 ShowMonthCalendar(false); | 610 ShowMonthCalendar(false); |
619 if (m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { | 611 if (m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { |
620 pMsg->m_pSrcTarget = m_pEdit.get(); | 612 pMsg->m_pSrcTarget = m_pEdit.get(); |
621 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); | 613 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); |
622 } | 614 } |
623 } | 615 } |
624 rtInvalidate.Inflate(2, 2); | 616 rtInvalidate.Inflate(2, 2); |
625 RepaintRect(rtInvalidate); | 617 RepaintRect(rtInvalidate); |
626 } | 618 } |
OLD | NEW |