diff options
author | tsepez <tsepez@chromium.org> | 2016-11-02 15:43:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-02 15:43:19 -0700 |
commit | d19e912dd469e4bdad9f3020e1f6eb98f10f3470 (patch) | |
tree | 239cb568a80445f14a1ab9b63dcaaddcce67e1cc /xfa/fwl/core | |
parent | 12f3e4a58f05850b93af35619cb04f0231d86acc (diff) | |
download | pdfium-d19e912dd469e4bdad9f3020e1f6eb98f10f3470.tar.xz |
Remove FX_BOOL from xfa.
Review-Url: https://codereview.chromium.org/2467203003
Diffstat (limited to 'xfa/fwl/core')
60 files changed, 1371 insertions, 1383 deletions
diff --git a/xfa/fwl/core/cfwl_barcode.cpp b/xfa/fwl/core/cfwl_barcode.cpp index a23bd16df3..d738f68955 100644 --- a/xfa/fwl/core/cfwl_barcode.cpp +++ b/xfa/fwl/core/cfwl_barcode.cpp @@ -48,11 +48,11 @@ void CFWL_Barcode::SetDataLength(int32_t dataLength) { m_barcodeData.m_nDataLength = dataLength; ToBarcode(GetWidget())->SetLimit(dataLength); } -void CFWL_Barcode::SetCalChecksum(FX_BOOL calChecksum) { +void CFWL_Barcode::SetCalChecksum(bool calChecksum) { m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CALCHECKSUM; m_barcodeData.m_bCalChecksum = calChecksum; } -void CFWL_Barcode::SetPrintChecksum(FX_BOOL printChecksum) { +void CFWL_Barcode::SetPrintChecksum(bool printChecksum) { m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_PRINTCHECKSUM; m_barcodeData.m_bPrintChecksum = printChecksum; } @@ -80,7 +80,7 @@ void CFWL_Barcode::SetErrorCorrectionLevel(int32_t ecLevel) { m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_ECLEVEL; m_barcodeData.m_nECLevel = ecLevel; } -void CFWL_Barcode::SetTruncated(FX_BOOL truncated) { +void CFWL_Barcode::SetTruncated(bool truncated) { m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_TRUNCATED; m_barcodeData.m_bTruncated = truncated; } @@ -93,8 +93,8 @@ void CFWL_Barcode::SetType(BC_TYPE type) { ToBarcode(GetWidget())->SetType(type); } -FX_BOOL CFWL_Barcode::IsProtectedType() { - return GetWidget() ? ToBarcode(GetWidget())->IsProtectedType() : FALSE; +bool CFWL_Barcode::IsProtectedType() { + return GetWidget() ? ToBarcode(GetWidget())->IsProtectedType() : false; } CFWL_Barcode::CFWL_BarcodeDP::CFWL_BarcodeDP() @@ -121,11 +121,11 @@ int32_t CFWL_Barcode::CFWL_BarcodeDP::GetDataLength() const { return m_nDataLength; } -FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetCalChecksum() const { +bool CFWL_Barcode::CFWL_BarcodeDP::GetCalChecksum() const { return m_bCalChecksum; } -FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetPrintChecksum() const { +bool CFWL_Barcode::CFWL_BarcodeDP::GetPrintChecksum() const { return m_bPrintChecksum; } @@ -153,7 +153,7 @@ int32_t CFWL_Barcode::CFWL_BarcodeDP::GetErrorCorrectionLevel() const { return m_nECLevel; } -FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetTruncated() const { +bool CFWL_Barcode::CFWL_BarcodeDP::GetTruncated() const { return m_bTruncated; } diff --git a/xfa/fwl/core/cfwl_barcode.h b/xfa/fwl/core/cfwl_barcode.h index 06b52c2112..8df93ff628 100644 --- a/xfa/fwl/core/cfwl_barcode.h +++ b/xfa/fwl/core/cfwl_barcode.h @@ -22,21 +22,21 @@ class CFWL_Barcode : public CFWL_Edit { void Initialize(); void SetType(BC_TYPE type); - FX_BOOL IsProtectedType(); + bool IsProtectedType(); void SetCharEncoding(BC_CHAR_ENCODING encoding); void SetModuleHeight(int32_t height); void SetModuleWidth(int32_t width); void SetDataLength(int32_t dataLength); - void SetCalChecksum(FX_BOOL calChecksum); - void SetPrintChecksum(FX_BOOL printChecksum); + void SetCalChecksum(bool calChecksum); + void SetPrintChecksum(bool printChecksum); void SetTextLocation(BC_TEXT_LOC location); void SetWideNarrowRatio(int32_t ratio); void SetStartChar(FX_CHAR startChar); void SetEndChar(FX_CHAR endChar); void SetVersion(int32_t version); void SetErrorCorrectionLevel(int32_t ecLevel); - void SetTruncated(FX_BOOL truncated); + void SetTruncated(bool truncated); void ResetBarcodeAttributes(); protected: @@ -53,30 +53,30 @@ class CFWL_Barcode : public CFWL_Edit { int32_t GetModuleHeight() const override; int32_t GetModuleWidth() const override; int32_t GetDataLength() const override; - FX_BOOL GetCalChecksum() const override; - FX_BOOL GetPrintChecksum() const override; + bool GetCalChecksum() const override; + bool GetPrintChecksum() const override; BC_TEXT_LOC GetTextLocation() const override; int32_t GetWideNarrowRatio() const override; FX_CHAR GetStartChar() const override; FX_CHAR GetEndChar() const override; int32_t GetVersion() const override; int32_t GetErrorCorrectionLevel() const override; - FX_BOOL GetTruncated() const override; + bool GetTruncated() const override; uint32_t GetBarcodeAttributeMask() const override; BC_CHAR_ENCODING m_eCharEncoding; int32_t m_nModuleHeight; int32_t m_nModuleWidth; int32_t m_nDataLength; - FX_BOOL m_bCalChecksum; - FX_BOOL m_bPrintChecksum; + bool m_bCalChecksum; + bool m_bPrintChecksum; BC_TEXT_LOC m_eTextLocation; int32_t m_nWideNarrowRatio; FX_CHAR m_cStartChar; FX_CHAR m_cEndChar; int32_t m_nVersion; int32_t m_nECLevel; - FX_BOOL m_bTruncated; + bool m_bTruncated; uint32_t m_dwAttributeMask; }; diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp index 3d45842872..e8dde06039 100644 --- a/xfa/fwl/core/cfwl_combobox.cpp +++ b/xfa/fwl/core/cfwl_combobox.cpp @@ -132,12 +132,12 @@ FWL_Error CFWL_ComboBox::EditDoClipboard(int32_t iCmd) { : FWL_Error::Indefinite; } -FX_BOOL CFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) { - return GetWidget() ? ToComboBox(GetWidget())->EditRedo(pRecord) : FALSE; +bool CFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) { + return GetWidget() ? ToComboBox(GetWidget())->EditRedo(pRecord) : false; } -FX_BOOL CFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) { - return GetWidget() ? ToComboBox(GetWidget())->EditUndo(pRecord) : FALSE; +bool CFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) { + return GetWidget() ? ToComboBox(GetWidget())->EditUndo(pRecord) : false; } FWL_Error CFWL_ComboBox::SetMaxListHeight(FX_FLOAT fMaxHeight) { @@ -164,64 +164,64 @@ FWL_Error CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { return ToComboBox(GetWidget())->GetListBoxt()->SetThemeProvider(pTheme); } -FX_BOOL CFWL_ComboBox::AfterFocusShowDropList() { +bool CFWL_ComboBox::AfterFocusShowDropList() { return ToComboBox(GetWidget())->AfterFocusShowDropList(); } -FWL_Error CFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) { +FWL_Error CFWL_ComboBox::OpenDropDownList(bool bActivate) { return ToComboBox(GetWidget())->OpenDropDownList(bActivate); } -FX_BOOL CFWL_ComboBox::EditCanUndo() { - return GetWidget() ? ToComboBox(GetWidget())->EditCanUndo() : FALSE; +bool CFWL_ComboBox::EditCanUndo() { + return GetWidget() ? ToComboBox(GetWidget())->EditCanUndo() : false; } -FX_BOOL CFWL_ComboBox::EditCanRedo() { - return GetWidget() ? ToComboBox(GetWidget())->EditCanRedo() : FALSE; +bool CFWL_ComboBox::EditCanRedo() { + return GetWidget() ? ToComboBox(GetWidget())->EditCanRedo() : false; } -FX_BOOL CFWL_ComboBox::EditUndo() { - return GetWidget() ? ToComboBox(GetWidget())->EditUndo() : FALSE; +bool CFWL_ComboBox::EditUndo() { + return GetWidget() ? ToComboBox(GetWidget())->EditUndo() : false; } -FX_BOOL CFWL_ComboBox::EditRedo() { - return GetWidget() ? ToComboBox(GetWidget())->EditRedo() : FALSE; +bool CFWL_ComboBox::EditRedo() { + return GetWidget() ? ToComboBox(GetWidget())->EditRedo() : false; } -FX_BOOL CFWL_ComboBox::EditCanCopy() { - return GetWidget() ? ToComboBox(GetWidget())->EditCanCopy() : FALSE; +bool CFWL_ComboBox::EditCanCopy() { + return GetWidget() ? ToComboBox(GetWidget())->EditCanCopy() : false; } -FX_BOOL CFWL_ComboBox::EditCanCut() { - return GetWidget() ? ToComboBox(GetWidget())->EditCanCut() : FALSE; +bool CFWL_ComboBox::EditCanCut() { + return GetWidget() ? ToComboBox(GetWidget())->EditCanCut() : false; } -FX_BOOL CFWL_ComboBox::EditCanSelectAll() { - return GetWidget() ? ToComboBox(GetWidget())->EditCanSelectAll() : FALSE; +bool CFWL_ComboBox::EditCanSelectAll() { + return GetWidget() ? ToComboBox(GetWidget())->EditCanSelectAll() : false; } -FX_BOOL CFWL_ComboBox::EditCopy(CFX_WideString& wsCopy) { - return GetWidget() ? ToComboBox(GetWidget())->EditCopy(wsCopy) : FALSE; +bool CFWL_ComboBox::EditCopy(CFX_WideString& wsCopy) { + return GetWidget() ? ToComboBox(GetWidget())->EditCopy(wsCopy) : false; } -FX_BOOL CFWL_ComboBox::EditCut(CFX_WideString& wsCut) { - return GetWidget() ? ToComboBox(GetWidget())->EditCut(wsCut) : FALSE; +bool CFWL_ComboBox::EditCut(CFX_WideString& wsCut) { + return GetWidget() ? ToComboBox(GetWidget())->EditCut(wsCut) : false; } -FX_BOOL CFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) { - return GetWidget() ? ToComboBox(GetWidget())->EditPaste(wsPaste) : FALSE; +bool CFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) { + return GetWidget() ? ToComboBox(GetWidget())->EditPaste(wsPaste) : false; } -FX_BOOL CFWL_ComboBox::EditSelectAll() { - return GetWidget() ? ToComboBox(GetWidget())->EditSelectAll() : FALSE; +bool CFWL_ComboBox::EditSelectAll() { + return GetWidget() ? ToComboBox(GetWidget())->EditSelectAll() : false; } -FX_BOOL CFWL_ComboBox::EditDelete() { - return GetWidget() ? ToComboBox(GetWidget())->EditDelete() : FALSE; +bool CFWL_ComboBox::EditDelete() { + return GetWidget() ? ToComboBox(GetWidget())->EditDelete() : false; } -FX_BOOL CFWL_ComboBox::EditDeSelect() { - return GetWidget() ? ToComboBox(GetWidget())->EditDeSelect() : FALSE; +bool CFWL_ComboBox::EditDeSelect() { + return GetWidget() ? ToComboBox(GetWidget())->EditDeSelect() : false; } FWL_Error CFWL_ComboBox::GetBBox(CFX_RectF& rect) { @@ -273,14 +273,14 @@ int32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIndex(IFWL_Widget* pWidget, return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1; } -FX_BOOL CFWL_ComboBox::CFWL_ComboBoxDP::SetItemIndex(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - int32_t nIndex) { +bool CFWL_ComboBox::CFWL_ComboBoxDP::SetItemIndex(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + int32_t nIndex) { if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size()) - return FALSE; + return false; m_ItemArray[nIndex].reset(static_cast<CFWL_ComboBoxItem*>(pItem)); - return TRUE; + return true; } uint32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemStyles(IFWL_Widget* pWidget, diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h index 82f1165dae..9511a36f3d 100644 --- a/xfa/fwl/core/cfwl_combobox.h +++ b/xfa/fwl/core/cfwl_combobox.h @@ -43,28 +43,28 @@ class CFWL_ComboBox : public CFWL_Widget { int32_t GetEditLimit(); FWL_Error SetEditLimit(int32_t nLimit); FWL_Error EditDoClipboard(int32_t iCmd); - FX_BOOL EditRedo(const IFDE_TxtEdtDoRecord* pRecord); - FX_BOOL EditUndo(const IFDE_TxtEdtDoRecord* pRecord); + bool EditRedo(const IFDE_TxtEdtDoRecord* pRecord); + bool EditUndo(const IFDE_TxtEdtDoRecord* pRecord); FWL_Error SetMaxListHeight(FX_FLOAT fMaxHeight); FWL_Error SetItemData(int32_t iIndex, void* pData); void* GetItemData(int32_t iIndex); FWL_Error SetListTheme(IFWL_ThemeProvider* pTheme); - FX_BOOL AfterFocusShowDropList(); - FWL_Error OpenDropDownList(FX_BOOL bActivate); - - FX_BOOL EditCanUndo(); - FX_BOOL EditCanRedo(); - FX_BOOL EditUndo(); - FX_BOOL EditRedo(); - FX_BOOL EditCanCopy(); - FX_BOOL EditCanCut(); - FX_BOOL EditCanSelectAll(); - FX_BOOL EditCopy(CFX_WideString& wsCopy); - FX_BOOL EditCut(CFX_WideString& wsCut); - FX_BOOL EditPaste(const CFX_WideString& wsPaste); - FX_BOOL EditSelectAll(); - FX_BOOL EditDelete(); - FX_BOOL EditDeSelect(); + bool AfterFocusShowDropList(); + FWL_Error OpenDropDownList(bool bActivate); + + bool EditCanUndo(); + bool EditCanRedo(); + bool EditUndo(); + bool EditRedo(); + bool EditCanCopy(); + bool EditCanCut(); + bool EditCanSelectAll(); + bool EditCopy(CFX_WideString& wsCopy); + bool EditCut(CFX_WideString& wsCut); + bool EditPaste(const CFX_WideString& wsPaste); + bool EditSelectAll(); + bool EditDelete(); + bool EditDeSelect(); FWL_Error GetBBox(CFX_RectF& rect); FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); @@ -83,9 +83,9 @@ class CFWL_ComboBox : public CFWL_Widget { int32_t CountItems(const IFWL_Widget* pWidget) override; IFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override; int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; - FX_BOOL SetItemIndex(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - int32_t nIndex) override; + bool SetItemIndex(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + int32_t nIndex) override; uint32_t GetItemStyles(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; FWL_Error GetItemText(IFWL_Widget* pWidget, diff --git a/xfa/fwl/core/cfwl_datetimepicker.cpp b/xfa/fwl/core/cfwl_datetimepicker.cpp index 973e06ea4b..8e377c2ca9 100644 --- a/xfa/fwl/core/cfwl_datetimepicker.cpp +++ b/xfa/fwl/core/cfwl_datetimepicker.cpp @@ -96,55 +96,55 @@ FWL_Error CFWL_DateTimePicker::CFWL_DateTimePickerDP::GetToday( return FWL_Error::Succeeded; } -FX_BOOL CFWL_DateTimePicker::CanUndo() { +bool CFWL_DateTimePicker::CanUndo() { return ToDateTimePicker(GetWidget())->CanUndo(); } -FX_BOOL CFWL_DateTimePicker::CanRedo() { +bool CFWL_DateTimePicker::CanRedo() { return ToDateTimePicker(GetWidget())->CanRedo(); } -FX_BOOL CFWL_DateTimePicker::Undo() { +bool CFWL_DateTimePicker::Undo() { return ToDateTimePicker(GetWidget())->Undo(); } -FX_BOOL CFWL_DateTimePicker::Redo() { +bool CFWL_DateTimePicker::Redo() { return ToDateTimePicker(GetWidget())->Redo(); } -FX_BOOL CFWL_DateTimePicker::CanCopy() { +bool CFWL_DateTimePicker::CanCopy() { return ToDateTimePicker(GetWidget())->CanCopy(); } -FX_BOOL CFWL_DateTimePicker::CanCut() { +bool CFWL_DateTimePicker::CanCut() { return ToDateTimePicker(GetWidget())->CanCut(); } -FX_BOOL CFWL_DateTimePicker::CanSelectAll() { +bool CFWL_DateTimePicker::CanSelectAll() { return ToDateTimePicker(GetWidget())->CanSelectAll(); } -FX_BOOL CFWL_DateTimePicker::Copy(CFX_WideString& wsCopy) { +bool CFWL_DateTimePicker::Copy(CFX_WideString& wsCopy) { return ToDateTimePicker(GetWidget())->Copy(wsCopy); } -FX_BOOL CFWL_DateTimePicker::Cut(CFX_WideString& wsCut) { +bool CFWL_DateTimePicker::Cut(CFX_WideString& wsCut) { return ToDateTimePicker(GetWidget())->Copy(wsCut); } -FX_BOOL CFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) { +bool CFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) { return ToDateTimePicker(GetWidget())->Paste(wsPaste); } -FX_BOOL CFWL_DateTimePicker::SelectAll() { +bool CFWL_DateTimePicker::SelectAll() { return ToDateTimePicker(GetWidget())->SelectAll(); } -FX_BOOL CFWL_DateTimePicker::Delete() { +bool CFWL_DateTimePicker::Delete() { return ToDateTimePicker(GetWidget())->Delete(); } -FX_BOOL CFWL_DateTimePicker::DeSelect() { +bool CFWL_DateTimePicker::DeSelect() { return ToDateTimePicker(GetWidget())->DeSelect(); } diff --git a/xfa/fwl/core/cfwl_datetimepicker.h b/xfa/fwl/core/cfwl_datetimepicker.h index e189e969a0..327364ce6a 100644 --- a/xfa/fwl/core/cfwl_datetimepicker.h +++ b/xfa/fwl/core/cfwl_datetimepicker.h @@ -24,19 +24,19 @@ class CFWL_DateTimePicker : public CFWL_Widget { int32_t GetSelRange(int32_t nIndex, int32_t& nStart); FWL_Error GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); FWL_Error SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); - FX_BOOL CanUndo(); - FX_BOOL CanRedo(); - FX_BOOL Undo(); - FX_BOOL Redo(); - FX_BOOL CanCopy(); - FX_BOOL CanCut(); - FX_BOOL CanSelectAll(); - FX_BOOL Copy(CFX_WideString& wsCopy); - FX_BOOL Cut(CFX_WideString& wsCut); - FX_BOOL Paste(const CFX_WideString& wsPaste); - FX_BOOL SelectAll(); - FX_BOOL Delete(); - FX_BOOL DeSelect(); + bool CanUndo(); + bool CanRedo(); + bool Undo(); + bool Redo(); + bool CanCopy(); + bool CanCut(); + bool CanSelectAll(); + bool Copy(CFX_WideString& wsCopy); + bool Cut(CFX_WideString& wsCut); + bool Paste(const CFX_WideString& wsPaste); + bool SelectAll(); + bool Delete(); + bool DeSelect(); FWL_Error GetBBox(CFX_RectF& rect); FWL_Error SetEditLimit(int32_t nLimit); FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, diff --git a/xfa/fwl/core/cfwl_edit.cpp b/xfa/fwl/core/cfwl_edit.cpp index 4b6769e2b1..3d19e57f29 100644 --- a/xfa/fwl/core/cfwl_edit.cpp +++ b/xfa/fwl/core/cfwl_edit.cpp @@ -68,7 +68,7 @@ int32_t CFWL_Edit::GetCaretPos() const { return ToEdit(GetWidget())->GetCaretPos(); } -int32_t CFWL_Edit::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) { +int32_t CFWL_Edit::SetCaretPos(int32_t nIndex, bool bBefore) { if (!GetWidget()) return -1; return ToEdit(GetWidget())->SetCaretPos(nIndex, bBefore); @@ -158,15 +158,15 @@ FWL_Error CFWL_Edit::DoClipboard(int32_t iCmd) { return ToEdit(GetWidget())->DoClipboard(iCmd); } -FX_BOOL CFWL_Edit::Redo(const IFDE_TxtEdtDoRecord* pRecord) { +bool CFWL_Edit::Redo(const IFDE_TxtEdtDoRecord* pRecord) { return GetWidget() && ToEdit(GetWidget())->Redo(pRecord); } -FX_BOOL CFWL_Edit::Undo(const IFDE_TxtEdtDoRecord* pRecord) { +bool CFWL_Edit::Undo(const IFDE_TxtEdtDoRecord* pRecord) { return GetWidget() && ToEdit(GetWidget())->Undo(pRecord); } -FWL_Error CFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { +FWL_Error CFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant) { if (!GetWidget()) return FWL_Error::Indefinite; return ToEdit(GetWidget())->SetTabWidth(fTabWidth, bEquidistant); @@ -190,35 +190,35 @@ FWL_Error CFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { return ToEdit(GetWidget())->SetFont(wsFont, fSize); } -FX_BOOL CFWL_Edit::CanUndo() { +bool CFWL_Edit::CanUndo() { return ToEdit(GetWidget())->CanUndo(); } -FX_BOOL CFWL_Edit::CanRedo() { +bool CFWL_Edit::CanRedo() { return ToEdit(GetWidget())->CanRedo(); } -FX_BOOL CFWL_Edit::Undo() { +bool CFWL_Edit::Undo() { return ToEdit(GetWidget())->Undo(); } -FX_BOOL CFWL_Edit::Redo() { +bool CFWL_Edit::Redo() { return ToEdit(GetWidget())->Undo(); } -FX_BOOL CFWL_Edit::Copy(CFX_WideString& wsCopy) { +bool CFWL_Edit::Copy(CFX_WideString& wsCopy) { return ToEdit(GetWidget())->Copy(wsCopy); } -FX_BOOL CFWL_Edit::Cut(CFX_WideString& wsCut) { +bool CFWL_Edit::Cut(CFX_WideString& wsCut) { return ToEdit(GetWidget())->Cut(wsCut); } -FX_BOOL CFWL_Edit::Paste(const CFX_WideString& wsPaste) { +bool CFWL_Edit::Paste(const CFX_WideString& wsPaste) { return ToEdit(GetWidget())->Paste(wsPaste); } -FX_BOOL CFWL_Edit::Delete() { +bool CFWL_Edit::Delete() { return ToEdit(GetWidget())->Delete(); } @@ -226,12 +226,12 @@ void CFWL_Edit::SetScrollOffset(FX_FLOAT fScrollOffset) { return ToEdit(GetWidget())->SetScrollOffset(fScrollOffset); } -FX_BOOL CFWL_Edit::GetSuggestWords(CFX_PointF pointf, - std::vector<CFX_ByteString>& sSuggest) { +bool CFWL_Edit::GetSuggestWords(CFX_PointF pointf, + std::vector<CFX_ByteString>& sSuggest) { return ToEdit(GetWidget())->GetSuggestWords(pointf, sSuggest); } -FX_BOOL CFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf, - const CFX_ByteStringC& bsReplace) { +bool CFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf, + const CFX_ByteStringC& bsReplace) { return ToEdit(GetWidget())->ReplaceSpellCheckWord(pointf, bsReplace); } diff --git a/xfa/fwl/core/cfwl_edit.h b/xfa/fwl/core/cfwl_edit.h index c18420015f..8fc0a13776 100644 --- a/xfa/fwl/core/cfwl_edit.h +++ b/xfa/fwl/core/cfwl_edit.h @@ -29,7 +29,7 @@ class CFWL_Edit : public CFWL_Widget { int32_t nCount = -1) const; FWL_Error ClearText(); int32_t GetCaretPos() const; - int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE); + int32_t SetCaretPos(int32_t nIndex, bool bBefore = true); int32_t AddSelRange(int32_t nStart, int32_t nCount = -1); int32_t CountSelRanges(); int32_t GetSelRange(int32_t nIndex, int32_t& nStart); @@ -45,25 +45,25 @@ class CFWL_Edit : public CFWL_Widget { int32_t nLen, const CFX_WideStringC& wsReplace); FWL_Error DoClipboard(int32_t iCmd); - FX_BOOL Redo(const IFDE_TxtEdtDoRecord* pRecord); - FX_BOOL Undo(const IFDE_TxtEdtDoRecord* pRecord); - FWL_Error SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); + bool Redo(const IFDE_TxtEdtDoRecord* pRecord); + bool Undo(const IFDE_TxtEdtDoRecord* pRecord); + FWL_Error SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant); FWL_Error SetNumberRange(int32_t iMin, int32_t iMax); FWL_Error SetBackColor(uint32_t dwColor); FWL_Error SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); - FX_BOOL CanUndo(); - FX_BOOL CanRedo(); - FX_BOOL Undo(); - FX_BOOL Redo(); - FX_BOOL Copy(CFX_WideString& wsCopy); - FX_BOOL Cut(CFX_WideString& wsCut); - FX_BOOL Paste(const CFX_WideString& wsPaste); - FX_BOOL Delete(); + bool CanUndo(); + bool CanRedo(); + bool Undo(); + bool Redo(); + bool Copy(CFX_WideString& wsCopy); + bool Cut(CFX_WideString& wsCut); + bool Paste(const CFX_WideString& wsPaste); + bool Delete(); void SetScrollOffset(FX_FLOAT fScrollOffset); - FX_BOOL GetSuggestWords(CFX_PointF pointf, - std::vector<CFX_ByteString>& sSuggest); - FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, - const CFX_ByteStringC& bsReplace); + bool GetSuggestWords(CFX_PointF pointf, + std::vector<CFX_ByteString>& sSuggest); + bool ReplaceSpellCheckWord(CFX_PointF pointf, + const CFX_ByteStringC& bsReplace); }; #endif // XFA_FWL_CORE_CFWL_EDIT_H_ diff --git a/xfa/fwl/core/cfwl_event.h b/xfa/fwl/core/cfwl_event.h index 2e1ed69145..f43ebb7cc9 100644 --- a/xfa/fwl/core/cfwl_event.h +++ b/xfa/fwl/core/cfwl_event.h @@ -139,7 +139,7 @@ FWL_EVENT_DEF(CFWL_EvtClick, CFWL_EventType::Click) FWL_EVENT_DEF(CFWL_EvtScroll, CFWL_EventType::Scroll, uint32_t m_iScrollCode; FX_FLOAT m_fPos; - FX_BOOL * m_pRet;) + bool* m_pRet;) FWL_EVENT_DEF(CFWL_EvtClose, CFWL_EventType::Close) diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp index 800dd2e570..f7e167125d 100644 --- a/xfa/fwl/core/cfwl_listbox.cpp +++ b/xfa/fwl/core/cfwl_listbox.cpp @@ -38,7 +38,7 @@ FWL_Error CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, IFWL_ListItem* pItem) { } IFWL_ListItem* CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd, - FX_BOOL bSelect) { + bool bSelect) { std::unique_ptr<CFWL_ListItem> pItem(new CFWL_ListItem); pItem->m_dwStates = 0; pItem->m_wsText = wsAdd; @@ -47,11 +47,11 @@ IFWL_ListItem* CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd, return m_ListBoxDP.m_ItemArray.back().get(); } -FX_BOOL CFWL_ListBox::DeleteString(IFWL_ListItem* pItem) { +bool CFWL_ListBox::DeleteString(IFWL_ListItem* pItem) { int32_t nIndex = m_ListBoxDP.GetItemIndex(GetWidget(), pItem); if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ListBoxDP.m_ItemArray.size()) { - return FALSE; + return false; } int32_t iCount = m_ListBoxDP.CountItems(m_pIface.get()); int32_t iSel = nIndex + 1; @@ -67,7 +67,7 @@ FX_BOOL CFWL_ListBox::DeleteString(IFWL_ListItem* pItem) { pSel->m_dwStates |= FWL_ITEMSTATE_LTB_Selected; } m_ListBoxDP.m_ItemArray.erase(m_ListBoxDP.m_ItemArray.begin() + nIndex); - return TRUE; + return true; } void CFWL_ListBox::DeleteAll() { @@ -92,7 +92,7 @@ int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) { return ToListBox(GetWidget())->GetSelIndex(nIndex); } -FWL_Error CFWL_ListBox::SetSelItem(IFWL_ListItem* pItem, FX_BOOL bSelect) { +FWL_Error CFWL_ListBox::SetSelItem(IFWL_ListItem* pItem, bool bSelect) { if (!GetWidget()) return FWL_Error::Indefinite; return ToListBox(GetWidget())->SetSelItem(pItem, bSelect); @@ -105,7 +105,7 @@ FWL_Error CFWL_ListBox::GetItemText(IFWL_ListItem* pItem, return ToListBox(GetWidget())->GetItemText(pItem, wsText); } -FWL_Error CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { +FWL_Error CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, bool bVert) { if (!GetWidget()) return FWL_Error::Indefinite; return ToListBox(GetWidget())->GetScrollPos(fPos, bVert); @@ -176,7 +176,7 @@ IFWL_ListItem* CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) { FX_FLOAT fPosX = 0; FX_FLOAT fPosY = 0; ToListBox(GetWidget())->GetScrollPos(fx); - ToListBox(GetWidget())->GetScrollPos(fy, FALSE); + ToListBox(GetWidget())->GetScrollPos(fy, false); int32_t nCount = m_ListBoxDP.CountItems(nullptr); for (int32_t i = 0; i < nCount; i++) { IFWL_ListItem* pItem = m_ListBoxDP.GetItem(nullptr, i); @@ -232,13 +232,13 @@ int32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemIndex(IFWL_Widget* pWidget, return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1; } -FX_BOOL CFWL_ListBox::CFWL_ListBoxDP::SetItemIndex(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - int32_t nIndex) { +bool CFWL_ListBox::CFWL_ListBoxDP::SetItemIndex(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + int32_t nIndex) { if (nIndex < 0 || nIndex >= CountItems(pWidget)) - return FALSE; + return false; m_ItemArray[nIndex].reset(static_cast<CFWL_ListItem*>(pItem)); - return TRUE; + return true; } uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemStyles(IFWL_Widget* pWidget, diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h index 42740fbfbc..cb77f90a63 100644 --- a/xfa/fwl/core/cfwl_listbox.h +++ b/xfa/fwl/core/cfwl_listbox.h @@ -25,16 +25,15 @@ class CFWL_ListBox : public CFWL_Widget { void Initialize(); FWL_Error AddDIBitmap(CFX_DIBitmap* pDIB, IFWL_ListItem* pItem); - IFWL_ListItem* AddString(const CFX_WideStringC& wsAdd, - FX_BOOL bSelect = FALSE); - FX_BOOL DeleteString(IFWL_ListItem* pItem); + IFWL_ListItem* AddString(const CFX_WideStringC& wsAdd, bool bSelect = false); + bool DeleteString(IFWL_ListItem* pItem); void DeleteAll(); int32_t CountSelItems(); IFWL_ListItem* GetSelItem(int32_t nIndexSel); int32_t GetSelIndex(int32_t nIndex); - FWL_Error SetSelItem(IFWL_ListItem* pItem, FX_BOOL bSelect = TRUE); + FWL_Error SetSelItem(IFWL_ListItem* pItem, bool bSelect = true); FWL_Error GetItemText(IFWL_ListItem* pItem, CFX_WideString& wsText); - FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); + FWL_Error GetScrollPos(FX_FLOAT& fPos, bool bVert = true); FWL_Error SetItemHeight(FX_FLOAT fItemHeight); IFWL_ListItem* GetFocusItem(); FWL_Error SetFocusItem(IFWL_ListItem* pItem); @@ -61,9 +60,9 @@ class CFWL_ListBox : public CFWL_Widget { int32_t CountItems(const IFWL_Widget* pWidget) override; IFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override; int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; - FX_BOOL SetItemIndex(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - int32_t nIndex) override; + bool SetItemIndex(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + int32_t nIndex) override; uint32_t GetItemStyles(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; FWL_Error GetItemText(IFWL_Widget* pWidget, IFWL_ListItem* pItem, diff --git a/xfa/fwl/core/cfwl_widget.cpp b/xfa/fwl/core/cfwl_widget.cpp index db0d4ebb5e..074803776b 100644 --- a/xfa/fwl/core/cfwl_widget.cpp +++ b/xfa/fwl/core/cfwl_widget.cpp @@ -40,7 +40,7 @@ const IFWL_Widget* CFWL_Widget::GetWidget() const { return m_pIface.get(); } -FWL_Error CFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_Widget::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (!m_pIface) return FWL_Error::Indefinite; return m_pIface->GetWidgetRect(rect, bAutoSize); @@ -86,7 +86,7 @@ uint32_t CFWL_Widget::GetStates() { return m_pIface ? m_pIface->GetStates() : 0; } -void CFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) { +void CFWL_Widget::SetStates(uint32_t dwStates, bool bSet) { if (m_pIface) m_pIface->SetStates(dwStates, bSet); } diff --git a/xfa/fwl/core/cfwl_widget.h b/xfa/fwl/core/cfwl_widget.h index 2921145f6a..0c590e2319 100644 --- a/xfa/fwl/core/cfwl_widget.h +++ b/xfa/fwl/core/cfwl_widget.h @@ -27,7 +27,7 @@ class CFWL_Widget { IFWL_Widget* GetWidget(); const IFWL_Widget* GetWidget() const; - FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); FWL_Error SetWidgetRect(const CFX_RectF& rect); FWL_Error GetGlobalRect(CFX_RectF& rect); FWL_Error GetClientRect(CFX_RectF& rtClient); @@ -38,7 +38,7 @@ class CFWL_Widget { uint32_t dwStylesExRemoved); uint32_t GetStates(); - void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); + void SetStates(uint32_t dwStates, bool bSet = true); void SetLayoutItem(void* pItem); diff --git a/xfa/fwl/core/cfwl_widgetmgr.cpp b/xfa/fwl/core/cfwl_widgetmgr.cpp index 37e31dc501..90dcd6e121 100644 --- a/xfa/fwl/core/cfwl_widgetmgr.cpp +++ b/xfa/fwl/core/cfwl_widgetmgr.cpp @@ -26,9 +26,9 @@ struct FWL_NEEDREPAINTHITDATA { } // namespace -FX_BOOL FWL_UseOffscreen(IFWL_Widget* pWidget) { +bool FWL_UseOffscreen(IFWL_Widget* pWidget) { #if (_FX_OS_ == _FX_MACOSX_) - return FALSE; + return false; #else return !!(pWidget->GetStyles() & FWL_WGTSTYLE_Offscreen); #endif @@ -109,18 +109,18 @@ IFWL_Widget* CFWL_WidgetMgr::GetSystemFormWidget(IFWL_Widget* pWidget) const { return nullptr; } -FX_BOOL CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) { +bool CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) { CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); if (!pItem) - return FALSE; + return false; if (!pItem->pParent) - return FALSE; + return false; CFWL_WidgetMgrItem* pChild = pItem->pParent->pChild; int32_t i = 0; while (pChild) { if (pChild == pItem) { if (i == nIndex) { - return TRUE; + return true; } if (pChild->pPrevious) { pChild->pPrevious->pNext = pChild->pNext; @@ -150,7 +150,7 @@ FX_BOOL CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) { pChild->pNext = pItem; pItem->pPrevious = pChild; pItem->pNext = nullptr; - return TRUE; + return true; } i = 0; while (i < nIndex && pChild->pNext) { @@ -161,7 +161,7 @@ FX_BOOL CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) { pChild->pNext = pItem; pItem->pPrevious = pChild; pItem->pNext = nullptr; - return TRUE; + return true; } if (pChild->pPrevious) { pItem->pPrevious = pChild->pPrevious; @@ -177,7 +177,7 @@ FX_BOOL CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) { pItem->pPrevious = nullptr; pItem->pNext = nullptr; } - return TRUE; + return true; } FWL_Error CFWL_WidgetMgr::RepaintWidget(IFWL_Widget* pWidget, const CFX_RectF* pRect) { @@ -313,14 +313,14 @@ void CFWL_WidgetMgr::SetParent(IFWL_Widget* pParent, IFWL_Widget* pChild) { SetWidgetIndex(pChild, -1); } -FX_BOOL CFWL_WidgetMgr::IsChild(IFWL_Widget* pChild, IFWL_Widget* pParent) { +bool CFWL_WidgetMgr::IsChild(IFWL_Widget* pChild, IFWL_Widget* pParent) { IFWL_Widget* pTemp = pChild; do { if (pTemp == pParent) - return TRUE; + return true; pTemp = GetParentWidget(pTemp); } while (pTemp); - return FALSE; + return false; } FWL_Error CFWL_WidgetMgr::SetWidgetRect_Native(IFWL_Widget* pWidget, @@ -385,12 +385,12 @@ void CFWL_WidgetMgr::NotifySizeChanged(IFWL_Widget* pForm, IFWL_Widget* CFWL_WidgetMgr::nextTab(IFWL_Widget* parent, IFWL_Widget* focus, - FX_BOOL& bFind) { + bool& bFind) { CFWL_WidgetMgr* pMgr = parent->GetOwnerApp()->GetWidgetMgr(); IFWL_Widget* child = pMgr->GetFirstChildWidget(parent); while (child) { if (focus == child) - bFind = TRUE; + bFind = true; if ((child->GetStyles() & FWL_WGTSTYLE_TabStop) && (!focus || (focus != child && bFind))) { @@ -415,7 +415,7 @@ int32_t CFWL_WidgetMgr::CountRadioButtonGroup(IFWL_Widget* pFirst) { return iRet; } IFWL_Widget* CFWL_WidgetMgr::GetSiblingRadioButton(IFWL_Widget* pWidget, - FX_BOOL bNext) { + bool bNext) { return nullptr; } IFWL_Widget* CFWL_WidgetMgr::GetRadioButtonGroupHeader( @@ -424,16 +424,16 @@ IFWL_Widget* CFWL_WidgetMgr::GetRadioButtonGroupHeader( while (pNext) { if (pNext->GetStyles() & FWL_WGTSTYLE_Group) return pNext; - pNext = GetSiblingRadioButton(pNext, FALSE); + pNext = GetSiblingRadioButton(pNext, false); } pNext = GetLastSiblingWidget(pRadioButton); - while ((pNext = GetSiblingRadioButton(pNext, FALSE)) != nullptr && + while ((pNext = GetSiblingRadioButton(pNext, false)) != nullptr && pNext != pRadioButton) { if (pNext->GetStyles() & FWL_WGTSTYLE_Group) return pNext; } pNext = GetFirstSiblingWidget(pRadioButton); - return GetSiblingRadioButton(pNext, TRUE); + return GetSiblingRadioButton(pNext, true); } void CFWL_WidgetMgr::GetSameGroupRadioButton( IFWL_Widget* pRadioButton, @@ -445,7 +445,7 @@ void CFWL_WidgetMgr::GetSameGroupRadioButton( int32_t iGroup = CountRadioButtonGroup(pFirst); if (iGroup < 2) { IFWL_Widget* pNext = pFirst; - while ((pNext = GetSiblingRadioButton(pNext, TRUE)) != nullptr) { + while ((pNext = GetSiblingRadioButton(pNext, true)) != nullptr) { group.Add(pNext); } return; @@ -453,9 +453,9 @@ void CFWL_WidgetMgr::GetSameGroupRadioButton( IFWL_Widget* pNext = GetRadioButtonGroupHeader(pRadioButton); do { group.Add(pNext); - pNext = GetSiblingRadioButton(pNext, TRUE); + pNext = GetSiblingRadioButton(pNext, true); if (!pNext) - pNext = GetSiblingRadioButton(pFirst, TRUE); + pNext = GetSiblingRadioButton(pFirst, true); } while (pNext && ((pNext->GetStyles() & FWL_WGTSTYLE_Group) == 0)); } IFWL_Widget* CFWL_WidgetMgr::GetDefaultButton(IFWL_Widget* pParent) { @@ -524,11 +524,11 @@ int32_t CFWL_WidgetMgr::TravelWidgetMgr(CFWL_WidgetMgrItem* pParent, return iCount - 1; } -FX_BOOL CFWL_WidgetMgr::IsAbleNative(IFWL_Widget* pWidget) const { +bool CFWL_WidgetMgr::IsAbleNative(IFWL_Widget* pWidget) const { if (!pWidget) - return FALSE; + return false; if (!pWidget->IsInstance(FX_WSTRC(FWL_CLASS_Form))) { - return FALSE; + return false; } uint32_t dwStyles = pWidget->GetStyles(); return ((dwStyles & FWL_WGTSTYLE_WindowTypeMask) == @@ -544,11 +544,11 @@ bool CFWL_WidgetMgr::IsFormDisabled() { return !!(m_dwCapability & FWL_WGTMGR_DisableForm); } -FX_BOOL CFWL_WidgetMgr::GetAdapterPopupPos(IFWL_Widget* pWidget, - FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, - const CFX_RectF& rtAnchor, - CFX_RectF& rtPopup) { +bool CFWL_WidgetMgr::GetAdapterPopupPos(IFWL_Widget* pWidget, + FX_FLOAT fMinHeight, + FX_FLOAT fMaxHeight, + const CFX_RectF& rtAnchor, + CFX_RectF& rtPopup) { CXFA_FWLAdapterWidgetMgr* pSDApapter = GetAdapterWidgetMgr(); return pSDApapter->GetPopupPos(pWidget, fMinHeight, fMaxHeight, rtAnchor, rtPopup); @@ -647,7 +647,7 @@ void CFWL_WidgetMgrDelegate::DrawChild(IFWL_Widget* parent, if (!parent) return; - FX_BOOL bFormDisable = m_pWidgetMgr->IsFormDisabled(); + bool bFormDisable = m_pWidgetMgr->IsFormDisabled(); IFWL_Widget* pNextChild = m_pWidgetMgr->GetFirstChildWidget(parent); while (pNextChild) { IFWL_Widget* child = pNextChild; @@ -663,7 +663,7 @@ void CFWL_WidgetMgrDelegate::DrawChild(IFWL_Widget* parent, CFX_Matrix widgetMatrix; CFX_RectF clipBounds(rtWidget); if (!bFormDisable) - child->GetMatrix(widgetMatrix, TRUE); + child->GetMatrix(widgetMatrix, true); if (pMatrix) widgetMatrix.Concat(*pMatrix); @@ -676,7 +676,7 @@ void CFWL_WidgetMgrDelegate::DrawChild(IFWL_Widget* parent, pGraphics->SaveGraphState(); pGraphics->SetClipRect(clipBounds); } - widgetMatrix.Translate(rtWidget.left, rtWidget.top, TRUE); + widgetMatrix.Translate(rtWidget.left, rtWidget.top, true); if (IFWL_WidgetDelegate* pDelegate = child->GetDelegate()) { if (m_pWidgetMgr->IsFormDisabled() || @@ -730,31 +730,31 @@ void CFWL_WidgetMgrDelegate::DrawWidgetAfter(IFWL_Widget* pWidget, pItem->iRedrawCounter = 0; } -FX_BOOL CFWL_WidgetMgrDelegate::IsNeedRepaint(IFWL_Widget* pWidget, - CFX_Matrix* pMatrix, - const CFX_RectF& rtDirty) { +bool CFWL_WidgetMgrDelegate::IsNeedRepaint(IFWL_Widget* pWidget, + CFX_Matrix* pMatrix, + const CFX_RectF& rtDirty) { CFWL_WidgetMgrItem* pItem = m_pWidgetMgr->GetWidgetMgrItem(pWidget); if (pItem && pItem->iRedrawCounter > 0) { pItem->iRedrawCounter = 0; - return TRUE; + return true; } CFX_RectF rtWidget; pWidget->GetWidgetRect(rtWidget); rtWidget.left = rtWidget.top = 0; pMatrix->TransformRect(rtWidget); if (!rtWidget.IntersectWith(rtDirty)) - return FALSE; + return false; IFWL_Widget* pChild = pWidget->GetOwnerApp()->GetWidgetMgr()->GetFirstChildWidget(pWidget); if (!pChild) - return TRUE; + return true; CFX_RectF rtChilds; rtChilds.Empty(); - FX_BOOL bChildIntersectWithDirty = FALSE; - FX_BOOL bOrginPtIntersectWidthChild = FALSE; - FX_BOOL bOrginPtIntersectWidthDirty = + bool bChildIntersectWithDirty = false; + bool bOrginPtIntersectWidthChild = false; + bool bOrginPtIntersectWidthDirty = rtDirty.Contains(rtWidget.left, rtWidget.top); static FWL_NEEDREPAINTHITDATA hitPoint[kNeedRepaintHitPoints]; FXSYS_memset(hitPoint, 0, sizeof(hitPoint)); @@ -783,9 +783,9 @@ FX_BOOL CFWL_WidgetMgrDelegate::IsNeedRepaint(IFWL_Widget* pWidget, if (r.IsEmpty()) continue; if (r.Contains(rtDirty)) - return FALSE; + return false; if (!bChildIntersectWithDirty && r.IntersectWith(rtDirty)) - bChildIntersectWithDirty = TRUE; + bChildIntersectWithDirty = true; if (bOrginPtIntersectWidthDirty && !bOrginPtIntersectWidthChild) bOrginPtIntersectWidthChild = rect.Contains(0, 0); @@ -809,11 +809,11 @@ FX_BOOL CFWL_WidgetMgrDelegate::IsNeedRepaint(IFWL_Widget* pWidget, } while (pChild); if (!bChildIntersectWithDirty) - return TRUE; + return true; if (bOrginPtIntersectWidthDirty && !bOrginPtIntersectWidthChild) - return TRUE; + return true; if (rtChilds.IsEmpty()) - return TRUE; + return true; int32_t repaintPoint = kNeedRepaintHitPoints; for (int32_t i = 0; i < kNeedRepaintHitPoints; i++) { @@ -821,18 +821,18 @@ FX_BOOL CFWL_WidgetMgrDelegate::IsNeedRepaint(IFWL_Widget* pWidget, repaintPoint--; } if (repaintPoint > 0) - return TRUE; + return true; pMatrix->TransformRect(rtChilds); if (rtChilds.Contains(rtDirty) || rtChilds.Contains(rtWidget)) - return FALSE; - return TRUE; + return false; + return true; } -FX_BOOL CFWL_WidgetMgrDelegate::bUseOffscreenDirect(IFWL_Widget* pWidget) { +bool CFWL_WidgetMgrDelegate::bUseOffscreenDirect(IFWL_Widget* pWidget) { CFWL_WidgetMgrItem* pItem = m_pWidgetMgr->GetWidgetMgrItem(pWidget); if (!FWL_UseOffscreen(pWidget) || !(pItem->pOffscreen)) - return FALSE; + return false; #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) if (pItem->bOutsideChanged) { @@ -841,9 +841,9 @@ FX_BOOL CFWL_WidgetMgrDelegate::bUseOffscreenDirect(IFWL_Widget* pWidget) { CFX_RectF temp(m_pWidgetMgr->m_rtScreen); temp.Deflate(50, 50); if (!temp.Contains(r)) - return FALSE; + return false; - pItem->bOutsideChanged = FALSE; + pItem->bOutsideChanged = false; } #endif @@ -862,7 +862,7 @@ CFWL_WidgetMgrItem::CFWL_WidgetMgrItem(IFWL_Widget* widget) iRedrawCounter(0) #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) , - bOutsideChanged(FALSE) + bOutsideChanged(false) #endif { } diff --git a/xfa/fwl/core/cfwl_widgetmgr.h b/xfa/fwl/core/cfwl_widgetmgr.h index 3c443cbfca..25c5735a98 100644 --- a/xfa/fwl/core/cfwl_widgetmgr.h +++ b/xfa/fwl/core/cfwl_widgetmgr.h @@ -40,7 +40,7 @@ class CFWL_WidgetMgrItem { std::unique_ptr<CFX_Graphics> pOffscreen; int32_t iRedrawCounter; #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) - FX_BOOL bOutsideChanged; + bool bOutsideChanged; #endif }; @@ -59,7 +59,7 @@ class CFWL_WidgetMgr { IFWL_Widget* GetLastChildWidget(IFWL_Widget* pWidget) const; IFWL_Widget* GetSystemFormWidget(IFWL_Widget* pWidget) const; - FX_BOOL SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex); + bool SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex); FWL_Error RepaintWidget(IFWL_Widget* pWidget, const CFX_RectF* pRect = nullptr); @@ -70,13 +70,13 @@ class CFWL_WidgetMgr { void RemoveWidget(IFWL_Widget* pWidget); void SetOwner(IFWL_Widget* pOwner, IFWL_Widget* pOwned); void SetParent(IFWL_Widget* pParent, IFWL_Widget* pChild); - FX_BOOL IsChild(IFWL_Widget* pChild, IFWL_Widget* pParent); + bool IsChild(IFWL_Widget* pChild, IFWL_Widget* pParent); FWL_Error SetWidgetRect_Native(IFWL_Widget* pWidget, const CFX_RectF& rect); IFWL_Widget* GetWidgetAtPoint(IFWL_Widget* pParent, FX_FLOAT fx, FX_FLOAT fy); void NotifySizeChanged(IFWL_Widget* pForm, FX_FLOAT fx, FX_FLOAT fy); - IFWL_Widget* nextTab(IFWL_Widget* parent, IFWL_Widget* focus, FX_BOOL& bFind); + IFWL_Widget* nextTab(IFWL_Widget* parent, IFWL_Widget* focus, bool& bFind); int32_t CountRadioButtonGroup(IFWL_Widget* pFirst); - IFWL_Widget* GetSiblingRadioButton(IFWL_Widget* pWidget, FX_BOOL bNext); + IFWL_Widget* GetSiblingRadioButton(IFWL_Widget* pWidget, bool bNext); IFWL_Widget* GetRadioButtonGroupHeader(IFWL_Widget* pRadioButton); void GetSameGroupRadioButton(IFWL_Widget* pRadioButton, CFX_ArrayTemplate<IFWL_Widget*>& group); @@ -88,11 +88,11 @@ class CFWL_WidgetMgr { CFWL_WidgetMgrItem* GetWidgetMgrItem(IFWL_Widget* pWidget) const; bool IsThreadEnabled(); bool IsFormDisabled(); - FX_BOOL GetAdapterPopupPos(IFWL_Widget* pWidget, - FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, - const CFX_RectF& rtAnchor, - CFX_RectF& rtPopup); + bool GetAdapterPopupPos(IFWL_Widget* pWidget, + FX_FLOAT fMinHeight, + FX_FLOAT fMaxHeight, + const CFX_RectF& rtAnchor, + CFX_RectF& rtPopup); protected: friend class CFWL_WidgetMgrDelegate; @@ -101,7 +101,7 @@ class CFWL_WidgetMgr { int32_t* pIndex, CFWL_WidgetMgrItem* pItem, IFWL_Widget** pWidget = nullptr); - FX_BOOL IsAbleNative(IFWL_Widget* pWidget) const; + bool IsAbleNative(IFWL_Widget* pWidget) const; uint32_t m_dwCapability; std::unique_ptr<CFWL_WidgetMgrDelegate> m_pDelegate; @@ -135,10 +135,10 @@ class CFWL_WidgetMgrDelegate { CFX_Graphics* pGraphics, CFX_RectF& rtClip, const CFX_Matrix* pMatrix); - FX_BOOL IsNeedRepaint(IFWL_Widget* pWidget, - CFX_Matrix* pMatrix, - const CFX_RectF& rtDirty); - FX_BOOL bUseOffscreenDirect(IFWL_Widget* pWidget); + bool IsNeedRepaint(IFWL_Widget* pWidget, + CFX_Matrix* pMatrix, + const CFX_RectF& rtDirty); + bool bUseOffscreenDirect(IFWL_Widget* pWidget); CFWL_WidgetMgr* m_pWidgetMgr; }; diff --git a/xfa/fwl/core/cfx_barcode.cpp b/xfa/fwl/core/cfx_barcode.cpp index f870833647..35a5f32e28 100644 --- a/xfa/fwl/core/cfx_barcode.cpp +++ b/xfa/fwl/core/cfx_barcode.cpp @@ -56,29 +56,29 @@ CFX_Barcode::CFX_Barcode() {} CFX_Barcode::~CFX_Barcode() {} -FX_BOOL CFX_Barcode::Create(BC_TYPE type) { +bool CFX_Barcode::Create(BC_TYPE type) { m_pBCEngine.reset(CreateBarCodeEngineObject(type)); return !!m_pBCEngine; } BC_TYPE CFX_Barcode::GetType() { return m_pBCEngine ? m_pBCEngine->GetType() : BC_UNKNOWN; } -FX_BOOL CFX_Barcode::SetCharEncoding(BC_CHAR_ENCODING encoding) { - return m_pBCEngine ? m_pBCEngine->SetCharEncoding(encoding) : FALSE; +bool CFX_Barcode::SetCharEncoding(BC_CHAR_ENCODING encoding) { + return m_pBCEngine ? m_pBCEngine->SetCharEncoding(encoding) : false; } -FX_BOOL CFX_Barcode::SetModuleHeight(int32_t moduleHeight) { - return m_pBCEngine ? m_pBCEngine->SetModuleHeight(moduleHeight) : FALSE; +bool CFX_Barcode::SetModuleHeight(int32_t moduleHeight) { + return m_pBCEngine ? m_pBCEngine->SetModuleHeight(moduleHeight) : false; } -FX_BOOL CFX_Barcode::SetModuleWidth(int32_t moduleWidth) { - return m_pBCEngine ? m_pBCEngine->SetModuleWidth(moduleWidth) : FALSE; +bool CFX_Barcode::SetModuleWidth(int32_t moduleWidth) { + return m_pBCEngine ? m_pBCEngine->SetModuleWidth(moduleWidth) : false; } -FX_BOOL CFX_Barcode::SetHeight(int32_t height) { - return m_pBCEngine ? m_pBCEngine->SetHeight(height) : FALSE; +bool CFX_Barcode::SetHeight(int32_t height) { + return m_pBCEngine ? m_pBCEngine->SetHeight(height) : false; } -FX_BOOL CFX_Barcode::SetWidth(int32_t width) { - return m_pBCEngine ? m_pBCEngine->SetWidth(width) : FALSE; +bool CFX_Barcode::SetWidth(int32_t width) { + return m_pBCEngine ? m_pBCEngine->SetWidth(width) : false; } -FX_BOOL CFX_Barcode::CheckContentValidity(const CFX_WideStringC& contents) { +bool CFX_Barcode::CheckContentValidity(const CFX_WideStringC& contents) { switch (GetType()) { case BC_CODE39: case BC_CODABAR: @@ -91,12 +91,12 @@ FX_BOOL CFX_Barcode::CheckContentValidity(const CFX_WideStringC& contents) { return m_pBCEngine ? static_cast<CBC_OneCode*>(m_pBCEngine.get()) ->CheckContentValidity(contents) - : TRUE; + : true; default: - return TRUE; + return true; } } -FX_BOOL CFX_Barcode::SetPrintChecksum(FX_BOOL checksum) { +bool CFX_Barcode::SetPrintChecksum(bool checksum) { switch (GetType()) { case BC_CODE39: case BC_CODABAR: @@ -108,13 +108,13 @@ FX_BOOL CFX_Barcode::SetPrintChecksum(FX_BOOL checksum) { case BC_UPCA: return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get()) ->SetPrintChecksum(checksum), - TRUE) - : FALSE; + true) + : false; default: - return FALSE; + return false; } } -FX_BOOL CFX_Barcode::SetDataLength(int32_t length) { +bool CFX_Barcode::SetDataLength(int32_t length) { switch (GetType()) { case BC_CODE39: case BC_CODABAR: @@ -126,13 +126,13 @@ FX_BOOL CFX_Barcode::SetDataLength(int32_t length) { case BC_UPCA: return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get()) ->SetDataLength(length), - TRUE) - : FALSE; + true) + : false; default: - return FALSE; + return false; } } -FX_BOOL CFX_Barcode::SetCalChecksum(FX_BOOL state) { +bool CFX_Barcode::SetCalChecksum(bool state) { switch (GetType()) { case BC_CODE39: case BC_CODABAR: @@ -144,13 +144,13 @@ FX_BOOL CFX_Barcode::SetCalChecksum(FX_BOOL state) { case BC_UPCA: return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get()) ->SetCalChecksum(state), - TRUE) - : FALSE; + true) + : false; default: - return FALSE; + return false; } } -FX_BOOL CFX_Barcode::SetFont(CFX_Font* pFont) { +bool CFX_Barcode::SetFont(CFX_Font* pFont) { switch (GetType()) { case BC_CODE39: case BC_CODABAR: @@ -162,12 +162,12 @@ FX_BOOL CFX_Barcode::SetFont(CFX_Font* pFont) { case BC_UPCA: return m_pBCEngine ? static_cast<CBC_OneCode*>(m_pBCEngine.get())->SetFont(pFont) - : FALSE; + : false; default: - return FALSE; + return false; } } -FX_BOOL CFX_Barcode::SetFontSize(FX_FLOAT size) { +bool CFX_Barcode::SetFontSize(FX_FLOAT size) { switch (GetType()) { case BC_CODE39: case BC_CODABAR: @@ -179,13 +179,13 @@ FX_BOOL CFX_Barcode::SetFontSize(FX_FLOAT size) { case BC_UPCA: return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get()) ->SetFontSize(size), - TRUE) - : FALSE; + true) + : false; default: - return FALSE; + return false; } } -FX_BOOL CFX_Barcode::SetFontStyle(int32_t style) { +bool CFX_Barcode::SetFontStyle(int32_t style) { switch (GetType()) { case BC_CODE39: case BC_CODABAR: @@ -197,13 +197,13 @@ FX_BOOL CFX_Barcode::SetFontStyle(int32_t style) { case BC_UPCA: return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get()) ->SetFontStyle(style), - TRUE) - : FALSE; + true) + : false; default: - return FALSE; + return false; } } -FX_BOOL CFX_Barcode::SetFontColor(FX_ARGB color) { +bool CFX_Barcode::SetFontColor(FX_ARGB color) { switch (GetType()) { case BC_CODE39: case BC_CODABAR: @@ -215,14 +215,14 @@ FX_BOOL CFX_Barcode::SetFontColor(FX_ARGB color) { case BC_UPCA: return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get()) ->SetFontColor(color), - TRUE) - : FALSE; + true) + : false; default: - return FALSE; + return false; } } -FX_BOOL CFX_Barcode::SetTextLocation(BC_TEXT_LOC location) { - typedef FX_BOOL (CBC_CodeBase::*memptrtype)(BC_TEXT_LOC); +bool CFX_Barcode::SetTextLocation(BC_TEXT_LOC location) { + typedef bool (CBC_CodeBase::*memptrtype)(BC_TEXT_LOC); memptrtype memptr = nullptr; switch (GetType()) { case BC_CODE39: @@ -239,10 +239,10 @@ FX_BOOL CFX_Barcode::SetTextLocation(BC_TEXT_LOC location) { default: break; } - return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(location) : FALSE; + return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(location) : false; } -FX_BOOL CFX_Barcode::SetWideNarrowRatio(int32_t ratio) { - typedef FX_BOOL (CBC_CodeBase::*memptrtype)(int32_t); +bool CFX_Barcode::SetWideNarrowRatio(int32_t ratio) { + typedef bool (CBC_CodeBase::*memptrtype)(int32_t); memptrtype memptr = nullptr; switch (GetType()) { case BC_CODE39: @@ -254,10 +254,10 @@ FX_BOOL CFX_Barcode::SetWideNarrowRatio(int32_t ratio) { default: break; } - return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(ratio) : FALSE; + return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(ratio) : false; } -FX_BOOL CFX_Barcode::SetStartChar(FX_CHAR start) { - typedef FX_BOOL (CBC_CodeBase::*memptrtype)(FX_CHAR); +bool CFX_Barcode::SetStartChar(FX_CHAR start) { + typedef bool (CBC_CodeBase::*memptrtype)(FX_CHAR); memptrtype memptr = nullptr; switch (GetType()) { case BC_CODABAR: @@ -266,10 +266,10 @@ FX_BOOL CFX_Barcode::SetStartChar(FX_CHAR start) { default: break; } - return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(start) : FALSE; + return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(start) : false; } -FX_BOOL CFX_Barcode::SetEndChar(FX_CHAR end) { - typedef FX_BOOL (CBC_CodeBase::*memptrtype)(FX_CHAR); +bool CFX_Barcode::SetEndChar(FX_CHAR end) { + typedef bool (CBC_CodeBase::*memptrtype)(FX_CHAR); memptrtype memptr = nullptr; switch (GetType()) { case BC_CODABAR: @@ -278,10 +278,10 @@ FX_BOOL CFX_Barcode::SetEndChar(FX_CHAR end) { default: break; } - return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(end) : FALSE; + return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(end) : false; } -FX_BOOL CFX_Barcode::SetVersion(int32_t version) { - typedef FX_BOOL (CBC_CodeBase::*memptrtype)(int32_t); +bool CFX_Barcode::SetVersion(int32_t version) { + typedef bool (CBC_CodeBase::*memptrtype)(int32_t); memptrtype memptr = nullptr; switch (GetType()) { case BC_QR_CODE: @@ -290,10 +290,10 @@ FX_BOOL CFX_Barcode::SetVersion(int32_t version) { default: break; } - return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(version) : FALSE; + return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(version) : false; } -FX_BOOL CFX_Barcode::SetErrorCorrectionLevel(int32_t level) { - typedef FX_BOOL (CBC_CodeBase::*memptrtype)(int32_t); +bool CFX_Barcode::SetErrorCorrectionLevel(int32_t level) { + typedef bool (CBC_CodeBase::*memptrtype)(int32_t); memptrtype memptr = nullptr; switch (GetType()) { case BC_QR_CODE: @@ -303,12 +303,12 @@ FX_BOOL CFX_Barcode::SetErrorCorrectionLevel(int32_t level) { memptr = (memptrtype)&CBC_PDF417I::SetErrorCorrectionLevel; break; default: - return FALSE; + return false; } - return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(level) : FALSE; + return m_pBCEngine && memptr ? (m_pBCEngine.get()->*memptr)(level) : false; } -FX_BOOL CFX_Barcode::SetTruncated(FX_BOOL truncated) { - typedef void (CBC_CodeBase::*memptrtype)(FX_BOOL); +bool CFX_Barcode::SetTruncated(bool truncated) { + typedef void (CBC_CodeBase::*memptrtype)(bool); memptrtype memptr = nullptr; switch (GetType()) { case BC_PDF417: @@ -317,22 +317,22 @@ FX_BOOL CFX_Barcode::SetTruncated(FX_BOOL truncated) { default: break; } - return m_pBCEngine && memptr ? ((m_pBCEngine.get()->*memptr)(truncated), TRUE) - : FALSE; + return m_pBCEngine && memptr ? ((m_pBCEngine.get()->*memptr)(truncated), true) + : false; } -FX_BOOL CFX_Barcode::Encode(const CFX_WideStringC& contents, - FX_BOOL isDevice, - int32_t& e) { +bool CFX_Barcode::Encode(const CFX_WideStringC& contents, + bool isDevice, + int32_t& e) { return m_pBCEngine && m_pBCEngine->Encode(contents, isDevice, e); } -FX_BOOL CFX_Barcode::RenderDevice(CFX_RenderDevice* device, - const CFX_Matrix* matrix, - int32_t& e) { +bool CFX_Barcode::RenderDevice(CFX_RenderDevice* device, + const CFX_Matrix* matrix, + int32_t& e) { return m_pBCEngine && m_pBCEngine->RenderDevice(device, matrix, e); } -FX_BOOL CFX_Barcode::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) { +bool CFX_Barcode::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) { return m_pBCEngine && m_pBCEngine->RenderBitmap(pOutBitmap, e); } diff --git a/xfa/fwl/core/cfx_barcode.h b/xfa/fwl/core/cfx_barcode.h index 8a6a10adc2..0a454e5599 100644 --- a/xfa/fwl/core/cfx_barcode.h +++ b/xfa/fwl/core/cfx_barcode.h @@ -25,33 +25,33 @@ class CFX_Barcode { CFX_Barcode(); ~CFX_Barcode(); - FX_BOOL Create(BC_TYPE type); + bool Create(BC_TYPE type); BC_TYPE GetType(); - FX_BOOL Encode(const CFX_WideStringC& contents, FX_BOOL isDevice, int32_t& e); - FX_BOOL RenderDevice(CFX_RenderDevice* device, - const CFX_Matrix* matrix, - int32_t& e); - FX_BOOL RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e); - FX_BOOL SetCharEncoding(BC_CHAR_ENCODING encoding); - FX_BOOL SetModuleHeight(int32_t moduleHeight); - FX_BOOL SetModuleWidth(int32_t moduleWidth); - FX_BOOL SetHeight(int32_t height); - FX_BOOL SetWidth(int32_t width); - FX_BOOL CheckContentValidity(const CFX_WideStringC& contents); - FX_BOOL SetPrintChecksum(FX_BOOL checksum); - FX_BOOL SetDataLength(int32_t length); - FX_BOOL SetCalChecksum(FX_BOOL state); - FX_BOOL SetFont(CFX_Font* pFont); - FX_BOOL SetFontSize(FX_FLOAT size); - FX_BOOL SetFontStyle(int32_t style); - FX_BOOL SetFontColor(FX_ARGB color); - FX_BOOL SetTextLocation(BC_TEXT_LOC location); - FX_BOOL SetWideNarrowRatio(int32_t ratio); - FX_BOOL SetStartChar(FX_CHAR start); - FX_BOOL SetEndChar(FX_CHAR end); - FX_BOOL SetVersion(int32_t version); - FX_BOOL SetErrorCorrectionLevel(int32_t level); - FX_BOOL SetTruncated(FX_BOOL truncated); + bool Encode(const CFX_WideStringC& contents, bool isDevice, int32_t& e); + bool RenderDevice(CFX_RenderDevice* device, + const CFX_Matrix* matrix, + int32_t& e); + bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e); + bool SetCharEncoding(BC_CHAR_ENCODING encoding); + bool SetModuleHeight(int32_t moduleHeight); + bool SetModuleWidth(int32_t moduleWidth); + bool SetHeight(int32_t height); + bool SetWidth(int32_t width); + bool CheckContentValidity(const CFX_WideStringC& contents); + bool SetPrintChecksum(bool checksum); + bool SetDataLength(int32_t length); + bool SetCalChecksum(bool state); + bool SetFont(CFX_Font* pFont); + bool SetFontSize(FX_FLOAT size); + bool SetFontStyle(int32_t style); + bool SetFontColor(FX_ARGB color); + bool SetTextLocation(BC_TEXT_LOC location); + bool SetWideNarrowRatio(int32_t ratio); + bool SetStartChar(FX_CHAR start); + bool SetEndChar(FX_CHAR end); + bool SetVersion(int32_t version); + bool SetErrorCorrectionLevel(int32_t level); + bool SetTruncated(bool truncated); protected: std::unique_ptr<CBC_CodeBase> m_pBCEngine; diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp index 2c67f6e34a..86a1ca8e44 100644 --- a/xfa/fwl/core/fwl_noteimp.cpp +++ b/xfa/fwl/core/fwl_noteimp.cpp @@ -14,7 +14,7 @@ #include "xfa/fwl/core/ifwl_tooltip.h" CFWL_NoteLoop::CFWL_NoteLoop(IFWL_Widget* pForm) - : m_pForm(pForm), m_bContinueModal(TRUE) {} + : m_pForm(pForm), m_bContinueModal(true) {} FWL_Error CFWL_NoteLoop::Idle(int32_t count) { #if (_FX_OS_ == _FX_WIN32_DESKTOP_) @@ -38,11 +38,11 @@ FWL_Error CFWL_NoteLoop::Idle(int32_t count) { IFWL_Widget* CFWL_NoteLoop::GetForm() { return m_pForm; } -FX_BOOL CFWL_NoteLoop::ContinueModal() { +bool CFWL_NoteLoop::ContinueModal() { return m_bContinueModal; } FWL_Error CFWL_NoteLoop::EndModalLoop() { - m_bContinueModal = FALSE; + m_bContinueModal = false; return FWL_Error::Succeeded; } @@ -71,7 +71,7 @@ CFWL_NoteDriver::CFWL_NoteDriver() PushNoteLoop(m_pNoteLoop.get()); } CFWL_NoteDriver::~CFWL_NoteDriver() { - ClearInvalidEventTargets(TRUE); + ClearInvalidEventTargets(true); } void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) { @@ -114,7 +114,7 @@ FWL_Error CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) { return FWL_Error::Succeeded; } -void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) { +void CFWL_NoteDriver::ClearEventTargets(bool bRemoveAll) { ClearInvalidEventTargets(bRemoveAll); } @@ -131,9 +131,9 @@ CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() { m_noteLoopQueue.RemoveAt(pos - 1); return p; } -FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) { +bool CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, bool bNotify) { if (m_pFocus == pFocus) { - return TRUE; + return true; } IFWL_Widget* pPrev = m_pFocus; m_pFocus = pFocus; @@ -163,7 +163,7 @@ FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) { if (IFWL_WidgetDelegate* pDelegate = pFocus->GetDelegate()) pDelegate->OnProcessMessage(&ms); } - return TRUE; + return true; } FWL_Error CFWL_NoteDriver::Run() { #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ @@ -190,7 +190,7 @@ IFWL_Widget* CFWL_NoteDriver::GetHover() { void CFWL_NoteDriver::SetHover(IFWL_Widget* pHover) { m_pHover = pHover; } -void CFWL_NoteDriver::SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet) { +void CFWL_NoteDriver::SetGrab(IFWL_Widget* pGrab, bool bSet) { m_pGrab = bSet ? pGrab : nullptr; } void CFWL_NoteDriver::NotifyTargetHide(IFWL_Widget* pNoteTarget) { @@ -256,25 +256,25 @@ FWL_Error CFWL_NoteDriver::UnRegisterForm(IFWL_Widget* pForm) { m_forms.RemoveAt(nIndex); return FWL_Error::Succeeded; } -FX_BOOL CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) { +bool CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) { pMessage->Retain(); m_noteQueue.Add(pMessage); - return TRUE; + return true; } -FX_BOOL CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) { +bool CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) { if (m_noteQueue.GetSize() < 1) { - return FALSE; + return false; } CFWL_Message* pMessage = m_noteQueue[0]; m_noteQueue.RemoveAt(0); if (!IsValidMessage(pMessage)) { pMessage->Release(); - return TRUE; + return true; } ProcessMessage(pMessage); pMessage->Release(); - return TRUE; + return true; } CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() { int32_t size = m_noteLoopQueue.GetSize(); @@ -286,25 +286,25 @@ int32_t CFWL_NoteDriver::CountLoop() { return m_noteLoopQueue.GetSize(); } -FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { +bool CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { CFWL_WidgetMgr* pWidgetMgr = pMessage->m_pDstTarget->GetOwnerApp()->GetWidgetMgr(); IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled() ? pMessage->m_pDstTarget : GetMessageForm(pMessage->m_pDstTarget); if (!pMessageForm) - return FALSE; + return false; if (DispatchMessage(pMessage, pMessageForm)) { if (pMessage->GetClassID() == CFWL_MessageType::Mouse) MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage)); - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage, - IFWL_Widget* pMessageForm) { - FX_BOOL bRet = FALSE; +bool CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage, + IFWL_Widget* pMessageForm) { + bool bRet = false; switch (pMessage->GetClassID()) { case CFWL_MessageType::Activate: { bRet = DoActivate(static_cast<CFWL_MsgActivate*>(pMessage), pMessageForm); @@ -341,7 +341,7 @@ FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage, break; } case CFWL_MessageType::Cursor: { - bRet = TRUE; + bRet = true; break; } case CFWL_MessageType::WindowMove: { @@ -355,7 +355,7 @@ FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage, break; } default: { - bRet = TRUE; + bRet = true; break; } } @@ -368,49 +368,49 @@ FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage, return bRet; } -FX_BOOL CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg, - IFWL_Widget* pMessageForm) { +bool CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg, + IFWL_Widget* pMessageForm) { pMsg->m_pDstTarget = pMessageForm; return !!(pMsg->m_pDstTarget->GetStates() & FWL_WGTSTATE_Deactivated); } -FX_BOOL CFWL_NoteDriver::DoDeactivate(CFWL_MsgDeactivate* pMsg, - IFWL_Widget* pMessageForm) { +bool CFWL_NoteDriver::DoDeactivate(CFWL_MsgDeactivate* pMsg, + IFWL_Widget* pMessageForm) { int32_t iTrackLoop = m_noteLoopQueue.GetSize(); if (iTrackLoop <= 0) - return FALSE; + return false; if (iTrackLoop == 1) { if (pMessageForm->IsInstance(FX_WSTRC(L"FWL_FORMPROXY"))) { - return FALSE; + return false; } if (pMsg->m_pSrcTarget && pMsg->m_pSrcTarget->IsInstance(FX_WSTRC(L"FWL_FORMPROXY"))) { - return FALSE; + return false; } if (pMsg->m_pSrcTarget && pMsg->m_pSrcTarget->GetClassID() == FWL_Type::ToolTip) { - return FALSE; + return false; } - return TRUE; + return true; } IFWL_Widget* pDst = pMsg->m_pDstTarget; if (!pDst) - return FALSE; + return false; #if (_FX_OS_ == _FX_MACOSX_) if (pDst == pMessageForm && pDst->IsInstance(L"FWL_FORMPROXY")) { - return TRUE; + return true; } #endif return pDst != pMessageForm && !pDst->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")) && !pMessageForm->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")); } -FX_BOOL CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg, - IFWL_Widget* pMessageForm) { +bool CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg, + IFWL_Widget* pMessageForm) { CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr(); if (pWidgetMgr->IsFormDisabled()) { m_pFocus = pMsg->m_pDstTarget; - return TRUE; + return true; } IFWL_Widget* pWidget = pMsg->m_pDstTarget; if (pWidget) { @@ -420,20 +420,20 @@ FX_BOOL CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg, pMsg->m_pDstTarget = pSubFocus; if (m_pFocus != pMsg->m_pDstTarget) { m_pFocus = pMsg->m_pDstTarget; - return TRUE; + return true; } } } - return FALSE; + return false; } -FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg, - IFWL_Widget* pMessageForm) { +bool CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg, + IFWL_Widget* pMessageForm) { CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr(); if (pWidgetMgr->IsFormDisabled()) { if (m_pFocus == pMsg->m_pDstTarget) { m_pFocus = nullptr; } - return TRUE; + return true; } IFWL_Form* pForm = static_cast<IFWL_Form*>(pMsg->m_pDstTarget); if (pForm) { @@ -442,13 +442,13 @@ FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg, pMsg->m_pDstTarget = pSubFocus; if (m_pFocus == pMsg->m_pDstTarget) { m_pFocus = nullptr; - return TRUE; + return true; } } } - return FALSE; + return false; } -FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) { +bool CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) { #if (_FX_OS_ != _FX_MACOSX_) if (pMsg->m_dwCmd == FWL_KeyCommand::KeyDown && pMsg->m_dwKeyCode == FWL_VKEY_Tab) { @@ -459,19 +459,19 @@ FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) { if (pWidgetMgr->GetSystemFormWidget(m_pFocus) != pForm) pFocus = nullptr; } - FX_BOOL bFind = FALSE; + bool bFind = false; IFWL_Widget* pNextTabStop = pWidgetMgr->nextTab(pForm, pFocus, bFind); if (!pNextTabStop) { - bFind = FALSE; + bFind = false; pNextTabStop = pWidgetMgr->nextTab(pForm, nullptr, bFind); } if (pNextTabStop == pFocus) { - return TRUE; + return true; } if (pNextTabStop) { SetFocus(pNextTabStop); } - return TRUE; + return true; } #endif if (!m_pFocus) { @@ -481,16 +481,15 @@ FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) { IFWL_Widget* defButton = pWidgetMgr->GetDefaultButton(pMessageForm); if (defButton) { pMsg->m_pDstTarget = defButton; - return TRUE; + return true; } } - return FALSE; + return false; } pMsg->m_pDstTarget = m_pFocus; - return TRUE; + return true; } -FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg, - IFWL_Widget* pMessageForm) { +bool CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg, IFWL_Widget* pMessageForm) { if (pMsg->m_dwCmd == FWL_MouseCommand::Leave || pMsg->m_dwCmd == FWL_MouseCommand::Hover || pMsg->m_dwCmd == FWL_MouseCommand::Enter) { @@ -502,45 +501,45 @@ FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg, if (!DoMouseEx(pMsg, pMessageForm)) { pMsg->m_pDstTarget = pMessageForm; } - return TRUE; + return true; } -FX_BOOL CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg, - IFWL_Widget* pMessageForm) { +bool CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg, + IFWL_Widget* pMessageForm) { CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr(); if (!pWidgetMgr) - return FALSE; + return false; IFWL_Widget* pDst = pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy); if (!pDst) - return FALSE; + return false; pMessageForm->TransformTo(pDst, pMsg->m_fx, pMsg->m_fy); pMsg->m_pDstTarget = pDst; - return TRUE; + return true; } -FX_BOOL CFWL_NoteDriver::DoSize(CFWL_MsgSize* pMsg) { +bool CFWL_NoteDriver::DoSize(CFWL_MsgSize* pMsg) { CFWL_WidgetMgr* pWidgetMgr = pMsg->m_pDstTarget->GetOwnerApp()->GetWidgetMgr(); if (!pWidgetMgr) - return FALSE; + return false; pWidgetMgr->NotifySizeChanged(pMsg->m_pDstTarget, (FX_FLOAT)pMsg->m_iWidth, (FX_FLOAT)pMsg->m_iHeight); - return TRUE; + return true; } -FX_BOOL CFWL_NoteDriver::DoWindowMove(CFWL_MsgWindowMove* pMsg, - IFWL_Widget* pMessageForm) { +bool CFWL_NoteDriver::DoWindowMove(CFWL_MsgWindowMove* pMsg, + IFWL_Widget* pMessageForm) { return pMsg->m_pDstTarget == pMessageForm; } -FX_BOOL CFWL_NoteDriver::DoDragFiles(CFWL_MsgDropFiles* pMsg, - IFWL_Widget* pMessageForm) { +bool CFWL_NoteDriver::DoDragFiles(CFWL_MsgDropFiles* pMsg, + IFWL_Widget* pMessageForm) { return pMsg->m_pDstTarget == pMessageForm; } -FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg, - IFWL_Widget* pMessageForm) { +bool CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg, + IFWL_Widget* pMessageForm) { CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr(); if (!pWidgetMgr) - return FALSE; + return false; IFWL_Widget* pTarget = nullptr; if (m_pGrab) pTarget = m_pGrab; @@ -554,9 +553,9 @@ FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg, } } if (!pTarget) - return FALSE; + return false; pMsg->m_pDstTarget = pTarget; - return TRUE; + return true; } void CFWL_NoteDriver::MouseSecondary(CFWL_MsgMouse* pMsg) { IFWL_Widget* pTarget = pMsg->m_pDstTarget; @@ -586,24 +585,24 @@ void CFWL_NoteDriver::MouseSecondary(CFWL_MsgMouse* pMsg) { msHover.m_dwCmd = FWL_MouseCommand::Hover; DispatchMessage(&msHover, nullptr); } -FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) { +bool CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) { if (pMessage->GetClassID() == CFWL_MessageType::Post) - return TRUE; + return true; int32_t iCount = m_noteLoopQueue.GetSize(); for (int32_t i = 0; i < iCount; i++) { CFWL_NoteLoop* pNoteLoop = static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[i]); IFWL_Widget* pForm = pNoteLoop->GetForm(); if (pForm && (pForm == pMessage->m_pDstTarget)) - return TRUE; + return true; } iCount = m_forms.GetSize(); for (int32_t j = 0; j < iCount; j++) { IFWL_Form* pForm = static_cast<IFWL_Form*>(m_forms[j]); if (pForm == pMessage->m_pDstTarget) - return TRUE; + return true; } - return FALSE; + return false; } IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) { @@ -627,7 +626,7 @@ IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) { return pMessageForm; } -void CFWL_NoteDriver::ClearInvalidEventTargets(FX_BOOL bRemoveAll) { +void CFWL_NoteDriver::ClearInvalidEventTargets(bool bRemoveAll) { auto it = m_eventTargets.begin(); while (it != m_eventTargets.end()) { auto old = it++; @@ -692,7 +691,7 @@ CFX_RectF CFWL_CoreToolTipDP::GetAnchor() { CFWL_EventTarget::CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver, IFWL_Widget* pListener) - : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(FALSE) {} + : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(false) {} CFWL_EventTarget::~CFWL_EventTarget() { m_eventSources.RemoveAll(); } @@ -706,13 +705,13 @@ int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, return 1; } -FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { +bool CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { IFWL_WidgetDelegate* pDelegate = m_pListener->GetDelegate(); if (!pDelegate) - return FALSE; + return false; if (m_eventSources.GetCount() == 0) { pDelegate->OnProcessEvent(pEvent); - return TRUE; + return true; } FX_POSITION pos = m_eventSources.GetStartPosition(); while (pos) { @@ -723,16 +722,16 @@ FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { pEvent->GetClassID() == CFWL_EventType::Idle) { if (IsFilterEvent(pEvent, dwFilter)) { pDelegate->OnProcessEvent(pEvent); - return TRUE; + return true; } } } - return FALSE; + return false; } -FX_BOOL CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) { +bool CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) { if (dwFilter == FWL_EVENT_ALL_MASK) - return TRUE; + return true; switch (pEvent->GetClassID()) { case CFWL_EventType::Mouse: diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h index db967fcc15..e9a738aa87 100644 --- a/xfa/fwl/core/fwl_noteimp.h +++ b/xfa/fwl/core/fwl_noteimp.h @@ -39,7 +39,7 @@ class CFWL_NoteLoop { FWL_Error Idle(int32_t count); IFWL_Widget* GetForm(); - FX_BOOL ContinueModal(); + bool ContinueModal(); FWL_Error EndModalLoop(); FWL_Error SetMainForm(IFWL_Widget* pForm); @@ -47,7 +47,7 @@ class CFWL_NoteLoop { void GenerateCommondEvent(uint32_t dwCommand); IFWL_Widget* m_pForm; - FX_BOOL m_bContinueModal; + bool m_bContinueModal; }; class CFWL_NoteDriver { @@ -60,12 +60,12 @@ class CFWL_NoteDriver { IFWL_Widget* pEventSource = nullptr, uint32_t dwFilter = FWL_EVENT_ALL_MASK); FWL_Error UnregisterEventTarget(IFWL_Widget* pListener); - void ClearEventTargets(FX_BOOL bRemoveAll); + void ClearEventTargets(bool bRemoveAll); FWL_Error PushNoteLoop(CFWL_NoteLoop* pNoteLoop); CFWL_NoteLoop* PopNoteLoop(); IFWL_Widget* GetFocus(); - FX_BOOL SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify = FALSE); - void SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet); + bool SetFocus(IFWL_Widget* pFocus, bool bNotify = false); + void SetGrab(IFWL_Widget* pGrab, bool bSet); FWL_Error Run(); IFWL_Widget* GetHover(); @@ -74,29 +74,29 @@ class CFWL_NoteDriver { void NotifyTargetDestroy(IFWL_Widget* pNoteTarget); FWL_Error RegisterForm(IFWL_Widget* pForm); FWL_Error UnRegisterForm(IFWL_Widget* pForm); - FX_BOOL QueueMessage(CFWL_Message* pMessage); - FX_BOOL UnqueueMessage(CFWL_NoteLoop* pNoteLoop); + bool QueueMessage(CFWL_Message* pMessage); + bool UnqueueMessage(CFWL_NoteLoop* pNoteLoop); CFWL_NoteLoop* GetTopLoop(); int32_t CountLoop(); - FX_BOOL ProcessMessage(CFWL_Message* pMessage); + bool ProcessMessage(CFWL_Message* pMessage); protected: - FX_BOOL DispatchMessage(CFWL_Message* pMessage, IFWL_Widget* pMessageForm); - FX_BOOL DoActivate(CFWL_MsgActivate* pMsg, IFWL_Widget* pMessageForm); - FX_BOOL DoDeactivate(CFWL_MsgDeactivate* pMsg, IFWL_Widget* pMessageForm); - FX_BOOL DoSetFocus(CFWL_MsgSetFocus* pMsg, IFWL_Widget* pMessageForm); - FX_BOOL DoKillFocus(CFWL_MsgKillFocus* pMsg, IFWL_Widget* pMessageForm); - FX_BOOL DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm); - FX_BOOL DoMouse(CFWL_MsgMouse* pMsg, IFWL_Widget* pMessageForm); - FX_BOOL DoWheel(CFWL_MsgMouseWheel* pMsg, IFWL_Widget* pMessageForm); - FX_BOOL DoSize(CFWL_MsgSize* pMsg); - FX_BOOL DoWindowMove(CFWL_MsgWindowMove* pMsg, IFWL_Widget* pMessageForm); - FX_BOOL DoDragFiles(CFWL_MsgDropFiles* pMsg, IFWL_Widget* pMessageForm); - FX_BOOL DoMouseEx(CFWL_MsgMouse* pMsg, IFWL_Widget* pMessageForm); + bool DispatchMessage(CFWL_Message* pMessage, IFWL_Widget* pMessageForm); + bool DoActivate(CFWL_MsgActivate* pMsg, IFWL_Widget* pMessageForm); + bool DoDeactivate(CFWL_MsgDeactivate* pMsg, IFWL_Widget* pMessageForm); + bool DoSetFocus(CFWL_MsgSetFocus* pMsg, IFWL_Widget* pMessageForm); + bool DoKillFocus(CFWL_MsgKillFocus* pMsg, IFWL_Widget* pMessageForm); + bool DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm); + bool DoMouse(CFWL_MsgMouse* pMsg, IFWL_Widget* pMessageForm); + bool DoWheel(CFWL_MsgMouseWheel* pMsg, IFWL_Widget* pMessageForm); + bool DoSize(CFWL_MsgSize* pMsg); + bool DoWindowMove(CFWL_MsgWindowMove* pMsg, IFWL_Widget* pMessageForm); + bool DoDragFiles(CFWL_MsgDropFiles* pMsg, IFWL_Widget* pMessageForm); + bool DoMouseEx(CFWL_MsgMouse* pMsg, IFWL_Widget* pMessageForm); void MouseSecondary(CFWL_MsgMouse* pMsg); - FX_BOOL IsValidMessage(CFWL_Message* pMessage); + bool IsValidMessage(CFWL_Message* pMessage); IFWL_Widget* GetMessageForm(IFWL_Widget* pDstTarget); - void ClearInvalidEventTargets(FX_BOOL bRemoveAll); + void ClearInvalidEventTargets(bool bRemoveAll); CFX_ArrayTemplate<IFWL_Widget*> m_forms; CFX_ArrayTemplate<CFWL_Message*> m_noteQueue; @@ -115,16 +115,16 @@ class CFWL_EventTarget { int32_t SetEventSource(IFWL_Widget* pSource, uint32_t dwFilter = FWL_EVENT_ALL_MASK); - FX_BOOL ProcessEvent(CFWL_Event* pEvent); - FX_BOOL IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter); - FX_BOOL IsInvalid() { return m_bInvalid; } - void FlagInvalid() { m_bInvalid = TRUE; } + bool ProcessEvent(CFWL_Event* pEvent); + bool IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter); + bool IsInvalid() { return m_bInvalid; } + void FlagInvalid() { m_bInvalid = true; } protected: CFX_MapPtrTemplate<void*, uint32_t> m_eventSources; IFWL_Widget* m_pListener; CFWL_NoteDriver* m_pNoteDriver; - FX_BOOL m_bInvalid; + bool m_bInvalid; }; class CFWL_ToolTipContainer final { diff --git a/xfa/fwl/core/ifwl_barcode.cpp b/xfa/fwl/core/ifwl_barcode.cpp index e708e7ed53..9495dd96b5 100644 --- a/xfa/fwl/core/ifwl_barcode.cpp +++ b/xfa/fwl/core/ifwl_barcode.cpp @@ -135,7 +135,7 @@ void IFWL_Barcode::GenerateBarcodeImageCache() { m_pBarcodeEngine->SetTruncated(pData->GetTruncated()); } int32_t errorCode = 0; - m_dwStatus = m_pBarcodeEngine->Encode(wsText.AsStringC(), TRUE, errorCode) + m_dwStatus = m_pBarcodeEngine->Encode(wsText.AsStringC(), true, errorCode) ? XFA_BCS_EncodeSuccess : 0; } @@ -162,16 +162,16 @@ FWL_Error IFWL_Barcode::SetText(const CFX_WideString& wsText) { m_dwStatus = XFA_BCS_NeedUpdate; return IFWL_Edit::SetText(wsText); } -FX_BOOL IFWL_Barcode::IsProtectedType() { +bool IFWL_Barcode::IsProtectedType() { if (!m_pBarcodeEngine) { - return TRUE; + return true; } BC_TYPE tEngineType = m_pBarcodeEngine->GetType(); if (tEngineType == BC_QR_CODE || tEngineType == BC_PDF417 || tEngineType == BC_DATAMATRIX) { - return TRUE; + return true; } - return FALSE; + return false; } void IFWL_Barcode::OnProcessEvent(CFWL_Event* pEvent) { diff --git a/xfa/fwl/core/ifwl_barcode.h b/xfa/fwl/core/ifwl_barcode.h index 33cb442e50..36befa469b 100644 --- a/xfa/fwl/core/ifwl_barcode.h +++ b/xfa/fwl/core/ifwl_barcode.h @@ -43,15 +43,15 @@ class IFWL_BarcodeDP : public IFWL_EditDP { virtual int32_t GetModuleHeight() const = 0; virtual int32_t GetModuleWidth() const = 0; virtual int32_t GetDataLength() const = 0; - virtual FX_BOOL GetCalChecksum() const = 0; - virtual FX_BOOL GetPrintChecksum() const = 0; + virtual bool GetCalChecksum() const = 0; + virtual bool GetPrintChecksum() const = 0; virtual BC_TEXT_LOC GetTextLocation() const = 0; virtual int32_t GetWideNarrowRatio() const = 0; virtual FX_CHAR GetStartChar() const = 0; virtual FX_CHAR GetEndChar() const = 0; virtual int32_t GetVersion() const = 0; virtual int32_t GetErrorCorrectionLevel() const = 0; - virtual FX_BOOL GetTruncated() const = 0; + virtual bool GetTruncated() const = 0; virtual uint32_t GetBarcodeAttributeMask() const = 0; }; @@ -70,7 +70,7 @@ class IFWL_Barcode : public IFWL_Edit { void OnProcessEvent(CFWL_Event* pEvent) override; void SetType(BC_TYPE type); - FX_BOOL IsProtectedType(); + bool IsProtectedType(); protected: void GenerateBarcodeImageCache(); diff --git a/xfa/fwl/core/ifwl_caret.cpp b/xfa/fwl/core/ifwl_caret.cpp index 94b56e8cf9..4e9b7f64b5 100644 --- a/xfa/fwl/core/ifwl_caret.cpp +++ b/xfa/fwl/core/ifwl_caret.cpp @@ -20,7 +20,7 @@ IFWL_Caret::IFWL_Caret(const IFWL_App* app, m_pTimer(new IFWL_Caret::Timer(this)), m_pTimerInfo(nullptr), m_dwElapse(400), - m_bSetColor(FALSE) { + m_bSetColor(false) { SetStates(FWL_STATE_CAT_HightLight); } @@ -48,7 +48,7 @@ FWL_Error IFWL_Caret::DrawWidget(CFX_Graphics* pGraphics, return FWL_Error::Succeeded; } -void IFWL_Caret::ShowCaret(FX_BOOL bFlag) { +void IFWL_Caret::ShowCaret(bool bFlag) { if (m_pTimerInfo) { m_pTimerInfo->StopTimer(); m_pTimerInfo = nullptr; @@ -70,7 +70,7 @@ FWL_Error IFWL_Caret::SetFrequency(uint32_t elapse) { } FWL_Error IFWL_Caret::SetColor(CFX_Color crFill) { - m_bSetColor = TRUE; + m_bSetColor = true; m_crFill = crFill; return FWL_Error::Succeeded; } diff --git a/xfa/fwl/core/ifwl_caret.h b/xfa/fwl/core/ifwl_caret.h index 888e8ffbed..7d91d5760f 100644 --- a/xfa/fwl/core/ifwl_caret.h +++ b/xfa/fwl/core/ifwl_caret.h @@ -33,7 +33,7 @@ class IFWL_Caret : public IFWL_Widget { void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; - void ShowCaret(FX_BOOL bFlag = TRUE); + void ShowCaret(bool bFlag = true); FWL_Error GetFrequency(uint32_t& elapse); FWL_Error SetFrequency(uint32_t elapse); FWL_Error SetColor(CFX_Color crFill); @@ -56,7 +56,7 @@ class IFWL_Caret : public IFWL_Widget { IFWL_TimerInfo* m_pTimerInfo; // not owned. uint32_t m_dwElapse; CFX_Color m_crFill; - FX_BOOL m_bSetColor; + bool m_bSetColor; }; #endif // XFA_FWL_CORE_IFWL_CARET_H_ diff --git a/xfa/fwl/core/ifwl_checkbox.cpp b/xfa/fwl/core/ifwl_checkbox.cpp index b4e6fd4ce1..f03b864717 100644 --- a/xfa/fwl/core/ifwl_checkbox.cpp +++ b/xfa/fwl/core/ifwl_checkbox.cpp @@ -30,7 +30,7 @@ IFWL_CheckBox::IFWL_CheckBox(const IFWL_App* app, : IFWL_Widget(app, properties, nullptr), m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), m_iTTOAlign(FDE_TTOALIGNMENT_Center), - m_bBtnDown(FALSE) { + m_bBtnDown(false) { m_rtClient.Reset(); m_rtBox.Reset(); m_rtCaption.Reset(); @@ -43,7 +43,7 @@ FWL_Type IFWL_CheckBox::GetClassID() const { return FWL_Type::CheckBox; } -FWL_Error IFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error IFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pThemeProvider) @@ -68,7 +68,7 @@ FWL_Error IFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (rect.height < fCheckBox) { rect.height = fCheckBox; } - IFWL_Widget::GetWidgetRect(rect, TRUE); + IFWL_Widget::GetWidgetRect(rect, true); } else { rect = m_pProperties->m_rtWidget; } @@ -399,10 +399,10 @@ void IFWL_CheckBox::OnProcessMessage(CFWL_Message* pMessage) { OnActivate(pMessage); break; case CFWL_MessageType::SetFocus: - OnFocusChanged(pMessage, TRUE); + OnFocusChanged(pMessage, true); break; case CFWL_MessageType::KillFocus: - OnFocusChanged(pMessage, FALSE); + OnFocusChanged(pMessage, false); break; case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); @@ -447,7 +447,7 @@ void IFWL_CheckBox::OnActivate(CFWL_Message* pMsg) { Repaint(&(m_rtClient)); } -void IFWL_CheckBox::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { +void IFWL_CheckBox::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { if (bSet) m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; else @@ -460,9 +460,9 @@ void IFWL_CheckBox::OnLButtonDown(CFWL_MsgMouse* pMsg) { if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) return; if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) - SetFocus(TRUE); + SetFocus(true); - m_bBtnDown = TRUE; + m_bBtnDown = true; m_pProperties->m_dwStates &= ~FWL_STATE_CKB_Hovered; m_pProperties->m_dwStates |= FWL_STATE_CKB_Pressed; Repaint(&(m_rtClient)); @@ -472,7 +472,7 @@ void IFWL_CheckBox::OnLButtonUp(CFWL_MsgMouse* pMsg) { if (!m_bBtnDown) return; - m_bBtnDown = FALSE; + m_bBtnDown = false; if (!m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) return; @@ -485,31 +485,31 @@ void IFWL_CheckBox::OnMouseMove(CFWL_MsgMouse* pMsg) { if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) return; - FX_BOOL bRepaint = FALSE; + bool bRepaint = false; if (m_bBtnDown) { if (m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) { if ((m_pProperties->m_dwStates & FWL_STATE_CKB_Pressed) == 0) { - bRepaint = TRUE; + bRepaint = true; m_pProperties->m_dwStates |= FWL_STATE_CKB_Pressed; } if ((m_pProperties->m_dwStates & FWL_STATE_CKB_Hovered)) { - bRepaint = TRUE; + bRepaint = true; m_pProperties->m_dwStates &= ~FWL_STATE_CKB_Hovered; } } else { if (m_pProperties->m_dwStates & FWL_STATE_CKB_Pressed) { - bRepaint = TRUE; + bRepaint = true; m_pProperties->m_dwStates &= ~FWL_STATE_CKB_Pressed; } if ((m_pProperties->m_dwStates & FWL_STATE_CKB_Hovered) == 0) { - bRepaint = TRUE; + bRepaint = true; m_pProperties->m_dwStates |= FWL_STATE_CKB_Hovered; } } } else { if (m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) { if ((m_pProperties->m_dwStates & FWL_STATE_CKB_Hovered) == 0) { - bRepaint = TRUE; + bRepaint = true; m_pProperties->m_dwStates |= FWL_STATE_CKB_Hovered; } } diff --git a/xfa/fwl/core/ifwl_checkbox.h b/xfa/fwl/core/ifwl_checkbox.h index 6222e4be79..c08d845d29 100644 --- a/xfa/fwl/core/ifwl_checkbox.h +++ b/xfa/fwl/core/ifwl_checkbox.h @@ -62,7 +62,7 @@ class IFWL_CheckBox : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; FWL_Error Update() override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr) override; @@ -86,11 +86,11 @@ class IFWL_CheckBox : public IFWL_Widget { CFX_RectF m_rtFocus; uint32_t m_dwTTOStyles; int32_t m_iTTOAlign; - FX_BOOL m_bBtnDown; + bool m_bBtnDown; private: void OnActivate(CFWL_Message* pMsg); - void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet); + void OnFocusChanged(CFWL_Message* pMsg, bool bSet); void OnLButtonDown(CFWL_MsgMouse* pMsg); void OnLButtonUp(CFWL_MsgMouse* pMsg); void OnMouseMove(CFWL_MsgMouse* pMsg); diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp index 1721aee2a7..4be684abb9 100644 --- a/xfa/fwl/core/ifwl_combobox.cpp +++ b/xfa/fwl/core/ifwl_combobox.cpp @@ -26,11 +26,11 @@ IFWL_ComboBox::IFWL_ComboBox(const IFWL_App* app, const CFWL_WidgetImpProperties& properties) : IFWL_Widget(app, properties, nullptr), m_pComboBoxProxy(nullptr), - m_bLButtonDown(FALSE), + m_bLButtonDown(false), m_iCurSel(-1), m_iBtnState(CFWL_PartState_Normal), m_fComboFormHandler(0), - m_bNeedShowList(FALSE) { + m_bNeedShowList(false) { m_rtClient.Reset(); m_rtBtn.Reset(); m_rtHandler.Reset(); @@ -66,12 +66,12 @@ FWL_Type IFWL_ComboBox::GetClassID() const { return FWL_Type::ComboBox; } -FWL_Error IFWL_ComboBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error IFWL_ComboBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Reset(); - FX_BOOL bIsDropDown = IsDropDownStyle(); + bool bIsDropDown = IsDropDownStyle(); if (bIsDropDown && m_pEdit) { - m_pEdit->GetWidgetRect(rect, TRUE); + m_pEdit->GetWidgetRect(rect, true); } else { rect.width = 100; rect.height = 16; @@ -84,7 +84,7 @@ FWL_Error IFWL_ComboBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (!pFWidth) return FWL_Error::Indefinite; rect.Inflate(0, 0, *pFWidth, 0); - IFWL_Widget::GetWidgetRect(rect, TRUE); + IFWL_Widget::GetWidgetRect(rect, true); } else { rect = m_pProperties->m_rtWidget; } @@ -104,7 +104,7 @@ FWL_Error IFWL_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, true); } return IFWL_Widget::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } @@ -117,7 +117,7 @@ FWL_Error IFWL_ComboBox::Update() { return FWL_Error::Indefinite; } ReSetTheme(); - FX_BOOL bDropDown = IsDropDownStyle(); + bool bDropDown = IsDropDownStyle(); if (bDropDown && m_pEdit) { ReSetEditAlignment(); } @@ -150,7 +150,7 @@ FWL_Error IFWL_ComboBox::DrawWidget(CFX_Graphics* pGraphics, if (!m_pProperties->m_pThemeProvider) return FWL_Error::Indefinite; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; - FX_BOOL bIsDropDown = IsDropDownStyle(); + bool bIsDropDown = IsDropDownStyle(); if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); } @@ -242,8 +242,8 @@ int32_t IFWL_ComboBox::GetCurSel() { FWL_Error IFWL_ComboBox::SetCurSel(int32_t iSel) { int32_t iCount = m_pListBox->CountItems(); - FX_BOOL bClearSel = iSel < 0 || iSel >= iCount; - FX_BOOL bDropDown = IsDropDownStyle(); + bool bClearSel = iSel < 0 || iSel >= iCount; + bool bDropDown = IsDropDownStyle(); if (bDropDown && m_pEdit) { if (bClearSel) { m_pEdit->SetText(CFX_WideString()); @@ -261,8 +261,8 @@ FWL_Error IFWL_ComboBox::SetCurSel(int32_t iSel) { return FWL_Error::Succeeded; } -void IFWL_ComboBox::SetStates(uint32_t dwStates, FX_BOOL bSet) { - FX_BOOL bIsDropDown = IsDropDownStyle(); +void IFWL_ComboBox::SetStates(uint32_t dwStates, bool bSet) { + bool bIsDropDown = IsDropDownStyle(); if (bIsDropDown && m_pEdit) m_pEdit->SetStates(dwStates, bSet); if (m_pListBox) @@ -329,11 +329,11 @@ FWL_Error IFWL_ComboBox::EditDoClipboard(int32_t iCmd) { return m_pEdit->DoClipboard(iCmd); } -FX_BOOL IFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) { +bool IFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) { return m_pEdit && m_pEdit->Redo(pRecord); } -FX_BOOL IFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) { +bool IFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) { return m_pEdit && m_pEdit->Undo(pRecord); } @@ -341,75 +341,75 @@ IFWL_ListBox* IFWL_ComboBox::GetListBoxt() { return m_pListBox.get(); } -FX_BOOL IFWL_ComboBox::AfterFocusShowDropList() { +bool IFWL_ComboBox::AfterFocusShowDropList() { if (!m_bNeedShowList) { - return FALSE; + return false; } if (m_pEdit) { MatchEditText(); } - ShowDropList(TRUE); - m_bNeedShowList = FALSE; - return TRUE; + ShowDropList(true); + m_bNeedShowList = false; + return true; } -FWL_Error IFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) { +FWL_Error IFWL_ComboBox::OpenDropDownList(bool bActivate) { ShowDropList(bActivate); return FWL_Error::Succeeded; } -FX_BOOL IFWL_ComboBox::EditCanUndo() { +bool IFWL_ComboBox::EditCanUndo() { return m_pEdit->CanUndo(); } -FX_BOOL IFWL_ComboBox::EditCanRedo() { +bool IFWL_ComboBox::EditCanRedo() { return m_pEdit->CanRedo(); } -FX_BOOL IFWL_ComboBox::EditUndo() { +bool IFWL_ComboBox::EditUndo() { return m_pEdit->Undo(); } -FX_BOOL IFWL_ComboBox::EditRedo() { +bool IFWL_ComboBox::EditRedo() { return m_pEdit->Redo(); } -FX_BOOL IFWL_ComboBox::EditCanCopy() { +bool IFWL_ComboBox::EditCanCopy() { return m_pEdit->CountSelRanges() > 0; } -FX_BOOL IFWL_ComboBox::EditCanCut() { +bool IFWL_ComboBox::EditCanCut() { if (m_pEdit->GetStylesEx() & FWL_STYLEEXT_EDT_ReadOnly) { - return FALSE; + return false; } return m_pEdit->CountSelRanges() > 0; } -FX_BOOL IFWL_ComboBox::EditCanSelectAll() { +bool IFWL_ComboBox::EditCanSelectAll() { return m_pEdit->GetTextLength() > 0; } -FX_BOOL IFWL_ComboBox::EditCopy(CFX_WideString& wsCopy) { +bool IFWL_ComboBox::EditCopy(CFX_WideString& wsCopy) { return m_pEdit->Copy(wsCopy); } -FX_BOOL IFWL_ComboBox::EditCut(CFX_WideString& wsCut) { +bool IFWL_ComboBox::EditCut(CFX_WideString& wsCut) { return m_pEdit->Cut(wsCut); } -FX_BOOL IFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) { +bool IFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) { return m_pEdit->Paste(wsPaste); } -FX_BOOL IFWL_ComboBox::EditSelectAll() { +bool IFWL_ComboBox::EditSelectAll() { return m_pEdit->AddSelRange(0) == FWL_Error::Succeeded; } -FX_BOOL IFWL_ComboBox::EditDelete() { +bool IFWL_ComboBox::EditDelete() { return m_pEdit->ClearText() == FWL_Error::Succeeded; } -FX_BOOL IFWL_ComboBox::EditDeSelect() { +bool IFWL_ComboBox::EditDeSelect() { return m_pEdit->ClearSelections() == FWL_Error::Succeeded; } @@ -453,11 +453,11 @@ void IFWL_ComboBox::DrawStretchHandler(CFX_Graphics* pGraphics, m_pProperties->m_pThemeProvider->DrawBackground(¶m); } -void IFWL_ComboBox::ShowDropList(FX_BOOL bActivate) { +void IFWL_ComboBox::ShowDropList(bool bActivate) { if (m_pWidgetMgr->IsFormDisabled()) return DisForm_ShowDropList(bActivate); - FX_BOOL bDropList = IsDropListShowed(); + bool bDropList = IsDropListShowed(); if (bDropList == bActivate) return; if (!m_pComboBoxProxy) @@ -470,7 +470,7 @@ void IFWL_ComboBox::ShowDropList(FX_BOOL bActivate) { uint32_t dwStyleAdd = m_pProperties->m_dwStyleExes & (FWL_STYLEEXT_CMB_Sort | FWL_STYLEEXT_CMB_OwnerDraw); m_pListBox->ModifyStylesEx(dwStyleAdd, 0); - m_pListBox->GetWidgetRect(m_rtList, TRUE); + m_pListBox->GetWidgetRect(m_rtList, true); FX_FLOAT fHeight = GetListHeight(); if (fHeight > 0) { if (m_rtList.height > GetListHeight()) { @@ -511,26 +511,26 @@ void IFWL_ComboBox::ShowDropList(FX_BOOL bActivate) { ev.m_pSrcTarget = this; DispatchEvent(&ev); m_fItemHeight = m_pListBox->m_fItemHeight; - m_pListBox->SetFocus(TRUE); + m_pListBox->SetFocus(true); m_pComboBoxProxy->DoModal(); - m_pListBox->SetFocus(FALSE); + m_pListBox->SetFocus(false); } else { m_pComboBoxProxy->EndDoModal(); CFWL_EvtCmbCloseUp ev; ev.m_pSrcTarget = this; DispatchEvent(&ev); - m_bLButtonDown = FALSE; - m_pListBox->m_bNotifyOwner = TRUE; - SetFocus(TRUE); + m_bLButtonDown = false; + m_pListBox->m_bNotifyOwner = true; + SetFocus(true); } } -FX_BOOL IFWL_ComboBox::IsDropListShowed() { +bool IFWL_ComboBox::IsDropListShowed() { return m_pComboBoxProxy && !(m_pComboBoxProxy->GetStates() & FWL_WGTSTATE_Invisible); } -FX_BOOL IFWL_ComboBox::IsDropDownStyle() const { +bool IFWL_ComboBox::IsDropDownStyle() const { return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown; } @@ -572,7 +572,7 @@ void IFWL_ComboBox::Layout() { FX_FLOAT fBtn = *pFWidth; m_rtBtn.Set(m_rtClient.right() - fBtn, m_rtClient.top, fBtn, m_rtClient.height); - FX_BOOL bIsDropDown = IsDropDownStyle(); + bool bIsDropDown = IsDropDownStyle(); if (bIsDropDown && m_pEdit) { CFX_RectF rtEdit; rtEdit.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn, @@ -659,11 +659,11 @@ void IFWL_ComboBox::ReSetListItemAlignment() { m_pListBox->ModifyStylesEx(dwAdd, FWL_STYLEEXT_CMB_ListItemAlignMask); } -void IFWL_ComboBox::ProcessSelChanged(FX_BOOL bLButtonUp) { +void IFWL_ComboBox::ProcessSelChanged(bool bLButtonUp) { IFWL_ComboBoxDP* pDatas = static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); m_iCurSel = pDatas->GetItemIndex(this, m_pListBox->GetSelItem(0)); - FX_BOOL bDropDown = IsDropDownStyle(); + bool bDropDown = IsDropDownStyle(); if (bDropDown) { IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); @@ -727,8 +727,8 @@ void IFWL_ComboBox::DisForm_InitComboEdit() { m_pEdit->SetOuter(this); } -void IFWL_ComboBox::DisForm_ShowDropList(FX_BOOL bActivate) { - FX_BOOL bDropList = DisForm_IsDropListShowed(); +void IFWL_ComboBox::DisForm_ShowDropList(bool bActivate) { + bool bDropList = DisForm_IsDropListShowed(); if (bDropList == bActivate) { return; } @@ -759,7 +759,7 @@ void IFWL_ComboBox::DisForm_ShowDropList(FX_BOOL bActivate) { m_pListBox->SetWidgetRect(rtList); m_pListBox->Update(); } else { - SetFocus(TRUE); + SetFocus(true); } m_pListBox->SetStates(FWL_WGTSTATE_Invisible, !bActivate); if (bActivate) { @@ -773,7 +773,7 @@ void IFWL_ComboBox::DisForm_ShowDropList(FX_BOOL bActivate) { Repaint(&rect); } -FX_BOOL IFWL_ComboBox::DisForm_IsDropListShowed() { +bool IFWL_ComboBox::DisForm_IsDropListShowed() { return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible); } @@ -830,7 +830,7 @@ FWL_Error IFWL_ComboBox::DisForm_DrawWidget(CFX_Graphics* pGraphics, if (pMatrix) { mtOrg = *pMatrix; } - FX_BOOL bListShowed = m_pListBox && DisForm_IsDropListShowed(); + bool bListShowed = m_pListBox && DisForm_IsDropListShowed(); pGraphics->SaveGraphState(); pGraphics->ConcatMatrix(&mtOrg); if (!m_rtBtn.IsEmpty(0.1f)) { @@ -892,7 +892,7 @@ void IFWL_ComboBox::DisForm_Layout() { m_rtContent.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width, pUIMargin->height); } - FX_BOOL bIsDropDown = IsDropDownStyle(); + bool bIsDropDown = IsDropDownStyle(); if (bIsDropDown && m_pEdit) { CFX_RectF rtEdit; rtEdit.Set(m_rtContent.left, m_rtContent.top, m_rtContent.width - fBtn, @@ -922,10 +922,10 @@ void IFWL_ComboBox::OnProcessMessage(CFWL_Message* pMessage) { switch (pMessage->GetClassID()) { case CFWL_MessageType::SetFocus: - OnFocusChanged(pMessage, TRUE); + OnFocusChanged(pMessage, true); break; case CFWL_MessageType::KillFocus: - OnFocusChanged(pMessage, FALSE); + OnFocusChanged(pMessage, false); break; case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); @@ -992,10 +992,10 @@ void IFWL_ComboBox::OnDrawWidget(CFX_Graphics* pGraphics, DrawWidget(pGraphics, pMatrix); } -void IFWL_ComboBox::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { +void IFWL_ComboBox::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { IFWL_Widget* pDstTarget = pMsg->m_pDstTarget; IFWL_Widget* pSrcTarget = pMsg->m_pSrcTarget; - FX_BOOL bDropDown = IsDropDownStyle(); + bool bDropDown = IsDropDownStyle(); if (bSet) { m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; if (bDropDown && pSrcTarget != m_pListBox.get()) { @@ -1010,7 +1010,7 @@ void IFWL_ComboBox::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { if (bDropDown && pDstTarget != m_pListBox.get()) { if (!m_pEdit) return; - m_pEdit->FlagFocus(FALSE); + m_pEdit->FlagFocus(false); m_pEdit->ClearSelected(); } else { Repaint(&m_rtClient); @@ -1022,25 +1022,25 @@ void IFWL_ComboBox::OnLButtonDown(CFWL_MsgMouse* pMsg) { if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) return; - FX_BOOL bDropDown = IsDropDownStyle(); + bool bDropDown = IsDropDownStyle(); CFX_RectF& rtBtn = bDropDown ? m_rtBtn : m_rtClient; - FX_BOOL bClickBtn = rtBtn.Contains(pMsg->m_fx, pMsg->m_fy); + bool bClickBtn = rtBtn.Contains(pMsg->m_fx, pMsg->m_fy); if (!bClickBtn) return; if (bDropDown && m_pEdit) MatchEditText(); - m_bLButtonDown = TRUE; + m_bLButtonDown = true; m_iBtnState = CFWL_PartState_Pressed; Repaint(&m_rtClient); - ShowDropList(TRUE); + ShowDropList(true); m_iBtnState = CFWL_PartState_Normal; Repaint(&m_rtClient); } void IFWL_ComboBox::OnLButtonUp(CFWL_MsgMouse* pMsg) { - m_bLButtonDown = FALSE; + m_bLButtonDown = false; if (m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) m_iBtnState = CFWL_PartState_Hovered; else @@ -1092,9 +1092,9 @@ void IFWL_ComboBox::DoSubCtrlKey(CFWL_MsgKey* pMsg) { if (iCount < 1) return; - FX_BOOL bMatchEqual = FALSE; + bool bMatchEqual = false; int32_t iCurSel = m_iCurSel; - FX_BOOL bDropDown = IsDropDownStyle(); + bool bDropDown = IsDropDownStyle(); if (bDropDown && m_pEdit) { CFX_WideString wsText; m_pEdit->GetText(wsText); @@ -1126,7 +1126,7 @@ void IFWL_ComboBox::DoSubCtrlKey(CFWL_MsgKey* pMsg) { return; } - FX_BOOL bDropDown = IsDropDownStyle(); + bool bDropDown = IsDropDownStyle(); if (bDropDown) m_pEdit->GetDelegate()->OnProcessMessage(pMsg); } @@ -1135,20 +1135,20 @@ void IFWL_ComboBox::DisForm_OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return; - FX_BOOL backDefault = TRUE; + bool backDefault = true; switch (pMessage->GetClassID()) { case CFWL_MessageType::SetFocus: { - backDefault = FALSE; - DisForm_OnFocusChanged(pMessage, TRUE); + backDefault = false; + DisForm_OnFocusChanged(pMessage, true); break; } case CFWL_MessageType::KillFocus: { - backDefault = FALSE; - DisForm_OnFocusChanged(pMessage, FALSE); + backDefault = false; + DisForm_OnFocusChanged(pMessage, false); break; } case CFWL_MessageType::Mouse: { - backDefault = FALSE; + backDefault = false; CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); switch (pMsg->m_dwCmd) { case FWL_MouseCommand::LeftButtonDown: @@ -1163,16 +1163,16 @@ void IFWL_ComboBox::DisForm_OnProcessMessage(CFWL_Message* pMessage) { break; } case CFWL_MessageType::Key: { - backDefault = FALSE; + backDefault = false; CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); if (pKey->m_dwCmd == FWL_KeyCommand::KeyUp) break; if (DisForm_IsDropListShowed() && pKey->m_dwCmd == FWL_KeyCommand::KeyDown) { - FX_BOOL bListKey = pKey->m_dwKeyCode == FWL_VKEY_Up || - pKey->m_dwKeyCode == FWL_VKEY_Down || - pKey->m_dwKeyCode == FWL_VKEY_Return || - pKey->m_dwKeyCode == FWL_VKEY_Escape; + bool bListKey = pKey->m_dwKeyCode == FWL_VKEY_Up || + pKey->m_dwKeyCode == FWL_VKEY_Down || + pKey->m_dwKeyCode == FWL_VKEY_Return || + pKey->m_dwKeyCode == FWL_VKEY_Escape; if (bListKey) { m_pListBox->GetDelegate()->OnProcessMessage(pMessage); break; @@ -1189,21 +1189,21 @@ void IFWL_ComboBox::DisForm_OnProcessMessage(CFWL_Message* pMessage) { } void IFWL_ComboBox::DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg) { - FX_BOOL bDropDown = DisForm_IsDropListShowed(); + bool bDropDown = DisForm_IsDropListShowed(); CFX_RectF& rtBtn = bDropDown ? m_rtBtn : m_rtClient; if (!rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) return; if (DisForm_IsDropListShowed()) { - DisForm_ShowDropList(FALSE); + DisForm_ShowDropList(false); return; } if (m_pEdit) MatchEditText(); - DisForm_ShowDropList(TRUE); + DisForm_ShowDropList(true); } -void IFWL_ComboBox::DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { +void IFWL_ComboBox::DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet) { if (bSet) { m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; if ((m_pEdit->GetStates() & FWL_WGTSTATE_Focused) == 0) { @@ -1214,7 +1214,7 @@ void IFWL_ComboBox::DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { } } else { m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; - DisForm_ShowDropList(FALSE); + DisForm_ShowDropList(false); CFWL_MsgKillFocus msg; msg.m_pDstTarget = nullptr; msg.m_pSrcTarget = m_pEdit.get(); @@ -1232,7 +1232,7 @@ void IFWL_ComboBox::DisForm_OnKey(CFWL_MsgKey* pMsg) { if (iCount < 1) return; - FX_BOOL bMatchEqual = FALSE; + bool bMatchEqual = false; int32_t iCurSel = m_iCurSel; if (m_pEdit) { CFX_WideString wsText; diff --git a/xfa/fwl/core/ifwl_combobox.h b/xfa/fwl/core/ifwl_combobox.h index cde99d8df1..7d11541e7f 100644 --- a/xfa/fwl/core/ifwl_combobox.h +++ b/xfa/fwl/core/ifwl_combobox.h @@ -59,7 +59,7 @@ FWL_EVENT_DEF(CFWL_EvtCmbEditChanged, FWL_EVENT_DEF(CFWL_EvtCmbSelChanged, CFWL_EventType::SelectChanged, CFX_Int32Array iArraySels; - FX_BOOL bLButtonUp;) + bool bLButtonUp;) FWL_EVENT_DEF(CFWL_EvtCmbHoverChanged, CFWL_EventType::HoverChanged, @@ -85,10 +85,10 @@ class IFWL_ComboBox : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved) override; - void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; + void SetStates(uint32_t dwStates, bool bSet = true) override; FWL_Error Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, @@ -111,39 +111,39 @@ class IFWL_ComboBox : public IFWL_Widget { int32_t GetEditLimit(); FWL_Error SetEditLimit(int32_t nLimit); FWL_Error EditDoClipboard(int32_t iCmd); - FX_BOOL EditRedo(const IFDE_TxtEdtDoRecord* pRecord); - FX_BOOL EditUndo(const IFDE_TxtEdtDoRecord* pRecord); + bool EditRedo(const IFDE_TxtEdtDoRecord* pRecord); + bool EditUndo(const IFDE_TxtEdtDoRecord* pRecord); IFWL_ListBox* GetListBoxt(); - FX_BOOL AfterFocusShowDropList(); - FWL_Error OpenDropDownList(FX_BOOL bActivate); - FX_BOOL EditCanUndo(); - FX_BOOL EditCanRedo(); - FX_BOOL EditUndo(); - FX_BOOL EditRedo(); - FX_BOOL EditCanCopy(); - FX_BOOL EditCanCut(); - FX_BOOL EditCanSelectAll(); - FX_BOOL EditCopy(CFX_WideString& wsCopy); - FX_BOOL EditCut(CFX_WideString& wsCut); - FX_BOOL EditPaste(const CFX_WideString& wsPaste); - FX_BOOL EditSelectAll(); - FX_BOOL EditDelete(); - FX_BOOL EditDeSelect(); + bool AfterFocusShowDropList(); + FWL_Error OpenDropDownList(bool bActivate); + bool EditCanUndo(); + bool EditCanRedo(); + bool EditUndo(); + bool EditRedo(); + bool EditCanCopy(); + bool EditCanCut(); + bool EditCanSelectAll(); + bool EditCopy(CFX_WideString& wsCopy); + bool EditCut(CFX_WideString& wsCut); + bool EditPaste(const CFX_WideString& wsPaste); + bool EditSelectAll(); + bool EditDelete(); + bool EditDeSelect(); FWL_Error GetBBox(CFX_RectF& rect); FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); - FX_BOOL IsDropListShowed(); - void ShowDropList(FX_BOOL bActivate); + bool IsDropListShowed(); + void ShowDropList(bool bActivate); IFWL_ComboEdit* GetComboEdit() const { return m_pEdit.get(); } - void ProcessSelChanged(FX_BOOL bLButtonUp); + void ProcessSelChanged(bool bLButtonUp); int32_t GetCurrentSelection() const { return m_iCurSel; } protected: FX_FLOAT GetListHeight(); - FX_BOOL IsDropDownStyle() const; + bool IsDropDownStyle() const; void MatchEditText(); void SynchrEditText(int32_t iListItem); void Layout(); @@ -153,8 +153,8 @@ class IFWL_ComboBox : public IFWL_Widget { void InitProxyForm(); void DisForm_InitComboList(); void DisForm_InitComboEdit(); - void DisForm_ShowDropList(FX_BOOL bActivate); - FX_BOOL DisForm_IsDropListShowed(); + void DisForm_ShowDropList(bool bActivate); + bool DisForm_IsDropListShowed(); FWL_Error DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); FWL_Error DisForm_Update(); @@ -173,16 +173,16 @@ class IFWL_ComboBox : public IFWL_Widget { std::unique_ptr<IFWL_ComboEdit> m_pEdit; std::unique_ptr<IFWL_ComboList> m_pListBox; IFWL_ComboBoxProxy* m_pComboBoxProxy; - FX_BOOL m_bLButtonDown; - FX_BOOL m_bUpFormHandler; + bool m_bLButtonDown; + bool m_bUpFormHandler; int32_t m_iCurSel; int32_t m_iBtnState; FX_FLOAT m_fComboFormHandler; FX_FLOAT m_fItemHeight; - FX_BOOL m_bNeedShowList; + bool m_bNeedShowList; private: - void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); + void OnFocusChanged(CFWL_Message* pMsg, bool bSet = true); void OnLButtonDown(CFWL_MsgMouse* pMsg); void OnLButtonUp(CFWL_MsgMouse* pMsg); void OnMouseMove(CFWL_MsgMouse* pMsg); @@ -191,7 +191,7 @@ class IFWL_ComboBox : public IFWL_Widget { void DoSubCtrlKey(CFWL_MsgKey* pMsg); void DisForm_OnProcessMessage(CFWL_Message* pMessage); void DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg); - void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); + void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet = true); void DisForm_OnKey(CFWL_MsgKey* pMsg); }; diff --git a/xfa/fwl/core/ifwl_comboboxproxy.cpp b/xfa/fwl/core/ifwl_comboboxproxy.cpp index a0afcd1d72..0675a3b9ec 100644 --- a/xfa/fwl/core/ifwl_comboboxproxy.cpp +++ b/xfa/fwl/core/ifwl_comboboxproxy.cpp @@ -16,8 +16,8 @@ IFWL_ComboBoxProxy::IFWL_ComboBoxProxy( const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : IFWL_FormProxy(app, properties, pOuter), - m_bLButtonDown(FALSE), - m_bLButtonUpSelf(FALSE), + m_bLButtonDown(false), + m_bLButtonUpSelf(false), m_pComboBox(pComboBox) {} IFWL_ComboBoxProxy::~IFWL_ComboBoxProxy() {} @@ -47,10 +47,10 @@ void IFWL_ComboBoxProxy::OnProcessMessage(CFWL_Message* pMessage) { OnDeactive(static_cast<CFWL_MsgDeactivate*>(pMessage)); break; case CFWL_MessageType::KillFocus: - OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), FALSE); + OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), false); break; case CFWL_MessageType::SetFocus: - OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), TRUE); + OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), true); break; default: break; @@ -74,45 +74,45 @@ void IFWL_ComboBoxProxy::OnLButtonDown(CFWL_MsgMouse* pMsg) { GetWidgetRect(rtWidget); rtWidget.left = rtWidget.top = 0; if (rtWidget.Contains(pMsg->m_fx, pMsg->m_fy)) { - m_bLButtonDown = TRUE; - pDriver->SetGrab(this, TRUE); + m_bLButtonDown = true; + pDriver->SetGrab(this, true); } else { - m_bLButtonDown = FALSE; - pDriver->SetGrab(this, FALSE); - m_pComboBox->ShowDropList(FALSE); + m_bLButtonDown = false; + pDriver->SetGrab(this, false); + m_pComboBox->ShowDropList(false); } } void IFWL_ComboBoxProxy::OnLButtonUp(CFWL_MsgMouse* pMsg) { - m_bLButtonDown = FALSE; + m_bLButtonDown = false; const IFWL_App* pApp = GetOwnerApp(); if (!pApp) return; CFWL_NoteDriver* pDriver = static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); - pDriver->SetGrab(this, FALSE); + pDriver->SetGrab(this, false); if (m_bLButtonUpSelf) { CFX_RectF rect; GetWidgetRect(rect); rect.left = rect.top = 0; if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) && m_pComboBox->IsDropListShowed()) { - m_pComboBox->ShowDropList(FALSE); + m_pComboBox->ShowDropList(false); } } else { - m_bLButtonUpSelf = TRUE; + m_bLButtonUpSelf = true; } } void IFWL_ComboBoxProxy::OnDeactive(CFWL_MsgDeactivate* pMsg) { - m_pComboBox->ShowDropList(FALSE); + m_pComboBox->ShowDropList(false); } -void IFWL_ComboBoxProxy::OnFocusChanged(CFWL_MsgKillFocus* pMsg, FX_BOOL bSet) { +void IFWL_ComboBoxProxy::OnFocusChanged(CFWL_MsgKillFocus* pMsg, bool bSet) { if (bSet) return; if (!pMsg->m_pSetFocus) - m_pComboBox->ShowDropList(FALSE); + m_pComboBox->ShowDropList(false); } diff --git a/xfa/fwl/core/ifwl_comboboxproxy.h b/xfa/fwl/core/ifwl_comboboxproxy.h index 1cf7a06ccb..7b5c929d36 100644 --- a/xfa/fwl/core/ifwl_comboboxproxy.h +++ b/xfa/fwl/core/ifwl_comboboxproxy.h @@ -24,16 +24,16 @@ class IFWL_ComboBoxProxy : public IFWL_FormProxy { void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; - void Reset() { m_bLButtonUpSelf = FALSE; } + void Reset() { m_bLButtonUpSelf = false; } private: void OnLButtonDown(CFWL_MsgMouse* pMsg); void OnLButtonUp(CFWL_MsgMouse* pMsg); void OnDeactive(CFWL_MsgDeactivate* pMsg); - void OnFocusChanged(CFWL_MsgKillFocus* pMsg, FX_BOOL bSet); + void OnFocusChanged(CFWL_MsgKillFocus* pMsg, bool bSet); - FX_BOOL m_bLButtonDown; - FX_BOOL m_bLButtonUpSelf; + bool m_bLButtonDown; + bool m_bLButtonUpSelf; IFWL_ComboBox* m_pComboBox; }; diff --git a/xfa/fwl/core/ifwl_comboedit.cpp b/xfa/fwl/core/ifwl_comboedit.cpp index ece35417ef..26106e14cf 100644 --- a/xfa/fwl/core/ifwl_comboedit.cpp +++ b/xfa/fwl/core/ifwl_comboedit.cpp @@ -22,7 +22,7 @@ void IFWL_ComboEdit::ClearSelected() { } void IFWL_ComboEdit::SetSelected() { - FlagFocus(TRUE); + FlagFocus(true); EndCaret(); AddSelRange(0); } @@ -31,16 +31,16 @@ void IFWL_ComboEdit::EndCaret() { m_pEdtEngine->MoveCaretPos(MC_End); } -void IFWL_ComboEdit::FlagFocus(FX_BOOL bSet) { +void IFWL_ComboEdit::FlagFocus(bool bSet) { if (bSet) { m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; } else { m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; - ShowCaret(FALSE); + ShowCaret(false); } } -void IFWL_ComboEdit::SetComboBoxFocus(FX_BOOL bSet) { +void IFWL_ComboEdit::SetComboBoxFocus(bool bSet) { m_pOuter->SetFocus(bSet); } @@ -48,16 +48,16 @@ void IFWL_ComboEdit::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) return; - FX_BOOL backDefault = TRUE; + bool backDefault = true; switch (pMessage->GetClassID()) { case CFWL_MessageType::SetFocus: { m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; - backDefault = FALSE; + backDefault = false; break; } case CFWL_MessageType::KillFocus: { m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; - backDefault = FALSE; + backDefault = false; break; } case CFWL_MessageType::Mouse: { @@ -65,7 +65,7 @@ void IFWL_ComboEdit::OnProcessMessage(CFWL_Message* pMessage) { if ((pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) && ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) { SetSelected(); - SetComboBoxFocus(TRUE); + SetComboBoxFocus(true); } break; } diff --git a/xfa/fwl/core/ifwl_comboedit.h b/xfa/fwl/core/ifwl_comboedit.h index 9c321d1cd4..59aa9956e9 100644 --- a/xfa/fwl/core/ifwl_comboedit.h +++ b/xfa/fwl/core/ifwl_comboedit.h @@ -25,10 +25,10 @@ class IFWL_ComboEdit : public IFWL_Edit { void ClearSelected(); void SetSelected(); void EndCaret(); - void FlagFocus(FX_BOOL bSet); + void FlagFocus(bool bSet); protected: - void SetComboBoxFocus(FX_BOOL bSet); + void SetComboBoxFocus(bool bSet); IFWL_ComboBox* m_pOuter; }; diff --git a/xfa/fwl/core/ifwl_combolist.cpp b/xfa/fwl/core/ifwl_combolist.cpp index 5a2ade96de..452cdff1e0 100644 --- a/xfa/fwl/core/ifwl_combolist.cpp +++ b/xfa/fwl/core/ifwl_combolist.cpp @@ -13,7 +13,7 @@ IFWL_ComboList::IFWL_ComboList(const IFWL_App* app, const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) - : IFWL_ListBox(app, properties, pOuter), m_bNotifyOwner(TRUE) { + : IFWL_ListBox(app, properties, pOuter), m_bNotifyOwner(true) { ASSERT(pOuter); } @@ -52,14 +52,14 @@ void IFWL_ComboList::ChangeSelected(int32_t iSel) { return; } else if (iOld > -1) { GetItemRect(iOld, rtInvalidate); - SetSelItem(hOld, FALSE); + SetSelItem(hOld, false); } if (hItem) { CFX_RectF rect; GetItemRect(iSel, rect); rtInvalidate.Union(rect); IFWL_ListItem* hSel = pData->GetItem(this, iSel); - SetSelItem(hSel, TRUE); + SetSelItem(hSel, true); } if (!rtInvalidate.IsEmpty()) { Repaint(&rtInvalidate); @@ -87,7 +87,7 @@ void IFWL_ComboList::ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy) { pOwner->TransformTo(m_pOuter, fx, fy); } -void IFWL_ComboList::SetFocus(FX_BOOL bSet) { +void IFWL_ComboList::SetFocus(bool bSet) { IFWL_Widget::SetFocus(bSet); } @@ -96,13 +96,13 @@ void IFWL_ComboList::OnProcessMessage(CFWL_Message* pMessage) { return; CFWL_MessageType dwHashCode = pMessage->GetClassID(); - FX_BOOL backDefault = TRUE; + bool backDefault = true; if (dwHashCode == CFWL_MessageType::SetFocus || dwHashCode == CFWL_MessageType::KillFocus) { OnDropListFocusChanged(pMessage, dwHashCode == CFWL_MessageType::SetFocus); } else if (dwHashCode == CFWL_MessageType::Mouse) { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); - if (IsShowScrollBar(TRUE) && m_pVertScrollBar) { + if (IsShowScrollBar(true) && m_pVertScrollBar) { CFX_RectF rect; m_pVertScrollBar->GetWidgetRect(rect); if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { @@ -114,17 +114,17 @@ void IFWL_ComboList::OnProcessMessage(CFWL_Message* pMessage) { } switch (pMsg->m_dwCmd) { case FWL_MouseCommand::Move: { - backDefault = FALSE; + backDefault = false; OnDropListMouseMove(pMsg); break; } case FWL_MouseCommand::LeftButtonDown: { - backDefault = FALSE; + backDefault = false; OnDropListLButtonDown(pMsg); break; } case FWL_MouseCommand::LeftButtonUp: { - backDefault = FALSE; + backDefault = false; OnDropListLButtonUp(pMsg); break; } @@ -138,7 +138,7 @@ void IFWL_ComboList::OnProcessMessage(CFWL_Message* pMessage) { IFWL_ListBox::OnProcessMessage(pMessage); } -void IFWL_ComboList::OnDropListFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { +void IFWL_ComboList::OnDropListFocusChanged(CFWL_Message* pMsg, bool bSet) { if (bSet) return; @@ -146,16 +146,16 @@ void IFWL_ComboList::OnDropListFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOuter); if (pKill->m_pSetFocus == m_pOuter || pKill->m_pSetFocus == pOuter->GetComboEdit()) { - pOuter->ShowDropList(FALSE); + pOuter->ShowDropList(false); } } int32_t IFWL_ComboList::OnDropListMouseMove(CFWL_MsgMouse* pMsg) { if (m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) { if (m_bNotifyOwner) { - m_bNotifyOwner = FALSE; + m_bNotifyOwner = false; } - if (IsShowScrollBar(TRUE) && m_pVertScrollBar) { + if (IsShowScrollBar(true) && m_pVertScrollBar) { CFX_RectF rect; m_pVertScrollBar->GetWidgetRect(rect); if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { @@ -188,7 +188,7 @@ int32_t IFWL_ComboList::OnDropListLButtonDown(CFWL_MsgMouse* pMsg) { return 0; IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOuter); - pOuter->ShowDropList(FALSE); + pOuter->ShowDropList(false); return 1; } @@ -198,42 +198,42 @@ int32_t IFWL_ComboList::OnDropListLButtonUp(CFWL_MsgMouse* pMsg) { ClientToOuter(pMsg->m_fx, pMsg->m_fy); pOuter->GetDelegate()->OnProcessMessage(pMsg); } else { - if (IsShowScrollBar(TRUE) && m_pVertScrollBar) { + if (IsShowScrollBar(true) && m_pVertScrollBar) { CFX_RectF rect; m_pVertScrollBar->GetWidgetRect(rect); if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { return 1; } } - pOuter->ShowDropList(FALSE); + pOuter->ShowDropList(false); IFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); if (hItem) - pOuter->ProcessSelChanged(TRUE); + pOuter->ProcessSelChanged(true); } return 1; } int32_t IFWL_ComboList::OnDropListKey(CFWL_MsgKey* pKey) { IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOuter); - FX_BOOL bPropagate = FALSE; + bool bPropagate = false; if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) { uint32_t dwKeyCode = pKey->m_dwKeyCode; switch (dwKeyCode) { case FWL_VKEY_Return: case FWL_VKEY_Escape: { - pOuter->ShowDropList(FALSE); + pOuter->ShowDropList(false); return 1; } case FWL_VKEY_Up: case FWL_VKEY_Down: { OnDropListKeyDown(pKey); - pOuter->ProcessSelChanged(FALSE); + pOuter->ProcessSelChanged(false); return 1; } - default: { bPropagate = TRUE; } + default: { bPropagate = true; } } } else if (pKey->m_dwCmd == FWL_KeyCommand::Char) { - bPropagate = TRUE; + bPropagate = true; } if (bPropagate) { pKey->m_pDstTarget = m_pOuter; @@ -259,7 +259,7 @@ void IFWL_ComboList::OnDropListKeyDown(CFWL_MsgKey* pKey) { if (!hItem) { break; } - SetSelection(hItem, hItem, TRUE); + SetSelection(hItem, hItem, true); ScrollToVisible(hItem); CFX_RectF rtInvalidate; rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, diff --git a/xfa/fwl/core/ifwl_combolist.h b/xfa/fwl/core/ifwl_combolist.h index a4e90f5b93..6da1640023 100644 --- a/xfa/fwl/core/ifwl_combolist.h +++ b/xfa/fwl/core/ifwl_combolist.h @@ -25,14 +25,14 @@ class IFWL_ComboList : public IFWL_ListBox { int32_t CountItems(); void GetItemRect(int32_t nIndex, CFX_RectF& rtItem); void ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy); - void SetFocus(FX_BOOL bSet); + void SetFocus(bool bSet); - FX_BOOL m_bNotifyOwner; + bool m_bNotifyOwner; friend class IFWL_ComboBox; private: - void OnDropListFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet); + void OnDropListFocusChanged(CFWL_Message* pMsg, bool bSet); int32_t OnDropListMouseMove(CFWL_MsgMouse* pMsg); int32_t OnDropListLButtonDown(CFWL_MsgMouse* pMsg); int32_t OnDropListLButtonUp(CFWL_MsgMouse* pMsg); diff --git a/xfa/fwl/core/ifwl_datetimecalendar.cpp b/xfa/fwl/core/ifwl_datetimecalendar.cpp index f521c56fb7..4e274fca7f 100644 --- a/xfa/fwl/core/ifwl_datetimecalendar.cpp +++ b/xfa/fwl/core/ifwl_datetimecalendar.cpp @@ -15,7 +15,7 @@ IFWL_DateTimeCalendar::IFWL_DateTimeCalendar( const IFWL_App* app, const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) - : IFWL_MonthCalendar(app, properties, pOuter), m_bFlag(FALSE) {} + : IFWL_MonthCalendar(app, properties, pOuter), m_bFlag(false) {} void IFWL_DateTimeCalendar::OnProcessMessage(CFWL_Message* pMessage) { CFWL_MessageType dwCode = pMessage->GetClassID(); @@ -94,9 +94,9 @@ void IFWL_DateTimeCalendar::OnLButtonUpEx(CFWL_MsgMouse* pMsg) { return; pIPicker->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel); - pIPicker->ShowMonthCalendar(FALSE); + pIPicker->ShowMonthCalendar(false); } else if (m_bFlag && (!rt.Contains(pMsg->m_fx, pMsg->m_fy))) { - pIPicker->ShowMonthCalendar(FALSE); + pIPicker->ShowMonthCalendar(false); } m_bFlag = 0; } @@ -105,7 +105,7 @@ void IFWL_DateTimeCalendar::OnMouseMoveEx(CFWL_MsgMouse* pMsg) { if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) return; - FX_BOOL bRepaint = FALSE; + bool bRepaint = false; CFX_RectF rtInvalidate; rtInvalidate.Set(0, 0, 0, 0); if (m_rtDates.Contains(pMsg->m_fx, pMsg->m_fy)) { @@ -179,6 +179,6 @@ void IFWL_DateTimeCalendar::DisForm_OnLButtonUpEx(CFWL_MsgMouse* pMsg) { IFWL_DateTimePicker* pDateTime = static_cast<IFWL_DateTimePicker*>(m_pOuter); pDateTime->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel); - pDateTime->ShowMonthCalendar(FALSE); + pDateTime->ShowMonthCalendar(false); } } diff --git a/xfa/fwl/core/ifwl_datetimecalendar.h b/xfa/fwl/core/ifwl_datetimecalendar.h index 721bc27a73..07f0373e1e 100644 --- a/xfa/fwl/core/ifwl_datetimecalendar.h +++ b/xfa/fwl/core/ifwl_datetimecalendar.h @@ -25,7 +25,7 @@ class IFWL_DateTimeCalendar : public IFWL_MonthCalendar { void DisForm_OnProcessMessage(CFWL_Message* pMessage); void DisForm_OnLButtonUpEx(CFWL_MsgMouse* pMsg); - FX_BOOL m_bFlag; + bool m_bFlag; }; #endif // XFA_FWL_CORE_IFWL_DATETIMECALENDAR_H_ diff --git a/xfa/fwl/core/ifwl_datetimeedit.cpp b/xfa/fwl/core/ifwl_datetimeedit.cpp index 906ba94e57..62675a3586 100644 --- a/xfa/fwl/core/ifwl_datetimeedit.cpp +++ b/xfa/fwl/core/ifwl_datetimeedit.cpp @@ -44,7 +44,7 @@ void IFWL_DateTimeEdit::DisForm_OnProcessMessage(CFWL_Message* pMessage) { if (pDateTime->IsMonthCalendarShowed()) { CFX_RectF rtInvalidate; pDateTime->GetWidgetRect(rtInvalidate); - pDateTime->ShowMonthCalendar(FALSE); + pDateTime->ShowMonthCalendar(false); rtInvalidate.Offset(-rtInvalidate.left, -rtInvalidate.top); pDateTime->Repaint(&rtInvalidate); } diff --git a/xfa/fwl/core/ifwl_datetimepicker.cpp b/xfa/fwl/core/ifwl_datetimepicker.cpp index 90f85a08a7..5237326b9e 100644 --- a/xfa/fwl/core/ifwl_datetimepicker.cpp +++ b/xfa/fwl/core/ifwl_datetimepicker.cpp @@ -32,7 +32,7 @@ IFWL_DateTimePicker::IFWL_DateTimePicker( m_iYear(-1), m_iMonth(-1), m_iDay(-1), - m_bLBtnDown(FALSE) { + m_bLBtnDown(false) { m_rtBtn.Set(0, 0, 0, 0); m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; @@ -45,7 +45,7 @@ IFWL_DateTimePicker::IFWL_DateTimePicker( m_pMonthCal.reset(new IFWL_DateTimeCalendar(m_pOwnerApp, propMonth, this)); CFX_RectF rtMonthCal; - m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); + m_pMonthCal->GetWidgetRect(rtMonthCal, true); rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height); m_pMonthCal->SetWidgetRect(rtMonthCal); CFWL_WidgetImpProperties propEdit; @@ -65,14 +65,13 @@ FWL_Type IFWL_DateTimePicker::GetClassID() const { return FWL_Type::DateTimePicker; } -FWL_Error IFWL_DateTimePicker::GetWidgetRect(CFX_RectF& rect, - FX_BOOL bAutoSize) { +FWL_Error IFWL_DateTimePicker::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_GetWidgetRect(rect, bAutoSize); } if (bAutoSize) { rect.Set(0, 0, kDateTimePickerWidth, kDateTimePickerHeight); - IFWL_Widget::GetWidgetRect(rect, TRUE); + IFWL_Widget::GetWidgetRect(rect, true); } else { rect = m_pProperties->m_rtWidget; } @@ -114,7 +113,7 @@ FWL_Error IFWL_DateTimePicker::Update() { m_MonthCalendarDP.m_iCurMonth, m_MonthCalendarDP.m_iCurDay); } CFX_RectF rtMonthCal; - m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); + m_pMonthCal->GetWidgetRect(rtMonthCal, true); CFX_RectF rtPopUp; rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight, rtMonthCal.width, rtMonthCal.height); @@ -219,60 +218,60 @@ FWL_Error IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText, return FWL_Error::Indefinite; } -FX_BOOL IFWL_DateTimePicker::CanUndo() { +bool IFWL_DateTimePicker::CanUndo() { return m_pEdit->CanUndo(); } -FX_BOOL IFWL_DateTimePicker::CanRedo() { +bool IFWL_DateTimePicker::CanRedo() { return m_pEdit->CanRedo(); } -FX_BOOL IFWL_DateTimePicker::Undo() { +bool IFWL_DateTimePicker::Undo() { return m_pEdit->Undo(); } -FX_BOOL IFWL_DateTimePicker::Redo() { +bool IFWL_DateTimePicker::Redo() { return m_pEdit->Redo(); } -FX_BOOL IFWL_DateTimePicker::CanCopy() { +bool IFWL_DateTimePicker::CanCopy() { int32_t nCount = m_pEdit->CountSelRanges(); return nCount > 0; } -FX_BOOL IFWL_DateTimePicker::CanCut() { +bool IFWL_DateTimePicker::CanCut() { if (m_pEdit->GetStylesEx() & FWL_STYLEEXT_EDT_ReadOnly) { - return FALSE; + return false; } int32_t nCount = m_pEdit->CountSelRanges(); return nCount > 0; } -FX_BOOL IFWL_DateTimePicker::CanSelectAll() { +bool IFWL_DateTimePicker::CanSelectAll() { return m_pEdit->GetTextLength() > 0; } -FX_BOOL IFWL_DateTimePicker::Copy(CFX_WideString& wsCopy) { +bool IFWL_DateTimePicker::Copy(CFX_WideString& wsCopy) { return m_pEdit->Copy(wsCopy); } -FX_BOOL IFWL_DateTimePicker::Cut(CFX_WideString& wsCut) { +bool IFWL_DateTimePicker::Cut(CFX_WideString& wsCut) { return m_pEdit->Cut(wsCut); } -FX_BOOL IFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) { +bool IFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) { return m_pEdit->Paste(wsPaste); } -FX_BOOL IFWL_DateTimePicker::SelectAll() { +bool IFWL_DateTimePicker::SelectAll() { return m_pEdit->AddSelRange(0) == FWL_Error::Succeeded; } -FX_BOOL IFWL_DateTimePicker::Delete() { +bool IFWL_DateTimePicker::Delete() { return m_pEdit->ClearText() == FWL_Error::Succeeded; } -FX_BOOL IFWL_DateTimePicker::DeSelect() { +bool IFWL_DateTimePicker::DeSelect() { return m_pEdit->ClearSelections() == FWL_Error::Succeeded; } @@ -335,7 +334,7 @@ void IFWL_DateTimePicker::FormatDateString(int32_t iYear, } } -void IFWL_DateTimePicker::ShowMonthCalendar(FX_BOOL bActivate) { +void IFWL_DateTimePicker::ShowMonthCalendar(bool bActivate) { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_ShowMonthCalendar(bActivate); } @@ -363,12 +362,12 @@ void IFWL_DateTimePicker::ShowMonthCalendar(FX_BOOL bActivate) { } } -FX_BOOL IFWL_DateTimePicker::IsMonthCalendarShowed() { +bool IFWL_DateTimePicker::IsMonthCalendarShowed() { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_IsMonthCalendarShowed(); } if (!m_pForm) - return FALSE; + return false; return !(m_pForm->GetStates() & FWL_WGTSTATE_Invisible); } @@ -470,7 +469,7 @@ void IFWL_DateTimePicker::DisForm_InitDateTimeCalendar() { m_pMonthCal.reset(new IFWL_DateTimeCalendar(m_pOwnerApp, propMonth, this)); CFX_RectF rtMonthCal; - m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); + m_pMonthCal->GetWidgetRect(rtMonthCal, true); rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height); m_pMonthCal->SetWidgetRect(rtMonthCal); } @@ -486,20 +485,20 @@ void IFWL_DateTimePicker::DisForm_InitDateTimeEdit() { m_pEdit.reset(new IFWL_DateTimeEdit(m_pOwnerApp, propEdit, this)); } -FX_BOOL IFWL_DateTimePicker::DisForm_IsMonthCalendarShowed() { +bool IFWL_DateTimePicker::DisForm_IsMonthCalendarShowed() { if (!m_pMonthCal) - return FALSE; + return false; return !(m_pMonthCal->GetStates() & FWL_WGTSTATE_Invisible); } -void IFWL_DateTimePicker::DisForm_ShowMonthCalendar(FX_BOOL bActivate) { - FX_BOOL bShowed = IsMonthCalendarShowed(); +void IFWL_DateTimePicker::DisForm_ShowMonthCalendar(bool bActivate) { + bool bShowed = IsMonthCalendarShowed(); if (bShowed == bActivate) { return; } if (bActivate) { CFX_RectF rtMonthCal; - m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); + m_pMonthCal->GetWidgetRect(rtMonthCal, true); FX_FLOAT fPopupMin = rtMonthCal.height; FX_FLOAT fPopupMax = rtMonthCal.height; CFX_RectF rtAnchor(m_pProperties->m_rtWidget); @@ -547,10 +546,10 @@ FWL_WidgetHit IFWL_DateTimePicker::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { return FWL_WidgetHit::Unknown; } -FX_BOOL IFWL_DateTimePicker::DisForm_IsNeedShowButton() { - FX_BOOL bFocus = m_pProperties->m_dwStates & FWL_WGTSTATE_Focused || - m_pMonthCal->GetStates() & FWL_WGTSTATE_Focused || - m_pEdit->GetStates() & FWL_WGTSTATE_Focused; +bool IFWL_DateTimePicker::DisForm_IsNeedShowButton() { + bool bFocus = m_pProperties->m_dwStates & FWL_WGTSTATE_Focused || + m_pMonthCal->GetStates() & FWL_WGTSTATE_Focused || + m_pEdit->GetStates() & FWL_WGTSTATE_Focused; return bFocus; } @@ -581,7 +580,7 @@ FWL_Error IFWL_DateTimePicker::DisForm_Update() { m_fBtn = *pWidth; CFX_RectF rtMonthCal; - m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); + m_pMonthCal->GetWidgetRect(rtMonthCal, true); CFX_RectF rtPopUp; rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight, rtMonthCal.width, rtMonthCal.height); @@ -591,7 +590,7 @@ FWL_Error IFWL_DateTimePicker::DisForm_Update() { } FWL_Error IFWL_DateTimePicker::DisForm_GetWidgetRect(CFX_RectF& rect, - FX_BOOL bAutoSize) { + bool bAutoSize) { rect = m_pProperties->m_rtWidget; if (DisForm_IsNeedShowButton()) { rect.width += m_fBtn; @@ -647,10 +646,10 @@ void IFWL_DateTimePicker::OnProcessMessage(CFWL_Message* pMessage) { switch (pMessage->GetClassID()) { case CFWL_MessageType::SetFocus: - OnFocusChanged(pMessage, TRUE); + OnFocusChanged(pMessage, true); break; case CFWL_MessageType::KillFocus: - OnFocusChanged(pMessage, FALSE); + OnFocusChanged(pMessage, false); break; case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); @@ -691,7 +690,7 @@ void IFWL_DateTimePicker::OnDrawWidget(CFX_Graphics* pGraphics, DrawWidget(pGraphics, pMatrix); } -void IFWL_DateTimePicker::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { +void IFWL_DateTimePicker::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { if (!pMsg) return; if (m_pWidgetMgr->IsFormDisabled()) @@ -705,7 +704,7 @@ void IFWL_DateTimePicker::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { Repaint(&m_rtClient); } if (pMsg->m_pSrcTarget == m_pMonthCal.get() && IsMonthCalendarShowed()) { - ShowMonthCalendar(FALSE); + ShowMonthCalendar(false); } Repaint(&m_rtClient); } @@ -714,19 +713,19 @@ void IFWL_DateTimePicker::OnLButtonDown(CFWL_MsgMouse* pMsg) { if (!pMsg) return; if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) - SetFocus(TRUE); + SetFocus(true); if (m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { if (IsMonthCalendarShowed()) { - ShowMonthCalendar(FALSE); + ShowMonthCalendar(false); CFWL_Event_DtpCloseUp ev; DispatchEvent(&ev); } else { if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_TimeFormat)) { - ShowMonthCalendar(TRUE); + ShowMonthCalendar(true); CFWL_Event_DtpDropDown ev; DispatchEvent(&ev); } - m_bLBtnDown = TRUE; + m_bLBtnDown = true; Repaint(&m_rtClient); } } @@ -736,7 +735,7 @@ void IFWL_DateTimePicker::OnLButtonUp(CFWL_MsgMouse* pMsg) { if (!pMsg) return; - m_bLBtnDown = FALSE; + m_bLBtnDown = false; if (m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) m_iBtnState = CFWL_PartState_Hovered; else @@ -759,7 +758,7 @@ void IFWL_DateTimePicker::OnMouseLeave(CFWL_MsgMouse* pMsg) { } void IFWL_DateTimePicker::DisForm_OnFocusChanged(CFWL_Message* pMsg, - FX_BOOL bSet) { + bool bSet) { CFX_RectF rtInvalidate(m_rtBtn); if (bSet) { m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; @@ -774,7 +773,7 @@ void IFWL_DateTimePicker::DisForm_OnFocusChanged(CFWL_Message* pMsg, m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; m_rtBtn.Set(0, 0, 0, 0); if (DisForm_IsMonthCalendarShowed()) - ShowMonthCalendar(FALSE); + ShowMonthCalendar(false); if (m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { pMsg->m_pSrcTarget = m_pEdit.get(); m_pEdit->GetDelegate()->OnProcessMessage(pMsg); diff --git a/xfa/fwl/core/ifwl_datetimepicker.h b/xfa/fwl/core/ifwl_datetimepicker.h index 04d2869c54..17eb7b851c 100644 --- a/xfa/fwl/core/ifwl_datetimepicker.h +++ b/xfa/fwl/core/ifwl_datetimepicker.h @@ -68,7 +68,7 @@ class IFWL_DateTimePicker : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; FWL_Error Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, @@ -87,27 +87,27 @@ class IFWL_DateTimePicker : public IFWL_Widget { int32_t CountSelRanges(); int32_t GetSelRange(int32_t nIndex, int32_t& nStart); - FX_BOOL CanUndo(); - FX_BOOL CanRedo(); - FX_BOOL Undo(); - FX_BOOL Redo(); - FX_BOOL CanCopy(); - FX_BOOL CanCut(); - FX_BOOL CanSelectAll(); - FX_BOOL Copy(CFX_WideString& wsCopy); - FX_BOOL Cut(CFX_WideString& wsCut); - FX_BOOL Paste(const CFX_WideString& wsPaste); - FX_BOOL SelectAll(); - FX_BOOL Delete(); - FX_BOOL DeSelect(); + bool CanUndo(); + bool CanRedo(); + bool Undo(); + bool Redo(); + bool CanCopy(); + bool CanCut(); + bool CanSelectAll(); + bool Copy(CFX_WideString& wsCopy); + bool Cut(CFX_WideString& wsCut); + bool Paste(const CFX_WideString& wsPaste); + bool SelectAll(); + bool Delete(); + bool DeSelect(); FWL_Error GetBBox(CFX_RectF& rect); FWL_Error SetEditLimit(int32_t nLimit); FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); IFWL_DateTimeEdit* GetDataTimeEdit(); - FX_BOOL IsMonthCalendarShowed(); - void ShowMonthCalendar(FX_BOOL bActivate); + bool IsMonthCalendarShowed(); + void ShowMonthCalendar(bool bActivate); void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay); IFWL_FormProxy* GetFormProxy() const { return m_pForm.get(); } @@ -147,7 +147,7 @@ class IFWL_DateTimePicker : public IFWL_Widget { int32_t m_iYear; int32_t m_iMonth; int32_t m_iDay; - FX_BOOL m_bLBtnDown; + bool m_bLBtnDown; std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; std::unique_ptr<IFWL_DateTimeCalendar> m_pMonthCal; std::unique_ptr<IFWL_FormProxy> m_pForm; @@ -158,22 +158,22 @@ class IFWL_DateTimePicker : public IFWL_Widget { FWL_Error DisForm_Initialize(); void DisForm_InitDateTimeCalendar(); void DisForm_InitDateTimeEdit(); - FX_BOOL DisForm_IsMonthCalendarShowed(); - void DisForm_ShowMonthCalendar(FX_BOOL bActivate); + bool DisForm_IsMonthCalendarShowed(); + void DisForm_ShowMonthCalendar(bool bActivate); FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); - FX_BOOL DisForm_IsNeedShowButton(); + bool DisForm_IsNeedShowButton(); FWL_Error DisForm_Update(); - FWL_Error DisForm_GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + FWL_Error DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); FWL_Error DisForm_GetBBox(CFX_RectF& rect); FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr); - void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet); + void OnFocusChanged(CFWL_Message* pMsg, bool bSet); void OnLButtonDown(CFWL_MsgMouse* pMsg); void OnLButtonUp(CFWL_MsgMouse* pMsg); void OnMouseMove(CFWL_MsgMouse* pMsg); void OnMouseLeave(CFWL_MsgMouse* pMsg); - void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet); + void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet); }; #endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ diff --git a/xfa/fwl/core/ifwl_edit.cpp b/xfa/fwl/core/ifwl_edit.cpp index 5222f37c45..111df72733 100644 --- a/xfa/fwl/core/ifwl_edit.cpp +++ b/xfa/fwl/core/ifwl_edit.cpp @@ -59,17 +59,17 @@ IFWL_Edit::IFWL_Edit(const IFWL_App* app, m_fVAlignOffset(0.0f), m_fScrollOffsetX(0.0f), m_fScrollOffsetY(0.0f), - m_bLButtonDown(FALSE), + m_bLButtonDown(false), m_nSelStart(0), m_nLimit(-1), m_fSpaceAbove(0), m_fSpaceBelow(0), m_fFontSize(0), - m_bSetRange(FALSE), + m_bSetRange(false), m_iMin(-1), m_iMax(0xFFFFFFF), m_backColor(0), - m_updateBackColor(FALSE), + m_updateBackColor(false), m_iCurRecord(-1), m_iMaxRecord(128) { m_rtClient.Reset(); @@ -83,7 +83,7 @@ IFWL_Edit::IFWL_Edit(const IFWL_App* app, IFWL_Edit::~IFWL_Edit() { if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) - ShowCaret(FALSE); + ShowCaret(false); ClearRecord(); } @@ -92,7 +92,7 @@ FWL_Type IFWL_Edit::GetClassID() const { return FWL_Type::Edit; } -FWL_Error IFWL_Edit::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error IFWL_Edit::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (m_pEdtEngine) { @@ -106,17 +106,17 @@ FWL_Error IFWL_Edit::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { rect.Set(0, 0, sz.x, sz.y); } } - IFWL_Widget::GetWidgetRect(rect, TRUE); + IFWL_Widget::GetWidgetRect(rect, true); } else { rect = m_pProperties->m_rtWidget; if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { - if (IsShowScrollBar(TRUE)) { + if (IsShowScrollBar(true)) { FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); rect.width += *pfWidth; rect.width += kEditMargin; } - if (IsShowScrollBar(FALSE)) { + if (IsShowScrollBar(false)) { FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); rect.height += *pfWidth; @@ -127,10 +127,10 @@ FWL_Error IFWL_Edit::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { return FWL_Error::Succeeded; } -void IFWL_Edit::SetStates(uint32_t dwStates, FX_BOOL bSet) { +void IFWL_Edit::SetStates(uint32_t dwStates, bool bSet) { if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) || (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) { - ShowCaret(FALSE); + ShowCaret(false); } IFWL_Widget::SetStates(dwStates, bSet); } @@ -158,13 +158,13 @@ FWL_Error IFWL_Edit::Update() { FWL_WidgetHit IFWL_Edit::HitTest(FX_FLOAT fx, FX_FLOAT fy) { if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { - if (IsShowScrollBar(TRUE)) { + if (IsShowScrollBar(true)) { CFX_RectF rect; m_pVertScrollBar->GetWidgetRect(rect); if (rect.Contains(fx, fy)) return FWL_WidgetHit::VScrollBar; } - if (IsShowScrollBar(FALSE)) { + if (IsShowScrollBar(false)) { CFX_RectF rect; m_pHorzScrollBar->GetWidgetRect(rect); if (rect.Contains(fx, fy)) @@ -204,12 +204,12 @@ void IFWL_Edit::AddSpellCheckObj(CFX_Path& PathData, int32_t IFWL_Edit::GetWordAtPoint(CFX_PointF pointf, int32_t& nCount) { return 0; } -FX_BOOL IFWL_Edit::GetSuggestWords(CFX_PointF pointf, - std::vector<CFX_ByteString>& sSuggest) { +bool IFWL_Edit::GetSuggestWords(CFX_PointF pointf, + std::vector<CFX_ByteString>& sSuggest) { int32_t nWordCount = 0; int32_t nWordStart = GetWordAtPoint(pointf, nWordCount); if (nWordCount < 1) { - return FALSE; + return false; } CFX_WideString wsSpell; GetText(wsSpell, nWordStart, nWordCount); @@ -221,30 +221,30 @@ FX_BOOL IFWL_Edit::GetSuggestWords(CFX_PointF pointf, sLatinWord += (FX_CHAR)wsSpell[i]; } if (sLatinWord.IsEmpty()) { - return FALSE; + return false; } CFWL_EvtEdtCheckWord checkWordEvent; checkWordEvent.m_pSrcTarget = this; checkWordEvent.bsWord = sLatinWord; - checkWordEvent.bCheckWord = TRUE; + checkWordEvent.bCheckWord = true; DispatchEvent(&checkWordEvent); if (checkWordEvent.bCheckWord) { - return FALSE; + return false; } CFWL_EvtEdtGetSuggestWords suggestWordsEvent; suggestWordsEvent.m_pSrcTarget = this; suggestWordsEvent.bsWord = sLatinWord; suggestWordsEvent.bsArraySuggestWords = sSuggest; - suggestWordsEvent.bSuggestWords = FALSE; + suggestWordsEvent.bSuggestWords = false; DispatchEvent(&checkWordEvent); return suggestWordsEvent.bSuggestWords; } -FX_BOOL IFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf, - const CFX_ByteStringC& bsReplace) { +bool IFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf, + const CFX_ByteStringC& bsReplace) { int32_t nWordCount = 0; int32_t nWordStart = GetWordAtPoint(pointf, nWordCount); if (nWordCount < 1) { - return FALSE; + return false; } CFX_WideString wsSpell; GetText(wsSpell, nWordStart, nWordCount); @@ -262,7 +262,7 @@ FX_BOOL IFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf, } wsDest.ReleaseBuffer(nDestLen); Replace(nWordStart, nWordCount, wsDest.AsStringC()); - return TRUE; + return true; } void IFWL_Edit::DrawSpellCheck(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { @@ -291,7 +291,7 @@ void IFWL_Edit::DrawSpellCheck(CFX_Graphics* pGraphics, sLatinWord += (FX_CHAR)wsSpell[i]; } else { checkWordEvent.bsWord = sLatinWord; - checkWordEvent.bCheckWord = TRUE; + checkWordEvent.bCheckWord = true; DispatchEvent(&checkWordEvent); if (!sLatinWord.IsEmpty() && !checkWordEvent.bCheckWord) { AddSpellCheckObj(pathSpell, nStart, sLatinWord.GetLength(), fOffSetX, @@ -301,7 +301,7 @@ void IFWL_Edit::DrawSpellCheck(CFX_Graphics* pGraphics, } } checkWordEvent.bsWord = sLatinWord; - checkWordEvent.bCheckWord = TRUE; + checkWordEvent.bCheckWord = true; DispatchEvent(&checkWordEvent); if (!sLatinWord.IsEmpty() && !checkWordEvent.bCheckWord) { AddSpellCheckObj(pathSpell, nStart, sLatinWord.GetLength(), fOffSetX, @@ -401,7 +401,7 @@ int32_t IFWL_Edit::GetCaretPos() const { return m_pEdtEngine->GetCaretPos(); } -int32_t IFWL_Edit::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) { +int32_t IFWL_Edit::SetCaretPos(int32_t nIndex, bool bBefore) { if (!m_pEdtEngine) return -1; return m_pEdtEngine->SetCaretPos(nIndex, bBefore); @@ -509,13 +509,13 @@ FWL_Error IFWL_Edit::DoClipboard(int32_t iCmd) { return FWL_Error::Indefinite; } -FX_BOOL IFWL_Edit::Copy(CFX_WideString& wsCopy) { +bool IFWL_Edit::Copy(CFX_WideString& wsCopy) { if (!m_pEdtEngine) - return FALSE; + return false; int32_t nCount = m_pEdtEngine->CountSelRanges(); if (nCount == 0) - return FALSE; + return false; wsCopy.clear(); CFX_WideString wsTemp; @@ -526,16 +526,16 @@ FX_BOOL IFWL_Edit::Copy(CFX_WideString& wsCopy) { wsCopy += wsTemp; wsTemp.clear(); } - return TRUE; + return true; } -FX_BOOL IFWL_Edit::Cut(CFX_WideString& wsCut) { +bool IFWL_Edit::Cut(CFX_WideString& wsCut) { if (!m_pEdtEngine) - return FALSE; + return false; int32_t nCount = m_pEdtEngine->CountSelRanges(); if (nCount == 0) - return FALSE; + return false; wsCut.clear(); CFX_WideString wsTemp; @@ -547,72 +547,72 @@ FX_BOOL IFWL_Edit::Cut(CFX_WideString& wsCut) { wsTemp.clear(); } m_pEdtEngine->Delete(0); - return TRUE; + return true; } -FX_BOOL IFWL_Edit::Paste(const CFX_WideString& wsPaste) { +bool IFWL_Edit::Paste(const CFX_WideString& wsPaste) { if (!m_pEdtEngine) - return FALSE; + return false; int32_t nCaret = m_pEdtEngine->GetCaretPos(); int32_t iError = m_pEdtEngine->Insert(nCaret, wsPaste.c_str(), wsPaste.GetLength()); if (iError < 0) { ProcessInsertError(iError); - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL IFWL_Edit::Delete() { +bool IFWL_Edit::Delete() { if (!m_pEdtEngine) - return FALSE; + return false; int32_t nCount = m_pEdtEngine->CountSelRanges(); if (nCount < 1) - return FALSE; + return false; m_pEdtEngine->Delete(0); - return TRUE; + return true; } -FX_BOOL IFWL_Edit::Redo(const IFDE_TxtEdtDoRecord* pRecord) { +bool IFWL_Edit::Redo(const IFDE_TxtEdtDoRecord* pRecord) { if (!m_pEdtEngine) - return FALSE; + return false; if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo) - return TRUE; + return true; return m_pEdtEngine->Redo(pRecord); } -FX_BOOL IFWL_Edit::Undo(const IFDE_TxtEdtDoRecord* pRecord) { +bool IFWL_Edit::Undo(const IFDE_TxtEdtDoRecord* pRecord) { if (!m_pEdtEngine) - return FALSE; + return false; if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo) - return TRUE; + return true; return m_pEdtEngine->Undo(pRecord); } -FX_BOOL IFWL_Edit::Undo() { +bool IFWL_Edit::Undo() { if (!CanUndo()) - return FALSE; + return false; return Undo(m_DoRecords[m_iCurRecord--].get()); } -FX_BOOL IFWL_Edit::Redo() { +bool IFWL_Edit::Redo() { if (!CanRedo()) - return FALSE; + return false; return Redo(m_DoRecords[++m_iCurRecord].get()); } -FX_BOOL IFWL_Edit::CanUndo() { +bool IFWL_Edit::CanUndo() { return m_iCurRecord >= 0; } -FX_BOOL IFWL_Edit::CanRedo() { +bool IFWL_Edit::CanRedo() { return m_iCurRecord < pdfium::CollectionSize<int32_t>(m_DoRecords) - 1; } -FWL_Error IFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { +FWL_Error IFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant) { if (!m_pEdtEngine) return FWL_Error::Indefinite; @@ -630,28 +630,28 @@ FWL_Error IFWL_Edit::SetOuter(IFWL_Widget* pOuter) { FWL_Error IFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) { m_iMin = iMin; m_iMax = iMax; - m_bSetRange = TRUE; + m_bSetRange = true; return FWL_Error::Succeeded; } void IFWL_Edit::On_CaretChanged(CFDE_TxtEdtEngine* pEdit, int32_t nPage, - FX_BOOL bVisible) { + bool bVisible) { if (m_rtEngine.IsEmpty()) return; if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) return; - FX_BOOL bRepaintContent = UpdateOffset(); + bool bRepaintContent = UpdateOffset(); UpdateCaret(); CFX_RectF rtInvalid; rtInvalid.Set(0, 0, 0, 0); - FX_BOOL bRepaintScroll = FALSE; + bool bRepaintScroll = false; if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) { IFWL_ScrollBar* pScroll = UpdateScroll(); if (pScroll) { pScroll->GetWidgetRect(rtInvalid); - bRepaintScroll = TRUE; + bRepaintScroll = true; } } if (bRepaintContent || bRepaintScroll) { @@ -681,8 +681,8 @@ void IFWL_Edit::On_TextChanged(CFDE_TxtEdtEngine* pEdit, if (bHSelfAdaption || bVSelfAdaption) { CFWL_EvtEdtPreSelfAdaption evt; evt.m_pSrcTarget = this; - evt.bHSelfAdaption = TRUE; - evt.bVSelfAdaption = TRUE; + evt.bHSelfAdaption = true; + evt.bVSelfAdaption = true; FX_FLOAT fWidth; FX_FLOAT fHight; fWidth = bHSelfAdaption ? fContentWidth : m_pProperties->m_rtWidget.width; @@ -734,24 +734,24 @@ void IFWL_Edit::On_SelChanged(CFDE_TxtEdtEngine* pEdit) { Repaint(&rtTemp); } -FX_BOOL IFWL_Edit::On_PageLoad(CFDE_TxtEdtEngine* pEdit, - int32_t nPageIndex, - int32_t nPurpose) { +bool IFWL_Edit::On_PageLoad(CFDE_TxtEdtEngine* pEdit, + int32_t nPageIndex, + int32_t nPurpose) { IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(nPageIndex); if (!pPage) - return FALSE; + return false; pPage->LoadPage(nullptr, nullptr); - return TRUE; + return true; } -FX_BOOL IFWL_Edit::On_PageUnload(CFDE_TxtEdtEngine* pEdit, - int32_t nPageIndex, - int32_t nPurpose) { +bool IFWL_Edit::On_PageUnload(CFDE_TxtEdtEngine* pEdit, + int32_t nPageIndex, + int32_t nPurpose) { IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(nPageIndex); if (!pPage) - return FALSE; + return false; pPage->UnloadPage(nullptr); - return TRUE; + return true; } void IFWL_Edit::On_AddDoRecord(CFDE_TxtEdtEngine* pEdit, @@ -759,8 +759,7 @@ void IFWL_Edit::On_AddDoRecord(CFDE_TxtEdtEngine* pEdit, AddDoRecord(pRecord); } -FX_BOOL IFWL_Edit::On_Validate(CFDE_TxtEdtEngine* pEdit, - CFX_WideString& wsText) { +bool IFWL_Edit::On_Validate(CFDE_TxtEdtEngine* pEdit, CFX_WideString& wsText) { IFWL_Widget* pDst = GetOuter(); if (!pDst) { pDst = this; @@ -769,14 +768,14 @@ FX_BOOL IFWL_Edit::On_Validate(CFDE_TxtEdtEngine* pEdit, event.pDstWidget = pDst; event.m_pSrcTarget = this; event.wsInsert = wsText; - event.bValidate = TRUE; + event.bValidate = true; DispatchEvent(&event); return event.bValidate; } FWL_Error IFWL_Edit::SetBackgroundColor(uint32_t color) { m_backColor = color; - m_updateBackColor = TRUE; + m_updateBackColor = true; return FWL_Error::Succeeded; } @@ -808,7 +807,7 @@ void IFWL_Edit::DrawTextBk(CFX_Graphics* pGraphics, param.m_matrix = *pMatrix; param.m_rtPart = m_rtClient; pTheme->DrawBackground(¶m); - if (!IsShowScrollBar(TRUE) || !IsShowScrollBar(FALSE)) { + if (!IsShowScrollBar(true) || !IsShowScrollBar(false)) { return; } CFX_RectF rtScorll; @@ -843,9 +842,8 @@ void IFWL_Edit::DrawContent(CFX_Graphics* pGraphics, pMatrix->TransformRect(rtClip); mt.Concat(*pMatrix); } - FX_BOOL bShowSel = - (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoHideSel) || - (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused); + bool bShowSel = (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoHideSel) || + (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused); if (bShowSel) { IFWL_Widget* pForm = m_pWidgetMgr->GetSystemFormWidget(this); if (pForm) { @@ -896,7 +894,7 @@ void IFWL_Edit::DrawContent(CFX_Graphics* pGraphics, return; std::unique_ptr<CFDE_RenderDevice> pRenderDevice( - new CFDE_RenderDevice(pRenderDev, FALSE)); + new CFDE_RenderDevice(pRenderDev, false)); std::unique_ptr<CFDE_RenderContext> pRenderContext(new CFDE_RenderContext); pRenderDevice->SetClipRect(rtClip); pRenderContext->StartRender(pRenderDevice.get(), pPage, mt); @@ -1039,7 +1037,7 @@ void IFWL_Edit::UpdateEditParams() { params.nLineCount = 1; } params.fTabWidth = params.fFontSize * 1; - params.bTabEquidistant = TRUE; + params.bTabEquidistant = true; params.wLineBreakChar = L'\n'; params.nCharRotation = 0; params.pEventSink = this; @@ -1062,7 +1060,7 @@ void IFWL_Edit::UpdateEditLayout() { pPage->LoadPage(nullptr, nullptr); } -FX_BOOL IFWL_Edit::UpdateOffset() { +bool IFWL_Edit::UpdateOffset() { CFX_RectF rtCaret; m_pEdtEngine->GetCaretRect(rtCaret); FX_FLOAT fOffSetX = m_rtEngine.left - m_fScrollOffsetX; @@ -1072,7 +1070,7 @@ FX_BOOL IFWL_Edit::UpdateOffset() { if (rtEidt.Contains(rtCaret)) { IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0); if (!pPage) - return FALSE; + return false; CFX_RectF rtFDE = pPage->GetContentsBox(); rtFDE.Offset(fOffSetX, fOffSetY); @@ -1084,7 +1082,7 @@ FX_BOOL IFWL_Edit::UpdateOffset() { m_fScrollOffsetY += rtFDE.bottom() - rtEidt.bottom(); m_fScrollOffsetY = std::max(m_fScrollOffsetY, 0.0f); } - return FALSE; + return false; } FX_FLOAT offsetX = 0.0; @@ -1103,16 +1101,15 @@ FX_BOOL IFWL_Edit::UpdateOffset() { m_fScrollOffsetY += offsetY; if (m_fFontSize > m_rtEngine.height) m_fScrollOffsetY = 0; - return TRUE; + return true; } -FX_BOOL IFWL_Edit::UpdateOffset(IFWL_ScrollBar* pScrollBar, - FX_FLOAT fPosChanged) { +bool IFWL_Edit::UpdateOffset(IFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged) { if (pScrollBar == m_pHorzScrollBar.get()) m_fScrollOffsetX += fPosChanged; else m_fScrollOffsetY += fPosChanged; - return TRUE; + return true; } void IFWL_Edit::UpdateVAlignment() { @@ -1169,19 +1166,19 @@ void IFWL_Edit::UpdateCaret() { rtCaret.left = rtClient.right() - 1; rtCaret.width = right - rtCaret.left; } - FX_BOOL bIntersect = !rtCaret.IsEmpty(); - FX_BOOL bShow = TRUE; - FX_BOOL bShowWhole = FALSE; + bool bIntersect = !rtCaret.IsEmpty(); + bool bShow = true; + bool bShowWhole = false; if (!(m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) || !bIntersect) { - bShow = FALSE; + bShow = false; } if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_HSelfAdaption && temp.right() > m_rtEngine.right()) { - bShowWhole = TRUE; + bShowWhole = true; } if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_VSelfAdaption && temp.bottom() > m_rtEngine.bottom()) { - bShowWhole = TRUE; + bShowWhole = true; } else { bShow = (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused && bIntersect); } @@ -1191,10 +1188,10 @@ void IFWL_Edit::UpdateCaret() { ShowCaret(bShow, &rtCaret); } IFWL_ScrollBar* IFWL_Edit::UpdateScroll() { - FX_BOOL bShowHorz = + bool bShowHorz = m_pHorzScrollBar && ((m_pHorzScrollBar->GetStates() & FWL_WGTSTATE_Invisible) == 0); - FX_BOOL bShowVert = + bool bShowVert = m_pVertScrollBar && ((m_pVertScrollBar->GetStates() & FWL_WGTSTATE_Invisible) == 0); if (!bShowHorz && !bShowVert) { @@ -1223,14 +1220,14 @@ IFWL_ScrollBar* IFWL_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->SetStates(FWL_WGTSTATE_Disabled, false); 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, true); m_pHorzScrollBar->UnlockUpdate(); m_pHorzScrollBar->Update(); pRepaint = m_pHorzScrollBar.get(); @@ -1258,14 +1255,14 @@ IFWL_ScrollBar* IFWL_Edit::UpdateScroll() { m_pVertScrollBar->SetTrackPos(fPos); m_pVertScrollBar->SetPageSize(rtScroll.height); m_pVertScrollBar->SetStepSize(fStep); - m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled, FALSE); + m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled, false); 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, true); m_pVertScrollBar->UnlockUpdate(); m_pVertScrollBar->Update(); pRepaint = m_pVertScrollBar.get(); @@ -1273,12 +1270,12 @@ IFWL_ScrollBar* IFWL_Edit::UpdateScroll() { } return pRepaint; } -FX_BOOL IFWL_Edit::IsShowScrollBar(FX_BOOL bVert) { - FX_BOOL bShow = +bool IFWL_Edit::IsShowScrollBar(bool bVert) { + bool bShow = (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ShowScrollbarFocus) ? (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == FWL_WGTSTATE_Focused - : TRUE; + : true; if (bVert) { return bShow && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll) && (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) && @@ -1287,12 +1284,12 @@ FX_BOOL IFWL_Edit::IsShowScrollBar(FX_BOOL bVert) { return bShow && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_HScroll) && (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine); } -FX_BOOL IFWL_Edit::IsContentHeightOverflow() { +bool IFWL_Edit::IsContentHeightOverflow() { if (!m_pEdtEngine) - return FALSE; + return false; IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0); if (!pPage) - return FALSE; + return false; return pPage->GetContentsBox().height > m_rtEngine.height + 1.0f; } int32_t IFWL_Edit::AddDoRecord(IFDE_TxtEdtDoRecord* pRecord) { @@ -1337,8 +1334,8 @@ void IFWL_Edit::Layout() { pUIMargin->height); } } - FX_BOOL bShowVertScrollbar = IsShowScrollBar(TRUE); - FX_BOOL bShowHorzScrollbar = IsShowScrollBar(FALSE); + bool bShowVertScrollbar = IsShowScrollBar(true); + bool bShowHorzScrollbar = IsShowScrollBar(false); if (bShowVertScrollbar) { InitScrollBar(); CFX_RectF rtVertScr; @@ -1354,13 +1351,13 @@ void IFWL_Edit::Layout() { m_rtEngine.width -= fWidth; } m_pVertScrollBar->SetWidgetRect(rtVertScr); - m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, FALSE); + m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); m_pVertScrollBar->Update(); } else if (m_pVertScrollBar) { - m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, TRUE); + m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); } if (bShowHorzScrollbar) { - InitScrollBar(FALSE); + InitScrollBar(false); CFX_RectF rtHoriScr; if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin, @@ -1374,10 +1371,10 @@ void IFWL_Edit::Layout() { m_rtEngine.height -= fWidth; } m_pHorzScrollBar->SetWidgetRect(rtHoriScr); - m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, FALSE); + m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); m_pHorzScrollBar->Update(); } else if (m_pHorzScrollBar) { - m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, TRUE); + m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); } } void IFWL_Edit::LayoutScrollBar() { @@ -1386,8 +1383,8 @@ void IFWL_Edit::LayoutScrollBar() { return; } FX_FLOAT* pfWidth = nullptr; - FX_BOOL bShowVertScrollbar = IsShowScrollBar(TRUE); - FX_BOOL bShowHorzScrollbar = IsShowScrollBar(FALSE); + bool bShowVertScrollbar = IsShowScrollBar(true); + bool bShowHorzScrollbar = IsShowScrollBar(false); if (bShowVertScrollbar) { if (!m_pVertScrollBar) { pfWidth = static_cast<FX_FLOAT*>( @@ -1408,9 +1405,9 @@ void IFWL_Edit::LayoutScrollBar() { m_pVertScrollBar->SetWidgetRect(rtVertScr); m_pVertScrollBar->Update(); } - m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, FALSE); + m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); } else if (m_pVertScrollBar) { - m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, TRUE); + m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); } if (bShowHorzScrollbar) { if (!m_pHorzScrollBar) { @@ -1419,7 +1416,7 @@ void IFWL_Edit::LayoutScrollBar() { GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); } FX_FLOAT fWidth = pfWidth ? *pfWidth : 0; - InitScrollBar(FALSE); + InitScrollBar(false); CFX_RectF rtHoriScr; if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) { rtHoriScr.Set(m_rtClient.left, m_rtClient.bottom() + kEditMargin, @@ -1434,9 +1431,9 @@ void IFWL_Edit::LayoutScrollBar() { m_pHorzScrollBar->SetWidgetRect(rtHoriScr); m_pHorzScrollBar->Update(); } - m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, FALSE); + m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, false); } else if (m_pHorzScrollBar) { - m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, TRUE); + m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, true); } if (bShowVertScrollbar || bShowHorzScrollbar) { UpdateScroll(); @@ -1448,7 +1445,7 @@ void IFWL_Edit::DeviceToEngine(CFX_PointF& pt) { pt.y += m_fScrollOffsetY - m_rtEngine.top - m_fVAlignOffset; } -void IFWL_Edit::InitScrollBar(FX_BOOL bVert) { +void IFWL_Edit::InitScrollBar(bool bVert) { if ((bVert && m_pVertScrollBar) || (!bVert && m_pHorzScrollBar)) { return; } @@ -1470,18 +1467,18 @@ void IFWL_Edit::InitEngine() { m_pEdtEngine.reset(new CFDE_TxtEdtEngine); } -FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget, - FX_BOOL bVisible, - const CFX_RectF* pRtAnchor) { +bool FWL_ShowCaret(IFWL_Widget* pWidget, + bool bVisible, + const CFX_RectF* pRtAnchor) { CXFA_FFWidget* pXFAWidget = static_cast<CXFA_FFWidget*>(pWidget->GetLayoutItem()); if (!pXFAWidget) - return FALSE; + return false; IXFA_DocEnvironment* pDocEnvironment = pXFAWidget->GetDoc()->GetDocEnvironment(); if (!pDocEnvironment) - return FALSE; + return false; if (bVisible) { CFX_Matrix mt; @@ -1489,13 +1486,13 @@ FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget, CFX_RectF rt(*pRtAnchor); mt.TransformRect(rt); pDocEnvironment->DisplayCaret(pXFAWidget, bVisible, &rt); - return TRUE; + return true; } pDocEnvironment->DisplayCaret(pXFAWidget, bVisible, pRtAnchor); - return TRUE; + return true; } -void IFWL_Edit::ShowCaret(FX_BOOL bVisible, CFX_RectF* pRect) { +void IFWL_Edit::ShowCaret(bool bVisible, CFX_RectF* pRect) { if (m_pCaret) { m_pCaret->ShowCaret(bVisible); if (bVisible && !pRect->IsEmpty()) { @@ -1519,40 +1516,40 @@ void IFWL_Edit::ShowCaret(FX_BOOL bVisible, CFX_RectF* pRect) { FWL_ShowCaret(pOuter, bVisible, pRect); } } -FX_BOOL IFWL_Edit::ValidateNumberChar(FX_WCHAR cNum) { +bool IFWL_Edit::ValidateNumberChar(FX_WCHAR cNum) { if (!m_pEdtEngine) { - return FALSE; + return false; } if (!m_bSetRange) { - return TRUE; + return true; } CFX_WideString wsOld, wsText; m_pEdtEngine->GetText(wsText, 0); if (wsText.IsEmpty()) { if (cNum == L'0') { - return FALSE; + return false; } - return TRUE; + return true; } int32_t caretPos = m_pEdtEngine->GetCaretPos(); int32_t iSel = CountSelRanges(); if (iSel == 0) { if (cNum == L'0' && caretPos == 0) { - return FALSE; + return false; } int32_t nLen = wsText.GetLength(); CFX_WideString l = wsText.Mid(0, caretPos); CFX_WideString r = wsText.Mid(caretPos, nLen - caretPos); CFX_WideString wsNew = l + cNum + r; if (wsNew.GetInteger() <= m_iMax) { - return TRUE; + return true; } } else { if (wsText.GetInteger() <= m_iMax) { - return TRUE; + return true; } } - return FALSE; + return false; } void IFWL_Edit::InitCaret() { if (!m_pCaret) { @@ -1670,7 +1667,7 @@ void IFWL_Edit::DoDeactivate(CFWL_MsgDeactivate* pMsg) { void IFWL_Edit::DoButtonDown(CFWL_MsgMouse* pMsg) { if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) - SetFocus(TRUE); + SetFocus(true); if (!m_pEdtEngine) UpdateEditEngine(); @@ -1679,7 +1676,7 @@ void IFWL_Edit::DoButtonDown(CFWL_MsgMouse* pMsg) { return; CFX_PointF pt(pMsg->m_fx, pMsg->m_fy); DeviceToEngine(pt); - FX_BOOL bBefore = TRUE; + bool bBefore = true; int32_t nIndex = pPage->GetCharIndex(pt, bBefore); if (nIndex < 0) nIndex = 0; @@ -1687,7 +1684,7 @@ void IFWL_Edit::DoButtonDown(CFWL_MsgMouse* pMsg) { m_pEdtEngine->SetCaretPos(nIndex, bBefore); } -void IFWL_Edit::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { +void IFWL_Edit::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { uint32_t dwStyleEx = GetStylesEx(); bool bRepaint = !!(dwStyleEx & FWL_STYLEEXT_EDT_InnerCaret); if (bSet) { @@ -1700,12 +1697,12 @@ void IFWL_Edit::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { UpdateCaret(); } else if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) { m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; - ShowCaret(FALSE); + ShowCaret(false); if (m_pEdtEngine && (dwStyleEx & FWL_STYLEEXT_EDT_NoHideSel) == 0) { int32_t nSel = CountSelRanges(); if (nSel > 0) { ClearSelections(); - bRepaint = TRUE; + bRepaint = true; } SetCaretPos(0); UpdateOffset(); @@ -1725,15 +1722,15 @@ void IFWL_Edit::OnLButtonDown(CFWL_MsgMouse* pMsg) { if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) return; - m_bLButtonDown = TRUE; - SetGrab(TRUE); + m_bLButtonDown = true; + SetGrab(true); DoButtonDown(pMsg); int32_t nIndex = m_pEdtEngine->GetCaretPos(); - FX_BOOL bRepaint = FALSE; + bool bRepaint = false; int32_t iCount = m_pEdtEngine->CountSelRanges(); if (iCount > 0) { m_pEdtEngine->ClearSelection(); - bRepaint = TRUE; + bRepaint = true; } bool bShift = !!(pMsg->m_dwFlags & FWL_KEYFLAG_Shift); @@ -1741,7 +1738,7 @@ void IFWL_Edit::OnLButtonDown(CFWL_MsgMouse* pMsg) { int32_t iStart = std::min(m_nSelStart, nIndex); int32_t iEnd = std::max(m_nSelStart, nIndex); m_pEdtEngine->AddSelRange(iStart, iEnd - iStart); - bRepaint = TRUE; + bRepaint = true; } else { m_nSelStart = nIndex; } @@ -1750,8 +1747,8 @@ void IFWL_Edit::OnLButtonDown(CFWL_MsgMouse* pMsg) { } void IFWL_Edit::OnLButtonUp(CFWL_MsgMouse* pMsg) { - m_bLButtonDown = FALSE; - SetGrab(FALSE); + m_bLButtonDown = false; + SetGrab(false); } void IFWL_Edit::OnButtonDblClk(CFWL_MsgMouse* pMsg) { @@ -1770,7 +1767,7 @@ void IFWL_Edit::OnButtonDblClk(CFWL_MsgMouse* pMsg) { return; m_pEdtEngine->AddSelRange(nIndex, nCount); - m_pEdtEngine->SetCaretPos(nIndex + nCount - 1, FALSE); + m_pEdtEngine->SetCaretPos(nIndex + nCount - 1, false); Repaint(&m_rtEngine); } @@ -1786,7 +1783,7 @@ void IFWL_Edit::OnMouseMove(CFWL_MsgMouse* pMsg) { CFX_PointF pt(pMsg->m_fx, pMsg->m_fy); DeviceToEngine(pt); - FX_BOOL bBefore = TRUE; + bool bBefore = true; int32_t nIndex = pPage->GetCharIndex(pt, bBefore); m_pEdtEngine->SetCaretPos(nIndex, bBefore); nIndex = m_pEdtEngine->GetCaretPos(); @@ -1843,7 +1840,7 @@ void IFWL_Edit::OnKeyDown(CFWL_MsgKey* pMsg) { } int32_t nCaret = m_pEdtEngine->GetCaretPos(); #if (_FX_OS_ == _FX_MACOSX_) - m_pEdtEngine->Delete(nCaret, TRUE); + m_pEdtEngine->Delete(nCaret, true); #else m_pEdtEngine->Delete(nCaret); #endif @@ -1893,7 +1890,7 @@ void IFWL_Edit::OnChar(CFWL_MsgKey* pMsg) { int32_t nCaret = m_pEdtEngine->GetCaretPos(); switch (c) { case FWL_VKEY_Back: - m_pEdtEngine->Delete(nCaret, TRUE); + m_pEdtEngine->Delete(nCaret, true); break; case 0x0A: break; @@ -1937,9 +1934,9 @@ void IFWL_Edit::OnChar(CFWL_MsgKey* pMsg) { ProcessInsertError(iError); } -FX_BOOL IFWL_Edit::OnScroll(IFWL_ScrollBar* pScrollBar, - uint32_t dwCode, - FX_FLOAT fPos) { +bool IFWL_Edit::OnScroll(IFWL_ScrollBar* pScrollBar, + uint32_t dwCode, + FX_FLOAT fPos) { CFX_SizeF fs; pScrollBar->GetRange(fs.x, fs.y); FX_FLOAT iCurPos = pScrollBar->GetPos(); @@ -1985,7 +1982,7 @@ FX_BOOL IFWL_Edit::OnScroll(IFWL_ScrollBar* pScrollBar, case FWL_SCBCODE_TrackPos: break; case FWL_SCBCODE_EndScroll: - return FALSE; + return false; default: break; } @@ -2002,5 +1999,5 @@ FX_BOOL IFWL_Edit::OnScroll(IFWL_ScrollBar* pScrollBar, rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); Repaint(&rtInvalidate); } - return TRUE; + return true; } diff --git a/xfa/fwl/core/ifwl_edit.h b/xfa/fwl/core/ifwl_edit.h index 9959e42ba5..c210ac20c5 100644 --- a/xfa/fwl/core/ifwl_edit.h +++ b/xfa/fwl/core/ifwl_edit.h @@ -70,24 +70,24 @@ FWL_EVENT_DEF(CFWL_EvtEdtTextFull, CFWL_EventType::TextFull) FWL_EVENT_DEF(CFWL_EvtEdtPreSelfAdaption, CFWL_EventType::PreSelfAdaption, - FX_BOOL bHSelfAdaption; - FX_BOOL bVSelfAdaption; + bool bHSelfAdaption; + bool bVSelfAdaption; CFX_RectF rtAfterChange;) FWL_EVENT_DEF(CFWL_EvtEdtValidate, CFWL_EventType::Validate, IFWL_Widget* pDstWidget; CFX_WideString wsInsert; - FX_BOOL bValidate;) + bool bValidate;) FWL_EVENT_DEF(CFWL_EvtEdtCheckWord, CFWL_EventType::CheckWord, CFX_ByteString bsWord; - FX_BOOL bCheckWord;) + bool bCheckWord;) FWL_EVENT_DEF(CFWL_EvtEdtGetSuggestWords, CFWL_EventType::GetSuggestedWords, - FX_BOOL bSuggestWords; + bool bSuggestWords; CFX_ByteString bsWord; std::vector<CFX_ByteString> bsArraySuggestWords;) @@ -111,11 +111,11 @@ class IFWL_Edit : public IFWL_Widget { // IFWL_Widget: FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; FWL_Error SetWidgetRect(const CFX_RectF& rect) override; FWL_Error Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; - void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; + void SetStates(uint32_t dwStates, bool bSet = true) override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr) override; FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; @@ -131,7 +131,7 @@ class IFWL_Edit : public IFWL_Widget { int32_t nCount = -1) const; virtual FWL_Error ClearText(); virtual int32_t GetCaretPos() const; - virtual int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE); + virtual int32_t SetCaretPos(int32_t nIndex, bool bBefore = true); virtual FWL_Error AddSelRange(int32_t nStart, int32_t nCount = -1); virtual int32_t CountSelRanges(); virtual int32_t GetSelRange(int32_t nIndex, int32_t& nStart); @@ -148,17 +148,17 @@ class IFWL_Edit : public IFWL_Widget { int32_t nLen, const CFX_WideStringC& wsReplace); virtual FWL_Error DoClipboard(int32_t iCmd); - virtual FX_BOOL Copy(CFX_WideString& wsCopy); - virtual FX_BOOL Cut(CFX_WideString& wsCut); - virtual FX_BOOL Paste(const CFX_WideString& wsPaste); - virtual FX_BOOL Delete(); - virtual FX_BOOL Redo(const IFDE_TxtEdtDoRecord* pRecord); - virtual FX_BOOL Undo(const IFDE_TxtEdtDoRecord* pRecord); - virtual FX_BOOL Undo(); - virtual FX_BOOL Redo(); - virtual FX_BOOL CanUndo(); - virtual FX_BOOL CanRedo(); - virtual FWL_Error SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); + virtual bool Copy(CFX_WideString& wsCopy); + virtual bool Cut(CFX_WideString& wsCut); + virtual bool Paste(const CFX_WideString& wsPaste); + virtual bool Delete(); + virtual bool Redo(const IFDE_TxtEdtDoRecord* pRecord); + virtual bool Undo(const IFDE_TxtEdtDoRecord* pRecord); + virtual bool Undo(); + virtual bool Redo(); + virtual bool CanUndo(); + virtual bool CanRedo(); + virtual FWL_Error SetTabWidth(FX_FLOAT fTabWidth, bool bEquidistant); virtual FWL_Error SetOuter(IFWL_Widget* pOuter); virtual FWL_Error SetNumberRange(int32_t iMin, int32_t iMax); virtual FWL_Error SetBackgroundColor(uint32_t color); @@ -166,23 +166,23 @@ class IFWL_Edit : public IFWL_Widget { void On_CaretChanged(CFDE_TxtEdtEngine* pEdit, int32_t nPage, - FX_BOOL bVisible = true); + bool bVisible = true); void On_TextChanged(CFDE_TxtEdtEngine* pEdit, FDE_TXTEDT_TEXTCHANGE_INFO& ChangeInfo); void On_SelChanged(CFDE_TxtEdtEngine* pEdit); - FX_BOOL On_PageLoad(CFDE_TxtEdtEngine* pEdit, - int32_t nPageIndex, - int32_t nPurpose); - FX_BOOL On_PageUnload(CFDE_TxtEdtEngine* pEdit, - int32_t nPageIndex, - int32_t nPurpose); + bool On_PageLoad(CFDE_TxtEdtEngine* pEdit, + int32_t nPageIndex, + int32_t nPurpose); + bool On_PageUnload(CFDE_TxtEdtEngine* pEdit, + int32_t nPageIndex, + int32_t nPurpose); void On_AddDoRecord(CFDE_TxtEdtEngine* pEdit, IFDE_TxtEdtDoRecord* pRecord); - FX_BOOL On_Validate(CFDE_TxtEdtEngine* pEdit, CFX_WideString& wsText); + bool On_Validate(CFDE_TxtEdtEngine* pEdit, CFX_WideString& wsText); void SetScrollOffset(FX_FLOAT fScrollOffset); - FX_BOOL GetSuggestWords(CFX_PointF pointf, - std::vector<CFX_ByteString>& sSuggest); - FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, - const CFX_ByteStringC& bsReplace); + bool GetSuggestWords(CFX_PointF pointf, + std::vector<CFX_ByteString>& sSuggest); + bool ReplaceSpellCheckWord(CFX_PointF pointf, + const CFX_ByteStringC& bsReplace); protected: friend class CFWL_TxtEdtEventSink; @@ -196,22 +196,22 @@ class IFWL_Edit : public IFWL_Widget { void UpdateEditEngine(); void UpdateEditParams(); void UpdateEditLayout(); - FX_BOOL UpdateOffset(); - FX_BOOL UpdateOffset(IFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged); + bool UpdateOffset(); + bool UpdateOffset(IFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged); void UpdateVAlignment(); void UpdateCaret(); IFWL_ScrollBar* UpdateScroll(); void Layout(); void LayoutScrollBar(); void DeviceToEngine(CFX_PointF& pt); - void InitScrollBar(FX_BOOL bVert = TRUE); + void InitScrollBar(bool bVert = true); void InitEngine(); - virtual void ShowCaret(FX_BOOL bVisible, CFX_RectF* pRect = nullptr); - FX_BOOL ValidateNumberChar(FX_WCHAR cNum); + virtual void ShowCaret(bool bVisible, CFX_RectF* pRect = nullptr); + bool ValidateNumberChar(FX_WCHAR cNum); void InitCaret(); void ClearRecord(); - FX_BOOL IsShowScrollBar(FX_BOOL bVert); - FX_BOOL IsContentHeightOverflow(); + bool IsShowScrollBar(bool bVert); + bool IsContentHeightOverflow(); int32_t AddDoRecord(IFDE_TxtEdtDoRecord* pRecord); void ProcessInsertError(int32_t iError); @@ -231,14 +231,14 @@ class IFWL_Edit : public IFWL_Widget { FX_FLOAT m_fScrollOffsetX; FX_FLOAT m_fScrollOffsetY; std::unique_ptr<CFDE_TxtEdtEngine> m_pEdtEngine; - FX_BOOL m_bLButtonDown; + bool m_bLButtonDown; int32_t m_nSelStart; int32_t m_nLimit; FX_FLOAT m_fSpaceAbove; FX_FLOAT m_fSpaceBelow; FX_FLOAT m_fFontSize; FX_ARGB m_argbSel; - FX_BOOL m_bSetRange; + bool m_bSetRange; int32_t m_iMin; int32_t m_iMax; std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar; @@ -246,7 +246,7 @@ class IFWL_Edit : public IFWL_Widget { std::unique_ptr<IFWL_Caret> m_pCaret; CFX_WideString m_wsCache; uint32_t m_backColor; - FX_BOOL m_updateBackColor; + bool m_updateBackColor; CFX_WideString m_wsFont; std::deque<std::unique_ptr<IFDE_TxtEdtDoRecord>> m_DoRecords; int32_t m_iCurRecord; @@ -256,14 +256,14 @@ class IFWL_Edit : public IFWL_Widget { void DoActivate(CFWL_MsgActivate* pMsg); void DoDeactivate(CFWL_MsgDeactivate* pMsg); void DoButtonDown(CFWL_MsgMouse* pMsg); - void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet); + void OnFocusChanged(CFWL_Message* pMsg, bool bSet); void OnLButtonDown(CFWL_MsgMouse* pMsg); void OnLButtonUp(CFWL_MsgMouse* pMsg); void OnButtonDblClk(CFWL_MsgMouse* pMsg); void OnMouseMove(CFWL_MsgMouse* pMsg); void OnKeyDown(CFWL_MsgKey* pMsg); void OnChar(CFWL_MsgKey* pMsg); - FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); + bool OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); }; #endif // XFA_FWL_CORE_IFWL_EDIT_H_ diff --git a/xfa/fwl/core/ifwl_form.cpp b/xfa/fwl/core/ifwl_form.cpp index 60213549f7..ab6887fec8 100644 --- a/xfa/fwl/core/ifwl_form.cpp +++ b/xfa/fwl/core/ifwl_form.cpp @@ -51,15 +51,15 @@ IFWL_Form::IFWL_Form(const IFWL_App* app, m_iCaptureBtn(-1), m_iSysBox(0), m_eResizeType(FORM_RESIZETYPE_None), - m_bLButtonDown(FALSE), + m_bLButtonDown(false), m_bMaximized(false), - m_bSetMaximize(FALSE), + m_bSetMaximize(false), m_bCustomizeLayout(false), m_eFormSize(FWL_FORMSIZE_Manual), - m_bDoModalFlag(FALSE), + m_bDoModalFlag(false), m_pBigIcon(nullptr), m_pSmallIcon(nullptr), - m_bMouseIn(FALSE) { + m_bMouseIn(false) { m_rtRelative.Reset(); m_rtCaption.Reset(); m_rtRestore.Reset(); @@ -80,18 +80,18 @@ FWL_Type IFWL_Form::GetClassID() const { return FWL_Type::Form; } -FX_BOOL IFWL_Form::IsInstance(const CFX_WideStringC& wsClass) const { +bool IFWL_Form::IsInstance(const CFX_WideStringC& wsClass) const { if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) - return TRUE; + return true; return IFWL_Widget::IsInstance(wsClass); } -FWL_Error IFWL_Form::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error IFWL_Form::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Reset(); FX_FLOAT fCapHeight = GetCaptionHeight(); - FX_FLOAT fCXBorder = GetBorderSize(TRUE); - FX_FLOAT fCYBorder = GetBorderSize(FALSE); + FX_FLOAT fCXBorder = GetBorderSize(true); + FX_FLOAT fCYBorder = GetBorderSize(false); FX_FLOAT fEdge = GetEdgeWidth(); rect.height += fCapHeight + fCYBorder + fEdge + fEdge; rect.width += fCXBorder + fCXBorder + fEdge + fEdge; @@ -213,7 +213,7 @@ FWL_Error IFWL_Form::DrawWidget(CFX_Graphics* pGraphics, if (!m_pProperties->m_pThemeProvider) return FWL_Error::Indefinite; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; - FX_BOOL bInactive = !IsActive(); + bool bInactive = !IsActive(); int32_t iState = bInactive ? CFWL_PartState_Inactive : CFWL_PartState_Normal; if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_NoDrawClient) == 0) { DrawBackground(pGraphics, pTheme); @@ -297,7 +297,7 @@ FWL_Error IFWL_Form::DrawWidget(CFX_Graphics* pGraphics, param.m_rtPart = m_pMinBox->m_rtBtn; pTheme->DrawBackground(¶m); } - m_bMouseIn = FALSE; + m_bMouseIn = false; } #else { @@ -345,8 +345,8 @@ IFWL_Widget* IFWL_Form::DoModal() { m_pNoteLoop.reset(new CFWL_NoteLoop(this)); pDriver->PushNoteLoop(m_pNoteLoop.get()); - m_bDoModalFlag = TRUE; - SetStates(FWL_WGTSTATE_Invisible, FALSE); + m_bDoModalFlag = true; + SetStates(FWL_WGTSTATE_Invisible, false); pDriver->Run(); #if (_FX_OS_ == _FX_MACOSX_) #else @@ -363,7 +363,7 @@ IFWL_Widget* IFWL_Form::DoModal(uint32_t& dwCommandID) { FWL_Error IFWL_Form::EndDoModal() { if (!m_pNoteLoop) return FWL_Error::Indefinite; - m_bDoModalFlag = FALSE; + m_bDoModalFlag = false; #if (_FX_OS_ == _FX_MACOSX_) m_pNoteLoop->EndModalLoop(); const IFWL_App* pApp = GetOwnerApp(); @@ -376,10 +376,10 @@ FWL_Error IFWL_Form::EndDoModal() { return FWL_Error::Indefinite; pDriver->PopNoteLoop(); - SetStates(FWL_WGTSTATE_Invisible, TRUE); + SetStates(FWL_WGTSTATE_Invisible, true); return FWL_Error::Succeeded; #else - SetStates(FWL_WGTSTATE_Invisible, TRUE); + SetStates(FWL_WGTSTATE_Invisible, true); return m_pNoteLoop->EndModalLoop(); #endif } @@ -561,7 +561,7 @@ void IFWL_Form::DrawIconImage(CFX_Graphics* pGs, param.m_pWidget = this; param.m_iPart = CFWL_Part::Icon; param.m_pGraphics = pGs; - param.m_pImage = pData->GetIcon(this, FALSE); + param.m_pImage = pData->GetIcon(this, false); param.m_rtPart = m_rtIcon; if (pMatrix) { param.m_matrix.Concat(*pMatrix); @@ -572,7 +572,7 @@ void IFWL_Form::GetEdgeRect(CFX_RectF& rtEdge) { rtEdge = m_rtRelative; if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { FX_FLOAT fCX = GetBorderSize(); - FX_FLOAT fCY = GetBorderSize(FALSE); + FX_FLOAT fCY = GetBorderSize(false); rtEdge.Deflate(fCX, m_rtCaption.Height(), fCX, fCY); } } @@ -581,7 +581,7 @@ void IFWL_Form::SetWorkAreaRect() { CFWL_WidgetMgr* pWidgetMgr = GetOwnerApp()->GetWidgetMgr(); if (!pWidgetMgr) return; - m_bSetMaximize = TRUE; + m_bSetMaximize = true; Repaint(&m_rtRelative); } void IFWL_Form::SetCursor(FX_FLOAT fx, FX_FLOAT fy) {} @@ -651,7 +651,7 @@ void IFWL_Form::ReSetSysBtn() { IFWL_FormDP* pData = static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon && - pData->GetIcon(this, FALSE)) { + pData->GetIcon(this, false)) { if (!m_bCustomizeLayout) { m_rtIcon.Set(5, (m_rtCaption.height - m_fSmallIconSz) / 2, m_fSmallIconSz, m_fSmallIconSz); @@ -682,7 +682,7 @@ void IFWL_Form::UnRegisterForm() { pDriver->UnRegisterForm(this); } -FX_BOOL IFWL_Form::IsDoModal() { +bool IFWL_Form::IsDoModal() { return m_bDoModalFlag; } void IFWL_Form::SetThemeData() { @@ -691,10 +691,10 @@ void IFWL_Form::SetThemeData() { m_fBigIconSz = *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::BigIcon)); } -FX_BOOL IFWL_Form::HasIcon() { +bool IFWL_Form::HasIcon() { IFWL_FormDP* pData = static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); - return !!pData->GetIcon(this, FALSE); + return !!pData->GetIcon(this, false); } void IFWL_Form::UpdateIcon() { CFWL_WidgetMgr* pWidgetMgr = GetOwnerApp()->GetWidgetMgr(); @@ -702,8 +702,8 @@ void IFWL_Form::UpdateIcon() { return; IFWL_FormDP* pData = static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); - CFX_DIBitmap* pBigIcon = pData->GetIcon(this, TRUE); - CFX_DIBitmap* pSmallIcon = pData->GetIcon(this, FALSE); + CFX_DIBitmap* pBigIcon = pData->GetIcon(this, true); + CFX_DIBitmap* pSmallIcon = pData->GetIcon(this, false); if (pBigIcon) m_pBigIcon = pBigIcon; if (pSmallIcon) @@ -725,7 +725,7 @@ void IFWL_Form::DoWidthLimit(FX_FLOAT& fLeft, FX_FLOAT fSpace, FX_FLOAT fLimitMin, FX_FLOAT fLimitMax, - FX_BOOL bLeft) { + bool bLeft) { FX_FLOAT fx = fCurX; FX_FLOAT fy = 0; TransformTo(nullptr, fx, fy); @@ -750,7 +750,7 @@ void IFWL_Form::DoHeightLimit(FX_FLOAT& fTop, FX_FLOAT fSpace, FX_FLOAT fLimitMin, FX_FLOAT fLimitMax, - FX_BOOL bTop) { + bool bTop) { FX_FLOAT fx = 0; FX_FLOAT fy = fCurY; TransformTo(nullptr, fx, fy); @@ -861,7 +861,7 @@ void IFWL_Form::OnProcessMessage(CFWL_Message* pMessage) { if (!m_bSetMaximize) break; - m_bSetMaximize = FALSE; + m_bSetMaximize = false; CFWL_MsgSize* pMsg = static_cast<CFWL_MsgSize*>(pMessage); m_pProperties->m_rtWidget.left = 0; m_pProperties->m_rtWidget.top = 0; @@ -888,8 +888,8 @@ void IFWL_Form::OnDrawWidget(CFX_Graphics* pGraphics, } void IFWL_Form::OnLButtonDown(CFWL_MsgMouse* pMsg) { - SetGrab(TRUE); - m_bLButtonDown = TRUE; + SetGrab(true); + m_bLButtonDown = true; m_eResizeType = FORM_RESIZETYPE_None; CFWL_SysBtn* pPressBtn = GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy); m_iCaptureBtn = GetSysBtnIndex(pPressBtn); @@ -914,8 +914,8 @@ void IFWL_Form::OnLButtonDown(CFWL_MsgMouse* pMsg) { } void IFWL_Form::OnLButtonUp(CFWL_MsgMouse* pMsg) { - SetGrab(FALSE); - m_bLButtonDown = FALSE; + SetGrab(false); + m_bLButtonDown = false; CFWL_SysBtn* pPointBtn = GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy); CFWL_SysBtn* pPressedBtn = GetSysBtnByIndex(m_iCaptureBtn); if (!pPressedBtn || pPointBtn != pPressedBtn) @@ -974,7 +974,7 @@ void IFWL_Form::OnMouseMove(CFWL_MsgMouse* pMsg) { } if (!rtInvalidate.IsEmpty() && rtInvalidate.Contains(pMsg->m_fx, pMsg->m_fy)) { - m_bMouseIn = TRUE; + m_bMouseIn = true; } } #else @@ -1057,7 +1057,7 @@ void CFWL_SysBtn::SetHover() { m_dwState |= FWL_SYSBUTTONSTATE_Hover; } -void CFWL_SysBtn::SetDisabled(FX_BOOL bDisabled) { +void CFWL_SysBtn::SetDisabled(bool bDisabled) { bDisabled ? m_dwState |= FWL_SYSBUTTONSTATE_Disabled : m_dwState &= ~FWL_SYSBUTTONSTATE_Disabled; } diff --git a/xfa/fwl/core/ifwl_form.h b/xfa/fwl/core/ifwl_form.h index 76634ab513..4936af6855 100644 --- a/xfa/fwl/core/ifwl_form.h +++ b/xfa/fwl/core/ifwl_form.h @@ -49,7 +49,7 @@ class CFWL_SysBtn { void SetNormal(); void SetPressed(); void SetHover(); - void SetDisabled(FX_BOOL bDisabled); + void SetDisabled(bool bDisabled); CFX_RectF m_rtBtn; uint32_t m_dwState; @@ -79,7 +79,7 @@ class CFWL_SysBtn; class IFWL_FormDP : public IFWL_DataProvider { public: - virtual CFX_DIBitmap* GetIcon(IFWL_Widget* pWidget, FX_BOOL bBig) = 0; + virtual CFX_DIBitmap* GetIcon(IFWL_Widget* pWidget, bool bBig) = 0; }; class IFWL_Form : public IFWL_Widget { @@ -91,8 +91,8 @@ class IFWL_Form : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + bool IsInstance(const CFX_WideStringC& wsClass) const override; + FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; FWL_Error GetClientRect(CFX_RectF& rect) override; FWL_Error Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; @@ -136,9 +136,9 @@ class IFWL_Form : public IFWL_Widget { void ReSetSysBtn(); void RegisterForm(); void UnRegisterForm(); - FX_BOOL IsDoModal(); + bool IsDoModal(); void SetThemeData(); - FX_BOOL HasIcon(); + bool HasIcon(); void UpdateIcon(); void UpdateCaption(); void DoWidthLimit(FX_FLOAT& fLeft, @@ -147,14 +147,14 @@ class IFWL_Form : public IFWL_Widget { FX_FLOAT fSpace, FX_FLOAT fLimitMin, FX_FLOAT fLimitMax, - FX_BOOL bLeft); + bool bLeft); void DoHeightLimit(FX_FLOAT& fTop, FX_FLOAT& fHeight, FX_FLOAT fCurY, FX_FLOAT fSpace, FX_FLOAT fLimitMin, FX_FLOAT fLimitMax, - FX_BOOL bTop); + bool bTop); CFX_RectF m_rtRestore; CFX_RectF m_rtCaptionText; @@ -173,17 +173,17 @@ class IFWL_Form : public IFWL_Widget { int32_t m_iCaptureBtn; int32_t m_iSysBox; int32_t m_eResizeType; - FX_BOOL m_bLButtonDown; + bool m_bLButtonDown; bool m_bMaximized; - FX_BOOL m_bSetMaximize; + bool m_bSetMaximize; bool m_bCustomizeLayout; FWL_FORMSIZE m_eFormSize; - FX_BOOL m_bDoModalFlag; + bool m_bDoModalFlag; FX_FLOAT m_fSmallIconSz; FX_FLOAT m_fBigIconSz; CFX_DIBitmap* m_pBigIcon; CFX_DIBitmap* m_pSmallIcon; - FX_BOOL m_bMouseIn; + bool m_bMouseIn; private: void OnLButtonDown(CFWL_MsgMouse* pMsg); diff --git a/xfa/fwl/core/ifwl_formproxy.cpp b/xfa/fwl/core/ifwl_formproxy.cpp index 30c25827d5..d06cf0b7a6 100644 --- a/xfa/fwl/core/ifwl_formproxy.cpp +++ b/xfa/fwl/core/ifwl_formproxy.cpp @@ -21,9 +21,9 @@ FWL_Type IFWL_FormProxy::GetClassID() const { return FWL_Type::FormProxy; } -FX_BOOL IFWL_FormProxy::IsInstance(const CFX_WideStringC& wsClass) const { +bool IFWL_FormProxy::IsInstance(const CFX_WideStringC& wsClass) const { if (wsClass == CFX_WideStringC(FWL_CLASS_FormProxy)) { - return TRUE; + return true; } return IFWL_Form::IsInstance(wsClass); } diff --git a/xfa/fwl/core/ifwl_formproxy.h b/xfa/fwl/core/ifwl_formproxy.h index d28208b842..7bab976307 100644 --- a/xfa/fwl/core/ifwl_formproxy.h +++ b/xfa/fwl/core/ifwl_formproxy.h @@ -20,7 +20,7 @@ class IFWL_FormProxy : public IFWL_Form { // IFWL_Widget FWL_Type GetClassID() const override; - FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const override; + bool IsInstance(const CFX_WideStringC& wsClass) const override; FWL_Error Update() override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr) override; diff --git a/xfa/fwl/core/ifwl_listbox.cpp b/xfa/fwl/core/ifwl_listbox.cpp index 5d95c749d7..b462c8e34b 100644 --- a/xfa/fwl/core/ifwl_listbox.cpp +++ b/xfa/fwl/core/ifwl_listbox.cpp @@ -29,7 +29,7 @@ IFWL_ListBox::IFWL_ListBox(const IFWL_App* app, m_iTTOAligns(0), m_hAnchor(nullptr), m_fScorllBarWidth(0), - m_bLButtonDown(FALSE), + m_bLButtonDown(false), m_pScrollBarTP(nullptr) { m_rtClient.Reset(); m_rtConent.Reset(); @@ -42,15 +42,15 @@ FWL_Type IFWL_ListBox::GetClassID() const { return FWL_Type::ListBox; } -FWL_Error IFWL_ListBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error IFWL_ListBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } - CFX_SizeF fs = CalcSize(TRUE); + CFX_SizeF fs = CalcSize(true); rect.Set(0, 0, fs.x, fs.y); - IFWL_Widget::GetWidgetRect(rect, TRUE); + IFWL_Widget::GetWidgetRect(rect, true); } else { rect = m_pProperties->m_rtWidget; } @@ -87,13 +87,13 @@ FWL_Error IFWL_ListBox::Update() { } FWL_WidgetHit IFWL_ListBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) { - if (IsShowScrollBar(FALSE)) { + if (IsShowScrollBar(false)) { CFX_RectF rect; m_pHorzScrollBar->GetWidgetRect(rect); if (rect.Contains(fx, fy)) return FWL_WidgetHit::HScrollBar; } - if (IsShowScrollBar(TRUE)) { + if (IsShowScrollBar(true)) { CFX_RectF rect; m_pVertScrollBar->GetWidgetRect(rect); if (rect.Contains(fx, fy)) @@ -119,10 +119,10 @@ FWL_Error IFWL_ListBox::DrawWidget(CFX_Graphics* pGraphics, DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } CFX_RectF rtClip(m_rtConent); - if (IsShowScrollBar(FALSE)) { + if (IsShowScrollBar(false)) { rtClip.height -= m_fScorllBarWidth; } - if (IsShowScrollBar(TRUE)) { + if (IsShowScrollBar(true)) { rtClip.width -= m_fScorllBarWidth; } if (pMatrix) { @@ -211,7 +211,7 @@ int32_t IFWL_ListBox::GetSelIndex(int32_t nIndex) { return -1; } -FWL_Error IFWL_ListBox::SetSelItem(IFWL_ListItem* pItem, FX_BOOL bSelect) { +FWL_Error IFWL_ListBox::SetSelItem(IFWL_ListItem* pItem, bool bSelect) { if (!m_pProperties->m_pDataProvider) return FWL_Error::Indefinite; if (!pItem) { @@ -243,8 +243,8 @@ FWL_Error IFWL_ListBox::GetItemText(IFWL_ListItem* pItem, return FWL_Error::Succeeded; } -FWL_Error IFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { - if ((bVert && IsShowScrollBar(TRUE)) || (!bVert && IsShowScrollBar(FALSE))) { +FWL_Error IFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, bool bVert) { + if ((bVert && IsShowScrollBar(true)) || (!bVert && IsShowScrollBar(false))) { IFWL_ScrollBar* pScrollBar = bVert ? m_pVertScrollBar.get() : m_pHorzScrollBar.get(); fPos = pScrollBar->GetPos(); @@ -285,7 +285,7 @@ IFWL_ListItem* IFWL_ListBox::GetItem(IFWL_ListItem* pItem, uint32_t dwKeyCode) { void IFWL_ListBox::SetSelection(IFWL_ListItem* hStart, IFWL_ListItem* hEnd, - FX_BOOL bSelected) { + bool bSelected) { IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); int32_t iStart = pData->GetItemIndex(this, hStart); @@ -299,7 +299,7 @@ void IFWL_ListBox::SetSelection(IFWL_ListItem* hStart, int32_t iCount = pData->CountItems(this); for (int32_t i = 0; i < iCount; i++) { IFWL_ListItem* pItem = pData->GetItem(this, i); - SetSelectionDirect(pItem, FALSE); + SetSelectionDirect(pItem, false); } } for (; iStart <= iEnd; iStart++) { @@ -308,7 +308,7 @@ void IFWL_ListBox::SetSelection(IFWL_ListItem* hStart, } } -void IFWL_ListBox::SetSelectionDirect(IFWL_ListItem* pItem, FX_BOOL bSelect) { +void IFWL_ListBox::SetSelectionDirect(IFWL_ListItem* pItem, bool bSelect) { IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); uint32_t dwOldStyle = pData->GetItemStyles(this, pItem); @@ -317,7 +317,7 @@ void IFWL_ListBox::SetSelectionDirect(IFWL_ListItem* pItem, FX_BOOL bSelect) { pData->SetItemStyles(this, pItem, dwOldStyle); } -FX_BOOL IFWL_ListBox::IsItemSelected(IFWL_ListItem* pItem) { +bool IFWL_ListBox::IsItemSelected(IFWL_ListItem* pItem) { IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); uint32_t dwState = pData->GetItemStyles(this, pItem); @@ -325,8 +325,7 @@ FX_BOOL IFWL_ListBox::IsItemSelected(IFWL_ListItem* pItem) { } void IFWL_ListBox::ClearSelection() { - FX_BOOL bMulti = - m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection; + bool bMulti = m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection; IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); int32_t iCount = pData->CountItems(this); @@ -335,15 +334,14 @@ void IFWL_ListBox::ClearSelection() { uint32_t dwState = pData->GetItemStyles(this, pItem); if (!(dwState & FWL_ITEMSTATE_LTB_Selected)) continue; - SetSelectionDirect(pItem, FALSE); + SetSelectionDirect(pItem, false); if (!bMulti) return; } } void IFWL_ListBox::SelectAll() { - FX_BOOL bMulti = - m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection; + bool bMulti = m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection; if (!bMulti) { return; } @@ -353,7 +351,7 @@ void IFWL_ListBox::SelectAll() { if (iCount > 0) { IFWL_ListItem* pItemStart = pData->GetItem(this, 0); IFWL_ListItem* pItemEnd = pData->GetItem(this, iCount - 1); - SetSelection(pItemStart, pItemEnd, FALSE); + SetSelection(pItemStart, pItemEnd, false); } } @@ -418,67 +416,66 @@ IFWL_ListItem* IFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) { return nullptr; } -FX_BOOL IFWL_ListBox::GetItemCheckRect(IFWL_ListItem* pItem, - CFX_RectF& rtCheck) { +bool IFWL_ListBox::GetItemCheckRect(IFWL_ListItem* pItem, CFX_RectF& rtCheck) { if (!m_pProperties->m_pDataProvider) - return FALSE; + return false; if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) { - return FALSE; + return false; } IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); pData->GetItemCheckRect(this, pItem, rtCheck); - return TRUE; + return true; } -FX_BOOL IFWL_ListBox::GetItemChecked(IFWL_ListItem* pItem) { +bool IFWL_ListBox::GetItemChecked(IFWL_ListItem* pItem) { if (!m_pProperties->m_pDataProvider) - return FALSE; + return false; if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) { - return FALSE; + return false; } IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); return !!(pData->GetItemCheckState(this, pItem) & FWL_ITEMSTATE_LTB_Checked); } -FX_BOOL IFWL_ListBox::SetItemChecked(IFWL_ListItem* pItem, FX_BOOL bChecked) { +bool IFWL_ListBox::SetItemChecked(IFWL_ListItem* pItem, bool bChecked) { if (!m_pProperties->m_pDataProvider) - return FALSE; + return false; if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) { - return FALSE; + return false; } IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); pData->SetItemCheckState(this, pItem, bChecked ? FWL_ITEMSTATE_LTB_Checked : 0); - return TRUE; + return true; } -FX_BOOL IFWL_ListBox::ScrollToVisible(IFWL_ListItem* pItem) { +bool IFWL_ListBox::ScrollToVisible(IFWL_ListItem* pItem) { if (!m_pVertScrollBar) - return FALSE; + return false; CFX_RectF rtItem; IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); pData->GetItemRect(this, pItem, rtItem); - FX_BOOL bScroll = FALSE; + bool bScroll = false; FX_FLOAT fPosY = m_pVertScrollBar->GetPos(); rtItem.Offset(0, -fPosY + m_rtConent.top); if (rtItem.top < m_rtConent.top) { fPosY += rtItem.top - m_rtConent.top; - bScroll = TRUE; + bScroll = true; } else if (rtItem.bottom() > m_rtConent.bottom()) { fPosY += rtItem.bottom() - m_rtConent.bottom(); - bScroll = TRUE; + bScroll = true; } if (!bScroll) { - return FALSE; + return false; } m_pVertScrollBar->SetPos(fPosY); m_pVertScrollBar->SetTrackPos(fPosY); Repaint(&m_rtClient); - return TRUE; + return true; } void IFWL_ListBox::DrawBkground(CFX_Graphics* pGraphics, @@ -495,7 +492,7 @@ void IFWL_ListBox::DrawBkground(CFX_Graphics* pGraphics, param.m_pGraphics = pGraphics; param.m_matrix.Concat(*pMatrix); param.m_rtPart = m_rtClient; - if (IsShowScrollBar(FALSE) && IsShowScrollBar(TRUE)) { + if (IsShowScrollBar(false) && IsShowScrollBar(true)) { param.m_pData = &m_rtStatic; } if (!IsEnabled()) { @@ -659,7 +656,7 @@ void IFWL_ListBox::DrawItem(CFX_Graphics* pGraphics, } } -CFX_SizeF IFWL_ListBox::CalcSize(FX_BOOL bAutoSize) { +CFX_SizeF IFWL_ListBox::CalcSize(bool bAutoSize) { CFX_SizeF fs; if (!m_pProperties->m_pThemeProvider) return fs; @@ -722,10 +719,10 @@ CFX_SizeF IFWL_ListBox::CalcSize(FX_BOOL bAutoSize) { } FX_FLOAT iWidth = m_rtClient.width - rtUIMargin.left - rtUIMargin.width; FX_FLOAT iHeight = m_rtClient.height; - FX_BOOL bShowVertScr = + bool bShowVertScr = (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_ShowScrollBarAlaways) && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll); - FX_BOOL bShowHorzScr = + bool bShowHorzScr = (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_ShowScrollBarAlaways) && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_HScroll); if (!bShowVertScr && m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll && @@ -766,17 +763,17 @@ CFX_SizeF IFWL_ListBox::CalcSize(FX_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->SetStates(FWL_WGTSTATE_Invisible, false); } 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, true); } if (bShowHorzScr) { if (!m_pHorzScrollBar) { - InitScrollBar(FALSE); + InitScrollBar(false); } CFX_RectF rtScrollBar; rtScrollBar.Set(m_rtClient.left, m_rtClient.bottom() - m_fScorllBarWidth, @@ -801,13 +798,13 @@ CFX_SizeF IFWL_ListBox::CalcSize(FX_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->SetStates(FWL_WGTSTATE_Invisible, false); } 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, true); } if (bShowVertScr && bShowHorzScr) { m_rtStatic.Set(m_rtClient.right() - m_fScorllBarWidth, @@ -821,7 +818,7 @@ void IFWL_ListBox::GetItemSize(CFX_SizeF& size, IFWL_ListItem* pItem, FX_FLOAT fWidth, FX_FLOAT fItemHeight, - FX_BOOL bAutoSize) { + bool bAutoSize) { if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiColumn) { } else { if (!bAutoSize) { @@ -872,7 +869,7 @@ FX_FLOAT IFWL_ListBox::GetItemHeigt() { return *pfFont + 2 * kItemTextMargin; } -void IFWL_ListBox::InitScrollBar(FX_BOOL bVert) { +void IFWL_ListBox::InitScrollBar(bool bVert) { if ((bVert && m_pVertScrollBar) || (!bVert && m_pHorzScrollBar)) { return; } @@ -885,11 +882,11 @@ void IFWL_ListBox::InitScrollBar(FX_BOOL bVert) { ->reset(new IFWL_ScrollBar(m_pOwnerApp, prop, this)); } -FX_BOOL IFWL_ListBox::IsShowScrollBar(FX_BOOL bVert) { +bool IFWL_ListBox::IsShowScrollBar(bool bVert) { IFWL_ScrollBar* pScrollbar = bVert ? m_pVertScrollBar.get() : m_pHorzScrollBar.get(); if (!pScrollbar || (pScrollbar->GetStates() & FWL_WGTSTATE_Invisible)) { - return FALSE; + return false; } return !(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_ShowScrollBarFocus) || @@ -920,10 +917,10 @@ void IFWL_ListBox::OnProcessMessage(CFWL_Message* pMessage) { CFWL_MessageType dwMsgCode = pMessage->GetClassID(); switch (dwMsgCode) { case CFWL_MessageType::SetFocus: - OnFocusChanged(pMessage, TRUE); + OnFocusChanged(pMessage, true); break; case CFWL_MessageType::KillFocus: - OnFocusChanged(pMessage, FALSE); + OnFocusChanged(pMessage, false); break; case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); @@ -974,7 +971,7 @@ void IFWL_ListBox::OnDrawWidget(CFX_Graphics* pGraphics, DrawWidget(pGraphics, pMatrix); } -void IFWL_ListBox::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { +void IFWL_ListBox::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { if (GetStylesEx() & FWL_STYLEEXT_LTB_ShowScrollBarFocus) { if (m_pVertScrollBar) m_pVertScrollBar->SetStates(FWL_WGTSTATE_Invisible, !bSet); @@ -990,9 +987,9 @@ void IFWL_ListBox::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { } void IFWL_ListBox::OnLButtonDown(CFWL_MsgMouse* pMsg) { - m_bLButtonDown = TRUE; + m_bLButtonDown = true; if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) - SetFocus(TRUE); + SetFocus(true); IFWL_ListItem* pItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); if (!pItem) @@ -1000,26 +997,26 @@ void IFWL_ListBox::OnLButtonDown(CFWL_MsgMouse* pMsg) { if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection) { if (pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl) { - FX_BOOL bSelected = IsItemSelected(pItem); + bool bSelected = IsItemSelected(pItem); SetSelectionDirect(pItem, !bSelected); m_hAnchor = pItem; } else if (pMsg->m_dwFlags & FWL_KEYFLAG_Shift) { if (m_hAnchor) - SetSelection(m_hAnchor, pItem, TRUE); + SetSelection(m_hAnchor, pItem, true); else - SetSelectionDirect(pItem, TRUE); + SetSelectionDirect(pItem, true); } else { - SetSelection(pItem, pItem, TRUE); + SetSelection(pItem, pItem, true); m_hAnchor = pItem; } } else { - SetSelection(pItem, pItem, TRUE); + SetSelection(pItem, pItem, true); } if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check) { IFWL_ListItem* hSelectedItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); CFX_RectF rtCheck; GetItemCheckRect(hSelectedItem, rtCheck); - FX_BOOL bChecked = GetItemChecked(pItem); + bool bChecked = GetItemChecked(pItem); if (rtCheck.Contains(pMsg->m_fx, pMsg->m_fy)) { SetItemChecked(pItem, !bChecked); Update(); @@ -1027,7 +1024,7 @@ void IFWL_ListBox::OnLButtonDown(CFWL_MsgMouse* pMsg) { } SetFocusItem(pItem); ScrollToVisible(pItem); - SetGrab(TRUE); + SetGrab(true); ProcessSelChanged(); Repaint(&m_rtClient); } @@ -1036,13 +1033,13 @@ void IFWL_ListBox::OnLButtonUp(CFWL_MsgMouse* pMsg) { if (!m_bLButtonDown) return; - m_bLButtonDown = FALSE; - SetGrab(FALSE); + m_bLButtonDown = false; + SetGrab(false); DispatchSelChangedEv(); } void IFWL_ListBox::OnMouseWheel(CFWL_MsgMouseWheel* pMsg) { - if (IsShowScrollBar(TRUE)) + if (IsShowScrollBar(true)) m_pVertScrollBar->GetDelegate()->OnProcessMessage(pMsg); } @@ -1068,7 +1065,7 @@ void IFWL_ListBox::OnKeyDown(CFWL_MsgKey* pMsg) { } } -void IFWL_ListBox::OnVK(IFWL_ListItem* pItem, FX_BOOL bShift, FX_BOOL bCtrl) { +void IFWL_ListBox::OnVK(IFWL_ListItem* pItem, bool bShift, bool bCtrl) { if (!pItem) return; @@ -1076,15 +1073,15 @@ void IFWL_ListBox::OnVK(IFWL_ListItem* pItem, FX_BOOL bShift, FX_BOOL bCtrl) { if (bCtrl) { } else if (bShift) { if (m_hAnchor) - SetSelection(m_hAnchor, pItem, TRUE); + SetSelection(m_hAnchor, pItem, true); else - SetSelectionDirect(pItem, TRUE); + SetSelectionDirect(pItem, true); } else { - SetSelection(pItem, pItem, TRUE); + SetSelection(pItem, pItem, true); m_hAnchor = pItem; } } else { - SetSelection(pItem, pItem, TRUE); + SetSelection(pItem, pItem, true); } SetFocusItem(pItem); @@ -1096,9 +1093,9 @@ void IFWL_ListBox::OnVK(IFWL_ListItem* pItem, FX_BOOL bShift, FX_BOOL bCtrl) { Repaint(&rtInvalidate); } -FX_BOOL IFWL_ListBox::OnScroll(IFWL_ScrollBar* pScrollBar, - uint32_t dwCode, - FX_FLOAT fPos) { +bool IFWL_ListBox::OnScroll(IFWL_ScrollBar* pScrollBar, + uint32_t dwCode, + FX_FLOAT fPos) { CFX_SizeF fs; pScrollBar->GetRange(fs.x, fs.y); FX_FLOAT iCurPos = pScrollBar->GetPos(); @@ -1140,14 +1137,14 @@ FX_BOOL IFWL_ListBox::OnScroll(IFWL_ScrollBar* pScrollBar, case FWL_SCBCODE_TrackPos: break; case FWL_SCBCODE_EndScroll: - return FALSE; + return false; } if (iCurPos != fPos) { pScrollBar->SetPos(fPos); pScrollBar->SetTrackPos(fPos); Repaint(&m_rtClient); } - return TRUE; + return true; } void IFWL_ListBox::DispatchSelChangedEv() { diff --git a/xfa/fwl/core/ifwl_listbox.h b/xfa/fwl/core/ifwl_listbox.h index 5d4f896e94..e16778f23e 100644 --- a/xfa/fwl/core/ifwl_listbox.h +++ b/xfa/fwl/core/ifwl_listbox.h @@ -56,9 +56,9 @@ class IFWL_ListBoxDP : public IFWL_DataProvider { virtual IFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) = 0; virtual int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) = 0; - virtual FX_BOOL SetItemIndex(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - int32_t nIndex) = 0; + virtual bool SetItemIndex(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + int32_t nIndex) = 0; virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, IFWL_ListItem* pItem) = 0; virtual FWL_Error GetItemText(IFWL_Widget* pWidget, @@ -108,7 +108,7 @@ class IFWL_ListBox : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; FWL_Error Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, @@ -122,29 +122,27 @@ class IFWL_ListBox : public IFWL_Widget { int32_t CountSelItems(); IFWL_ListItem* GetSelItem(int32_t nIndexSel); int32_t GetSelIndex(int32_t nIndex); - FWL_Error SetSelItem(IFWL_ListItem* hItem, FX_BOOL bSelect = TRUE); + FWL_Error SetSelItem(IFWL_ListItem* hItem, bool bSelect = true); FWL_Error GetItemText(IFWL_ListItem* hItem, CFX_WideString& wsText); - FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); + FWL_Error GetScrollPos(FX_FLOAT& fPos, bool bVert = true); FWL_Error* Sort(IFWL_ListBoxCompare* pCom); protected: friend class CFWL_ListBoxImpDelegate; IFWL_ListItem* GetItem(IFWL_ListItem* hItem, uint32_t dwKeyCode); - void SetSelection(IFWL_ListItem* hStart, - IFWL_ListItem* hEnd, - FX_BOOL bSelected); - void SetSelectionDirect(IFWL_ListItem* hItem, FX_BOOL bSelect); - FX_BOOL IsItemSelected(IFWL_ListItem* hItem); + void SetSelection(IFWL_ListItem* hStart, IFWL_ListItem* hEnd, bool bSelected); + void SetSelectionDirect(IFWL_ListItem* hItem, bool bSelect); + bool IsItemSelected(IFWL_ListItem* hItem); void ClearSelection(); void SelectAll(); IFWL_ListItem* GetFocusedItem(); void SetFocusItem(IFWL_ListItem* hItem); IFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); - FX_BOOL GetItemCheckRect(IFWL_ListItem* hItem, CFX_RectF& rtCheck); - FX_BOOL SetItemChecked(IFWL_ListItem* hItem, FX_BOOL bChecked); - FX_BOOL GetItemChecked(IFWL_ListItem* hItem); - FX_BOOL ScrollToVisible(IFWL_ListItem* hItem); + bool GetItemCheckRect(IFWL_ListItem* hItem, CFX_RectF& rtCheck); + bool SetItemChecked(IFWL_ListItem* hItem, bool bChecked); + bool GetItemChecked(IFWL_ListItem* hItem); + bool ScrollToVisible(IFWL_ListItem* hItem); void DrawBkground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix = nullptr); @@ -158,17 +156,17 @@ class IFWL_ListBox : public IFWL_Widget { const CFX_RectF& rtItem, const CFX_Matrix* pMatrix = nullptr); void DrawStatic(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme); - CFX_SizeF CalcSize(FX_BOOL bAutoSize = FALSE); + CFX_SizeF CalcSize(bool bAutoSize = false); void GetItemSize(CFX_SizeF& size, IFWL_ListItem* hItem, FX_FLOAT fWidth, FX_FLOAT fHeight, - FX_BOOL bAutoSize = FALSE); + bool bAutoSize = false); FX_FLOAT GetMaxTextWidth(); FX_FLOAT GetScrollWidth(); FX_FLOAT GetItemHeigt(); - void InitScrollBar(FX_BOOL bVert = TRUE); - FX_BOOL IsShowScrollBar(FX_BOOL bVert); + void InitScrollBar(bool bVert = true); + bool IsShowScrollBar(bool bVert); void ProcessSelChanged(); CFX_RectF m_rtClient; @@ -181,17 +179,17 @@ class IFWL_ListBox : public IFWL_Widget { IFWL_ListItem* m_hAnchor; FX_FLOAT m_fItemHeight; FX_FLOAT m_fScorllBarWidth; - FX_BOOL m_bLButtonDown; + bool m_bLButtonDown; IFWL_ThemeProvider* m_pScrollBarTP; private: - void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); + void OnFocusChanged(CFWL_Message* pMsg, bool bSet = true); void OnLButtonDown(CFWL_MsgMouse* pMsg); void OnLButtonUp(CFWL_MsgMouse* pMsg); void OnMouseWheel(CFWL_MsgMouseWheel* pMsg); void OnKeyDown(CFWL_MsgKey* pMsg); - void OnVK(IFWL_ListItem* hItem, FX_BOOL bShift, FX_BOOL bCtrl); - FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); + void OnVK(IFWL_ListItem* hItem, bool bShift, bool bCtrl); + bool OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); void DispatchSelChangedEv(); }; diff --git a/xfa/fwl/core/ifwl_monthcalendar.cpp b/xfa/fwl/core/ifwl_monthcalendar.cpp index 4ac0d2b222..4190dbdefd 100644 --- a/xfa/fwl/core/ifwl_monthcalendar.cpp +++ b/xfa/fwl/core/ifwl_monthcalendar.cpp @@ -123,7 +123,7 @@ IFWL_MonthCalendar::IFWL_MonthCalendar( const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : IFWL_Widget(app, properties, pOuter), - m_bInit(FALSE), + m_bInit(false), m_pDateTime(new CFX_DateTime), m_iCurYear(2011), m_iCurMonth(1), @@ -157,12 +157,11 @@ FWL_Type IFWL_MonthCalendar::GetClassID() const { return FWL_Type::MonthCalendar; } -FWL_Error IFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect, - FX_BOOL bAutoSize) { +FWL_Error IFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { - CFX_SizeF fs = CalcSize(TRUE); + CFX_SizeF fs = CalcSize(true); rect.Set(0, 0, fs.x, fs.y); - IFWL_Widget::GetWidgetRect(rect, TRUE); + IFWL_Widget::GetWidgetRect(rect, true); } else { rect = m_pProperties->m_rtWidget; } @@ -223,22 +222,22 @@ int32_t IFWL_MonthCalendar::CountSelect() { return m_arrSelDays.GetSize(); } -FX_BOOL IFWL_MonthCalendar::GetSelect(int32_t& iYear, - int32_t& iMonth, - int32_t& iDay, - int32_t nIndex) { +bool IFWL_MonthCalendar::GetSelect(int32_t& iYear, + int32_t& iMonth, + int32_t& iDay, + int32_t nIndex) { if (nIndex >= m_arrSelDays.GetSize()) { - return FALSE; + return false; } iYear = m_iCurYear; iMonth = m_iCurMonth; iDay = m_arrSelDays[nIndex]; - return TRUE; + return true; } -FX_BOOL IFWL_MonthCalendar::SetSelect(int32_t iYear, - int32_t iMonth, - int32_t iDay) { +bool IFWL_MonthCalendar::SetSelect(int32_t iYear, + int32_t iMonth, + int32_t iDay) { ChangeToMonth(iYear, iMonth); return AddSelDay(iDay); } @@ -566,7 +565,7 @@ void IFWL_MonthCalendar::DrawTodayCircle(CFX_Graphics* pGraphics, pTheme->DrawBackground(¶ms); } -CFX_SizeF IFWL_MonthCalendar::CalcSize(FX_BOOL bAutoSize) { +CFX_SizeF IFWL_MonthCalendar::CalcSize(bool bAutoSize) { if (!m_pProperties->m_pThemeProvider) return CFX_SizeF(); @@ -686,7 +685,7 @@ void IFWL_MonthCalendar::LayOut() { } void IFWL_MonthCalendar::CalDateItem() { - FX_BOOL bNewWeek = FALSE; + bool bNewWeek = false; int32_t iWeekOfMonth = 0; FX_FLOAT fLeft = m_rtDates.left; FX_FLOAT fTop = m_rtDates.top; @@ -695,7 +694,7 @@ void IFWL_MonthCalendar::CalDateItem() { FWL_DATEINFO* pDateInfo = m_arrDates.GetAt(i); if (bNewWeek) { iWeekOfMonth++; - bNewWeek = FALSE; + bNewWeek = false; } pDateInfo->rect.Set( fLeft + pDateInfo->iDayOfWeek * (m_szCell.x + (MONTHCAL_HMARGIN * 2)), @@ -706,7 +705,7 @@ void IFWL_MonthCalendar::CalDateItem() { pDateInfo->rect.Offset(m_fWeekNumWid, 0); } if (pDateInfo->iDayOfWeek >= 6) { - bNewWeek = TRUE; + bNewWeek = true; } } } @@ -781,39 +780,39 @@ int32_t IFWL_MonthCalendar::CalWeekNumber(int32_t iYear, return 0; } -FX_BOOL IFWL_MonthCalendar::GetMinDate(int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) { +bool IFWL_MonthCalendar::GetMinDate(int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) { iYear = m_dtMin.iYear; iMonth = m_dtMin.iMonth; iDay = m_dtMin.iDay; - return TRUE; + return true; } -FX_BOOL IFWL_MonthCalendar::SetMinDate(int32_t iYear, - int32_t iMonth, - int32_t iDay) { +bool IFWL_MonthCalendar::SetMinDate(int32_t iYear, + int32_t iMonth, + int32_t iDay) { m_dtMin = DATE(iYear, iMonth, iDay); - return TRUE; + return true; } -FX_BOOL IFWL_MonthCalendar::GetMaxDate(int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) { +bool IFWL_MonthCalendar::GetMaxDate(int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) { iYear = m_dtMax.iYear; iMonth = m_dtMax.iMonth; iDay = m_dtMax.iDay; - return TRUE; + return true; } -FX_BOOL IFWL_MonthCalendar::SetMaxDate(int32_t iYear, - int32_t iMonth, - int32_t iDay) { +bool IFWL_MonthCalendar::SetMaxDate(int32_t iYear, + int32_t iMonth, + int32_t iDay) { m_dtMax = DATE(iYear, iMonth, iDay); - return TRUE; + return true; } -FX_BOOL IFWL_MonthCalendar::InitDate() { +bool IFWL_MonthCalendar::InitDate() { if (m_pProperties->m_pDataProvider) { IFWL_MonthCalendarDP* pDateProv = static_cast<IFWL_MonthCalendarDP*>(m_pProperties->m_pDataProvider); @@ -833,7 +832,7 @@ FX_BOOL IFWL_MonthCalendar::InitDate() { GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead); m_dtMin = DATE(1500, 12, 1); m_dtMax = DATE(2200, 1, 1); - return TRUE; + return true; } void IFWL_MonthCalendar::ClearDateItem() { @@ -868,7 +867,7 @@ void IFWL_MonthCalendar::ReSetDateItem() { } } -FX_BOOL IFWL_MonthCalendar::NextMonth() { +bool IFWL_MonthCalendar::NextMonth() { int32_t iYear = m_iCurYear, iMonth = m_iCurMonth; if (iMonth >= 12) { iMonth = 1; @@ -878,14 +877,14 @@ FX_BOOL IFWL_MonthCalendar::NextMonth() { } DATE dt(m_iCurYear, m_iCurMonth, 1); if (!(dt < m_dtMax)) { - return FALSE; + return false; } m_iCurYear = iYear, m_iCurMonth = iMonth; ChangeToMonth(m_iCurYear, m_iCurMonth); - return TRUE; + return true; } -FX_BOOL IFWL_MonthCalendar::PrevMonth() { +bool IFWL_MonthCalendar::PrevMonth() { int32_t iYear = m_iCurYear, iMonth = m_iCurMonth; if (iMonth <= 1) { iMonth = 12; @@ -895,11 +894,11 @@ FX_BOOL IFWL_MonthCalendar::PrevMonth() { } DATE dt(m_iCurYear, m_iCurMonth, 1); if (!(dt > m_dtMin)) { - return FALSE; + return false; } m_iCurYear = iYear, m_iCurMonth = iMonth; ChangeToMonth(m_iCurYear, m_iCurMonth); - return TRUE; + return true; } void IFWL_MonthCalendar::ChangeToMonth(int32_t iYear, int32_t iMonth) { @@ -912,9 +911,9 @@ void IFWL_MonthCalendar::ChangeToMonth(int32_t iYear, int32_t iMonth) { GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead); } -FX_BOOL IFWL_MonthCalendar::RemoveSelDay(int32_t iDay, FX_BOOL bAll) { +bool IFWL_MonthCalendar::RemoveSelDay(int32_t iDay, bool bAll) { if (iDay == -1 && !bAll) { - return FALSE; + return false; } if (bAll) { int32_t iCount = m_arrSelDays.GetSize(); @@ -930,7 +929,7 @@ FX_BOOL IFWL_MonthCalendar::RemoveSelDay(int32_t iDay, FX_BOOL bAll) { } else { int32_t index = m_arrSelDays.Find(iDay); if (index == -1) { - return FALSE; + return false; } int32_t iSelDay = m_arrSelDays.GetAt(iDay); int32_t iDatesCount = m_arrDates.GetSize(); @@ -940,15 +939,15 @@ FX_BOOL IFWL_MonthCalendar::RemoveSelDay(int32_t iDay, FX_BOOL bAll) { } m_arrSelDays.RemoveAt(index); } - return TRUE; + return true; } -FX_BOOL IFWL_MonthCalendar::AddSelDay(int32_t iDay) { +bool IFWL_MonthCalendar::AddSelDay(int32_t iDay) { ASSERT(iDay > 0); if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) { } else { if (m_arrSelDays.Find(iDay) == -1) { - RemoveSelDay(-1, TRUE); + RemoveSelDay(-1, true); if (iDay <= m_arrDates.GetSize()) { FWL_DATEINFO* pDateInfo = m_arrDates.GetAt(iDay - 1); pDateInfo->dwStates |= FWL_ITEMSTATE_MCD_Selected; @@ -956,10 +955,10 @@ FX_BOOL IFWL_MonthCalendar::AddSelDay(int32_t iDay) { m_arrSelDays.Add(iDay); } } - return TRUE; + return true; } -FX_BOOL IFWL_MonthCalendar::JumpToToday() { +bool IFWL_MonthCalendar::JumpToToday() { if (m_iYear != m_iCurYear || m_iMonth != m_iCurMonth) { m_iCurYear = m_iYear; m_iCurMonth = m_iMonth; @@ -970,7 +969,7 @@ FX_BOOL IFWL_MonthCalendar::JumpToToday() { AddSelDay(m_iDay); } } - return TRUE; + return true; } void IFWL_MonthCalendar::GetHeadText(int32_t iYear, @@ -1002,15 +1001,15 @@ int32_t IFWL_MonthCalendar::GetDayAtPoint(FX_FLOAT x, FX_FLOAT y) { return -1; } -FX_BOOL IFWL_MonthCalendar::GetDayRect(int32_t iDay, CFX_RectF& rtDay) { +bool IFWL_MonthCalendar::GetDayRect(int32_t iDay, CFX_RectF& rtDay) { if (iDay <= 0 || iDay > m_arrDates.GetSize()) { - return FALSE; + return false; } FWL_DATEINFO* pDateInfo = m_arrDates[iDay - 1]; if (!pDateInfo) - return FALSE; + return false; rtDay = pDateInfo->rect; - return TRUE; + return true; } void IFWL_MonthCalendar::OnProcessMessage(CFWL_Message* pMessage) { @@ -1020,10 +1019,10 @@ void IFWL_MonthCalendar::OnProcessMessage(CFWL_Message* pMessage) { CFWL_MessageType dwMsgCode = pMessage->GetClassID(); switch (dwMsgCode) { case CFWL_MessageType::SetFocus: - OnFocusChanged(pMessage, TRUE); + OnFocusChanged(pMessage, true); break; case CFWL_MessageType::KillFocus: - OnFocusChanged(pMessage, FALSE); + OnFocusChanged(pMessage, false); break; case CFWL_MessageType::Key: break; @@ -1058,7 +1057,7 @@ void IFWL_MonthCalendar::OnDrawWidget(CFX_Graphics* pGraphics, DrawWidget(pGraphics, pMatrix); } -void IFWL_MonthCalendar::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { +void IFWL_MonthCalendar::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { if (bSet) m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; else @@ -1089,7 +1088,7 @@ void IFWL_MonthCalendar::OnLButtonDown(CFWL_MsgMouse* pMsg) { iOldSel = m_arrSelDays[0]; int32_t iCurSel = GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); - FX_BOOL bSelChanged = iCurSel > 0 && iCurSel != iOldSel; + bool bSelChanged = iCurSel > 0 && iCurSel != iOldSel; if (bSelChanged) { FWL_DATEINFO* lpDatesInfo = m_arrDates.GetAt(iCurSel - 1); CFX_RectF rtInvalidate(lpDatesInfo->rect); @@ -1132,7 +1131,7 @@ void IFWL_MonthCalendar::OnMouseMove(CFWL_MsgMouse* pMsg) { if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) return; - FX_BOOL bRepaint = FALSE; + bool bRepaint = false; CFX_RectF rtInvalidate; rtInvalidate.Set(0, 0, 0, 0); if (m_rtDates.Contains(pMsg->m_fx, pMsg->m_fy)) { diff --git a/xfa/fwl/core/ifwl_monthcalendar.h b/xfa/fwl/core/ifwl_monthcalendar.h index dfde3944a1..1017c8653e 100644 --- a/xfa/fwl/core/ifwl_monthcalendar.h +++ b/xfa/fwl/core/ifwl_monthcalendar.h @@ -58,7 +58,7 @@ class IFWL_MonthCalendar : public IFWL_Widget { // FWL_WidgetImp FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; FWL_Error Update() override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr) override; @@ -67,40 +67,40 @@ class IFWL_MonthCalendar : public IFWL_Widget { const CFX_Matrix* pMatrix) override; int32_t CountSelect(); - FX_BOOL GetSelect(int32_t& iYear, - int32_t& iMonth, - int32_t& iDay, - int32_t nIndex = 0); - FX_BOOL SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay); + bool GetSelect(int32_t& iYear, + int32_t& iMonth, + int32_t& iDay, + int32_t nIndex = 0); + bool SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay); protected: struct DATE { DATE() : iYear(0), iMonth(0), iDay(0) {} DATE(int32_t year, int32_t month, int32_t day) : iYear(year), iMonth(month), iDay(day) {} - FX_BOOL operator<(const DATE& right) { + bool operator<(const DATE& right) { if (iYear < right.iYear) { - return TRUE; + return true; } else if (iYear == right.iYear) { if (iMonth < right.iMonth) { - return TRUE; + return true; } else if (iMonth == right.iMonth) { return iDay < right.iDay; } } - return FALSE; + return false; } - FX_BOOL operator>(const DATE& right) { + bool operator>(const DATE& right) { if (iYear > right.iYear) { - return TRUE; + return true; } else if (iYear == right.iYear) { if (iMonth > right.iMonth) { - return TRUE; + return true; } else if (iMonth == right.iMonth) { return iDay > right.iDay; } } - return FALSE; + return false; } int32_t iYear; int32_t iMonth; @@ -152,35 +152,35 @@ class IFWL_MonthCalendar : public IFWL_Widget { void DrawTodayCircle(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix); - CFX_SizeF CalcSize(FX_BOOL bAutoSize = FALSE); + CFX_SizeF CalcSize(bool bAutoSize = false); void LayOut(); void CalcHeadSize(); void CalcTodaySize(); void CalDateItem(); void GetCapValue(); int32_t CalWeekNumber(int32_t iYear, int32_t iMonth, int32_t iDay); - FX_BOOL GetMinDate(int32_t& iYear, int32_t& iMonth, int32_t& iDay); - FX_BOOL SetMinDate(int32_t iYear, int32_t iMonth, int32_t iDay); - FX_BOOL GetMaxDate(int32_t& iYear, int32_t& iMonth, int32_t& iDay); - FX_BOOL SetMaxDate(int32_t iYear, int32_t iMonth, int32_t iDay); - FX_BOOL InitDate(); + bool GetMinDate(int32_t& iYear, int32_t& iMonth, int32_t& iDay); + bool SetMinDate(int32_t iYear, int32_t iMonth, int32_t iDay); + bool GetMaxDate(int32_t& iYear, int32_t& iMonth, int32_t& iDay); + bool SetMaxDate(int32_t iYear, int32_t iMonth, int32_t iDay); + bool InitDate(); void ClearDateItem(); void ReSetDateItem(); - FX_BOOL NextMonth(); - FX_BOOL PrevMonth(); + bool NextMonth(); + bool PrevMonth(); void ChangeToMonth(int32_t iYear, int32_t iMonth); - FX_BOOL RemoveSelDay(int32_t iDay, FX_BOOL bAll = FALSE); - FX_BOOL AddSelDay(int32_t iDay); - FX_BOOL JumpToToday(); + bool RemoveSelDay(int32_t iDay, bool bAll = false); + bool AddSelDay(int32_t iDay); + bool JumpToToday(); void GetHeadText(int32_t iYear, int32_t iMonth, CFX_WideString& wsHead); void GetTodayText(int32_t iYear, int32_t iMonth, int32_t iDay, CFX_WideString& wsToday); int32_t GetDayAtPoint(FX_FLOAT x, FX_FLOAT y); - FX_BOOL GetDayRect(int32_t iDay, CFX_RectF& rtDay); + bool GetDayRect(int32_t iDay, CFX_RectF& rtDay); - FX_BOOL m_bInit; + bool m_bInit; CFX_RectF m_rtHead; CFX_RectF m_rtWeek; CFX_RectF m_rtLBtn; @@ -241,7 +241,7 @@ class IFWL_MonthCalendar : public IFWL_Widget { FX_FLOAT m_fMCHei; private: - void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet); + void OnFocusChanged(CFWL_Message* pMsg, bool bSet); void OnLButtonDown(CFWL_MsgMouse* pMsg); void OnLButtonUp(CFWL_MsgMouse* pMsg); void OnMouseMove(CFWL_MsgMouse* pMsg); diff --git a/xfa/fwl/core/ifwl_picturebox.cpp b/xfa/fwl/core/ifwl_picturebox.cpp index 6ab792c985..d820573f30 100644 --- a/xfa/fwl/core/ifwl_picturebox.cpp +++ b/xfa/fwl/core/ifwl_picturebox.cpp @@ -13,9 +13,9 @@ IFWL_PictureBox::IFWL_PictureBox(const IFWL_App* app, const CFWL_WidgetImpProperties& properties) : IFWL_Widget(app, properties, nullptr), - m_bTop(FALSE), - m_bVCenter(FALSE), - m_bButton(FALSE) { + m_bTop(false), + m_bVCenter(false), + m_bButton(false) { m_rtClient.Reset(); m_rtImage.Reset(); m_matrix.SetIdentity(); @@ -27,7 +27,7 @@ FWL_Type IFWL_PictureBox::GetClassID() const { return FWL_Type::PictureBox; } -FWL_Error IFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error IFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pDataProvider) @@ -39,7 +39,7 @@ FWL_Error IFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { rect.Set(0, 0, (FX_FLOAT)pBitmap->GetWidth(), (FX_FLOAT)pBitmap->GetHeight()); } - IFWL_Widget::GetWidgetRect(rect, TRUE); + IFWL_Widget::GetWidgetRect(rect, true); } else { rect = m_pProperties->m_rtWidget; } @@ -105,13 +105,13 @@ void IFWL_PictureBox::DrawBkground(CFX_Graphics* pGraphics, bool IFWL_PictureBox::VStyle(uint32_t dwStyle) { switch (dwStyle & FWL_STYLEEXT_PTB_VAlignMask) { case FWL_STYLEEXT_PTB_Top: - m_bTop = TRUE; + m_bTop = true; return true; case FWL_STYLEEXT_PTB_Vcenter: - m_bVCenter = TRUE; + m_bVCenter = true; return true; case FWL_STYLEEXT_PTB_Bottom: - m_bButton = TRUE; + m_bButton = true; return true; } return false; diff --git a/xfa/fwl/core/ifwl_picturebox.h b/xfa/fwl/core/ifwl_picturebox.h index 05f094b25c..edd8e7efa5 100644 --- a/xfa/fwl/core/ifwl_picturebox.h +++ b/xfa/fwl/core/ifwl_picturebox.h @@ -49,7 +49,7 @@ class IFWL_PictureBox : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; FWL_Error Update() override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr) override; @@ -65,9 +65,9 @@ class IFWL_PictureBox : public IFWL_Widget { CFX_RectF m_rtClient; CFX_RectF m_rtImage; CFX_Matrix m_matrix; - FX_BOOL m_bTop; - FX_BOOL m_bVCenter; - FX_BOOL m_bButton; + bool m_bTop; + bool m_bVCenter; + bool m_bButton; }; #endif // XFA_FWL_CORE_IFWL_PICTUREBOX_H_ diff --git a/xfa/fwl/core/ifwl_pushbutton.cpp b/xfa/fwl/core/ifwl_pushbutton.cpp index 8eab8d6eb7..f9f996ac2d 100644 --- a/xfa/fwl/core/ifwl_pushbutton.cpp +++ b/xfa/fwl/core/ifwl_pushbutton.cpp @@ -18,7 +18,7 @@ IFWL_PushButton::IFWL_PushButton(const IFWL_App* app, const CFWL_WidgetImpProperties& properties) : IFWL_Widget(app, properties, nullptr), - m_bBtnDown(FALSE), + m_bBtnDown(false), m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), m_iTTOAlign(FDE_TTOALIGNMENT_Center) { m_rtClient.Set(0, 0, 0, 0); @@ -31,7 +31,7 @@ FWL_Type IFWL_PushButton::GetClassID() const { return FWL_Type::PushButton; } -FWL_Error IFWL_PushButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error IFWL_PushButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pThemeProvider) { @@ -51,14 +51,14 @@ FWL_Error IFWL_PushButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { FX_FLOAT* fcaption = static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::Margin)); rect.Inflate(*fcaption, *fcaption); - IFWL_Widget::GetWidgetRect(rect, TRUE); + IFWL_Widget::GetWidgetRect(rect, true); } else { rect = m_pProperties->m_rtWidget; } return FWL_Error::Succeeded; } -void IFWL_PushButton::SetStates(uint32_t dwStates, FX_BOOL bSet) { +void IFWL_PushButton::SetStates(uint32_t dwStates, bool bSet) { if ((dwStates & FWL_WGTSTATE_Disabled) && bSet) { m_pProperties->m_dwStates = FWL_WGTSTATE_Disabled; return; @@ -388,10 +388,10 @@ void IFWL_PushButton::OnProcessMessage(CFWL_Message* pMessage) { CFWL_MessageType dwMsgCode = pMessage->GetClassID(); switch (dwMsgCode) { case CFWL_MessageType::SetFocus: - OnFocusChanged(pMessage, TRUE); + OnFocusChanged(pMessage, true); break; case CFWL_MessageType::KillFocus: - OnFocusChanged(pMessage, FALSE); + OnFocusChanged(pMessage, false); break; case CFWL_MessageType::Mouse: { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); @@ -430,7 +430,7 @@ void IFWL_PushButton::OnDrawWidget(CFX_Graphics* pGraphics, DrawWidget(pGraphics, pMatrix); } -void IFWL_PushButton::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { +void IFWL_PushButton::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { if (bSet) m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; else @@ -441,16 +441,16 @@ void IFWL_PushButton::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { void IFWL_PushButton::OnLButtonDown(CFWL_MsgMouse* pMsg) { if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) - SetFocus(TRUE); + SetFocus(true); - m_bBtnDown = TRUE; + m_bBtnDown = true; m_pProperties->m_dwStates |= FWL_STATE_PSB_Hovered; m_pProperties->m_dwStates |= FWL_STATE_PSB_Pressed; Repaint(&m_rtClient); } void IFWL_PushButton::OnLButtonUp(CFWL_MsgMouse* pMsg) { - m_bBtnDown = FALSE; + m_bBtnDown = false; if (m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) { m_pProperties->m_dwStates &= ~FWL_STATE_PSB_Pressed; m_pProperties->m_dwStates |= FWL_STATE_PSB_Hovered; @@ -467,25 +467,25 @@ void IFWL_PushButton::OnLButtonUp(CFWL_MsgMouse* pMsg) { } void IFWL_PushButton::OnMouseMove(CFWL_MsgMouse* pMsg) { - FX_BOOL bRepaint = FALSE; + bool bRepaint = false; if (m_bBtnDown) { if (m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) { if ((m_pProperties->m_dwStates & FWL_STATE_PSB_Pressed) == 0) { m_pProperties->m_dwStates |= FWL_STATE_PSB_Pressed; - bRepaint = TRUE; + bRepaint = true; } if (m_pProperties->m_dwStates & FWL_STATE_PSB_Hovered) { m_pProperties->m_dwStates &= ~FWL_STATE_PSB_Hovered; - bRepaint = TRUE; + bRepaint = true; } } else { if (m_pProperties->m_dwStates & FWL_STATE_PSB_Pressed) { m_pProperties->m_dwStates &= ~FWL_STATE_PSB_Pressed; - bRepaint = TRUE; + bRepaint = true; } if ((m_pProperties->m_dwStates & FWL_STATE_PSB_Hovered) == 0) { m_pProperties->m_dwStates |= FWL_STATE_PSB_Hovered; - bRepaint = TRUE; + bRepaint = true; } } } else { @@ -493,7 +493,7 @@ void IFWL_PushButton::OnMouseMove(CFWL_MsgMouse* pMsg) { return; if ((m_pProperties->m_dwStates & FWL_STATE_PSB_Hovered) == 0) { m_pProperties->m_dwStates |= FWL_STATE_PSB_Hovered; - bRepaint = TRUE; + bRepaint = true; } } if (bRepaint) @@ -501,7 +501,7 @@ void IFWL_PushButton::OnMouseMove(CFWL_MsgMouse* pMsg) { } void IFWL_PushButton::OnMouseLeave(CFWL_MsgMouse* pMsg) { - m_bBtnDown = FALSE; + m_bBtnDown = false; m_pProperties->m_dwStates &= ~FWL_STATE_PSB_Hovered; m_pProperties->m_dwStates &= ~FWL_STATE_PSB_Pressed; Repaint(&m_rtClient); diff --git a/xfa/fwl/core/ifwl_pushbutton.h b/xfa/fwl/core/ifwl_pushbutton.h index 18b15ab846..422e597e06 100644 --- a/xfa/fwl/core/ifwl_pushbutton.h +++ b/xfa/fwl/core/ifwl_pushbutton.h @@ -45,8 +45,8 @@ class IFWL_PushButton : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; - void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; + FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; + void SetStates(uint32_t dwStates, bool bSet = true) override; FWL_Error Update() override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr) override; @@ -66,12 +66,12 @@ class IFWL_PushButton : public IFWL_Widget { CFX_RectF m_rtClient; CFX_RectF m_rtCaption; - FX_BOOL m_bBtnDown; + bool m_bBtnDown; uint32_t m_dwTTOStyles; int32_t m_iTTOAlign; private: - void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet); + void OnFocusChanged(CFWL_Message* pMsg, bool bSet); void OnLButtonDown(CFWL_MsgMouse* pMsg); void OnLButtonUp(CFWL_MsgMouse* pMsg); void OnMouseMove(CFWL_MsgMouse* pMsg); diff --git a/xfa/fwl/core/ifwl_scrollbar.cpp b/xfa/fwl/core/ifwl_scrollbar.cpp index 24f6b367a5..9369bd8ada 100644 --- a/xfa/fwl/core/ifwl_scrollbar.cpp +++ b/xfa/fwl/core/ifwl_scrollbar.cpp @@ -37,12 +37,12 @@ IFWL_ScrollBar::IFWL_ScrollBar(const IFWL_App* app, m_cpTrackPointX(0), m_cpTrackPointY(0), m_iMouseWheel(0), - m_bTrackMouseLeave(FALSE), - m_bMouseHover(FALSE), - m_bMouseDown(FALSE), - m_bRepaintThumb(FALSE), + m_bTrackMouseLeave(false), + m_bMouseHover(false), + m_bMouseDown(false), + m_bRepaintThumb(false), m_fButtonLen(0), - m_bMinSize(FALSE), + m_bMinSize(false), m_bCustomLayout(false), m_fMinThumb(FWL_SCROLLBAR_MinThumb), m_Timer(this) { @@ -60,7 +60,7 @@ FWL_Type IFWL_ScrollBar::GetClassID() const { return FWL_Type::ScrollBar; } -FWL_Error IFWL_ScrollBar::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error IFWL_ScrollBar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); FX_FLOAT* pfMinWidth = static_cast<FX_FLOAT*>( @@ -72,7 +72,7 @@ FWL_Error IFWL_ScrollBar::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect.Set(0, 0, (*pfMinWidth) * 3, (*pfMinWidth)); } - IFWL_Widget::GetWidgetRect(rect, TRUE); + IFWL_Widget::GetWidgetRect(rect, true); } else { rect = m_pProperties->m_rtWidget; } @@ -103,15 +103,15 @@ FWL_Error IFWL_ScrollBar::DrawWidget(CFX_Graphics* pGraphics, if (HasEdge()) { DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } - DrawTrack(pGraphics, pTheme, TRUE, pMatrix); - DrawTrack(pGraphics, pTheme, FALSE, pMatrix); - DrawArrowBtn(pGraphics, pTheme, TRUE, pMatrix); - DrawArrowBtn(pGraphics, pTheme, FALSE, pMatrix); + DrawTrack(pGraphics, pTheme, true, pMatrix); + DrawTrack(pGraphics, pTheme, false, pMatrix); + DrawArrowBtn(pGraphics, pTheme, true, pMatrix); + DrawArrowBtn(pGraphics, pTheme, false, pMatrix); DrawThumb(pGraphics, pTheme, pMatrix); return FWL_Error::Succeeded; } -inline FX_BOOL IFWL_ScrollBar::IsVertical() { +inline bool IFWL_ScrollBar::IsVertical() { return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_SCB_Vert; } @@ -166,7 +166,7 @@ FWL_Error IFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { return FWL_Error::Succeeded; } -FX_BOOL IFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) { +bool IFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) { switch (dwCode) { case FWL_SCBCODE_Min: case FWL_SCBCODE_Max: @@ -180,7 +180,7 @@ FX_BOOL IFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) { case FWL_SCBCODE_TrackPos: case FWL_SCBCODE_EndScroll: break; - default: { return FALSE; } + default: { return false; } } return OnScroll(dwCode, fPos); } @@ -192,7 +192,7 @@ FWL_Error IFWL_ScrollBar::SetOuter(IFWL_Widget* pOuter) { void IFWL_ScrollBar::DrawTrack(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, - FX_BOOL bLower, + bool bLower, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground param; param.m_pWidget = this; @@ -208,7 +208,7 @@ void IFWL_ScrollBar::DrawTrack(CFX_Graphics* pGraphics, void IFWL_ScrollBar::DrawArrowBtn(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, - FX_BOOL bMinBtn, + bool bMinBtn, const CFX_Matrix* pMatrix) { CFWL_ThemeBackground param; param.m_pWidget = this; @@ -260,9 +260,9 @@ void IFWL_ScrollBar::CalcButtonLen() { FX_FLOAT fLength = IsVertical() ? m_rtClient.height : m_rtClient.width; if (fLength < m_fButtonLen * 2) { m_fButtonLen = fLength / 2; - m_bMinSize = TRUE; + m_bMinSize = true; } else { - m_bMinSize = FALSE; + m_bMinSize = false; } } @@ -394,7 +394,7 @@ void IFWL_ScrollBar::CalcMinTrackRect(CFX_RectF& rect) { FX_FLOAT iy = (m_rtThumb.top + fBottom) / 2; rect.left = m_rtClient.left; rect.top = m_rtClient.top; - FX_BOOL bVertical = IsVertical(); + bool bVertical = IsVertical(); rect.width = bVertical ? m_rtClient.width : ix; rect.height = bVertical ? iy : m_rtClient.height; if (m_bCustomLayout) { @@ -423,7 +423,7 @@ void IFWL_ScrollBar::CalcMaxTrackRect(CFX_RectF& rect) { } FX_FLOAT ix = (m_rtThumb.left + m_rtThumb.right()) / 2; FX_FLOAT iy = (m_rtThumb.top + m_rtThumb.bottom()) / 2; - FX_BOOL bVertical = IsVertical(); + bool bVertical = IsVertical(); rect.left = bVertical ? m_rtClient.left : ix; rect.top = bVertical ? iy : m_rtClient.top; rect.width = bVertical ? m_rtClient.width : m_rtClient.right() - ix; @@ -493,14 +493,14 @@ FX_FLOAT IFWL_ScrollBar::GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy) { return fPos; } -void IFWL_ScrollBar::GetTrackRect(CFX_RectF& rect, FX_BOOL bLower) { +void IFWL_ScrollBar::GetTrackRect(CFX_RectF& rect, bool bLower) { bool bDisabled = !!(m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled); if (bDisabled || m_bCustomLayout) { rect = bLower ? m_rtMinTrack : m_rtMaxTrack; } else { FX_FLOAT fW = m_rtThumb.width / 2; FX_FLOAT fH = m_rtThumb.height / 2; - FX_BOOL bVert = IsVertical(); + bool bVert = IsVertical(); if (bLower) { if (bVert) { FX_FLOAT fMinTrackHeight = m_rtMinTrack.height - fH - m_rtMinBtn.height; @@ -531,14 +531,14 @@ void IFWL_ScrollBar::GetTrackRect(CFX_RectF& rect, FX_BOOL bLower) { } } -FX_BOOL IFWL_ScrollBar::SendEvent() { +bool IFWL_ScrollBar::SendEvent() { if (m_iMinButtonState == CFWL_PartState_Pressed) { DoScroll(FWL_SCBCODE_StepBackward, m_fTrackPos); - return FALSE; + return false; } if (m_iMaxButtonState == CFWL_PartState_Pressed) { DoScroll(FWL_SCBCODE_StepForward, m_fTrackPos); - return FALSE; + return false; } if (m_iMinTrackState == CFWL_PartState_Pressed) { DoScroll(FWL_SCBCODE_PageBackward, m_fTrackPos); @@ -553,11 +553,11 @@ FX_BOOL IFWL_ScrollBar::SendEvent() { m_iMouseWheel < 0 ? FWL_SCBCODE_StepForward : FWL_SCBCODE_StepBackward; DoScroll(dwCode, m_fTrackPos); } - return TRUE; + return true; } -FX_BOOL IFWL_ScrollBar::OnScroll(uint32_t dwCode, FX_FLOAT fPos) { - FX_BOOL bRet = TRUE; +bool IFWL_ScrollBar::OnScroll(uint32_t dwCode, FX_FLOAT fPos) { + bool bRet = true; CFWL_EvtScroll ev; ev.m_iScrollCode = dwCode; ev.m_pSrcTarget = this; @@ -606,8 +606,8 @@ void IFWL_ScrollBar::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { if (!IsEnabled()) return; - m_bMouseDown = TRUE; - SetGrab(TRUE); + m_bMouseDown = true; + SetGrab(true); m_cpTrackPointX = fx; m_cpTrackPointY = fy; m_fLastTrackPos = m_fTrackPos; @@ -628,13 +628,13 @@ void IFWL_ScrollBar::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { void IFWL_ScrollBar::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { m_pTimerInfo->StopTimer(); - m_bMouseDown = FALSE; + m_bMouseDown = false; DoMouseUp(0, m_rtMinBtn, m_iMinButtonState, fx, fy); DoMouseUp(1, m_rtThumb, m_iThumbButtonState, fx, fy); DoMouseUp(2, m_rtMaxBtn, m_iMaxButtonState, fx, fy); DoMouseUp(3, m_rtMinTrack, m_iMinTrackState, fx, fy); DoMouseUp(4, m_rtMaxTrack, m_iMaxTrackState, fx, fy); - SetGrab(FALSE); + SetGrab(false); } void IFWL_ScrollBar::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { diff --git a/xfa/fwl/core/ifwl_scrollbar.h b/xfa/fwl/core/ifwl_scrollbar.h index 1c107638ec..5c41fdd2a1 100644 --- a/xfa/fwl/core/ifwl_scrollbar.h +++ b/xfa/fwl/core/ifwl_scrollbar.h @@ -44,7 +44,7 @@ class IFWL_ScrollBar : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; FWL_Error Update() override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr) override; @@ -52,7 +52,7 @@ class IFWL_ScrollBar : public IFWL_Widget { void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; - FX_BOOL IsVertical(); + bool IsVertical(); FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); FX_FLOAT GetPageSize(); @@ -63,7 +63,7 @@ class IFWL_ScrollBar : public IFWL_Widget { FWL_Error SetPos(FX_FLOAT fPos); FX_FLOAT GetTrackPos(); FWL_Error SetTrackPos(FX_FLOAT fTrackPos); - FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); + bool DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); FWL_Error SetOuter(IFWL_Widget* pOuter); protected: @@ -79,11 +79,11 @@ class IFWL_ScrollBar : public IFWL_Widget { IFWL_ScrollBar(); void DrawTrack(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, - FX_BOOL bLower = TRUE, + bool bLower = true, const CFX_Matrix* pMatrix = nullptr); void DrawArrowBtn(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, - FX_BOOL bMinBtn = TRUE, + bool bMinBtn = true, const CFX_Matrix* pMatrix = nullptr); void DrawThumb(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, @@ -96,9 +96,9 @@ class IFWL_ScrollBar : public IFWL_Widget { void CalcMinTrackRect(CFX_RectF& rect); void CalcMaxTrackRect(CFX_RectF& rect); FX_FLOAT GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy); - void GetTrackRect(CFX_RectF& rect, FX_BOOL bLower = TRUE); - FX_BOOL SendEvent(); - FX_BOOL OnScroll(uint32_t dwCode, FX_FLOAT fPos); + void GetTrackRect(CFX_RectF& rect, bool bLower = true); + bool SendEvent(); + bool OnScroll(uint32_t dwCode, FX_FLOAT fPos); IFWL_TimerInfo* m_pTimerInfo; FX_FLOAT m_fRangeMin; @@ -116,12 +116,12 @@ class IFWL_ScrollBar : public IFWL_Widget { FX_FLOAT m_cpTrackPointX; FX_FLOAT m_cpTrackPointY; int32_t m_iMouseWheel; - FX_BOOL m_bTrackMouseLeave; - FX_BOOL m_bMouseHover; - FX_BOOL m_bMouseDown; - FX_BOOL m_bRepaintThumb; + bool m_bTrackMouseLeave; + bool m_bMouseHover; + bool m_bMouseDown; + bool m_bRepaintThumb; FX_FLOAT m_fButtonLen; - FX_BOOL m_bMinSize; + bool m_bMinSize; CFX_RectF m_rtClient; CFX_RectF m_rtThumb; CFX_RectF m_rtMinBtn; diff --git a/xfa/fwl/core/ifwl_spinbutton.cpp b/xfa/fwl/core/ifwl_spinbutton.cpp index 1ad5f0a969..16032345da 100644 --- a/xfa/fwl/core/ifwl_spinbutton.cpp +++ b/xfa/fwl/core/ifwl_spinbutton.cpp @@ -30,7 +30,7 @@ IFWL_SpinButton::IFWL_SpinButton(const IFWL_App* app, m_dwUpState(CFWL_PartState_Normal), m_dwDnState(CFWL_PartState_Normal), m_iButtonIndex(0), - m_bLButtonDwn(FALSE), + m_bLButtonDwn(false), m_pTimerInfo(nullptr), m_Timer(this) { m_rtClient.Reset(); @@ -45,10 +45,10 @@ FWL_Type IFWL_SpinButton::GetClassID() const { return FWL_Type::SpinButton; } -FWL_Error IFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error IFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, kMinWidth, kMinHeight); - IFWL_Widget::GetWidgetRect(rect, TRUE); + IFWL_Widget::GetWidgetRect(rect, true); } else { rect = m_pProperties->m_rtWidget; } @@ -112,7 +112,7 @@ FWL_Error IFWL_SpinButton::DrawWidget(CFX_Graphics* pGraphics, return FWL_Error::Succeeded; } -FWL_Error IFWL_SpinButton::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { +FWL_Error IFWL_SpinButton::EnableButton(bool bEnable, bool bUp) { if (bUp) m_dwUpState = bEnable ? CFWL_PartState_Normal : CFWL_PartState_Disabled; else @@ -121,7 +121,7 @@ FWL_Error IFWL_SpinButton::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { return FWL_Error::Succeeded; } -FX_BOOL IFWL_SpinButton::IsButtonEnable(FX_BOOL bUp) { +bool IFWL_SpinButton::IsButtonEnable(bool bUp) { if (bUp) return (m_dwUpState != CFWL_PartState_Disabled); return (m_dwDnState != CFWL_PartState_Disabled); @@ -164,11 +164,11 @@ void IFWL_SpinButton::OnProcessMessage(CFWL_Message* pMessage) { CFWL_MessageType dwMsgCode = pMessage->GetClassID(); switch (dwMsgCode) { case CFWL_MessageType::SetFocus: { - OnFocusChanged(pMessage, TRUE); + OnFocusChanged(pMessage, true); break; } case CFWL_MessageType::KillFocus: { - OnFocusChanged(pMessage, FALSE); + OnFocusChanged(pMessage, false); break; } case CFWL_MessageType::Mouse: { @@ -208,7 +208,7 @@ void IFWL_SpinButton::OnDrawWidget(CFX_Graphics* pGraphics, DrawWidget(pGraphics, pMatrix); } -void IFWL_SpinButton::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { +void IFWL_SpinButton::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { if (bSet) m_pProperties->m_dwStates |= (FWL_WGTSTATE_Focused); else @@ -218,16 +218,16 @@ void IFWL_SpinButton::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { } void IFWL_SpinButton::OnLButtonDown(CFWL_MsgMouse* pMsg) { - m_bLButtonDwn = TRUE; - SetGrab(TRUE); - SetFocus(TRUE); + m_bLButtonDwn = true; + SetGrab(true); + SetFocus(true); if (!m_pProperties->m_pDataProvider) return; - FX_BOOL bUpPress = - (m_rtUpButton.Contains(pMsg->m_fx, pMsg->m_fy) && IsButtonEnable(TRUE)); - FX_BOOL bDnPress = - (m_rtDnButton.Contains(pMsg->m_fx, pMsg->m_fy) && IsButtonEnable(FALSE)); + bool bUpPress = + (m_rtUpButton.Contains(pMsg->m_fx, pMsg->m_fy) && IsButtonEnable(true)); + bool bDnPress = + (m_rtDnButton.Contains(pMsg->m_fx, pMsg->m_fy) && IsButtonEnable(false)); if (!bUpPress && !bDnPress) return; if (bUpPress) { @@ -250,22 +250,22 @@ void IFWL_SpinButton::OnLButtonUp(CFWL_MsgMouse* pMsg) { if (m_pProperties->m_dwStates & CFWL_PartState_Disabled) return; - m_bLButtonDwn = FALSE; - SetGrab(FALSE); - SetFocus(FALSE); + m_bLButtonDwn = false; + SetGrab(false); + SetFocus(false); if (m_pTimerInfo) { m_pTimerInfo->StopTimer(); m_pTimerInfo = nullptr; } - FX_BOOL bRepaint = FALSE; + bool bRepaint = false; CFX_RectF rtInvalidate; - if (m_dwUpState == CFWL_PartState_Pressed && IsButtonEnable(TRUE)) { + if (m_dwUpState == CFWL_PartState_Pressed && IsButtonEnable(true)) { m_dwUpState = CFWL_PartState_Normal; - bRepaint = TRUE; + bRepaint = true; rtInvalidate = m_rtUpButton; - } else if (m_dwDnState == CFWL_PartState_Pressed && IsButtonEnable(FALSE)) { + } else if (m_dwDnState == CFWL_PartState_Pressed && IsButtonEnable(false)) { m_dwDnState = CFWL_PartState_Normal; - bRepaint = TRUE; + bRepaint = true; rtInvalidate = m_rtDnButton; } if (bRepaint) @@ -278,50 +278,50 @@ void IFWL_SpinButton::OnMouseMove(CFWL_MsgMouse* pMsg) { if (m_bLButtonDwn) return; - FX_BOOL bRepaint = FALSE; + bool bRepaint = false; CFX_RectF rtInvlidate; rtInvlidate.Reset(); if (m_rtUpButton.Contains(pMsg->m_fx, pMsg->m_fy)) { - if (IsButtonEnable(TRUE)) { + if (IsButtonEnable(true)) { if (m_dwUpState == CFWL_PartState_Hovered) { m_dwUpState = CFWL_PartState_Hovered; - bRepaint = TRUE; + bRepaint = true; rtInvlidate = m_rtUpButton; } - if (m_dwDnState != CFWL_PartState_Normal && IsButtonEnable(FALSE)) { + if (m_dwDnState != CFWL_PartState_Normal && IsButtonEnable(false)) { m_dwDnState = CFWL_PartState_Normal; if (bRepaint) rtInvlidate.Union(m_rtDnButton); else rtInvlidate = m_rtDnButton; - bRepaint = TRUE; + bRepaint = true; } } - if (!IsButtonEnable(FALSE)) - EnableButton(FALSE, FALSE); + if (!IsButtonEnable(false)) + EnableButton(false, false); } else if (m_rtDnButton.Contains(pMsg->m_fx, pMsg->m_fy)) { - if (IsButtonEnable(FALSE)) { + if (IsButtonEnable(false)) { if (m_dwDnState != CFWL_PartState_Hovered) { m_dwDnState = CFWL_PartState_Hovered; - bRepaint = TRUE; + bRepaint = true; rtInvlidate = m_rtDnButton; } - if (m_dwUpState != CFWL_PartState_Normal && IsButtonEnable(TRUE)) { + if (m_dwUpState != CFWL_PartState_Normal && IsButtonEnable(true)) { m_dwUpState = CFWL_PartState_Normal; if (bRepaint) rtInvlidate.Union(m_rtUpButton); else rtInvlidate = m_rtUpButton; - bRepaint = TRUE; + bRepaint = true; } } } else if (m_dwUpState != CFWL_PartState_Normal || m_dwDnState != CFWL_PartState_Normal) { if (m_dwUpState != CFWL_PartState_Normal) { m_dwUpState = CFWL_PartState_Normal; - bRepaint = TRUE; + bRepaint = true; rtInvlidate = m_rtUpButton; } if (m_dwDnState != CFWL_PartState_Normal) { @@ -331,7 +331,7 @@ void IFWL_SpinButton::OnMouseMove(CFWL_MsgMouse* pMsg) { else rtInvlidate = m_rtDnButton; - bRepaint = TRUE; + bRepaint = true; } } if (bRepaint) @@ -341,9 +341,9 @@ void IFWL_SpinButton::OnMouseMove(CFWL_MsgMouse* pMsg) { void IFWL_SpinButton::OnMouseLeave(CFWL_MsgMouse* pMsg) { if (!pMsg) return; - if (m_dwUpState != CFWL_PartState_Normal && IsButtonEnable(TRUE)) + if (m_dwUpState != CFWL_PartState_Normal && IsButtonEnable(true)) m_dwUpState = CFWL_PartState_Normal; - if (m_dwDnState != CFWL_PartState_Normal && IsButtonEnable(FALSE)) + if (m_dwDnState != CFWL_PartState_Normal && IsButtonEnable(false)) m_dwDnState = CFWL_PartState_Normal; Repaint(&m_rtClient); @@ -353,15 +353,15 @@ void IFWL_SpinButton::OnKeyDown(CFWL_MsgKey* pMsg) { if (!m_pProperties->m_pDataProvider) return; - FX_BOOL bUp = + bool bUp = pMsg->m_dwKeyCode == FWL_VKEY_Up || pMsg->m_dwKeyCode == FWL_VKEY_Left; - FX_BOOL bDown = + bool bDown = pMsg->m_dwKeyCode == FWL_VKEY_Down || pMsg->m_dwKeyCode == FWL_VKEY_Right; if (!bUp && !bDown) return; - FX_BOOL bUpEnable = IsButtonEnable(TRUE); - FX_BOOL bDownEnable = IsButtonEnable(FALSE); + bool bUpEnable = IsButtonEnable(true); + bool bDownEnable = IsButtonEnable(false); if (!bUpEnable && !bDownEnable) return; diff --git a/xfa/fwl/core/ifwl_spinbutton.h b/xfa/fwl/core/ifwl_spinbutton.h index 5a6b15628e..a388489a9b 100644 --- a/xfa/fwl/core/ifwl_spinbutton.h +++ b/xfa/fwl/core/ifwl_spinbutton.h @@ -17,7 +17,7 @@ class CFWL_MsgMouse; class CFWL_WidgetImpProperties; -FWL_EVENT_DEF(CFWL_EvtSpbClick, CFWL_EventType::Click, FX_BOOL m_bUp;) +FWL_EVENT_DEF(CFWL_EvtSpbClick, CFWL_EventType::Click, bool m_bUp;) class IFWL_SpinButton : public IFWL_Widget { public: @@ -27,7 +27,7 @@ class IFWL_SpinButton : public IFWL_Widget { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; FWL_Error Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, @@ -37,8 +37,8 @@ class IFWL_SpinButton : public IFWL_Widget { void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; - FWL_Error EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE); - FX_BOOL IsButtonEnable(FX_BOOL bUp = TRUE); + FWL_Error EnableButton(bool bEnable, bool bUp = true); + bool IsButtonEnable(bool bUp = true); protected: class Timer : public IFWL_Timer { @@ -63,12 +63,12 @@ class IFWL_SpinButton : public IFWL_Widget { uint32_t m_dwUpState; uint32_t m_dwDnState; int32_t m_iButtonIndex; - FX_BOOL m_bLButtonDwn; + bool m_bLButtonDwn; IFWL_TimerInfo* m_pTimerInfo; IFWL_SpinButton::Timer m_Timer; private: - void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet); + void OnFocusChanged(CFWL_Message* pMsg, bool bSet); void OnLButtonDown(CFWL_MsgMouse* pMsg); void OnLButtonUp(CFWL_MsgMouse* pMsg); void OnMouseMove(CFWL_MsgMouse* pMsg); diff --git a/xfa/fwl/core/ifwl_tooltip.cpp b/xfa/fwl/core/ifwl_tooltip.cpp index 200cf7adab..2d518c5f83 100644 --- a/xfa/fwl/core/ifwl_tooltip.cpp +++ b/xfa/fwl/core/ifwl_tooltip.cpp @@ -20,7 +20,7 @@ IFWL_ToolTip::IFWL_ToolTip(const IFWL_App* app, const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : IFWL_Form(app, properties, pOuter), - m_bBtnDown(FALSE), + m_bBtnDown(false), m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), m_iTTOAlign(FDE_TTOALIGNMENT_Center), m_pTimerInfoShow(nullptr), @@ -40,7 +40,7 @@ FWL_Type IFWL_ToolTip::GetClassID() const { return FWL_Type::ToolTip; } -FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pThemeProvider) { @@ -59,7 +59,7 @@ FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { rect.width += 25; rect.height += 16; } - IFWL_Widget::GetWidgetRect(rect, TRUE); + IFWL_Widget::GetWidgetRect(rect, true); } else { rect = m_pProperties->m_rtWidget; } @@ -176,7 +176,7 @@ void IFWL_ToolTip::Show() { } void IFWL_ToolTip::Hide() { - SetStates(FWL_WGTSTATE_Invisible, TRUE); + SetStates(FWL_WGTSTATE_Invisible, true); if (m_pTimerInfoHide) { m_pTimerInfoHide->StopTimer(); m_pTimerInfoHide = nullptr; @@ -187,7 +187,7 @@ void IFWL_ToolTip::Hide() { } } -void IFWL_ToolTip::SetStates(uint32_t dwStates, FX_BOOL bSet) { +void IFWL_ToolTip::SetStates(uint32_t dwStates, bool bSet) { if ((dwStates & FWL_WGTSTATE_Invisible) && !bSet) { IFWL_ToolTipDP* pData = static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider); @@ -238,7 +238,7 @@ void IFWL_ToolTip::Timer::Run(IFWL_TimerInfo* pTimerInfo) { if (pToolTip->m_pTimerInfoShow == pTimerInfo && pToolTip->m_pTimerInfoShow) { if (pToolTip->GetStates() & FWL_WGTSTATE_Invisible) { - pToolTip->SetStates(FWL_WGTSTATE_Invisible, FALSE); + pToolTip->SetStates(FWL_WGTSTATE_Invisible, false); pToolTip->RefreshToolTipPos(); pToolTip->m_pTimerInfoShow->StopTimer(); pToolTip->m_pTimerInfoShow = nullptr; @@ -246,7 +246,7 @@ void IFWL_ToolTip::Timer::Run(IFWL_TimerInfo* pTimerInfo) { } } if (pToolTip->m_pTimerInfoHide == pTimerInfo && pToolTip->m_pTimerInfoHide) { - pToolTip->SetStates(FWL_WGTSTATE_Invisible, TRUE); + pToolTip->SetStates(FWL_WGTSTATE_Invisible, true); pToolTip->m_pTimerInfoHide->StopTimer(); pToolTip->m_pTimerInfoHide = nullptr; } diff --git a/xfa/fwl/core/ifwl_tooltip.h b/xfa/fwl/core/ifwl_tooltip.h index 0293759165..c2ad663739 100644 --- a/xfa/fwl/core/ifwl_tooltip.h +++ b/xfa/fwl/core/ifwl_tooltip.h @@ -41,11 +41,11 @@ class IFWL_ToolTip : public IFWL_Form { // IFWL_Widget FWL_Type GetClassID() const override; - FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; FWL_Error Update() override; FWL_Error DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr) override; - void SetStates(uint32_t dwStates, FX_BOOL bSet) override; + void SetStates(uint32_t dwStates, bool bSet) override; FWL_Error GetClientRect(CFX_RectF& rect) override; void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; @@ -75,7 +75,7 @@ class IFWL_ToolTip : public IFWL_Form { CFX_RectF m_rtClient; CFX_RectF m_rtCaption; - FX_BOOL m_bBtnDown; + bool m_bBtnDown; uint32_t m_dwTTOStyles; int32_t m_iTTOAlign; CFX_RectF m_rtAnchor; @@ -85,7 +85,7 @@ class IFWL_ToolTip : public IFWL_Form { IFWL_ToolTip::Timer m_TimerHide; private: - void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet); + void OnFocusChanged(CFWL_Message* pMsg, bool bSet); void OnLButtonDown(CFWL_MsgMouse* pMsg); void OnLButtonUp(CFWL_MsgMouse* pMsg); void OnMouseMove(CFWL_MsgMouse* pMsg); diff --git a/xfa/fwl/core/ifwl_widget.cpp b/xfa/fwl/core/ifwl_widget.cpp index f57d0a11c7..7bcdf18386 100644 --- a/xfa/fwl/core/ifwl_widget.cpp +++ b/xfa/fwl/core/ifwl_widget.cpp @@ -53,11 +53,11 @@ IFWL_Widget::~IFWL_Widget() { m_pWidgetMgr->RemoveWidget(this); } -FX_BOOL IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { - return FALSE; +bool IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { + return false; } -FWL_Error IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error IFWL_Widget::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { if (bAutoSize) { if (HasEdge()) { FX_FLOAT fEdge = GetEdgeWidth(); @@ -176,7 +176,7 @@ static void NotifyHideChildWidget(CFWL_WidgetMgr* widgetMgr, } } -void IFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) { +void IFWL_Widget::SetStates(uint32_t dwStates, bool bSet) { bSet ? (m_pProperties->m_dwStates |= dwStates) : (m_pProperties->m_dwStates &= ~dwStates); if (!(dwStates & FWL_WGTSTATE_Invisible) || !bSet) @@ -254,7 +254,7 @@ FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, GetWidgetRect(r); fx += r.left; fy += r.top; - GetMatrix(m, TRUE); + GetMatrix(m, true); m.TransformPoint(fx, fy); } IFWL_Widget* form1 = m_pWidgetMgr->GetSystemFormWidget(this); @@ -279,7 +279,7 @@ FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, } parent = pWidget->GetParent(); if (parent) { - pWidget->GetMatrix(m, TRUE); + pWidget->GetMatrix(m, true); CFX_Matrix m1; m1.SetIdentity(); m1.SetReverse(m); @@ -295,7 +295,7 @@ FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { return TransformTo(pWidget, rt.left, rt.top); } -FWL_Error IFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { +FWL_Error IFWL_Widget::GetMatrix(CFX_Matrix& matrix, bool bGlobal) { if (!m_pProperties) return FWL_Error::Indefinite; if (bGlobal) { @@ -311,12 +311,12 @@ FWL_Error IFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { int32_t count = parents.GetSize(); for (int32_t i = count - 2; i >= 0; i--) { parent = parents.GetAt(i); - parent->GetMatrix(ctmOnParent, FALSE); + parent->GetMatrix(ctmOnParent, false); parent->GetWidgetRect(rect); - matrix.Concat(ctmOnParent, TRUE); - matrix.Translate(rect.left, rect.top, TRUE); + matrix.Concat(ctmOnParent, true); + matrix.Translate(rect.left, rect.top, true); } - matrix.Concat(m_pProperties->m_ctmOnParent, TRUE); + matrix.Concat(m_pProperties->m_ctmOnParent, true); parents.RemoveAll(); } else { matrix = m_pProperties->m_ctmOnParent; @@ -371,44 +371,44 @@ void IFWL_Widget::SetLayoutItem(void* pItem) { void IFWL_Widget::SetAssociateWidget(CFWL_Widget* pAssociate) { m_pAssociate = pAssociate; } -FX_BOOL IFWL_Widget::IsEnabled() const { +bool IFWL_Widget::IsEnabled() const { return (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == 0; } -FX_BOOL IFWL_Widget::IsVisible() const { +bool IFWL_Widget::IsVisible() const { return (m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) == 0; } -FX_BOOL IFWL_Widget::IsActive() const { +bool IFWL_Widget::IsActive() const { return (m_pProperties->m_dwStates & FWL_WGTSTATE_Deactivated) == 0; } -FX_BOOL IFWL_Widget::IsOverLapper() const { +bool IFWL_Widget::IsOverLapper() const { return (m_pProperties->m_dwStyles & FWL_WGTSTYLE_WindowTypeMask) == FWL_WGTSTYLE_OverLapper; } -FX_BOOL IFWL_Widget::IsPopup() const { +bool IFWL_Widget::IsPopup() const { return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Popup); } -FX_BOOL IFWL_Widget::IsChild() const { +bool IFWL_Widget::IsChild() const { return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Child); } -FX_BOOL IFWL_Widget::IsLocked() const { +bool IFWL_Widget::IsLocked() const { return m_iLock > 0; } -FX_BOOL IFWL_Widget::IsOffscreen() const { +bool IFWL_Widget::IsOffscreen() const { return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Offscreen); } -FX_BOOL IFWL_Widget::HasBorder() const { +bool IFWL_Widget::HasBorder() const { return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border); } -FX_BOOL IFWL_Widget::HasEdge() const { +bool IFWL_Widget::HasEdge() const { return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_EdgeMask); } @@ -417,12 +417,12 @@ void IFWL_Widget::GetEdgeRect(CFX_RectF& rtEdge) { rtEdge.left = rtEdge.top = 0; if (HasBorder()) { FX_FLOAT fCX = GetBorderSize(); - FX_FLOAT fCY = GetBorderSize(FALSE); + FX_FLOAT fCY = GetBorderSize(false); rtEdge.Deflate(fCX, fCY); } } -FX_FLOAT IFWL_Widget::GetBorderSize(FX_BOOL bCX) { +FX_FLOAT IFWL_Widget::GetBorderSize(bool bCX) { FX_FLOAT* pfBorder = static_cast<FX_FLOAT*>(GetThemeCapacity( bCX ? CFWL_WidgetCapacity::CXBorder : CFWL_WidgetCapacity::CYBorder)); if (!pfBorder) @@ -501,7 +501,7 @@ IFWL_Widget* IFWL_Widget::GetRootOuter() { CFX_SizeF IFWL_Widget::CalcTextSize(const CFX_WideString& wsText, IFWL_ThemeProvider* pTheme, - FX_BOOL bMultiLine, + bool bMultiLine, int32_t iLineWidth) { if (!pTheme) return CFX_SizeF(); @@ -535,7 +535,7 @@ void IFWL_Widget::CalcTextRect(const CFX_WideString& wsText, pTheme->CalcTextRect(&calPart, rect); } -void IFWL_Widget::SetFocus(FX_BOOL bFocus) { +void IFWL_Widget::SetFocus(bool bFocus) { if (m_pWidgetMgr->IsFormDisabled()) return; @@ -556,7 +556,7 @@ void IFWL_Widget::SetFocus(FX_BOOL bFocus) { } } -void IFWL_Widget::SetGrab(FX_BOOL bSet) { +void IFWL_Widget::SetGrab(bool bSet) { const IFWL_App* pApp = GetOwnerApp(); if (!pApp) return; @@ -565,10 +565,10 @@ void IFWL_Widget::SetGrab(FX_BOOL bSet) { pDriver->SetGrab(this, bSet); } -FX_BOOL IFWL_Widget::GetPopupPos(FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, - const CFX_RectF& rtAnchor, - CFX_RectF& rtPopup) { +bool IFWL_Widget::GetPopupPos(FX_FLOAT fMinHeight, + FX_FLOAT fMaxHeight, + const CFX_RectF& rtAnchor, + CFX_RectF& rtPopup) { if (GetClassID() == FWL_Type::ComboBox) { if (m_pWidgetMgr->IsFormDisabled()) { return m_pWidgetMgr->GetAdapterPopupPos(this, fMinHeight, fMaxHeight, @@ -584,17 +584,17 @@ FX_BOOL IFWL_Widget::GetPopupPos(FX_FLOAT fMinHeight, return GetPopupPosGeneral(fMinHeight, fMaxHeight, rtAnchor, rtPopup); } -FX_BOOL IFWL_Widget::GetPopupPosMenu(FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, - const CFX_RectF& rtAnchor, - CFX_RectF& rtPopup) { +bool IFWL_Widget::GetPopupPosMenu(FX_FLOAT fMinHeight, + FX_FLOAT fMaxHeight, + const CFX_RectF& rtAnchor, + CFX_RectF& rtPopup) { FX_FLOAT fx = 0; FX_FLOAT fy = 0; FX_FLOAT fScreenWidth = 0; FX_FLOAT fScreenHeight = 0; GetScreenSize(fScreenWidth, fScreenHeight); if (GetStylesEx() & FWL_STYLEEXT_MNU_Vert) { - FX_BOOL bLeft = m_pProperties->m_rtWidget.left < 0; + bool bLeft = m_pProperties->m_rtWidget.left < 0; FX_FLOAT fRight = rtAnchor.right() + rtPopup.width; TransformTo(nullptr, fx, fy); if (fRight + fx > fScreenWidth || bLeft) { @@ -616,13 +616,13 @@ FX_BOOL IFWL_Widget::GetPopupPosMenu(FX_FLOAT fMinHeight, } } rtPopup.Offset(fx, fy); - return TRUE; + return true; } -FX_BOOL IFWL_Widget::GetPopupPosComboBox(FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, - const CFX_RectF& rtAnchor, - CFX_RectF& rtPopup) { +bool IFWL_Widget::GetPopupPosComboBox(FX_FLOAT fMinHeight, + FX_FLOAT fMaxHeight, + const CFX_RectF& rtAnchor, + CFX_RectF& rtPopup) { FX_FLOAT fx = 0; FX_FLOAT fy = 0; FX_FLOAT fScreenWidth = 0; @@ -643,13 +643,13 @@ FX_BOOL IFWL_Widget::GetPopupPosComboBox(FX_FLOAT fMinHeight, rtPopup.Set(rtAnchor.left, rtAnchor.bottom(), fWidth, fPopHeight); } rtPopup.Offset(fx, fy); - return TRUE; + return true; } -FX_BOOL IFWL_Widget::GetPopupPosGeneral(FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, - const CFX_RectF& rtAnchor, - CFX_RectF& rtPopup) { +bool IFWL_Widget::GetPopupPosGeneral(FX_FLOAT fMinHeight, + FX_FLOAT fMaxHeight, + const CFX_RectF& rtAnchor, + CFX_RectF& rtPopup) { FX_FLOAT fx = 0; FX_FLOAT fy = 0; FX_FLOAT fScreenWidth = 0; @@ -664,11 +664,11 @@ FX_BOOL IFWL_Widget::GetPopupPosGeneral(FX_FLOAT fMinHeight, rtPopup.height); } rtPopup.Offset(fx, fy); - return TRUE; + return true; } -FX_BOOL IFWL_Widget::GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy) { - return FALSE; +bool IFWL_Widget::GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy) { + return false; } void IFWL_Widget::RegisterEventTarget(IFWL_Widget* pEventSource, @@ -744,7 +744,7 @@ void IFWL_Widget::DrawBackground(CFX_Graphics* pGraphics, param.m_iPart = iPartBk; param.m_pGraphics = pGraphics; if (pMatrix) { - param.m_matrix.Concat(*pMatrix, TRUE); + param.m_matrix.Concat(*pMatrix, true); } param.m_rtPart = rtRelative; pTheme->DrawBackground(¶m); @@ -761,7 +761,7 @@ void IFWL_Widget::DrawBorder(CFX_Graphics* pGraphics, param.m_iPart = iPartBorder; param.m_pGraphics = pGraphics; if (pMatrix) { - param.m_matrix.Concat(*pMatrix, TRUE); + param.m_matrix.Concat(*pMatrix, true); } param.m_rtPart = rtRelative; pTheme->DrawBackground(¶m); @@ -778,7 +778,7 @@ void IFWL_Widget::DrawEdge(CFX_Graphics* pGraphics, param.m_iPart = iPartEdge; param.m_pGraphics = pGraphics; if (pMatrix) { - param.m_matrix.Concat(*pMatrix, TRUE); + param.m_matrix.Concat(*pMatrix, true); } param.m_rtPart = rtEdge; pTheme->DrawBackground(¶m); @@ -818,14 +818,14 @@ CFX_SizeF IFWL_Widget::GetOffsetFromParent(IFWL_Widget* pParent) { return szRet; } -FX_BOOL IFWL_Widget::IsParent(IFWL_Widget* pParent) { +bool IFWL_Widget::IsParent(IFWL_Widget* pParent) { IFWL_Widget* pUpWidget = GetParent(); while (pUpWidget) { if (pUpWidget == pParent) - return TRUE; + return true; pUpWidget = pUpWidget->GetParent(); } - return FALSE; + return false; } void IFWL_Widget::OnProcessMessage(CFWL_Message* pMessage) { diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h index 0c8cef1adc..b5dc1f9391 100644 --- a/xfa/fwl/core/ifwl_widget.h +++ b/xfa/fwl/core/ifwl_widget.h @@ -67,9 +67,9 @@ class IFWL_Widget : public IFWL_WidgetDelegate { ~IFWL_Widget() override; virtual FWL_Type GetClassID() const = 0; - virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; + virtual bool IsInstance(const CFX_WideStringC& wsClass) const; - virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); virtual FWL_Error GetGlobalRect(CFX_RectF& rect); virtual FWL_Error SetWidgetRect(const CFX_RectF& rect); virtual FWL_Error GetClientRect(CFX_RectF& rect); @@ -90,7 +90,7 @@ class IFWL_Widget : public IFWL_WidgetDelegate { uint32_t dwStylesExRemoved); virtual uint32_t GetStates(); - virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); + virtual void SetStates(uint32_t dwStates, bool bSet = true); virtual FWL_Error Update(); virtual FWL_Error LockUpdate(); @@ -103,7 +103,7 @@ class IFWL_Widget : public IFWL_WidgetDelegate { FX_FLOAT& fy); virtual FWL_Error TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); - virtual FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); + virtual FWL_Error GetMatrix(CFX_Matrix& matrix, bool bGlobal = false); virtual FWL_Error SetMatrix(const CFX_Matrix& matrix); virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, @@ -138,7 +138,7 @@ class IFWL_Widget : public IFWL_WidgetDelegate { void SetAssociateWidget(CFWL_Widget* pAssociate); - void SetFocus(FX_BOOL bFocus); + void SetFocus(bool bFocus); void Repaint(const CFX_RectF* pRect = nullptr); protected: @@ -148,18 +148,18 @@ class IFWL_Widget : public IFWL_WidgetDelegate { const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - FX_BOOL IsEnabled() const; - FX_BOOL IsVisible() const; - FX_BOOL IsActive() const; - FX_BOOL IsOverLapper() const; - FX_BOOL IsPopup() const; - FX_BOOL IsChild() const; - FX_BOOL IsLocked() const; - FX_BOOL IsOffscreen() const; - FX_BOOL HasBorder() const; - FX_BOOL HasEdge() const; + bool IsEnabled() const; + bool IsVisible() const; + bool IsActive() const; + bool IsOverLapper() const; + bool IsPopup() const; + bool IsChild() const; + bool IsLocked() const; + bool IsOffscreen() const; + bool HasBorder() const; + bool HasEdge() const; void GetEdgeRect(CFX_RectF& rtEdge); - FX_FLOAT GetBorderSize(FX_BOOL bCX = TRUE); + FX_FLOAT GetBorderSize(bool bCX = true); FX_FLOAT GetEdgeWidth(); void GetRelativeRect(CFX_RectF& rect); void* GetThemeCapacity(CFWL_WidgetCapacity dwCapacity); @@ -167,31 +167,31 @@ class IFWL_Widget : public IFWL_WidgetDelegate { IFWL_Widget* GetRootOuter(); CFX_SizeF CalcTextSize(const CFX_WideString& wsText, IFWL_ThemeProvider* pTheme, - FX_BOOL bMultiLine = FALSE, + bool bMultiLine = false, int32_t iLineWidth = -1); void CalcTextRect(const CFX_WideString& wsText, IFWL_ThemeProvider* pTheme, uint32_t dwTTOStyles, int32_t iTTOAlign, CFX_RectF& rect); - void SetGrab(FX_BOOL bSet); - FX_BOOL GetPopupPos(FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, - const CFX_RectF& rtAnchor, - CFX_RectF& rtPopup); - FX_BOOL GetPopupPosMenu(FX_FLOAT fMinHeight, + void SetGrab(bool bSet); + bool GetPopupPos(FX_FLOAT fMinHeight, + FX_FLOAT fMaxHeight, + const CFX_RectF& rtAnchor, + CFX_RectF& rtPopup); + bool GetPopupPosMenu(FX_FLOAT fMinHeight, + FX_FLOAT fMaxHeight, + const CFX_RectF& rtAnchor, + CFX_RectF& rtPopup); + bool GetPopupPosComboBox(FX_FLOAT fMinHeight, + FX_FLOAT fMaxHeight, + const CFX_RectF& rtAnchor, + CFX_RectF& rtPopup); + bool GetPopupPosGeneral(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight, const CFX_RectF& rtAnchor, CFX_RectF& rtPopup); - FX_BOOL GetPopupPosComboBox(FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, - const CFX_RectF& rtAnchor, - CFX_RectF& rtPopup); - FX_BOOL GetPopupPosGeneral(FX_FLOAT fMinHeight, - FX_FLOAT fMaxHeight, - const CFX_RectF& rtAnchor, - CFX_RectF& rtPopup); - FX_BOOL GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy); + bool GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy); void RegisterEventTarget(IFWL_Widget* pEventSource = nullptr, uint32_t dwFilter = FWL_EVENT_ALL_MASK); void UnregisterEventTarget(); @@ -211,7 +211,7 @@ class IFWL_Widget : public IFWL_WidgetDelegate { const CFX_Matrix* pMatrix = nullptr); void NotifyDriver(); - FX_BOOL IsParent(IFWL_Widget* pParent); + bool IsParent(IFWL_Widget* pParent); const IFWL_App* const m_pOwnerApp; CFWL_WidgetMgr* const m_pWidgetMgr; |