| 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/basewidget/fwl_datetimepickerimp.h" | 7 #include "xfa/fwl/basewidget/fwl_datetimepickerimp.h" |
| 8 | 8 |
| 9 #include "xfa/fwl/basewidget/fwl_editimp.h" | 9 #include "xfa/fwl/basewidget/fwl_editimp.h" |
| 10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" | 10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 int32_t IFWL_DateTimePicker::CountSelRanges() { | 76 int32_t IFWL_DateTimePicker::CountSelRanges() { |
| 77 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) | 77 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) |
| 78 ->GetDataTimeEdit() | 78 ->GetDataTimeEdit() |
| 79 ->CountSelRanges(); | 79 ->CountSelRanges(); |
| 80 } | 80 } |
| 81 int32_t IFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) { | 81 int32_t IFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) { |
| 82 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) | 82 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) |
| 83 ->GetDataTimeEdit() | 83 ->GetDataTimeEdit() |
| 84 ->GetSelRange(nIndex, nStart); | 84 ->GetSelRange(nIndex, nStart); |
| 85 } | 85 } |
| 86 FWL_ERR IFWL_DateTimePicker::GetCurSel(int32_t& iYear, | 86 FWL_Error IFWL_DateTimePicker::GetCurSel(int32_t& iYear, |
| 87 int32_t& iMonth, | 87 int32_t& iMonth, |
| 88 int32_t& iDay) { | 88 int32_t& iDay) { |
| 89 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) | 89 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) |
| 90 ->GetCurSel(iYear, iMonth, iDay); | 90 ->GetCurSel(iYear, iMonth, iDay); |
| 91 } | 91 } |
| 92 FWL_ERR IFWL_DateTimePicker::SetCurSel(int32_t iYear, | 92 FWL_Error IFWL_DateTimePicker::SetCurSel(int32_t iYear, |
| 93 int32_t iMonth, | 93 int32_t iMonth, |
| 94 int32_t iDay) { | 94 int32_t iDay) { |
| 95 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) | 95 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) |
| 96 ->SetCurSel(iYear, iMonth, iDay); | 96 ->SetCurSel(iYear, iMonth, iDay); |
| 97 } | 97 } |
| 98 FWL_ERR IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { | 98 FWL_Error IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { |
| 99 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->SetEditText(wsText); | 99 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->SetEditText(wsText); |
| 100 } | 100 } |
| 101 FWL_ERR IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText, | 101 FWL_Error IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText, |
| 102 int32_t nStart, | 102 int32_t nStart, |
| 103 int32_t nCount) const { | 103 int32_t nCount) const { |
| 104 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) | 104 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) |
| 105 ->GetEditText(wsText, nStart, nCount); | 105 ->GetEditText(wsText, nStart, nCount); |
| 106 } | 106 } |
| 107 FX_BOOL IFWL_DateTimePicker::CanUndo() { | 107 FX_BOOL IFWL_DateTimePicker::CanUndo() { |
| 108 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->CanUndo(); | 108 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->CanUndo(); |
| 109 } | 109 } |
| 110 FX_BOOL IFWL_DateTimePicker::CanRedo() { | 110 FX_BOOL IFWL_DateTimePicker::CanRedo() { |
| 111 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->CanRedo(); | 111 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->CanRedo(); |
| 112 } | 112 } |
| 113 FX_BOOL IFWL_DateTimePicker::Undo() { | 113 FX_BOOL IFWL_DateTimePicker::Undo() { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 136 } | 136 } |
| 137 FX_BOOL IFWL_DateTimePicker::SelectAll() { | 137 FX_BOOL IFWL_DateTimePicker::SelectAll() { |
| 138 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->SelectAll(); | 138 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->SelectAll(); |
| 139 } | 139 } |
| 140 FX_BOOL IFWL_DateTimePicker::Delete() { | 140 FX_BOOL IFWL_DateTimePicker::Delete() { |
| 141 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->Delete(); | 141 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->Delete(); |
| 142 } | 142 } |
| 143 FX_BOOL IFWL_DateTimePicker::DeSelect() { | 143 FX_BOOL IFWL_DateTimePicker::DeSelect() { |
| 144 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->DeSelect(); | 144 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->DeSelect(); |
| 145 } | 145 } |
| 146 FWL_ERR IFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { | 146 FWL_Error IFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { |
| 147 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->GetBBox(rect); | 147 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->GetBBox(rect); |
| 148 } | 148 } |
| 149 FWL_ERR IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { | 149 FWL_Error IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { |
| 150 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->SetEditLimit(nLimit); | 150 return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->SetEditLimit(nLimit); |
| 151 } | 151 } |
| 152 FWL_ERR IFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, | 152 FWL_Error IFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, |
| 153 uint32_t dwStylesExRemoved) { | 153 uint32_t dwStylesExRemoved) { |
| 154 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) | 154 return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) |
| 155 ->ModifyEditStylesEx(dwStylesExAdded, dwStylesExRemoved); | 155 ->ModifyEditStylesEx(dwStylesExAdded, dwStylesExRemoved); |
| 156 } | 156 } |
| 157 CFWL_DateTimeEdit::CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties, | 157 CFWL_DateTimeEdit::CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties, |
| 158 IFWL_Widget* pOuter) | 158 IFWL_Widget* pOuter) |
| 159 : CFWL_EditImp(properties, pOuter) {} | 159 : CFWL_EditImp(properties, pOuter) {} |
| 160 FWL_ERR CFWL_DateTimeEdit::Initialize() { | 160 FWL_Error CFWL_DateTimeEdit::Initialize() { |
| 161 m_pDelegate = new CFWL_DateTimeEditImpDelegate(this); | 161 m_pDelegate = new CFWL_DateTimeEditImpDelegate(this); |
| 162 if (CFWL_EditImp::Initialize() != FWL_ERR_Succeeded) | 162 if (CFWL_EditImp::Initialize() != FWL_Error::Succeeded) |
| 163 return FWL_ERR_Indefinite; | 163 return FWL_Error::Indefinite; |
| 164 return FWL_ERR_Succeeded; | 164 return FWL_Error::Succeeded; |
| 165 } | 165 } |
| 166 FWL_ERR CFWL_DateTimeEdit::Finalize() { | 166 FWL_Error CFWL_DateTimeEdit::Finalize() { |
| 167 delete m_pDelegate; | 167 delete m_pDelegate; |
| 168 m_pDelegate = nullptr; | 168 m_pDelegate = nullptr; |
| 169 return CFWL_EditImp::Finalize(); | 169 return CFWL_EditImp::Finalize(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate( | 172 CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate( |
| 173 CFWL_DateTimeEdit* pOwner) | 173 CFWL_DateTimeEdit* pOwner) |
| 174 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} | 174 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} |
| 175 | 175 |
| 176 int32_t CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 176 int32_t CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 return CFWL_EditImpDelegate::OnProcessMessage(pMessage); | 212 return CFWL_EditImpDelegate::OnProcessMessage(pMessage); |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 return CFWL_EditImpDelegate::OnProcessMessage(pMessage); | 215 return CFWL_EditImpDelegate::OnProcessMessage(pMessage); |
| 216 } | 216 } |
| 217 | 217 |
| 218 CFWL_DateTimeCalendar::CFWL_DateTimeCalendar( | 218 CFWL_DateTimeCalendar::CFWL_DateTimeCalendar( |
| 219 const CFWL_WidgetImpProperties& properties, | 219 const CFWL_WidgetImpProperties& properties, |
| 220 IFWL_Widget* pOuter) | 220 IFWL_Widget* pOuter) |
| 221 : CFWL_MonthCalendarImp(properties, pOuter) {} | 221 : CFWL_MonthCalendarImp(properties, pOuter) {} |
| 222 FWL_ERR CFWL_DateTimeCalendar::Initialize() { | 222 FWL_Error CFWL_DateTimeCalendar::Initialize() { |
| 223 if (CFWL_MonthCalendarImp::Initialize() != FWL_ERR_Succeeded) | 223 if (CFWL_MonthCalendarImp::Initialize() != FWL_Error::Succeeded) |
| 224 return FWL_ERR_Indefinite; | 224 return FWL_Error::Indefinite; |
| 225 delete m_pDelegate; | 225 delete m_pDelegate; |
| 226 m_pDelegate = new CFWL_DateTimeCalendarImpDelegate(this); | 226 m_pDelegate = new CFWL_DateTimeCalendarImpDelegate(this); |
| 227 return FWL_ERR_Succeeded; | 227 return FWL_Error::Succeeded; |
| 228 } | 228 } |
| 229 FWL_ERR CFWL_DateTimeCalendar::Finalize() { | 229 FWL_Error CFWL_DateTimeCalendar::Finalize() { |
| 230 delete m_pDelegate; | 230 delete m_pDelegate; |
| 231 m_pDelegate = nullptr; | 231 m_pDelegate = nullptr; |
| 232 return CFWL_MonthCalendarImp::Finalize(); | 232 return CFWL_MonthCalendarImp::Finalize(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 CFWL_DateTimeCalendarImpDelegate::CFWL_DateTimeCalendarImpDelegate( | 235 CFWL_DateTimeCalendarImpDelegate::CFWL_DateTimeCalendarImpDelegate( |
| 236 CFWL_DateTimeCalendar* pOwner) | 236 CFWL_DateTimeCalendar* pOwner) |
| 237 : CFWL_MonthCalendarImpDelegate(pOwner), m_pOwner(pOwner) { | 237 : CFWL_MonthCalendarImpDelegate(pOwner), m_pOwner(pOwner) { |
| 238 m_bFlag = FALSE; | 238 m_bFlag = FALSE; |
| 239 } | 239 } |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 m_iYear(-1), | 430 m_iYear(-1), |
| 431 m_iMonth(-1), | 431 m_iMonth(-1), |
| 432 m_iDay(-1), | 432 m_iDay(-1), |
| 433 m_bLBtnDown(FALSE), | 433 m_bLBtnDown(FALSE), |
| 434 m_pEdit(nullptr), | 434 m_pEdit(nullptr), |
| 435 m_pMonthCal(nullptr), | 435 m_pMonthCal(nullptr), |
| 436 m_pForm(nullptr) { | 436 m_pForm(nullptr) { |
| 437 m_rtBtn.Set(0, 0, 0, 0); | 437 m_rtBtn.Set(0, 0, 0, 0); |
| 438 } | 438 } |
| 439 CFWL_DateTimePickerImp::~CFWL_DateTimePickerImp() {} | 439 CFWL_DateTimePickerImp::~CFWL_DateTimePickerImp() {} |
| 440 FWL_ERR CFWL_DateTimePickerImp::GetClassName(CFX_WideString& wsClass) const { | 440 FWL_Error CFWL_DateTimePickerImp::GetClassName(CFX_WideString& wsClass) const { |
| 441 wsClass = FWL_CLASS_DateTimePicker; | 441 wsClass = FWL_CLASS_DateTimePicker; |
| 442 return FWL_ERR_Succeeded; | 442 return FWL_Error::Succeeded; |
| 443 } | 443 } |
| 444 uint32_t CFWL_DateTimePickerImp::GetClassID() const { | 444 uint32_t CFWL_DateTimePickerImp::GetClassID() const { |
| 445 return FWL_CLASSHASH_DateTimePicker; | 445 return FWL_CLASSHASH_DateTimePicker; |
| 446 } | 446 } |
| 447 FWL_ERR CFWL_DateTimePickerImp::Initialize() { | 447 FWL_Error CFWL_DateTimePickerImp::Initialize() { |
| 448 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) | 448 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) |
| 449 return FWL_ERR_Indefinite; | 449 return FWL_Error::Indefinite; |
| 450 m_pDelegate = new CFWL_DateTimePickerImpDelegate(this); | 450 m_pDelegate = new CFWL_DateTimePickerImpDelegate(this); |
| 451 m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; | 451 m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; |
| 452 CFWL_WidgetImpProperties propMonth; | 452 CFWL_WidgetImpProperties propMonth; |
| 453 propMonth.m_dwStyles = FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border; | 453 propMonth.m_dwStyles = FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border; |
| 454 propMonth.m_dwStates = FWL_WGTSTATE_Invisible; | 454 propMonth.m_dwStates = FWL_WGTSTATE_Invisible; |
| 455 propMonth.m_pDataProvider = &m_MonthCalendarDP; | 455 propMonth.m_pDataProvider = &m_MonthCalendarDP; |
| 456 propMonth.m_pParent = m_pInterface; | 456 propMonth.m_pParent = m_pInterface; |
| 457 propMonth.m_pThemeProvider = m_pProperties->m_pThemeProvider; | 457 propMonth.m_pThemeProvider = m_pProperties->m_pThemeProvider; |
| 458 m_pMonthCal.reset(IFWL_DateTimeCalender::Create(propMonth, m_pInterface)); | 458 m_pMonthCal.reset(IFWL_DateTimeCalender::Create(propMonth, m_pInterface)); |
| 459 m_pMonthCal->Initialize(); | 459 m_pMonthCal->Initialize(); |
| 460 CFX_RectF rtMonthCal; | 460 CFX_RectF rtMonthCal; |
| 461 m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); | 461 m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); |
| 462 rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height); | 462 rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height); |
| 463 m_pMonthCal->SetWidgetRect(rtMonthCal); | 463 m_pMonthCal->SetWidgetRect(rtMonthCal); |
| 464 CFWL_WidgetImpProperties propEdit; | 464 CFWL_WidgetImpProperties propEdit; |
| 465 propEdit.m_pParent = m_pInterface; | 465 propEdit.m_pParent = m_pInterface; |
| 466 propEdit.m_pThemeProvider = m_pProperties->m_pThemeProvider; | 466 propEdit.m_pThemeProvider = m_pProperties->m_pThemeProvider; |
| 467 m_pEdit.reset(IFWL_DateTimeEdit::Create(propEdit, m_pInterface)); | 467 m_pEdit.reset(IFWL_DateTimeEdit::Create(propEdit, m_pInterface)); |
| 468 m_pEdit->Initialize(); | 468 m_pEdit->Initialize(); |
| 469 RegisterEventTarget(m_pMonthCal.get()); | 469 RegisterEventTarget(m_pMonthCal.get()); |
| 470 RegisterEventTarget(m_pEdit.get()); | 470 RegisterEventTarget(m_pEdit.get()); |
| 471 return FWL_ERR_Succeeded; | 471 return FWL_Error::Succeeded; |
| 472 } | 472 } |
| 473 FWL_ERR CFWL_DateTimePickerImp::Finalize() { | 473 FWL_Error CFWL_DateTimePickerImp::Finalize() { |
| 474 if (m_pEdit) { | 474 if (m_pEdit) { |
| 475 m_pEdit->Finalize(); | 475 m_pEdit->Finalize(); |
| 476 } | 476 } |
| 477 if (m_pMonthCal) { | 477 if (m_pMonthCal) { |
| 478 m_pMonthCal->Finalize(); | 478 m_pMonthCal->Finalize(); |
| 479 } | 479 } |
| 480 if (m_pForm) { | 480 if (m_pForm) { |
| 481 m_pForm->Finalize(); | 481 m_pForm->Finalize(); |
| 482 } | 482 } |
| 483 UnregisterEventTarget(); | 483 UnregisterEventTarget(); |
| 484 delete m_pDelegate; | 484 delete m_pDelegate; |
| 485 m_pDelegate = nullptr; | 485 m_pDelegate = nullptr; |
| 486 return CFWL_WidgetImp::Finalize(); | 486 return CFWL_WidgetImp::Finalize(); |
| 487 } | 487 } |
| 488 FWL_ERR CFWL_DateTimePickerImp::GetWidgetRect(CFX_RectF& rect, | 488 FWL_Error CFWL_DateTimePickerImp::GetWidgetRect(CFX_RectF& rect, |
| 489 FX_BOOL bAutoSize) { | 489 FX_BOOL bAutoSize) { |
| 490 if (m_pWidgetMgr->IsFormDisabled()) { | 490 if (m_pWidgetMgr->IsFormDisabled()) { |
| 491 return DisForm_GetWidgetRect(rect, bAutoSize); | 491 return DisForm_GetWidgetRect(rect, bAutoSize); |
| 492 } | 492 } |
| 493 if (bAutoSize) { | 493 if (bAutoSize) { |
| 494 rect.Set(0, 0, kDateTimePickerWidth, kDateTimePickerHeight); | 494 rect.Set(0, 0, kDateTimePickerWidth, kDateTimePickerHeight); |
| 495 CFWL_WidgetImp::GetWidgetRect(rect, TRUE); | 495 CFWL_WidgetImp::GetWidgetRect(rect, TRUE); |
| 496 } else { | 496 } else { |
| 497 rect = m_pProperties->m_rtWidget; | 497 rect = m_pProperties->m_rtWidget; |
| 498 } | 498 } |
| 499 return FWL_ERR_Succeeded; | 499 return FWL_Error::Succeeded; |
| 500 } | 500 } |
| 501 FWL_ERR CFWL_DateTimePickerImp::Update() { | 501 FWL_Error CFWL_DateTimePickerImp::Update() { |
| 502 if (m_pWidgetMgr->IsFormDisabled()) { | 502 if (m_pWidgetMgr->IsFormDisabled()) { |
| 503 return DisForm_Update(); | 503 return DisForm_Update(); |
| 504 } | 504 } |
| 505 if (m_iLock) { | 505 if (m_iLock) { |
| 506 return FWL_ERR_Indefinite; | 506 return FWL_Error::Indefinite; |
| 507 } | 507 } |
| 508 if (!m_pProperties->m_pThemeProvider) { | 508 if (!m_pProperties->m_pThemeProvider) { |
| 509 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 509 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
| 510 } | 510 } |
| 511 m_pEdit->SetThemeProvider(m_pProperties->m_pThemeProvider); | 511 m_pEdit->SetThemeProvider(m_pProperties->m_pThemeProvider); |
| 512 GetClientRect(m_rtClient); | 512 GetClientRect(m_rtClient); |
| 513 FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( | 513 FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( |
| 514 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); | 514 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); |
| 515 if (!pFWidth) | 515 if (!pFWidth) |
| 516 return FWL_ERR_Indefinite; | 516 return FWL_Error::Indefinite; |
| 517 FX_FLOAT fBtn = *pFWidth; | 517 FX_FLOAT fBtn = *pFWidth; |
| 518 m_rtBtn.Set(m_rtClient.right() - fBtn, m_rtClient.top, fBtn - 1, | 518 m_rtBtn.Set(m_rtClient.right() - fBtn, m_rtClient.top, fBtn - 1, |
| 519 m_rtClient.height - 1); | 519 m_rtClient.height - 1); |
| 520 CFX_RectF rtEdit; | 520 CFX_RectF rtEdit; |
| 521 rtEdit.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn, | 521 rtEdit.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn, |
| 522 m_rtClient.height); | 522 m_rtClient.height); |
| 523 m_pEdit->SetWidgetRect(rtEdit); | 523 m_pEdit->SetWidgetRect(rtEdit); |
| 524 ReSetEditAlignment(); | 524 ReSetEditAlignment(); |
| 525 m_pEdit->Update(); | 525 m_pEdit->Update(); |
| 526 if (!(m_pMonthCal->GetThemeProvider())) { | 526 if (!(m_pMonthCal->GetThemeProvider())) { |
| 527 m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider); | 527 m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider); |
| 528 } | 528 } |
| 529 if (m_pProperties->m_pDataProvider) { | 529 if (m_pProperties->m_pDataProvider) { |
| 530 IFWL_DateTimePickerDP* pData = | 530 IFWL_DateTimePickerDP* pData = |
| 531 static_cast<IFWL_DateTimePickerDP*>(m_pProperties->m_pDataProvider); | 531 static_cast<IFWL_DateTimePickerDP*>(m_pProperties->m_pDataProvider); |
| 532 pData->GetToday(m_pInterface, m_MonthCalendarDP.m_iCurYear, | 532 pData->GetToday(m_pInterface, m_MonthCalendarDP.m_iCurYear, |
| 533 m_MonthCalendarDP.m_iCurMonth, m_MonthCalendarDP.m_iCurDay); | 533 m_MonthCalendarDP.m_iCurMonth, m_MonthCalendarDP.m_iCurDay); |
| 534 } | 534 } |
| 535 CFX_RectF rtMonthCal; | 535 CFX_RectF rtMonthCal; |
| 536 m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); | 536 m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); |
| 537 CFX_RectF rtPopUp; | 537 CFX_RectF rtPopUp; |
| 538 rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight, | 538 rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight, |
| 539 rtMonthCal.width, rtMonthCal.height); | 539 rtMonthCal.width, rtMonthCal.height); |
| 540 m_pMonthCal->SetWidgetRect(rtPopUp); | 540 m_pMonthCal->SetWidgetRect(rtPopUp); |
| 541 m_pMonthCal->Update(); | 541 m_pMonthCal->Update(); |
| 542 return FWL_ERR_Succeeded; | 542 return FWL_Error::Succeeded; |
| 543 } | 543 } |
| 544 uint32_t CFWL_DateTimePickerImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 544 uint32_t CFWL_DateTimePickerImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
| 545 if (m_pWidgetMgr->IsFormDisabled()) { | 545 if (m_pWidgetMgr->IsFormDisabled()) { |
| 546 return DisForm_HitTest(fx, fy); | 546 return DisForm_HitTest(fx, fy); |
| 547 } | 547 } |
| 548 if (m_rtClient.Contains(fx, fy)) { | 548 if (m_rtClient.Contains(fx, fy)) { |
| 549 return FWL_WGTHITTEST_Client; | 549 return FWL_WGTHITTEST_Client; |
| 550 } | 550 } |
| 551 if (IsMonthCalendarShowed()) { | 551 if (IsMonthCalendarShowed()) { |
| 552 CFX_RectF rect; | 552 CFX_RectF rect; |
| 553 m_pMonthCal->GetWidgetRect(rect); | 553 m_pMonthCal->GetWidgetRect(rect); |
| 554 if (rect.Contains(fx, fy)) { | 554 if (rect.Contains(fx, fy)) { |
| 555 return FWL_WGTHITTEST_Client; | 555 return FWL_WGTHITTEST_Client; |
| 556 } | 556 } |
| 557 } | 557 } |
| 558 return FWL_WGTHITTEST_Unknown; | 558 return FWL_WGTHITTEST_Unknown; |
| 559 } | 559 } |
| 560 FWL_ERR CFWL_DateTimePickerImp::DrawWidget(CFX_Graphics* pGraphics, | 560 FWL_Error CFWL_DateTimePickerImp::DrawWidget(CFX_Graphics* pGraphics, |
| 561 const CFX_Matrix* pMatrix) { | 561 const CFX_Matrix* pMatrix) { |
| 562 if (!pGraphics) | 562 if (!pGraphics) |
| 563 return FWL_ERR_Indefinite; | 563 return FWL_Error::Indefinite; |
| 564 if (!m_pProperties->m_pThemeProvider) | 564 if (!m_pProperties->m_pThemeProvider) |
| 565 return FWL_ERR_Indefinite; | 565 return FWL_Error::Indefinite; |
| 566 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 566 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
| 567 if (HasBorder()) { | 567 if (HasBorder()) { |
| 568 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); | 568 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); |
| 569 } | 569 } |
| 570 if (HasEdge()) { | 570 if (HasEdge()) { |
| 571 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); | 571 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); |
| 572 } | 572 } |
| 573 if (!m_rtBtn.IsEmpty()) { | 573 if (!m_rtBtn.IsEmpty()) { |
| 574 DrawDropDownButton(pGraphics, pTheme, pMatrix); | 574 DrawDropDownButton(pGraphics, pTheme, pMatrix); |
| 575 } | 575 } |
| 576 if (m_pWidgetMgr->IsFormDisabled()) { | 576 if (m_pWidgetMgr->IsFormDisabled()) { |
| 577 return DisForm_DrawWidget(pGraphics, pMatrix); | 577 return DisForm_DrawWidget(pGraphics, pMatrix); |
| 578 } | 578 } |
| 579 return FWL_ERR_Succeeded; | 579 return FWL_Error::Succeeded; |
| 580 } | 580 } |
| 581 FWL_ERR CFWL_DateTimePickerImp::SetThemeProvider(IFWL_ThemeProvider* pTP) { | 581 FWL_Error CFWL_DateTimePickerImp::SetThemeProvider(IFWL_ThemeProvider* pTP) { |
| 582 m_pProperties->m_pThemeProvider = pTP; | 582 m_pProperties->m_pThemeProvider = pTP; |
| 583 m_pMonthCal->SetThemeProvider(pTP); | 583 m_pMonthCal->SetThemeProvider(pTP); |
| 584 return FWL_ERR_Succeeded; | 584 return FWL_Error::Succeeded; |
| 585 } | 585 } |
| 586 FWL_ERR CFWL_DateTimePickerImp::GetCurSel(int32_t& iYear, | 586 FWL_Error CFWL_DateTimePickerImp::GetCurSel(int32_t& iYear, |
| 587 int32_t& iMonth, | 587 int32_t& iMonth, |
| 588 int32_t& iDay) { | 588 int32_t& iDay) { |
| 589 iYear = m_iYear; | 589 iYear = m_iYear; |
| 590 iMonth = m_iMonth; | 590 iMonth = m_iMonth; |
| 591 iDay = m_iDay; | 591 iDay = m_iDay; |
| 592 return FWL_ERR_Succeeded; | 592 return FWL_Error::Succeeded; |
| 593 } | 593 } |
| 594 FWL_ERR CFWL_DateTimePickerImp::SetCurSel(int32_t iYear, | 594 FWL_Error CFWL_DateTimePickerImp::SetCurSel(int32_t iYear, |
| 595 int32_t iMonth, | 595 int32_t iMonth, |
| 596 int32_t iDay) { | 596 int32_t iDay) { |
| 597 if (iYear <= 0 || iYear >= 3000) | 597 if (iYear <= 0 || iYear >= 3000) |
| 598 return FWL_ERR_Indefinite; | 598 return FWL_Error::Indefinite; |
| 599 if (iMonth <= 0 || iMonth >= 13) | 599 if (iMonth <= 0 || iMonth >= 13) |
| 600 return FWL_ERR_Indefinite; | 600 return FWL_Error::Indefinite; |
| 601 if (iDay <= 0 || iDay >= 32) | 601 if (iDay <= 0 || iDay >= 32) |
| 602 return FWL_ERR_Indefinite; | 602 return FWL_Error::Indefinite; |
| 603 m_iYear = iYear; | 603 m_iYear = iYear; |
| 604 m_iMonth = iMonth; | 604 m_iMonth = iMonth; |
| 605 m_iDay = iDay; | 605 m_iDay = iDay; |
| 606 m_pMonthCal->SetSelect(iYear, iMonth, iDay); | 606 m_pMonthCal->SetSelect(iYear, iMonth, iDay); |
| 607 return FWL_ERR_Succeeded; | 607 return FWL_Error::Succeeded; |
| 608 } | 608 } |
| 609 FWL_ERR CFWL_DateTimePickerImp::SetEditText(const CFX_WideString& wsText) { | 609 |
| 610 FWL_Error CFWL_DateTimePickerImp::SetEditText(const CFX_WideString& wsText) { |
| 610 if (!m_pEdit) | 611 if (!m_pEdit) |
| 611 return FWL_ERR_Indefinite; | 612 return FWL_Error::Indefinite; |
| 612 int32_t iRet = m_pEdit->SetText(wsText); | 613 |
| 614 FWL_Error iRet = m_pEdit->SetText(wsText); |
| 613 Repaint(&m_rtClient); | 615 Repaint(&m_rtClient); |
| 614 CFWL_Event_DtpEditChanged ev; | 616 CFWL_Event_DtpEditChanged ev; |
| 615 ev.m_wsText = wsText; | 617 ev.m_wsText = wsText; |
| 616 DispatchEvent(&ev); | 618 DispatchEvent(&ev); |
| 617 return iRet; | 619 return iRet; |
| 618 } | 620 } |
| 619 FWL_ERR CFWL_DateTimePickerImp::GetEditText(CFX_WideString& wsText, | 621 |
| 620 int32_t nStart, | 622 FWL_Error CFWL_DateTimePickerImp::GetEditText(CFX_WideString& wsText, |
| 621 int32_t nCount) const { | 623 int32_t nStart, |
| 624 int32_t nCount) const { |
| 622 if (m_pEdit) { | 625 if (m_pEdit) { |
| 623 return m_pEdit->GetText(wsText, nStart, nCount); | 626 return m_pEdit->GetText(wsText, nStart, nCount); |
| 624 } | 627 } |
| 625 return FWL_ERR_Indefinite; | 628 return FWL_Error::Indefinite; |
| 626 } | 629 } |
| 627 FX_BOOL CFWL_DateTimePickerImp::CanUndo() { | 630 FX_BOOL CFWL_DateTimePickerImp::CanUndo() { |
| 628 return m_pEdit->CanUndo(); | 631 return m_pEdit->CanUndo(); |
| 629 } | 632 } |
| 630 FX_BOOL CFWL_DateTimePickerImp::CanRedo() { | 633 FX_BOOL CFWL_DateTimePickerImp::CanRedo() { |
| 631 return m_pEdit->CanRedo(); | 634 return m_pEdit->CanRedo(); |
| 632 } | 635 } |
| 633 FX_BOOL CFWL_DateTimePickerImp::Undo() { | 636 FX_BOOL CFWL_DateTimePickerImp::Undo() { |
| 634 return m_pEdit->Undo(); | 637 return m_pEdit->Undo(); |
| 635 } | 638 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 653 FX_BOOL CFWL_DateTimePickerImp::Copy(CFX_WideString& wsCopy) { | 656 FX_BOOL CFWL_DateTimePickerImp::Copy(CFX_WideString& wsCopy) { |
| 654 return m_pEdit->Copy(wsCopy); | 657 return m_pEdit->Copy(wsCopy); |
| 655 } | 658 } |
| 656 FX_BOOL CFWL_DateTimePickerImp::Cut(CFX_WideString& wsCut) { | 659 FX_BOOL CFWL_DateTimePickerImp::Cut(CFX_WideString& wsCut) { |
| 657 return m_pEdit->Cut(wsCut); | 660 return m_pEdit->Cut(wsCut); |
| 658 } | 661 } |
| 659 FX_BOOL CFWL_DateTimePickerImp::Paste(const CFX_WideString& wsPaste) { | 662 FX_BOOL CFWL_DateTimePickerImp::Paste(const CFX_WideString& wsPaste) { |
| 660 return m_pEdit->Paste(wsPaste); | 663 return m_pEdit->Paste(wsPaste); |
| 661 } | 664 } |
| 662 FX_BOOL CFWL_DateTimePickerImp::SelectAll() { | 665 FX_BOOL CFWL_DateTimePickerImp::SelectAll() { |
| 663 return m_pEdit->AddSelRange(0) == FWL_ERR_Succeeded; | 666 return m_pEdit->AddSelRange(0) == FWL_Error::Succeeded; |
| 664 } | 667 } |
| 665 FX_BOOL CFWL_DateTimePickerImp::Delete() { | 668 FX_BOOL CFWL_DateTimePickerImp::Delete() { |
| 666 return m_pEdit->ClearText() == FWL_ERR_Succeeded; | 669 return m_pEdit->ClearText() == FWL_Error::Succeeded; |
| 667 } | 670 } |
| 668 FX_BOOL CFWL_DateTimePickerImp::DeSelect() { | 671 FX_BOOL CFWL_DateTimePickerImp::DeSelect() { |
| 669 return m_pEdit->ClearSelections() == FWL_ERR_Succeeded; | 672 return m_pEdit->ClearSelections() == FWL_Error::Succeeded; |
| 670 } | 673 } |
| 671 FWL_ERR CFWL_DateTimePickerImp::GetBBox(CFX_RectF& rect) { | 674 FWL_Error CFWL_DateTimePickerImp::GetBBox(CFX_RectF& rect) { |
| 672 if (m_pWidgetMgr->IsFormDisabled()) { | 675 if (m_pWidgetMgr->IsFormDisabled()) { |
| 673 return DisForm_GetBBox(rect); | 676 return DisForm_GetBBox(rect); |
| 674 } | 677 } |
| 675 rect = m_pProperties->m_rtWidget; | 678 rect = m_pProperties->m_rtWidget; |
| 676 if (IsMonthCalendarShowed()) { | 679 if (IsMonthCalendarShowed()) { |
| 677 CFX_RectF rtMonth; | 680 CFX_RectF rtMonth; |
| 678 m_pMonthCal->GetWidgetRect(rtMonth); | 681 m_pMonthCal->GetWidgetRect(rtMonth); |
| 679 rtMonth.Offset(m_pProperties->m_rtWidget.left, | 682 rtMonth.Offset(m_pProperties->m_rtWidget.left, |
| 680 m_pProperties->m_rtWidget.top); | 683 m_pProperties->m_rtWidget.top); |
| 681 rect.Union(rtMonth); | 684 rect.Union(rtMonth); |
| 682 } | 685 } |
| 683 return FWL_ERR_Succeeded; | 686 return FWL_Error::Succeeded; |
| 684 } | 687 } |
| 685 FWL_ERR CFWL_DateTimePickerImp::SetEditLimit(int32_t nLimit) { | 688 FWL_Error CFWL_DateTimePickerImp::SetEditLimit(int32_t nLimit) { |
| 686 return m_pEdit->SetLimit(nLimit); | 689 return m_pEdit->SetLimit(nLimit); |
| 687 } | 690 } |
| 688 FWL_ERR CFWL_DateTimePickerImp::ModifyEditStylesEx(uint32_t dwStylesExAdded, | 691 FWL_Error CFWL_DateTimePickerImp::ModifyEditStylesEx( |
| 689 uint32_t dwStylesExRemoved) { | 692 uint32_t dwStylesExAdded, |
| 693 uint32_t dwStylesExRemoved) { |
| 690 return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 694 return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
| 691 } | 695 } |
| 692 void CFWL_DateTimePickerImp::DrawDropDownButton(CFX_Graphics* pGraphics, | 696 void CFWL_DateTimePickerImp::DrawDropDownButton(CFX_Graphics* pGraphics, |
| 693 IFWL_ThemeProvider* pTheme, | 697 IFWL_ThemeProvider* pTheme, |
| 694 const CFX_Matrix* pMatrix) { | 698 const CFX_Matrix* pMatrix) { |
| 695 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_Spin) == | 699 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_Spin) == |
| 696 FWL_STYLEEXT_DTP_Spin) { | 700 FWL_STYLEEXT_DTP_Spin) { |
| 697 CFWL_WidgetImpProperties prop; | 701 CFWL_WidgetImpProperties prop; |
| 698 prop.m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; | 702 prop.m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; |
| 699 prop.m_pParent = m_pInterface; | 703 prop.m_pParent = m_pInterface; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 propForm.m_dwStyles = FWL_WGTSTYLE_Popup; | 830 propForm.m_dwStyles = FWL_WGTSTYLE_Popup; |
| 827 propForm.m_dwStates = FWL_WGTSTATE_Invisible; | 831 propForm.m_dwStates = FWL_WGTSTATE_Invisible; |
| 828 propForm.m_pOwner = m_pInterface; | 832 propForm.m_pOwner = m_pInterface; |
| 829 m_pForm.reset(IFWL_DateTimeForm::Create(propForm, m_pMonthCal.get())); | 833 m_pForm.reset(IFWL_DateTimeForm::Create(propForm, m_pMonthCal.get())); |
| 830 m_pForm->Initialize(); | 834 m_pForm->Initialize(); |
| 831 m_pMonthCal->SetParent(m_pForm.get()); | 835 m_pMonthCal->SetParent(m_pForm.get()); |
| 832 } | 836 } |
| 833 IFWL_DateTimeEdit* CFWL_DateTimePickerImp::GetDataTimeEdit() { | 837 IFWL_DateTimeEdit* CFWL_DateTimePickerImp::GetDataTimeEdit() { |
| 834 return m_pEdit.get(); | 838 return m_pEdit.get(); |
| 835 } | 839 } |
| 836 FWL_ERR CFWL_DateTimePickerImp::DisForm_Initialize() { | 840 FWL_Error CFWL_DateTimePickerImp::DisForm_Initialize() { |
| 837 m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; | 841 m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; |
| 838 DisForm_InitDateTimeCalendar(); | 842 DisForm_InitDateTimeCalendar(); |
| 839 DisForm_InitDateTimeEdit(); | 843 DisForm_InitDateTimeEdit(); |
| 840 RegisterEventTarget(m_pMonthCal.get()); | 844 RegisterEventTarget(m_pMonthCal.get()); |
| 841 RegisterEventTarget(m_pEdit.get()); | 845 RegisterEventTarget(m_pEdit.get()); |
| 842 return FWL_ERR_Succeeded; | 846 return FWL_Error::Succeeded; |
| 843 } | 847 } |
| 844 void CFWL_DateTimePickerImp::DisForm_InitDateTimeCalendar() { | 848 void CFWL_DateTimePickerImp::DisForm_InitDateTimeCalendar() { |
| 845 if (m_pMonthCal) { | 849 if (m_pMonthCal) { |
| 846 return; | 850 return; |
| 847 } | 851 } |
| 848 CFWL_WidgetImpProperties propMonth; | 852 CFWL_WidgetImpProperties propMonth; |
| 849 propMonth.m_dwStyles = | 853 propMonth.m_dwStyles = |
| 850 FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border | FWL_WGTSTYLE_EdgeSunken; | 854 FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border | FWL_WGTSTYLE_EdgeSunken; |
| 851 propMonth.m_dwStates = FWL_WGTSTATE_Invisible; | 855 propMonth.m_dwStates = FWL_WGTSTATE_Invisible; |
| 852 propMonth.m_pParent = m_pInterface; | 856 propMonth.m_pParent = m_pInterface; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 } | 935 } |
| 932 } | 936 } |
| 933 return FWL_WGTHITTEST_Unknown; | 937 return FWL_WGTHITTEST_Unknown; |
| 934 } | 938 } |
| 935 FX_BOOL CFWL_DateTimePickerImp::DisForm_IsNeedShowButton() { | 939 FX_BOOL CFWL_DateTimePickerImp::DisForm_IsNeedShowButton() { |
| 936 FX_BOOL bFocus = m_pProperties->m_dwStates & FWL_WGTSTATE_Focused || | 940 FX_BOOL bFocus = m_pProperties->m_dwStates & FWL_WGTSTATE_Focused || |
| 937 m_pMonthCal->GetStates() & FWL_WGTSTATE_Focused || | 941 m_pMonthCal->GetStates() & FWL_WGTSTATE_Focused || |
| 938 m_pEdit->GetStates() & FWL_WGTSTATE_Focused; | 942 m_pEdit->GetStates() & FWL_WGTSTATE_Focused; |
| 939 return bFocus; | 943 return bFocus; |
| 940 } | 944 } |
| 941 FWL_ERR CFWL_DateTimePickerImp::DisForm_Update() { | 945 |
| 942 if (m_iLock) { | 946 FWL_Error CFWL_DateTimePickerImp::DisForm_Update() { |
| 943 return FWL_ERR_Indefinite; | 947 if (m_iLock) |
| 944 } | 948 return FWL_Error::Indefinite; |
| 945 if (!m_pProperties->m_pThemeProvider) { | 949 if (!m_pProperties->m_pThemeProvider) |
| 946 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 950 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
| 947 } | 951 |
| 948 m_pEdit->SetThemeProvider(m_pProperties->m_pThemeProvider); | 952 m_pEdit->SetThemeProvider(m_pProperties->m_pThemeProvider); |
| 949 GetClientRect(m_rtClient); | 953 GetClientRect(m_rtClient); |
| 950 m_pEdit->SetWidgetRect(m_rtClient); | 954 m_pEdit->SetWidgetRect(m_rtClient); |
| 951 ReSetEditAlignment(); | 955 ReSetEditAlignment(); |
| 952 m_pEdit->Update(); | 956 m_pEdit->Update(); |
| 953 if (m_pMonthCal->GetThemeProvider() == NULL) { | 957 if (!m_pMonthCal->GetThemeProvider()) |
| 954 m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider); | 958 m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider); |
| 955 } | 959 |
| 956 if (m_pProperties->m_pDataProvider) { | 960 if (m_pProperties->m_pDataProvider) { |
| 957 IFWL_DateTimePickerDP* pData = | 961 IFWL_DateTimePickerDP* pData = |
| 958 static_cast<IFWL_DateTimePickerDP*>(m_pProperties->m_pDataProvider); | 962 static_cast<IFWL_DateTimePickerDP*>(m_pProperties->m_pDataProvider); |
| 959 pData->GetToday(m_pInterface, m_MonthCalendarDP.m_iCurYear, | 963 pData->GetToday(m_pInterface, m_MonthCalendarDP.m_iCurYear, |
| 960 m_MonthCalendarDP.m_iCurMonth, m_MonthCalendarDP.m_iCurDay); | 964 m_MonthCalendarDP.m_iCurMonth, m_MonthCalendarDP.m_iCurDay); |
| 961 } | 965 } |
| 962 FX_FLOAT* pWidth = static_cast<FX_FLOAT*>( | 966 FX_FLOAT* pWidth = static_cast<FX_FLOAT*>( |
| 963 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); | 967 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); |
| 964 if (!pWidth) | 968 if (!pWidth) |
| 965 return 0; | 969 return FWL_Error::Succeeded; |
| 970 |
| 966 m_fBtn = *pWidth; | 971 m_fBtn = *pWidth; |
| 967 CFX_RectF rtMonthCal; | 972 CFX_RectF rtMonthCal; |
| 968 m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); | 973 m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); |
| 969 CFX_RectF rtPopUp; | 974 CFX_RectF rtPopUp; |
| 970 rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight, | 975 rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight, |
| 971 rtMonthCal.width, rtMonthCal.height); | 976 rtMonthCal.width, rtMonthCal.height); |
| 972 m_pMonthCal->SetWidgetRect(rtPopUp); | 977 m_pMonthCal->SetWidgetRect(rtPopUp); |
| 973 m_pMonthCal->Update(); | 978 m_pMonthCal->Update(); |
| 974 return FWL_ERR_Succeeded; | 979 return FWL_Error::Succeeded; |
| 975 } | 980 } |
| 976 FWL_ERR CFWL_DateTimePickerImp::DisForm_GetWidgetRect(CFX_RectF& rect, | 981 |
| 977 FX_BOOL bAutoSize) { | 982 FWL_Error CFWL_DateTimePickerImp::DisForm_GetWidgetRect(CFX_RectF& rect, |
| 983 FX_BOOL bAutoSize) { |
| 978 rect = m_pProperties->m_rtWidget; | 984 rect = m_pProperties->m_rtWidget; |
| 979 if (DisForm_IsNeedShowButton()) { | 985 if (DisForm_IsNeedShowButton()) { |
| 980 rect.width += m_fBtn; | 986 rect.width += m_fBtn; |
| 981 } | 987 } |
| 982 return FWL_ERR_Succeeded; | 988 return FWL_Error::Succeeded; |
| 983 } | 989 } |
| 984 FWL_ERR CFWL_DateTimePickerImp::DisForm_GetBBox(CFX_RectF& rect) { | 990 FWL_Error CFWL_DateTimePickerImp::DisForm_GetBBox(CFX_RectF& rect) { |
| 985 rect = m_pProperties->m_rtWidget; | 991 rect = m_pProperties->m_rtWidget; |
| 986 if (DisForm_IsNeedShowButton()) { | 992 if (DisForm_IsNeedShowButton()) { |
| 987 rect.width += m_fBtn; | 993 rect.width += m_fBtn; |
| 988 } | 994 } |
| 989 if (IsMonthCalendarShowed()) { | 995 if (IsMonthCalendarShowed()) { |
| 990 CFX_RectF rtMonth; | 996 CFX_RectF rtMonth; |
| 991 m_pMonthCal->GetWidgetRect(rtMonth); | 997 m_pMonthCal->GetWidgetRect(rtMonth); |
| 992 rtMonth.Offset(m_pProperties->m_rtWidget.left, | 998 rtMonth.Offset(m_pProperties->m_rtWidget.left, |
| 993 m_pProperties->m_rtWidget.top); | 999 m_pProperties->m_rtWidget.top); |
| 994 rect.Union(rtMonth); | 1000 rect.Union(rtMonth); |
| 995 } | 1001 } |
| 996 return FWL_ERR_Succeeded; | 1002 return FWL_Error::Succeeded; |
| 997 } | 1003 } |
| 998 FWL_ERR CFWL_DateTimePickerImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, | 1004 FWL_Error CFWL_DateTimePickerImp::DisForm_DrawWidget( |
| 999 const CFX_Matrix* pMatrix) { | 1005 CFX_Graphics* pGraphics, |
| 1006 const CFX_Matrix* pMatrix) { |
| 1000 if (!pGraphics) | 1007 if (!pGraphics) |
| 1001 return FWL_ERR_Indefinite; | 1008 return FWL_Error::Indefinite; |
| 1002 if (m_pEdit) { | 1009 if (m_pEdit) { |
| 1003 CFX_RectF rtEdit; | 1010 CFX_RectF rtEdit; |
| 1004 m_pEdit->GetWidgetRect(rtEdit); | 1011 m_pEdit->GetWidgetRect(rtEdit); |
| 1005 CFX_Matrix mt; | 1012 CFX_Matrix mt; |
| 1006 mt.Set(1, 0, 0, 1, rtEdit.left, rtEdit.top); | 1013 mt.Set(1, 0, 0, 1, rtEdit.left, rtEdit.top); |
| 1007 if (pMatrix) { | 1014 if (pMatrix) { |
| 1008 mt.Concat(*pMatrix); | 1015 mt.Concat(*pMatrix); |
| 1009 } | 1016 } |
| 1010 m_pEdit->DrawWidget(pGraphics, &mt); | 1017 m_pEdit->DrawWidget(pGraphics, &mt); |
| 1011 } | 1018 } |
| 1012 if (IsMonthCalendarShowed()) { | 1019 if (IsMonthCalendarShowed()) { |
| 1013 CFX_RectF rtMonth; | 1020 CFX_RectF rtMonth; |
| 1014 m_pMonthCal->GetWidgetRect(rtMonth); | 1021 m_pMonthCal->GetWidgetRect(rtMonth); |
| 1015 CFX_Matrix mt; | 1022 CFX_Matrix mt; |
| 1016 mt.Set(1, 0, 0, 1, rtMonth.left, rtMonth.top); | 1023 mt.Set(1, 0, 0, 1, rtMonth.left, rtMonth.top); |
| 1017 if (pMatrix) { | 1024 if (pMatrix) { |
| 1018 mt.Concat(*pMatrix); | 1025 mt.Concat(*pMatrix); |
| 1019 } | 1026 } |
| 1020 m_pMonthCal->DrawWidget(pGraphics, &mt); | 1027 m_pMonthCal->DrawWidget(pGraphics, &mt); |
| 1021 } | 1028 } |
| 1022 return FWL_ERR_Succeeded; | 1029 return FWL_Error::Succeeded; |
| 1023 } | 1030 } |
| 1024 | 1031 |
| 1025 CFWL_DateTimePickerImpDelegate::CFWL_DateTimePickerImpDelegate( | 1032 CFWL_DateTimePickerImpDelegate::CFWL_DateTimePickerImpDelegate( |
| 1026 CFWL_DateTimePickerImp* pOwner) | 1033 CFWL_DateTimePickerImp* pOwner) |
| 1027 : m_pOwner(pOwner) {} | 1034 : m_pOwner(pOwner) {} |
| 1028 | 1035 |
| 1029 int32_t CFWL_DateTimePickerImpDelegate::OnProcessMessage( | 1036 int32_t CFWL_DateTimePickerImpDelegate::OnProcessMessage( |
| 1030 CFWL_Message* pMessage) { | 1037 CFWL_Message* pMessage) { |
| 1031 if (!pMessage) | 1038 if (!pMessage) |
| 1032 return 0; | 1039 return 0; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 } | 1078 } |
| 1072 break; | 1079 break; |
| 1073 } | 1080 } |
| 1074 default: | 1081 default: |
| 1075 break; | 1082 break; |
| 1076 } | 1083 } |
| 1077 | 1084 |
| 1078 return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 1085 return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
| 1079 } | 1086 } |
| 1080 | 1087 |
| 1081 FWL_ERR CFWL_DateTimePickerImpDelegate::OnDrawWidget( | 1088 FWL_Error CFWL_DateTimePickerImpDelegate::OnDrawWidget( |
| 1082 CFX_Graphics* pGraphics, | 1089 CFX_Graphics* pGraphics, |
| 1083 const CFX_Matrix* pMatrix) { | 1090 const CFX_Matrix* pMatrix) { |
| 1084 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 1091 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
| 1085 } | 1092 } |
| 1086 void CFWL_DateTimePickerImpDelegate::OnFocusChanged(CFWL_Message* pMsg, | 1093 void CFWL_DateTimePickerImpDelegate::OnFocusChanged(CFWL_Message* pMsg, |
| 1087 FX_BOOL bSet) { | 1094 FX_BOOL bSet) { |
| 1088 if (!pMsg) | 1095 if (!pMsg) |
| 1089 return; | 1096 return; |
| 1090 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { | 1097 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { |
| 1091 return DisForm_OnFocusChanged(pMsg, bSet); | 1098 return DisForm_OnFocusChanged(pMsg, bSet); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 } | 1181 } |
| 1175 if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { | 1182 if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { |
| 1176 pMsg->m_pSrcTarget = m_pOwner->m_pEdit.get(); | 1183 pMsg->m_pSrcTarget = m_pOwner->m_pEdit.get(); |
| 1177 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); | 1184 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); |
| 1178 pDelegate->OnProcessMessage(pMsg); | 1185 pDelegate->OnProcessMessage(pMsg); |
| 1179 } | 1186 } |
| 1180 } | 1187 } |
| 1181 rtInvalidate.Inflate(2, 2); | 1188 rtInvalidate.Inflate(2, 2); |
| 1182 m_pOwner->Repaint(&rtInvalidate); | 1189 m_pOwner->Repaint(&rtInvalidate); |
| 1183 } | 1190 } |
| OLD | NEW |