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