diff options
author | dsinclair <dsinclair@chromium.org> | 2016-12-07 17:23:28 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-12-07 17:23:28 -0800 |
commit | 7fa190dbda7b3a5f46b8108aa7984b2fcc23d45c (patch) | |
tree | 334c92bc076724892ca6cfe96767f0e5ed841ca1 /xfa/fwl/core | |
parent | 919c0842b74d382e7ae60c85ff16642b646afbb9 (diff) | |
download | pdfium-7fa190dbda7b3a5f46b8108aa7984b2fcc23d45c.tar.xz |
Cleanup default FWL params part I
This Cl removes some of the default FWL parameters.
Review-Url: https://codereview.chromium.org/2533623002
Diffstat (limited to 'xfa/fwl/core')
29 files changed, 160 insertions, 143 deletions
diff --git a/xfa/fwl/core/cfwl_barcode.h b/xfa/fwl/core/cfwl_barcode.h index 05c2375c7c..66b47ce3f0 100644 --- a/xfa/fwl/core/cfwl_barcode.h +++ b/xfa/fwl/core/cfwl_barcode.h @@ -46,8 +46,7 @@ class CFWL_Barcode : public CFWL_Edit { // CFWL_Widget FWL_Type GetClassID() const override; void Update() override; - void DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; void OnProcessEvent(CFWL_Event* pEvent) override; // CFWL_Edit diff --git a/xfa/fwl/core/cfwl_caret.cpp b/xfa/fwl/core/cfwl_caret.cpp index b42945c6a8..0457347b66 100644 --- a/xfa/fwl/core/cfwl_caret.cpp +++ b/xfa/fwl/core/cfwl_caret.cpp @@ -59,7 +59,7 @@ void CFWL_Caret::ShowCaret() { if (m_pTimerInfo) m_pTimerInfo->StopTimer(); m_pTimerInfo = m_pTimer->StartTimer(kFrequency, true); - SetStates(FWL_WGTSTATE_Invisible, false); + RemoveStates(FWL_WGTSTATE_Invisible); } void CFWL_Caret::HideCaret() { @@ -67,7 +67,7 @@ void CFWL_Caret::HideCaret() { m_pTimerInfo->StopTimer(); m_pTimerInfo = nullptr; } - SetStates(FWL_WGTSTATE_Invisible, true); + SetStates(FWL_WGTSTATE_Invisible); } void CFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics, @@ -77,7 +77,7 @@ void CFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics, return; CFX_RectF rect; - GetWidgetRect(rect); + GetWidgetRect(rect, false); rect.Set(0, 0, rect.width, rect.height); CFWL_ThemeBackground param; @@ -102,11 +102,13 @@ CFWL_Caret::Timer::Timer(CFWL_Caret* pCaret) : CFWL_Timer(pCaret) {} void CFWL_Caret::Timer::Run(CFWL_TimerInfo* pTimerInfo) { CFWL_Caret* pCaret = static_cast<CFWL_Caret*>(m_pWidget); - pCaret->SetStates(FWL_STATE_CAT_HightLight, - !(pCaret->GetStates() & FWL_STATE_CAT_HightLight)); + if (!(pCaret->GetStates() & FWL_STATE_CAT_HightLight)) + pCaret->SetStates(FWL_STATE_CAT_HightLight); + else + pCaret->RemoveStates(FWL_STATE_CAT_HightLight); CFX_RectF rt; - pCaret->GetWidgetRect(rt); + pCaret->GetWidgetRect(rt, false); rt.Set(0, 0, rt.width + 1, rt.height); pCaret->Repaint(&rt); } diff --git a/xfa/fwl/core/cfwl_caret.h b/xfa/fwl/core/cfwl_caret.h index ada0405748..aa718b7af3 100644 --- a/xfa/fwl/core/cfwl_caret.h +++ b/xfa/fwl/core/cfwl_caret.h @@ -27,8 +27,7 @@ class CFWL_Caret : public CFWL_Widget { // CFWL_Widget FWL_Type GetClassID() const override; - void DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; diff --git a/xfa/fwl/core/cfwl_checkbox.cpp b/xfa/fwl/core/cfwl_checkbox.cpp index dc042d5c39..5b147bd55a 100644 --- a/xfa/fwl/core/cfwl_checkbox.cpp +++ b/xfa/fwl/core/cfwl_checkbox.cpp @@ -309,7 +309,7 @@ void CFWL_CheckBox::NextStates() { pCheckBox->GetStates() & FWL_STATE_CKB_Checked) { pCheckBox->SetCheckState(0); CFX_RectF rt; - pCheckBox->GetWidgetRect(rt); + pCheckBox->GetWidgetRect(rt, false); rt.left = rt.top = 0; m_pWidgetMgr->RepaintWidget(pCheckBox, &rt); break; diff --git a/xfa/fwl/core/cfwl_checkbox.h b/xfa/fwl/core/cfwl_checkbox.h index 71497a3fe4..ace09e57c9 100644 --- a/xfa/fwl/core/cfwl_checkbox.h +++ b/xfa/fwl/core/cfwl_checkbox.h @@ -55,10 +55,9 @@ class CFWL_CheckBox : public CFWL_Widget { // CFWL_Widget FWL_Type GetClassID() const override; - void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override; void Update() override; - void DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp index c8486c39c4..70f863504d 100644 --- a/xfa/fwl/core/cfwl_combobox.cpp +++ b/xfa/fwl/core/cfwl_combobox.cpp @@ -124,7 +124,7 @@ void CFWL_ComboBox::ModifyStylesEx(uint32_t dwStylesExAdded, m_pEdit->SetOuter(this); m_pEdit->SetParent(this); } else if (bRemoveDropDown && m_pEdit) { - m_pEdit->SetStates(FWL_WGTSTATE_Invisible, true); + m_pEdit->SetStates(FWL_WGTSTATE_Invisible); } CFWL_Widget::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } @@ -276,12 +276,20 @@ void CFWL_ComboBox::SetCurSel(int32_t iSel) { m_iCurSel = bClearSel ? -1 : iSel; } -void CFWL_ComboBox::SetStates(uint32_t dwStates, bool bSet) { +void CFWL_ComboBox::SetStates(uint32_t dwStates) { if (IsDropDownStyle() && m_pEdit) - m_pEdit->SetStates(dwStates, bSet); + m_pEdit->SetStates(dwStates); if (m_pListBox) - m_pListBox->SetStates(dwStates, bSet); - CFWL_Widget::SetStates(dwStates, bSet); + m_pListBox->SetStates(dwStates); + CFWL_Widget::SetStates(dwStates); +} + +void CFWL_ComboBox::RemoveStates(uint32_t dwStates) { + if (IsDropDownStyle() && m_pEdit) + m_pEdit->RemoveStates(dwStates); + if (m_pListBox) + m_pListBox->RemoveStates(dwStates); + CFWL_Widget::RemoveStates(dwStates); } void CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { @@ -319,7 +327,7 @@ void CFWL_ComboBox::GetBBox(CFX_RectF& rect) const { return; CFX_RectF rtList; - m_pListBox->GetWidgetRect(rtList); + m_pListBox->GetWidgetRect(rtList, false); rtList.Offset(rect.left, rect.top); rect.Union(rtList); } @@ -635,14 +643,16 @@ void CFWL_ComboBox::DisForm_ShowDropList(bool bActivate) { SetFocus(true); } - m_pListBox->SetStates(FWL_WGTSTATE_Invisible, !bActivate); if (bActivate) { + m_pListBox->RemoveStates(FWL_WGTSTATE_Invisible); CFWL_Event postEvent(CFWL_Event::Type::PostDropDown, this); DispatchEvent(&postEvent); + } else { + m_pListBox->SetStates(FWL_WGTSTATE_Invisible); } CFX_RectF rect; - m_pListBox->GetWidgetRect(rect); + m_pListBox->GetWidgetRect(rect, false); rect.Inflate(2, 2); Repaint(&rect); } @@ -683,7 +693,7 @@ FWL_WidgetHit CFWL_ComboBox::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { if (m_rtBtn.Contains(fx, fy)) return FWL_WidgetHit::Client; if (DisForm_IsDropListVisible()) { - m_pListBox->GetWidgetRect(rect); + m_pListBox->GetWidgetRect(rect, false); if (rect.Contains(fx, fy)) return FWL_WidgetHit::Client; } @@ -713,7 +723,7 @@ void CFWL_ComboBox::DisForm_DrawWidget(CFX_Graphics* pGraphics, if (m_pEdit) { CFX_RectF rtEdit; - m_pEdit->GetWidgetRect(rtEdit); + m_pEdit->GetWidgetRect(rtEdit, false); CFX_Matrix mt; mt.Set(1, 0, 0, 1, rtEdit.left, rtEdit.top); mt.Concat(mtOrg); @@ -721,7 +731,7 @@ void CFWL_ComboBox::DisForm_DrawWidget(CFX_Graphics* pGraphics, } if (m_pListBox && DisForm_IsDropListVisible()) { CFX_RectF rtList; - m_pListBox->GetWidgetRect(rtList); + m_pListBox->GetWidgetRect(rtList, false); CFX_Matrix mt; mt.Set(1, 0, 0, 1, rtList.left, rtList.top); mt.Concat(mtOrg); @@ -735,7 +745,7 @@ void CFWL_ComboBox::DisForm_GetBBox(CFX_RectF& rect) const { return; CFX_RectF rtList; - m_pListBox->GetWidgetRect(rtList); + m_pListBox->GetWidgetRect(rtList, false); rtList.Offset(rect.left, rect.top); rect.Union(rtList); } diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h index b9f4897586..dda83486a6 100644 --- a/xfa/fwl/core/cfwl_combobox.h +++ b/xfa/fwl/core/cfwl_combobox.h @@ -54,14 +54,14 @@ class CFWL_ComboBox : public CFWL_Widget { // CFWL_Widget FWL_Type GetClassID() const override; - void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override; void ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved) override; - void SetStates(uint32_t dwStates, bool bSet = true) override; + void SetStates(uint32_t dwStates) override; + void RemoveStates(uint32_t dwStates) override; void Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; - void DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; diff --git a/xfa/fwl/core/cfwl_comboboxproxy.cpp b/xfa/fwl/core/cfwl_comboboxproxy.cpp index 4fb6bbb3ac..be45f2b729 100644 --- a/xfa/fwl/core/cfwl_comboboxproxy.cpp +++ b/xfa/fwl/core/cfwl_comboboxproxy.cpp @@ -71,7 +71,7 @@ void CFWL_ComboBoxProxy::OnLButtonDown(CFWL_Message* pMessage) { CFWL_NoteDriver* pDriver = static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); CFX_RectF rtWidget; - GetWidgetRect(rtWidget); + GetWidgetRect(rtWidget, false); rtWidget.left = rtWidget.top = 0; CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); @@ -101,7 +101,7 @@ void CFWL_ComboBoxProxy::OnLButtonUp(CFWL_Message* pMessage) { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); CFX_RectF rect; - GetWidgetRect(rect); + GetWidgetRect(rect, false); rect.left = rect.top = 0; if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) && m_pComboBox->IsDropListVisible()) { diff --git a/xfa/fwl/core/cfwl_combolist.cpp b/xfa/fwl/core/cfwl_combolist.cpp index ad80ac0475..7532da26d7 100644 --- a/xfa/fwl/core/cfwl_combolist.cpp +++ b/xfa/fwl/core/cfwl_combolist.cpp @@ -87,7 +87,7 @@ void CFWL_ComboList::OnProcessMessage(CFWL_Message* pMessage) { CFWL_ScrollBar* vertSB = GetVertScrollBar(); if (IsShowScrollBar(true) && vertSB) { CFX_RectF rect; - vertSB->GetWidgetRect(rect); + vertSB->GetWidgetRect(rect, false); if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { pMsg->m_fx -= rect.left; pMsg->m_fy -= rect.top; @@ -141,7 +141,7 @@ void CFWL_ComboList::OnDropListMouseMove(CFWL_MsgMouse* pMsg) { CFWL_ScrollBar* vertSB = GetVertScrollBar(); if (IsShowScrollBar(true) && vertSB) { CFX_RectF rect; - vertSB->GetWidgetRect(rect); + vertSB->GetWidgetRect(rect, false); if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) return; } @@ -177,7 +177,7 @@ void CFWL_ComboList::OnDropListLButtonUp(CFWL_MsgMouse* pMsg) { CFWL_ScrollBar* vertSB = GetVertScrollBar(); if (IsShowScrollBar(true) && vertSB) { CFX_RectF rect; - vertSB->GetWidgetRect(rect); + vertSB->GetWidgetRect(rect, false); if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) return; } diff --git a/xfa/fwl/core/cfwl_datetimeedit.cpp b/xfa/fwl/core/cfwl_datetimeedit.cpp index dc7aa1faef..fc3edcf52b 100644 --- a/xfa/fwl/core/cfwl_datetimeedit.cpp +++ b/xfa/fwl/core/cfwl_datetimeedit.cpp @@ -51,7 +51,7 @@ void CFWL_DateTimeEdit::DisForm_OnProcessMessage(CFWL_Message* pMessage) { static_cast<CFWL_DateTimePicker*>(m_pOuter); if (pDateTime->IsMonthCalendarVisible()) { CFX_RectF rtInvalidate; - pDateTime->GetWidgetRect(rtInvalidate); + pDateTime->GetWidgetRect(rtInvalidate, false); pDateTime->ShowMonthCalendar(false); rtInvalidate.Offset(-rtInvalidate.left, -rtInvalidate.top); pDateTime->Repaint(&rtInvalidate); diff --git a/xfa/fwl/core/cfwl_datetimepicker.cpp b/xfa/fwl/core/cfwl_datetimepicker.cpp index 28f174c374..29aaaf0a2e 100644 --- a/xfa/fwl/core/cfwl_datetimepicker.cpp +++ b/xfa/fwl/core/cfwl_datetimepicker.cpp @@ -129,7 +129,7 @@ FWL_WidgetHit CFWL_DateTimePicker::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return FWL_WidgetHit::Client; if (IsMonthCalendarVisible()) { CFX_RectF rect; - m_pMonthCal->GetWidgetRect(rect); + m_pMonthCal->GetWidgetRect(rect, false); if (rect.Contains(fx, fy)) return FWL_WidgetHit::Client; } @@ -210,7 +210,7 @@ void CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) const { rect = m_pProperties->m_rtWidget; if (IsMonthCalendarVisible()) { CFX_RectF rtMonth; - m_pMonthCal->GetWidgetRect(rtMonth); + m_pMonthCal->GetWidgetRect(rtMonth, false); rtMonth.Offset(m_pProperties->m_rtWidget.left, m_pProperties->m_rtWidget.top); rect.Union(rtMonth); @@ -268,7 +268,7 @@ void CFWL_DateTimePicker::ShowMonthCalendar(bool bActivate) { } CFX_RectF rtMonth; - m_pMonthCal->GetWidgetRect(rtMonth); + m_pMonthCal->GetWidgetRect(rtMonth, false); CFX_RectF rtAnchor; rtAnchor.Set(0, 0, m_pProperties->m_rtWidget.width, @@ -277,7 +277,10 @@ void CFWL_DateTimePicker::ShowMonthCalendar(bool bActivate) { m_pForm->SetWidgetRect(rtMonth); rtMonth.left = rtMonth.top = 0; - m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible, !bActivate); + if (bActivate) + m_pMonthCal->RemoveStates(FWL_WGTSTATE_Invisible); + else + m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible); m_pMonthCal->SetWidgetRect(rtMonth); m_pMonthCal->Update(); m_pForm->DoModal(); @@ -395,7 +398,10 @@ void CFWL_DateTimePicker::DisForm_ShowMonthCalendar(bool bActivate) { m_pMonthCal->SetSelect(m_iYear, m_iMonth, m_iDay); m_pMonthCal->Update(); } - m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible, !bActivate); + if (bActivate) + m_pMonthCal->RemoveStates(FWL_WGTSTATE_Invisible); + else + m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible); if (bActivate) { CFWL_MsgSetFocus msg(m_pEdit.get(), m_pMonthCal.get()); @@ -405,7 +411,7 @@ void CFWL_DateTimePicker::DisForm_ShowMonthCalendar(bool bActivate) { CFX_RectF rtInvalidate, rtCal; rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, m_pProperties->m_rtWidget.height); - m_pMonthCal->GetWidgetRect(rtCal); + m_pMonthCal->GetWidgetRect(rtCal, false); rtInvalidate.Union(rtCal); rtInvalidate.Inflate(2, 2); Repaint(&rtInvalidate); @@ -423,7 +429,7 @@ FWL_WidgetHit CFWL_DateTimePicker::DisForm_HitTest(FX_FLOAT fx, if (rect.Contains(fx, fy)) return FWL_WidgetHit::Client; if (IsMonthCalendarVisible()) { - m_pMonthCal->GetWidgetRect(rect); + m_pMonthCal->GetWidgetRect(rect, false); if (rect.Contains(fx, fy)) return FWL_WidgetHit::Client; } @@ -482,7 +488,7 @@ void CFWL_DateTimePicker::DisForm_GetBBox(CFX_RectF& rect) const { return; CFX_RectF rtMonth; - m_pMonthCal->GetWidgetRect(rtMonth); + m_pMonthCal->GetWidgetRect(rtMonth, false); rtMonth.Offset(m_pProperties->m_rtWidget.left, m_pProperties->m_rtWidget.top); rect.Union(rtMonth); } @@ -493,7 +499,7 @@ void CFWL_DateTimePicker::DisForm_DrawWidget(CFX_Graphics* pGraphics, return; if (m_pEdit) { CFX_RectF rtEdit; - m_pEdit->GetWidgetRect(rtEdit); + m_pEdit->GetWidgetRect(rtEdit, false); CFX_Matrix mt; mt.Set(1, 0, 0, 1, rtEdit.left, rtEdit.top); @@ -505,7 +511,7 @@ void CFWL_DateTimePicker::DisForm_DrawWidget(CFX_Graphics* pGraphics, return; CFX_RectF rtMonth; - m_pMonthCal->GetWidgetRect(rtMonth); + m_pMonthCal->GetWidgetRect(rtMonth, false); CFX_Matrix mt; mt.Set(1, 0, 0, 1, rtMonth.left, rtMonth.top); if (pMatrix) diff --git a/xfa/fwl/core/cfwl_datetimepicker.h b/xfa/fwl/core/cfwl_datetimepicker.h index 69e4ef3122..985627441d 100644 --- a/xfa/fwl/core/cfwl_datetimepicker.h +++ b/xfa/fwl/core/cfwl_datetimepicker.h @@ -42,11 +42,10 @@ class CFWL_DateTimePicker : public CFWL_Widget { // CFWL_Widget FWL_Type GetClassID() const override; - void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override; void Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; - void DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; void SetThemeProvider(IFWL_ThemeProvider* pTP) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, @@ -89,7 +88,7 @@ class CFWL_DateTimePicker : public CFWL_Widget { FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) const; bool DisForm_IsNeedShowButton() const; void DisForm_Update(); - void DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); + void DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize); void DisForm_GetBBox(CFX_RectF& rect) const; void DisForm_DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr); diff --git a/xfa/fwl/core/cfwl_edit.cpp b/xfa/fwl/core/cfwl_edit.cpp index 0844da3713..a2fee2a4e1 100644 --- a/xfa/fwl/core/cfwl_edit.cpp +++ b/xfa/fwl/core/cfwl_edit.cpp @@ -122,12 +122,12 @@ void CFWL_Edit::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { CFWL_Widget::GetWidgetRect(rect, true); } -void CFWL_Edit::SetStates(uint32_t dwStates, bool bSet) { +void CFWL_Edit::SetStates(uint32_t dwStates) { if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) || (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) { HideCaret(nullptr); } - CFWL_Widget::SetStates(dwStates, bSet); + CFWL_Widget::SetStates(dwStates); } void CFWL_Edit::Update() { @@ -150,13 +150,13 @@ FWL_WidgetHit CFWL_Edit::HitTest(FX_FLOAT fx, FX_FLOAT fy) { if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { if (IsShowScrollBar(true)) { CFX_RectF rect; - m_pVertScrollBar->GetWidgetRect(rect); + m_pVertScrollBar->GetWidgetRect(rect, false); if (rect.Contains(fx, fy)) return FWL_WidgetHit::VScrollBar; } if (IsShowScrollBar(false)) { CFX_RectF rect; - m_pHorzScrollBar->GetWidgetRect(rect); + m_pHorzScrollBar->GetWidgetRect(rect, false); if (rect.Contains(fx, fy)) return FWL_WidgetHit::HScrollBar; } @@ -432,7 +432,7 @@ void CFWL_Edit::On_CaretChanged(CFDE_TxtEdtEngine* pEdit, if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) { CFWL_ScrollBar* pScroll = UpdateScroll(); if (pScroll) { - pScroll->GetWidgetRect(rtInvalid); + pScroll->GetWidgetRect(rtInvalid, false); bRepaintScroll = true; } } @@ -529,13 +529,13 @@ void CFWL_Edit::DrawTextBk(CFX_Graphics* pGraphics, if (!IsShowScrollBar(true) || !IsShowScrollBar(false)) return; - CFX_RectF rtScorll; - m_pHorzScrollBar->GetWidgetRect(rtScorll); + CFX_RectF rtScroll; + m_pHorzScrollBar->GetWidgetRect(rtScroll, false); CFX_RectF rtStatic; - rtStatic.Set(m_rtClient.right() - rtScorll.height, - m_rtClient.bottom() - rtScorll.height, rtScorll.height, - rtScorll.height); + rtStatic.Set(m_rtClient.right() - rtScroll.height, + m_rtClient.bottom() - rtScroll.height, rtScroll.height, + rtScroll.height); param.m_bStaticBackground = true; param.m_bMaximize = true; param.m_rtPart = rtStatic; @@ -914,7 +914,7 @@ CFWL_ScrollBar* CFWL_Edit::UpdateScroll() { CFWL_ScrollBar* pRepaint = nullptr; if (bShowHorz) { CFX_RectF rtScroll; - m_pHorzScrollBar->GetWidgetRect(rtScroll); + m_pHorzScrollBar->GetWidgetRect(rtScroll, false); if (rtScroll.width < rtFDE.width) { m_pHorzScrollBar->LockUpdate(); FX_FLOAT fRange = rtFDE.width - rtScroll.width; @@ -925,14 +925,14 @@ CFWL_ScrollBar* CFWL_Edit::UpdateScroll() { m_pHorzScrollBar->SetTrackPos(fPos); m_pHorzScrollBar->SetPageSize(rtScroll.width); m_pHorzScrollBar->SetStepSize(rtScroll.width / 10); - m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Disabled, false); + m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Disabled); m_pHorzScrollBar->UnlockUpdate(); m_pHorzScrollBar->Update(); pRepaint = m_pHorzScrollBar.get(); } else if ((m_pHorzScrollBar->GetStates() & FWL_WGTSTATE_Disabled) == 0) { m_pHorzScrollBar->LockUpdate(); m_pHorzScrollBar->SetRange(0, -1); - m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Disabled, true); + m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Disabled); m_pHorzScrollBar->UnlockUpdate(); m_pHorzScrollBar->Update(); pRepaint = m_pHorzScrollBar.get(); @@ -941,7 +941,7 @@ CFWL_ScrollBar* CFWL_Edit::UpdateScroll() { if (bShowVert) { CFX_RectF rtScroll; - m_pVertScrollBar->GetWidgetRect(rtScroll); + m_pVertScrollBar->GetWidgetRect(rtScroll, false); if (rtScroll.height < rtFDE.height) { m_pVertScrollBar->LockUpdate(); FX_FLOAT fStep = m_EdtEngine.GetEditParams()->fLineSpace; @@ -953,14 +953,14 @@ CFWL_ScrollBar* CFWL_Edit::UpdateScroll() { m_pVertScrollBar->SetTrackPos(fPos); m_pVertScrollBar->SetPageSize(rtScroll.height); m_pVertScrollBar->SetStepSize(fStep); - m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled, false); + m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Disabled); m_pVertScrollBar->UnlockUpdate(); m_pVertScrollBar->Update(); pRepaint = m_pVertScrollBar.get(); } else if ((m_pVertScrollBar->GetStates() & FWL_WGTSTATE_Disabled) == 0) { m_pVertScrollBar->LockUpdate(); m_pVertScrollBar->SetRange(0, -1); - m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled, true); + m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled); m_pVertScrollBar->UnlockUpdate(); m_pVertScrollBar->Update(); pRepaint = m_pVertScrollBar.get(); @@ -1054,10 +1054,10 @@ void CFWL_Edit::Layout() { } m_pVertScrollBar->SetWidgetRect(rtVertScr); - m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); + m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Invisible); m_pVertScrollBar->Update(); } else if (m_pVertScrollBar) { - m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); + m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible); } if (bShowHorzScrollbar) { @@ -1075,10 +1075,10 @@ void CFWL_Edit::Layout() { m_rtEngine.height -= fWidth; } m_pHorzScrollBar->SetWidgetRect(rtHoriScr); - m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); + m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Invisible); m_pHorzScrollBar->Update(); } else if (m_pHorzScrollBar) { - m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); + m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible); } } @@ -1110,9 +1110,9 @@ void CFWL_Edit::LayoutScrollBar() { m_pVertScrollBar->SetWidgetRect(rtVertScr); m_pVertScrollBar->Update(); } - m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); + m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Invisible); } else if (m_pVertScrollBar) { - m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); + m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible); } if (bShowHorzScrollbar) { @@ -1137,9 +1137,9 @@ void CFWL_Edit::LayoutScrollBar() { m_pHorzScrollBar->SetWidgetRect(rtHoriScr); m_pHorzScrollBar->Update(); } - m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); + m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Invisible); } else if (m_pHorzScrollBar) { - m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); + m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible); } if (bShowVertScrollbar || bShowHorzScrollbar) UpdateScroll(); @@ -1182,7 +1182,7 @@ void CFWL_Edit::ShowCaret(CFX_RectF* pRect) { pOuter = pOuter->GetOuter(); CFX_RectF rtOuter; - pOuter->GetWidgetRect(rtOuter); + pOuter->GetWidgetRect(rtOuter, false); pRect->Offset(rtOuter.left, rtOuter.top); } @@ -1648,7 +1648,7 @@ bool CFWL_Edit::OnScroll(CFWL_ScrollBar* pScrollBar, UpdateCaret(); CFX_RectF rect; - GetWidgetRect(rect); + GetWidgetRect(rect, false); CFX_RectF rtInvalidate; rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); Repaint(&rtInvalidate); diff --git a/xfa/fwl/core/cfwl_edit.h b/xfa/fwl/core/cfwl_edit.h index b8b3b143a3..0e5f0dcbaf 100644 --- a/xfa/fwl/core/cfwl_edit.h +++ b/xfa/fwl/core/cfwl_edit.h @@ -65,12 +65,11 @@ class CFWL_Edit : public CFWL_Widget { // CFWL_Widget: FWL_Type GetClassID() const override; - void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override; void Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; - void SetStates(uint32_t dwStates, bool bSet = true) override; - void DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void SetStates(uint32_t dwStates) override; + void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; diff --git a/xfa/fwl/core/cfwl_form.cpp b/xfa/fwl/core/cfwl_form.cpp index 00d47d4100..1fe5e90b87 100644 --- a/xfa/fwl/core/cfwl_form.cpp +++ b/xfa/fwl/core/cfwl_form.cpp @@ -281,7 +281,7 @@ CFWL_Widget* CFWL_Form::DoModal() { pDriver->PushNoteLoop(m_pNoteLoop.get()); m_bDoModalFlag = true; - SetStates(FWL_WGTSTATE_Invisible, false); + RemoveStates(FWL_WGTSTATE_Invisible); pDriver->Run(); #if _FX_OS_ != _FX_MACOSX_ @@ -310,9 +310,9 @@ void CFWL_Form::EndDoModal() { return; pDriver->PopNoteLoop(); - SetStates(FWL_WGTSTATE_Invisible, true); + SetStates(FWL_WGTSTATE_Invisible); #else - SetStates(FWL_WGTSTATE_Invisible, true); + SetStates(FWL_WGTSTATE_Invisible); m_pNoteLoop->EndModalLoop(); #endif } diff --git a/xfa/fwl/core/cfwl_form.h b/xfa/fwl/core/cfwl_form.h index db09c66bb8..fc7c47be3b 100644 --- a/xfa/fwl/core/cfwl_form.h +++ b/xfa/fwl/core/cfwl_form.h @@ -43,12 +43,11 @@ class CFWL_Form : public CFWL_Widget { // CFWL_Widget FWL_Type GetClassID() const override; bool IsInstance(const CFX_WideStringC& wsClass) const override; - void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override; void GetClientRect(CFX_RectF& rect) override; void Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; - void DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; diff --git a/xfa/fwl/core/cfwl_formproxy.h b/xfa/fwl/core/cfwl_formproxy.h index db8323bf64..9c12597c09 100644 --- a/xfa/fwl/core/cfwl_formproxy.h +++ b/xfa/fwl/core/cfwl_formproxy.h @@ -24,8 +24,7 @@ class CFWL_FormProxy : public CFWL_Form { FWL_Type GetClassID() const override; bool IsInstance(const CFX_WideStringC& wsClass) const override; void Update() override; - void DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; void OnProcessMessage(CFWL_Message* pMessage) override; }; diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp index be9e8b9395..7589623e51 100644 --- a/xfa/fwl/core/cfwl_listbox.cpp +++ b/xfa/fwl/core/cfwl_listbox.cpp @@ -96,13 +96,13 @@ void CFWL_ListBox::Update() { FWL_WidgetHit CFWL_ListBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) { if (IsShowScrollBar(false)) { CFX_RectF rect; - m_pHorzScrollBar->GetWidgetRect(rect); + m_pHorzScrollBar->GetWidgetRect(rect, false); if (rect.Contains(fx, fy)) return FWL_WidgetHit::HScrollBar; } if (IsShowScrollBar(true)) { CFX_RectF rect; - m_pVertScrollBar->GetWidgetRect(rect); + m_pVertScrollBar->GetWidgetRect(rect, false); if (rect.Contains(fx, fy)) return FWL_WidgetHit::VScrollBar; } @@ -645,13 +645,13 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) { if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_ShowScrollBarFocus) == 0 || (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused)) { - m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); + m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Invisible); } m_pVertScrollBar->Update(); } else if (m_pVertScrollBar) { m_pVertScrollBar->SetPos(0); m_pVertScrollBar->SetTrackPos(0); - m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); + m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible); } if (bShowHorzScr) { if (!m_pHorzScrollBar) @@ -676,13 +676,13 @@ CFX_SizeF CFWL_ListBox::CalcSize(bool bAutoSize) { if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_ShowScrollBarFocus) == 0 || (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused)) { - m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); + m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Invisible); } m_pHorzScrollBar->Update(); } else if (m_pHorzScrollBar) { m_pHorzScrollBar->SetPos(0); m_pHorzScrollBar->SetTrackPos(0); - m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); + m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible); } if (bShowVertScr && bShowHorzScr) { m_rtStatic.Set(m_rtClient.right() - m_fScorllBarWidth, @@ -830,10 +830,18 @@ void CFWL_ListBox::OnDrawWidget(CFX_Graphics* pGraphics, void CFWL_ListBox::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { if (GetStylesEx() & FWL_STYLEEXT_LTB_ShowScrollBarFocus) { - if (m_pVertScrollBar) - m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, !bSet); - if (m_pHorzScrollBar) - m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, !bSet); + if (m_pVertScrollBar) { + if (bSet) + m_pVertScrollBar->RemoveStates(FWL_WGTSTATE_Invisible); + else + m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible); + } + if (m_pHorzScrollBar) { + if (bSet) + m_pHorzScrollBar->RemoveStates(FWL_WGTSTATE_Invisible); + else + m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible); + } } if (bSet) m_pProperties->m_dwStates |= (FWL_WGTSTATE_Focused); diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h index d2f439e108..e9e59ebc10 100644 --- a/xfa/fwl/core/cfwl_listbox.h +++ b/xfa/fwl/core/cfwl_listbox.h @@ -47,11 +47,10 @@ class CFWL_ListBox : public CFWL_Widget { // CFWL_Widget FWL_Type GetClassID() const override; - void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override; void Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; - void DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; diff --git a/xfa/fwl/core/cfwl_monthcalendar.cpp b/xfa/fwl/core/cfwl_monthcalendar.cpp index a550d310c4..76426cd5be 100644 --- a/xfa/fwl/core/cfwl_monthcalendar.cpp +++ b/xfa/fwl/core/cfwl_monthcalendar.cpp @@ -995,7 +995,7 @@ void CFWL_MonthCalendar::OnLButtonUp(CFWL_MsgMouse* pMsg) { int32_t iCurSel = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); CFX_RectF rt; CFWL_DateTimePicker* pIPicker = static_cast<CFWL_DateTimePicker*>(m_pOuter); - pIPicker->GetFormProxy()->GetWidgetRect(rt); + pIPicker->GetFormProxy()->GetWidgetRect(rt, false); rt.Set(0, 0, rt.width, rt.height); if (iCurSel > 0) { DATEINFO* lpDatesInfo = m_arrDates.GetAt(iCurSel - 1); diff --git a/xfa/fwl/core/cfwl_monthcalendar.h b/xfa/fwl/core/cfwl_monthcalendar.h index 6c004aa236..1a983abdfb 100644 --- a/xfa/fwl/core/cfwl_monthcalendar.h +++ b/xfa/fwl/core/cfwl_monthcalendar.h @@ -35,10 +35,9 @@ class CFWL_MonthCalendar : public CFWL_Widget { // FWL_WidgetImp FWL_Type GetClassID() const override; - void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override; void Update() override; - void DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; diff --git a/xfa/fwl/core/cfwl_picturebox.h b/xfa/fwl/core/cfwl_picturebox.h index f4097336fa..37127048de 100644 --- a/xfa/fwl/core/cfwl_picturebox.h +++ b/xfa/fwl/core/cfwl_picturebox.h @@ -37,10 +37,9 @@ class CFWL_PictureBox : public CFWL_Widget { // CFWL_Widget FWL_Type GetClassID() const override; - void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override; void Update() override; - void DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; diff --git a/xfa/fwl/core/cfwl_pushbutton.cpp b/xfa/fwl/core/cfwl_pushbutton.cpp index 295de1e07e..9e1e693ff0 100644 --- a/xfa/fwl/core/cfwl_pushbutton.cpp +++ b/xfa/fwl/core/cfwl_pushbutton.cpp @@ -51,12 +51,12 @@ void CFWL_PushButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { CFWL_Widget::GetWidgetRect(rect, true); } -void CFWL_PushButton::SetStates(uint32_t dwStates, bool bSet) { - if ((dwStates & FWL_WGTSTATE_Disabled) && bSet) { +void CFWL_PushButton::SetStates(uint32_t dwStates) { + if (dwStates & FWL_WGTSTATE_Disabled) { m_pProperties->m_dwStates = FWL_WGTSTATE_Disabled; return; } - CFWL_Widget::SetStates(dwStates, bSet); + CFWL_Widget::SetStates(dwStates); } void CFWL_PushButton::Update() { diff --git a/xfa/fwl/core/cfwl_pushbutton.h b/xfa/fwl/core/cfwl_pushbutton.h index 3bfae6c42b..68f2278258 100644 --- a/xfa/fwl/core/cfwl_pushbutton.h +++ b/xfa/fwl/core/cfwl_pushbutton.h @@ -39,11 +39,10 @@ class CFWL_PushButton : public CFWL_Widget { // CFWL_Widget FWL_Type GetClassID() const override; - void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; - void SetStates(uint32_t dwStates, bool bSet = true) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override; + void SetStates(uint32_t dwStates) override; void Update() override; - void DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; diff --git a/xfa/fwl/core/cfwl_scrollbar.h b/xfa/fwl/core/cfwl_scrollbar.h index 98bcaf2178..5e9c0b5df2 100644 --- a/xfa/fwl/core/cfwl_scrollbar.h +++ b/xfa/fwl/core/cfwl_scrollbar.h @@ -29,10 +29,9 @@ class CFWL_ScrollBar : public CFWL_Widget { // CFWL_Widget FWL_Type GetClassID() const override; - void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override; void Update() override; - void DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; diff --git a/xfa/fwl/core/cfwl_spinbutton.h b/xfa/fwl/core/cfwl_spinbutton.h index 391d55c3e8..2993663a58 100644 --- a/xfa/fwl/core/cfwl_spinbutton.h +++ b/xfa/fwl/core/cfwl_spinbutton.h @@ -26,11 +26,10 @@ class CFWL_SpinButton : public CFWL_Widget { // CFWL_Widget FWL_Type GetClassID() const override; - void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void GetWidgetRect(CFX_RectF& rect, bool bAutoSize) override; void Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; - void DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; diff --git a/xfa/fwl/core/cfwl_widget.cpp b/xfa/fwl/core/cfwl_widget.cpp index d487aadb9d..8989563112 100644 --- a/xfa/fwl/core/cfwl_widget.cpp +++ b/xfa/fwl/core/cfwl_widget.cpp @@ -136,10 +136,9 @@ static void NotifyHideChildWidget(CFWL_WidgetMgr* widgetMgr, } } -void CFWL_Widget::SetStates(uint32_t dwStates, bool bSet) { - bSet ? (m_pProperties->m_dwStates |= dwStates) - : (m_pProperties->m_dwStates &= ~dwStates); - if (!(dwStates & FWL_WGTSTATE_Invisible) || !bSet) +void CFWL_Widget::SetStates(uint32_t dwStates) { + m_pProperties->m_dwStates |= dwStates; + if (!(dwStates & FWL_WGTSTATE_Invisible)) return; CFWL_NoteDriver* noteDriver = @@ -155,6 +154,10 @@ void CFWL_Widget::SetStates(uint32_t dwStates, bool bSet) { return; } +void CFWL_Widget::RemoveStates(uint32_t dwStates) { + m_pProperties->m_dwStates &= ~dwStates; +} + FWL_WidgetHit CFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { CFX_RectF rtClient; GetClientRect(rtClient); @@ -195,7 +198,7 @@ void CFWL_Widget::TransformTo(CFWL_Widget* pWidget, CFX_Matrix m; CFWL_Widget* parent = GetParent(); if (parent) { - GetWidgetRect(r); + GetWidgetRect(r, false); fx += r.left; fy += r.top; GetMatrix(m, true); @@ -205,7 +208,7 @@ void CFWL_Widget::TransformTo(CFWL_Widget* pWidget, if (!form1) return; if (!pWidget) { - form1->GetWidgetRect(r); + form1->GetWidgetRect(r, false); fx += r.left; fy += r.top; return; @@ -214,10 +217,10 @@ void CFWL_Widget::TransformTo(CFWL_Widget* pWidget, if (!form2) return; if (form1 != form2) { - form1->GetWidgetRect(r); + form1->GetWidgetRect(r, false); fx += r.left; fy += r.top; - form2->GetWidgetRect(r); + form2->GetWidgetRect(r, false); fx -= r.left; fy -= r.top; } @@ -228,7 +231,7 @@ void CFWL_Widget::TransformTo(CFWL_Widget* pWidget, m1.SetIdentity(); m1.SetReverse(m); m1.TransformPoint(fx, fy); - pWidget->GetWidgetRect(r); + pWidget->GetWidgetRect(r, false); fx -= r.left; fy -= r.top; } @@ -255,7 +258,7 @@ void CFWL_Widget::GetMatrix(CFX_Matrix& matrix, bool bGlobal) { for (int32_t i = count - 2; i >= 0; i--) { parent = parents.GetAt(i); parent->GetMatrix(ctmOnParent, false); - parent->GetWidgetRect(rect); + parent->GetWidgetRect(rect, false); matrix.Concat(ctmOnParent, true); matrix.Translate(rect.left, rect.top, true); } @@ -684,7 +687,7 @@ CFX_SizeF CFWL_Widget::GetOffsetFromParent(CFWL_Widget* pParent) { CFWL_Widget* pDstWidget = GetParent(); while (pDstWidget && pDstWidget != pParent) { CFX_RectF rtDst; - pDstWidget->GetWidgetRect(rtDst); + pDstWidget->GetWidgetRect(rtDst, false); szRet += CFX_SizeF(rtDst.left, rtDst.top); pDstWidget = pWidgetMgr->GetParentWidget(pDstWidget); } diff --git a/xfa/fwl/core/cfwl_widget.h b/xfa/fwl/core/cfwl_widget.h index 5e9660c6de..a17c623b53 100644 --- a/xfa/fwl/core/cfwl_widget.h +++ b/xfa/fwl/core/cfwl_widget.h @@ -51,15 +51,16 @@ class CFWL_Widget : public IFWL_WidgetDelegate { virtual FWL_Type GetClassID() const = 0; virtual bool IsInstance(const CFX_WideStringC& wsClass) const; - virtual void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); + virtual void GetWidgetRect(CFX_RectF& rect, bool bAutoSize); virtual void GetClientRect(CFX_RectF& rect); virtual void ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); - virtual void SetStates(uint32_t dwStates, bool bSet = true); + virtual void SetStates(uint32_t dwStates); + virtual void RemoveStates(uint32_t dwStates); virtual void Update() = 0; virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); virtual void DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) = 0; + const CFX_Matrix* pMatrix) = 0; virtual void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); // IFWL_WidgetDelegate. diff --git a/xfa/fwl/core/cfwl_widgetmgr.cpp b/xfa/fwl/core/cfwl_widgetmgr.cpp index 1514aeedff..fc9f150ac3 100644 --- a/xfa/fwl/core/cfwl_widgetmgr.cpp +++ b/xfa/fwl/core/cfwl_widgetmgr.cpp @@ -184,7 +184,7 @@ void CFWL_WidgetMgr::RepaintWidget(CFWL_Widget* pWidget, CFWL_Widget* pOuter = pWidget->GetOuter(); while (pOuter) { CFX_RectF rtTemp; - pNative->GetWidgetRect(rtTemp); + pNative->GetWidgetRect(rtTemp, false); rect.left += rtTemp.left; rect.top += rtTemp.top; pNative = pOuter; @@ -333,7 +333,7 @@ CFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(CFWL_Widget* parent, m.SetReverse(matrixOnParent); m.TransformPoint(x1, y1); CFX_RectF bounds; - child->GetWidgetRect(bounds); + child->GetWidgetRect(bounds, false); if (bounds.Contains(x1, y1)) { x1 -= bounds.left; y1 -= bounds.top; @@ -502,7 +502,7 @@ void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget, CFX_Graphics* pTemp = DrawWidgetBefore(pWidget, pGraphics, pMatrix); CFX_RectF clipCopy; - pWidget->GetWidgetRect(clipCopy); + pWidget->GetWidgetRect(clipCopy, false); clipCopy.left = clipCopy.top = 0; if (UseOffscreenDirect(pWidget)) { @@ -556,7 +556,7 @@ void CFWL_WidgetMgr::DrawChild(CFWL_Widget* parent, continue; CFX_RectF rtWidget; - child->GetWidgetRect(rtWidget); + child->GetWidgetRect(rtWidget, false); if (rtWidget.IsEmpty()) continue; @@ -601,7 +601,7 @@ CFX_Graphics* CFWL_WidgetMgr::DrawWidgetBefore(CFWL_Widget* pWidget, if (!pItem->pOffscreen) { pItem->pOffscreen.reset(new CFX_Graphics); CFX_RectF rect; - pWidget->GetWidgetRect(rect); + pWidget->GetWidgetRect(rect, false); pItem->pOffscreen->Create((int32_t)rect.width, (int32_t)rect.height, FXDIB_Argb); } @@ -637,7 +637,7 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget, } CFX_RectF rtWidget; - pWidget->GetWidgetRect(rtWidget); + pWidget->GetWidgetRect(rtWidget, false); rtWidget.left = rtWidget.top = 0; pMatrix->TransformRect(rtWidget); if (!rtWidget.IntersectWith(rtDirty)) @@ -674,7 +674,7 @@ bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget, rtWidget.height + rtWidget.top; do { CFX_RectF rect; - pChild->GetWidgetRect(rect); + pChild->GetWidgetRect(rect, false); CFX_RectF r = rect; r.left += rtWidget.left; r.top += rtWidget.top; @@ -735,7 +735,7 @@ bool CFWL_WidgetMgr::UseOffscreenDirect(CFWL_Widget* pWidget) const { #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) if (pItem->bOutsideChanged) { CFX_RectF r; - pWidget->GetWidgetRect(r); + pWidget->GetWidgetRect(r, false); CFX_RectF temp(m_rtScreen); temp.Deflate(50, 50); if (!temp.Contains(r)) |