| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #ifndef FPDFSDK_INCLUDE_PDFWINDOW_PWL_COMBOBOX_H_ | |
| 8 #define FPDFSDK_INCLUDE_PDFWINDOW_PWL_COMBOBOX_H_ | |
| 9 | |
| 10 #include "fpdfsdk/include/pdfwindow/PWL_Edit.h" | |
| 11 #include "fpdfsdk/include/pdfwindow/PWL_ListBox.h" | |
| 12 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" | |
| 13 | |
| 14 class CPWL_CBEdit : public CPWL_Edit { | |
| 15 public: | |
| 16 CPWL_CBEdit() {} | |
| 17 ~CPWL_CBEdit() override {} | |
| 18 }; | |
| 19 | |
| 20 class CPWL_CBListBox : public CPWL_ListBox { | |
| 21 public: | |
| 22 CPWL_CBListBox() {} | |
| 23 ~CPWL_CBListBox() override {} | |
| 24 | |
| 25 // CPWL_ListBox | |
| 26 FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override; | |
| 27 | |
| 28 FX_BOOL OnKeyDownWithExit(uint16_t nChar, FX_BOOL& bExit, FX_DWORD nFlag); | |
| 29 FX_BOOL OnCharWithExit(uint16_t nChar, FX_BOOL& bExit, FX_DWORD nFlag); | |
| 30 }; | |
| 31 | |
| 32 #define PWL_COMBOBOX_BUTTON_WIDTH 13 | |
| 33 | |
| 34 class CPWL_CBButton : public CPWL_Wnd { | |
| 35 public: | |
| 36 CPWL_CBButton() {} | |
| 37 ~CPWL_CBButton() override {} | |
| 38 | |
| 39 // CPWL_Wnd | |
| 40 void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; | |
| 41 void DrawThisAppearance(CFX_RenderDevice* pDevice, | |
| 42 CFX_Matrix* pUser2Device) override; | |
| 43 FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag) override; | |
| 44 FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override; | |
| 45 }; | |
| 46 | |
| 47 class CPWL_ComboBox : public CPWL_Wnd { | |
| 48 public: | |
| 49 CPWL_ComboBox(); | |
| 50 ~CPWL_ComboBox() override {} | |
| 51 | |
| 52 CPWL_Edit* GetEdit() const { return m_pEdit; } | |
| 53 | |
| 54 // CPWL_Wnd: | |
| 55 CFX_ByteString GetClassName() const override; | |
| 56 void OnCreate(PWL_CREATEPARAM& cp) override; | |
| 57 FX_BOOL OnKeyDown(uint16_t nChar, FX_DWORD nFlag) override; | |
| 58 FX_BOOL OnChar(uint16_t nChar, FX_DWORD nFlag) override; | |
| 59 void OnNotify(CPWL_Wnd* pWnd, | |
| 60 FX_DWORD msg, | |
| 61 intptr_t wParam = 0, | |
| 62 intptr_t lParam = 0) override; | |
| 63 void CreateChildWnd(const PWL_CREATEPARAM& cp) override; | |
| 64 void RePosChildWnd() override; | |
| 65 CFX_FloatRect GetFocusRect() const override; | |
| 66 void SetFocus() override; | |
| 67 void KillFocus() override; | |
| 68 | |
| 69 void SetFillerNotify(IPWL_Filler_Notify* pNotify); | |
| 70 | |
| 71 CFX_WideString GetText() const; | |
| 72 void SetText(const FX_WCHAR* text); | |
| 73 | |
| 74 void AddString(const FX_WCHAR* str); | |
| 75 int32_t GetSelect() const; | |
| 76 void SetSelect(int32_t nItemIndex); | |
| 77 | |
| 78 void SetEditSel(int32_t nStartChar, int32_t nEndChar); | |
| 79 void GetEditSel(int32_t& nStartChar, int32_t& nEndChar) const; | |
| 80 void Clear(); | |
| 81 void SelectAll(); | |
| 82 FX_BOOL IsPopup() const; | |
| 83 | |
| 84 void SetSelectText(); | |
| 85 | |
| 86 void AttachFFLData(void* pData) { m_pFormFiller = pData; } | |
| 87 | |
| 88 private: | |
| 89 void CreateEdit(const PWL_CREATEPARAM& cp); | |
| 90 void CreateButton(const PWL_CREATEPARAM& cp); | |
| 91 void CreateListBox(const PWL_CREATEPARAM& cp); | |
| 92 void SetPopup(FX_BOOL bPopup); | |
| 93 | |
| 94 CPWL_CBEdit* m_pEdit; | |
| 95 CPWL_CBButton* m_pButton; | |
| 96 CPWL_CBListBox* m_pList; | |
| 97 FX_BOOL m_bPopup; | |
| 98 CFX_FloatRect m_rcOldWindow; | |
| 99 int32_t m_nPopupWhere; | |
| 100 int32_t m_nSelectItem; | |
| 101 IPWL_Filler_Notify* m_pFillerNotify; | |
| 102 | |
| 103 void* m_pFormFiller; | |
| 104 }; | |
| 105 | |
| 106 #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_COMBOBOX_H_ | |
| OLD | NEW |