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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 } | 197 } |
198 | 198 |
199 void CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, | 199 void CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, |
200 uint32_t dwStylesExRemoved) { | 200 uint32_t dwStylesExRemoved) { |
201 m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 201 m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
202 } | 202 } |
203 | 203 |
204 void CFWL_DateTimePicker::DrawDropDownButton(CFX_Graphics* pGraphics, | 204 void CFWL_DateTimePicker::DrawDropDownButton(CFX_Graphics* pGraphics, |
205 IFWL_ThemeProvider* pTheme, | 205 IFWL_ThemeProvider* pTheme, |
206 const CFX_Matrix* pMatrix) { | 206 const CFX_Matrix* pMatrix) { |
207 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_Spin) == | |
208 FWL_STYLEEXT_DTP_Spin) { | |
209 return; | |
210 } | |
211 | |
212 CFWL_ThemeBackground param; | 207 CFWL_ThemeBackground param; |
213 param.m_pWidget = this; | 208 param.m_pWidget = this; |
214 param.m_iPart = CFWL_Part::DropDownButton; | 209 param.m_iPart = CFWL_Part::DropDownButton; |
215 param.m_dwStates = m_iBtnState; | 210 param.m_dwStates = m_iBtnState; |
216 param.m_pGraphics = pGraphics; | 211 param.m_pGraphics = pGraphics; |
217 param.m_rtPart = m_rtBtn; | 212 param.m_rtPart = m_rtBtn; |
218 if (pMatrix) | 213 if (pMatrix) |
219 param.m_matrix.Concat(*pMatrix); | 214 param.m_matrix.Concat(*pMatrix); |
220 pTheme->DrawBackground(¶m); | 215 pTheme->DrawBackground(¶m); |
221 } | 216 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 dwAdd |= FWL_STYLEEXT_EDT_VFar; | 295 dwAdd |= FWL_STYLEEXT_EDT_VFar; |
301 break; | 296 break; |
302 } | 297 } |
303 default: { | 298 default: { |
304 dwAdd |= FWL_STYLEEXT_EDT_VNear; | 299 dwAdd |= FWL_STYLEEXT_EDT_VNear; |
305 break; | 300 break; |
306 } | 301 } |
307 } | 302 } |
308 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_EditJustified) | 303 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_EditJustified) |
309 dwAdd |= FWL_STYLEEXT_EDT_Justified; | 304 dwAdd |= FWL_STYLEEXT_EDT_Justified; |
310 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_EditDistributed) | |
311 dwAdd |= FWL_STYLEEXT_EDT_Distributed; | |
312 | 305 |
313 m_pEdit->ModifyStylesEx(dwAdd, FWL_STYLEEXT_EDT_HAlignMask | | 306 m_pEdit->ModifyStylesEx(dwAdd, FWL_STYLEEXT_EDT_HAlignMask | |
314 FWL_STYLEEXT_EDT_HAlignModeMask | | 307 FWL_STYLEEXT_EDT_HAlignModeMask | |
315 FWL_STYLEEXT_EDT_VAlignMask); | 308 FWL_STYLEEXT_EDT_VAlignMask); |
316 } | 309 } |
317 | 310 |
318 void CFWL_DateTimePicker::ProcessSelChanged(int32_t iYear, | 311 void CFWL_DateTimePicker::ProcessSelChanged(int32_t iYear, |
319 int32_t iMonth, | 312 int32_t iMonth, |
320 int32_t iDay) { | 313 int32_t iDay) { |
321 m_iYear = iYear; | 314 m_iYear = iYear; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 return; | 552 return; |
560 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) | 553 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) |
561 SetFocus(true); | 554 SetFocus(true); |
562 if (!m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) | 555 if (!m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) |
563 return; | 556 return; |
564 | 557 |
565 if (IsMonthCalendarVisible()) { | 558 if (IsMonthCalendarVisible()) { |
566 ShowMonthCalendar(false); | 559 ShowMonthCalendar(false); |
567 return; | 560 return; |
568 } | 561 } |
569 if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_TimeFormat)) | 562 ShowMonthCalendar(true); |
570 ShowMonthCalendar(true); | |
571 | 563 |
572 m_bLBtnDown = true; | 564 m_bLBtnDown = true; |
573 RepaintRect(m_rtClient); | 565 RepaintRect(m_rtClient); |
574 } | 566 } |
575 | 567 |
576 void CFWL_DateTimePicker::OnLButtonUp(CFWL_MessageMouse* pMsg) { | 568 void CFWL_DateTimePicker::OnLButtonUp(CFWL_MessageMouse* pMsg) { |
577 if (!pMsg) | 569 if (!pMsg) |
578 return; | 570 return; |
579 | 571 |
580 m_bLBtnDown = false; | 572 m_bLBtnDown = false; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 if (DisForm_IsMonthCalendarVisible()) | 608 if (DisForm_IsMonthCalendarVisible()) |
617 ShowMonthCalendar(false); | 609 ShowMonthCalendar(false); |
618 if (m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { | 610 if (m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { |
619 pMsg->m_pSrcTarget = m_pEdit.get(); | 611 pMsg->m_pSrcTarget = m_pEdit.get(); |
620 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); | 612 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); |
621 } | 613 } |
622 } | 614 } |
623 rtInvalidate.Inflate(2, 2); | 615 rtInvalidate.Inflate(2, 2); |
624 RepaintRect(rtInvalidate); | 616 RepaintRect(rtInvalidate); |
625 } | 617 } |
OLD | NEW |