summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/pdfwindow')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_combo_box.cpp26
-rw-r--r--fpdfsdk/pdfwindow/cpwl_combo_box.h3
2 files changed, 14 insertions, 15 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
index 4427440bb8..acebfbe58b 100644
--- a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
@@ -46,9 +46,7 @@ bool CPWL_CBListBox::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) {
return !bExit;
}
-bool CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar,
- bool& bExit,
- uint32_t nFlag) {
+bool CPWL_CBListBox::IsMovementKey(uint16_t nChar) const {
switch (nChar) {
case FWL_VKEY_Up:
case FWL_VKEY_Down:
@@ -56,10 +54,14 @@ bool CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar,
case FWL_VKEY_Left:
case FWL_VKEY_End:
case FWL_VKEY_Right:
- break;
+ return true;
default:
return false;
}
+}
+
+bool CPWL_CBListBox::OnMovementKeyDown(uint16_t nChar, uint32_t nFlag) {
+ ASSERT(IsMovementKey(nChar));
switch (nChar) {
case FWL_VKEY_Up:
@@ -80,13 +82,11 @@ bool CPWL_CBListBox::OnKeyDownWithExit(uint16_t nChar,
case FWL_VKEY_Right:
m_pList->OnVK_RIGHT(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag));
break;
- case FWL_VKEY_Delete:
- break;
}
+ bool bExit = false;
OnNotifySelChanged(true, bExit, nFlag);
-
- return true;
+ return bExit;
}
bool CPWL_CBListBox::OnCharWithExit(uint16_t nChar,
@@ -479,9 +479,8 @@ bool CPWL_ComboBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) {
return false;
}
#endif // PDF_ENABLE_XFA
- bool bExit = false;
- if (m_pList->OnKeyDownWithExit(nChar, bExit, nFlag)) {
- if (bExit)
+ if (m_pList->IsMovementKey(nChar)) {
+ if (m_pList->OnMovementKeyDown(nChar, nFlag))
return false;
SetSelectText();
}
@@ -497,9 +496,8 @@ bool CPWL_ComboBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) {
return false;
}
#endif // PDF_ENABLE_XFA
- bool bExit = false;
- if (m_pList->OnKeyDownWithExit(nChar, bExit, nFlag)) {
- if (bExit)
+ if (m_pList->IsMovementKey(nChar)) {
+ if (m_pList->OnMovementKeyDown(nChar, nFlag))
return false;
SetSelectText();
}
diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.h b/fpdfsdk/pdfwindow/cpwl_combo_box.h
index 25f0886fe4..e60e781656 100644
--- a/fpdfsdk/pdfwindow/cpwl_combo_box.h
+++ b/fpdfsdk/pdfwindow/cpwl_combo_box.h
@@ -22,7 +22,8 @@ class CPWL_CBListBox : public CPWL_ListBox {
// CPWL_ListBox
bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override;
- bool OnKeyDownWithExit(uint16_t nChar, bool& bExit, uint32_t nFlag);
+ bool IsMovementKey(uint16_t nChar) const;
+ bool OnMovementKeyDown(uint16_t nChar, uint32_t nFlag);
bool OnCharWithExit(uint16_t nChar, bool& bExit, uint32_t nFlag);
};