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_INCLUDE_PDFWINDOW_PWL_COMBOBOX_H_ | 7 #ifndef FPDFSDK_INCLUDE_PDFWINDOW_PWL_COMBOBOX_H_ |
8 #define FPDFSDK_INCLUDE_PDFWINDOW_PWL_COMBOBOX_H_ | 8 #define FPDFSDK_INCLUDE_PDFWINDOW_PWL_COMBOBOX_H_ |
9 | 9 |
10 #include "PWL_Edit.h" | 10 #include "PWL_Edit.h" |
11 #include "PWL_ListBox.h" | 11 #include "PWL_ListBox.h" |
12 #include "PWL_Wnd.h" | 12 #include "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 virtual ~CPWL_CBEdit(){}; | 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 virtual ~CPWL_CBListBox(){}; | 23 ~CPWL_CBListBox() override {} |
24 | 24 |
25 public: | 25 // CPWL_ListBox |
26 virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); | 26 FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; |
27 | 27 |
28 FX_BOOL OnKeyDownWithExit(FX_WORD nChar, FX_BOOL& bExit, FX_DWORD nFlag); | 28 FX_BOOL OnKeyDownWithExit(FX_WORD nChar, FX_BOOL& bExit, FX_DWORD nFlag); |
29 FX_BOOL OnCharWithExit(FX_WORD nChar, FX_BOOL& bExit, FX_DWORD nFlag); | 29 FX_BOOL OnCharWithExit(FX_WORD nChar, FX_BOOL& bExit, FX_DWORD 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 virtual ~CPWL_CBButton(){}; | 37 ~CPWL_CBButton() override {} |
38 | 38 |
39 public: | 39 // CPWL_Wnd |
40 virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream); | 40 void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; |
41 virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, | 41 void DrawThisAppearance(CFX_RenderDevice* pDevice, |
42 CPDF_Matrix* pUser2Device); | 42 CPDF_Matrix* pUser2Device) override; |
43 | 43 FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) override; |
44 virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); | 44 FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; |
45 virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); | |
46 }; | 45 }; |
47 | 46 |
48 class CPWL_ComboBox : public CPWL_Wnd { | 47 class CPWL_ComboBox : public CPWL_Wnd { |
49 public: | 48 public: |
50 CPWL_ComboBox(); | 49 CPWL_ComboBox(); |
| 50 ~CPWL_ComboBox() {} |
| 51 |
51 operator CPWL_Edit*() { return m_pEdit; } | 52 operator CPWL_Edit*() { return m_pEdit; } |
52 | 53 |
53 public: | 54 // CPWL_Wnd |
54 virtual CFX_ByteString GetClassName() const; | 55 CFX_ByteString GetClassName() const override; |
55 virtual void OnCreate(PWL_CREATEPARAM& cp); | 56 void OnCreate(PWL_CREATEPARAM& cp) override; |
| 57 FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) override; |
| 58 FX_BOOL OnChar(FX_WORD 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 CPDF_Rect GetFocusRect() const override; |
| 66 void SetFocus() override; |
| 67 void KillFocus() override; |
| 68 FX_BOOL IsModified() const override; |
56 | 69 |
57 virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); | |
58 virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); | |
59 | |
60 virtual void OnNotify(CPWL_Wnd* pWnd, | |
61 FX_DWORD msg, | |
62 intptr_t wParam = 0, | |
63 intptr_t lParam = 0); | |
64 | |
65 virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); | |
66 virtual void RePosChildWnd(); | |
67 | |
68 virtual CPDF_Rect GetFocusRect() const; | |
69 | |
70 virtual void SetFocus(); | |
71 virtual void KillFocus(); | |
72 | |
73 FX_BOOL IsModified() const; | |
74 | |
75 public: | |
76 void SetFillerNotify(IPWL_Filler_Notify* pNotify); | 70 void SetFillerNotify(IPWL_Filler_Notify* pNotify); |
77 | 71 |
78 CFX_WideString GetText() const; | 72 CFX_WideString GetText() const; |
79 void SetText(const FX_WCHAR* text); | 73 void SetText(const FX_WCHAR* text); |
80 | 74 |
81 void AddString(const FX_WCHAR* string); | 75 void AddString(const FX_WCHAR* string); |
82 int32_t GetSelect() const; | 76 int32_t GetSelect() const; |
83 void SetSelect(int32_t nItemIndex); | 77 void SetSelect(int32_t nItemIndex); |
84 | 78 |
85 void SetEditSel(int32_t nStartChar, int32_t nEndChar); | 79 void SetEditSel(int32_t nStartChar, int32_t nEndChar); |
86 void GetEditSel(int32_t& nStartChar, int32_t& nEndChar) const; | 80 void GetEditSel(int32_t& nStartChar, int32_t& nEndChar) const; |
87 void Clear(); | 81 void Clear(); |
88 void SelectAll(); | 82 void SelectAll(); |
89 FX_BOOL IsPopup() const; | 83 FX_BOOL IsPopup() const; |
90 | 84 |
91 void SetSelectText(); | 85 void SetSelectText(); |
92 | 86 |
| 87 void AttachFFLData(void* pData) { m_pFormFiller = pData; } |
| 88 |
93 private: | 89 private: |
94 void CreateEdit(const PWL_CREATEPARAM& cp); | 90 void CreateEdit(const PWL_CREATEPARAM& cp); |
95 void CreateButton(const PWL_CREATEPARAM& cp); | 91 void CreateButton(const PWL_CREATEPARAM& cp); |
96 void CreateListBox(const PWL_CREATEPARAM& cp); | 92 void CreateListBox(const PWL_CREATEPARAM& cp); |
97 | |
98 void SetPopup(FX_BOOL bPopup); | 93 void SetPopup(FX_BOOL bPopup); |
99 | 94 |
100 private: | |
101 CPWL_CBEdit* m_pEdit; | 95 CPWL_CBEdit* m_pEdit; |
102 CPWL_CBButton* m_pButton; | 96 CPWL_CBButton* m_pButton; |
103 CPWL_CBListBox* m_pList; | 97 CPWL_CBListBox* m_pList; |
104 | |
105 FX_BOOL m_bPopup; | 98 FX_BOOL m_bPopup; |
106 CPDF_Rect m_rcOldWindow; | 99 CPDF_Rect m_rcOldWindow; |
107 int32_t m_nPopupWhere; | 100 int32_t m_nPopupWhere; |
108 int32_t m_nSelectItem; | 101 int32_t m_nSelectItem; |
109 IPWL_Filler_Notify* m_pFillerNotify; | 102 IPWL_Filler_Notify* m_pFillerNotify; |
110 | 103 |
111 public: | |
112 void AttachFFLData(void* pData) { m_pFormFiller = pData; } | |
113 | |
114 private: | |
115 void* m_pFormFiller; | 104 void* m_pFormFiller; |
116 }; | 105 }; |
117 | 106 |
118 #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_COMBOBOX_H_ | 107 #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_COMBOBOX_H_ |
OLD | NEW |