diff options
Diffstat (limited to 'fpdfsdk/pdfwindow')
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_combo_box.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_combo_box.h | 8 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_edit.cpp | 30 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_edit.h | 1 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp | 42 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_edit_ctrl.h | 19 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_list_box.h | 5 |
7 files changed, 13 insertions, 94 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp index ace59a8e13..660f8cd9d3 100644 --- a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp +++ b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp @@ -278,7 +278,7 @@ void CPWL_ComboBox::CreateEdit(const PWL_CREATEPARAM& cp) { if (m_pEdit) return; - m_pEdit = new CPWL_CBEdit(); + m_pEdit = new CPWL_Edit(); m_pEdit->AttachFFLData(m_pFormFiller.Get()); PWL_CREATEPARAM ecp = cp; diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.h b/fpdfsdk/pdfwindow/cpwl_combo_box.h index 15915e64b4..25f0886fe4 100644 --- a/fpdfsdk/pdfwindow/cpwl_combo_box.h +++ b/fpdfsdk/pdfwindow/cpwl_combo_box.h @@ -14,12 +14,6 @@ #include "fpdfsdk/pdfwindow/cpwl_list_box.h" #include "fpdfsdk/pdfwindow/cpwl_wnd.h" -class CPWL_CBEdit : public CPWL_Edit { - public: - CPWL_CBEdit() {} - ~CPWL_CBEdit() override {} -}; - class CPWL_CBListBox : public CPWL_ListBox { public: CPWL_CBListBox() {} @@ -93,7 +87,7 @@ class CPWL_ComboBox : public CPWL_Wnd { void CreateListBox(const PWL_CREATEPARAM& cp); void SetPopup(bool bPopup); - CFX_UnownedPtr<CPWL_CBEdit> m_pEdit; + CFX_UnownedPtr<CPWL_Edit> m_pEdit; CFX_UnownedPtr<CPWL_CBButton> m_pButton; CFX_UnownedPtr<CPWL_CBListBox> m_pList; CFX_FloatRect m_rcOldWindow; diff --git a/fpdfsdk/pdfwindow/cpwl_edit.cpp b/fpdfsdk/pdfwindow/cpwl_edit.cpp index 4ad107653d..de21dac144 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit.cpp +++ b/fpdfsdk/pdfwindow/cpwl_edit.cpp @@ -451,7 +451,12 @@ void CPWL_Edit::OnSetFocus() { } void CPWL_Edit::OnKillFocus() { - ShowVScrollBar(false); + CPWL_ScrollBar* pScroll = GetVScrollBar(); + if (pScroll && pScroll->IsVisible()) { + pScroll->SetVisible(false); + Move(m_rcOldWindow, true, true); + } + m_pEdit->SelectNone(); SetCaret(false, CFX_PointF(), CFX_PointF()); SetCharSet(FX_CHARSET_ANSI); @@ -569,30 +574,9 @@ CFX_FloatRect CPWL_Edit::GetFocusRect() const { return CFX_FloatRect(); } -void CPWL_Edit::ShowVScrollBar(bool bShow) { - if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { - if (bShow) { - if (!pScroll->IsVisible()) { - pScroll->SetVisible(true); - CFX_FloatRect rcWindow = GetWindowRect(); - m_rcOldWindow = rcWindow; - rcWindow.right += PWL_SCROLLBAR_WIDTH; - Move(rcWindow, true, true); - } - } else { - if (pScroll->IsVisible()) { - pScroll->SetVisible(false); - Move(m_rcOldWindow, true, true); - } - } - } -} - bool CPWL_Edit::IsVScrollBarVisible() const { - if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { + if (CPWL_ScrollBar* pScroll = GetVScrollBar()) return pScroll->IsVisible(); - } - return false; } diff --git a/fpdfsdk/pdfwindow/cpwl_edit.h b/fpdfsdk/pdfwindow/cpwl_edit.h index 31296f664a..8d549b5f6b 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit.h +++ b/fpdfsdk/pdfwindow/cpwl_edit.h @@ -113,7 +113,6 @@ class CPWL_Edit : public CPWL_EditCtrl { private: CPVT_WordRange GetSelectWordRange() const; - virtual void ShowVScrollBar(bool bShow); bool IsVScrollBarVisible() const; void SetParamByFlag(); diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp index 59879bb274..ccc214ab00 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp +++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp @@ -299,8 +299,7 @@ void CPWL_EditCtrl::SetEditCaret(bool bVisible) { if (bVisible) GetCaretInfo(&ptHead, &ptFoot); - CPVT_WordPlace wpTemp = m_pEdit->GetCaretWordPlace(); - IOnSetCaret(bVisible, ptHead, ptFoot, wpTemp); + SetCaret(bVisible, ptHead, ptFoot); } void CPWL_EditCtrl::GetCaretInfo(CFX_PointF* ptHead, CFX_PointF* ptFoot) const { @@ -367,8 +366,6 @@ void CPWL_EditCtrl::PasteText() {} void CPWL_EditCtrl::CutText() {} -void CPWL_EditCtrl::ShowVScrollBar(bool bShow) {} - void CPWL_EditCtrl::InsertWord(uint16_t word, int32_t nCharset) { if (!IsReadOnly()) m_pEdit->InsertWord(word, nCharset); @@ -407,43 +404,6 @@ void CPWL_EditCtrl::Undo() { m_pEdit->Undo(); } -void CPWL_EditCtrl::IOnSetScrollInfoY(float fPlateMin, - float fPlateMax, - float fContentMin, - float fContentMax, - float fSmallStep, - float fBigStep) { - PWL_SCROLL_INFO Info; - Info.fPlateWidth = fPlateMax - fPlateMin; - Info.fContentMin = fContentMin; - Info.fContentMax = fContentMax; - Info.fSmallStep = fSmallStep; - Info.fBigStep = fBigStep; - SetScrollInfo(Info); - - if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) || - IsFloatEqual(Info.fPlateWidth, Info.fContentMax - Info.fContentMin)) { - ShowVScrollBar(false); - } else { - ShowVScrollBar(true); - } -} - -void CPWL_EditCtrl::IOnSetScrollPosY(float fy) { - SetScrollPosition(fy); -} - -void CPWL_EditCtrl::IOnSetCaret(bool bVisible, - const CFX_PointF& ptHead, - const CFX_PointF& ptFoot, - const CPVT_WordPlace& place) { - SetCaret(bVisible, ptHead, ptFoot); -} - -void CPWL_EditCtrl::IOnInvalidateRect(CFX_FloatRect* pRect) { - InvalidateRect(pRect); -} - int32_t CPWL_EditCtrl::GetCharSet() const { return m_nCharSet < 0 ? FX_CHARSET_Default : m_nCharSet; } diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h index f81def6464..454e579622 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h +++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h @@ -62,24 +62,14 @@ class CPWL_EditCtrl : public CPWL_Wnd { void SetCursor() override; CFX_WideString GetSelectedText() override; - void IOnSetScrollInfoY(float fPlateMin, - float fPlateMax, - float fContentMin, - float fContentMax, - float fSmallStep, - float fBigStep); - void IOnSetScrollPosY(float fy); - void IOnSetCaret(bool bVisible, - const CFX_PointF& ptHead, - const CFX_PointF& ptFoot, - const CPVT_WordPlace& place); - void IOnInvalidateRect(CFX_FloatRect* pRect); + void SetCaret(bool bVisible, + const CFX_PointF& ptHead, + const CFX_PointF& ptFoot); protected: void CopyText(); void PasteText(); void CutText(); - void ShowVScrollBar(bool bShow); void InsertWord(uint16_t word, int32_t nCharset); void InsertReturn(); @@ -89,9 +79,6 @@ class CPWL_EditCtrl : public CPWL_Wnd { void Backspace(); void GetCaretInfo(CFX_PointF* ptHead, CFX_PointF* ptFoot) const; - void SetCaret(bool bVisible, - const CFX_PointF& ptHead, - const CFX_PointF& ptFoot); void SetEditCaret(bool bVisible); diff --git a/fpdfsdk/pdfwindow/cpwl_list_box.h b/fpdfsdk/pdfwindow/cpwl_list_box.h index f1bfea7779..d97f5ae31a 100644 --- a/fpdfsdk/pdfwindow/cpwl_list_box.h +++ b/fpdfsdk/pdfwindow/cpwl_list_box.h @@ -35,11 +35,6 @@ class CPWL_List_Notify { void IOnSetScrollPosY(float fy); void IOnInvalidateRect(CFX_FloatRect* pRect); - void IOnSetCaret(bool bVisible, - const CFX_PointF& ptHead, - const CFX_PointF& ptFoot, - const CPVT_WordPlace& place); - private: CFX_UnownedPtr<CPWL_ListBox> m_pList; }; |