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_LISTBOX_H_ | |
8 #define FPDFSDK_INCLUDE_PDFWINDOW_PWL_LISTBOX_H_ | |
9 | |
10 #include "fpdfsdk/include/fxedit/fx_edit.h" | |
11 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" | |
12 | |
13 class CPWL_List_Notify; | |
14 class CPWL_ListBox; | |
15 class IPWL_Filler_Notify; | |
16 | |
17 class CPWL_List_Notify : public IFX_List_Notify { | |
18 public: | |
19 CPWL_List_Notify(CPWL_ListBox* pList); | |
20 ~CPWL_List_Notify() override; | |
21 | |
22 // IFX_List_Notify | |
23 void IOnSetScrollInfoX(FX_FLOAT fPlateMin, | |
24 FX_FLOAT fPlateMax, | |
25 FX_FLOAT fContentMin, | |
26 FX_FLOAT fContentMax, | |
27 FX_FLOAT fSmallStep, | |
28 FX_FLOAT fBigStep) override {} | |
29 void IOnSetScrollInfoY(FX_FLOAT fPlateMin, | |
30 FX_FLOAT fPlateMax, | |
31 FX_FLOAT fContentMin, | |
32 FX_FLOAT fContentMax, | |
33 FX_FLOAT fSmallStep, | |
34 FX_FLOAT fBigStep) override; | |
35 void IOnSetScrollPosX(FX_FLOAT fx) override {} | |
36 void IOnSetScrollPosY(FX_FLOAT fy) override; | |
37 void IOnInvalidateRect(CFX_FloatRect* pRect) override; | |
38 | |
39 void IOnSetCaret(FX_BOOL bVisible, | |
40 const CFX_FloatPoint& ptHead, | |
41 const CFX_FloatPoint& ptFoot, | |
42 const CPVT_WordPlace& place); | |
43 void IOnCaretChange(const CPVT_SecProps& secProps, | |
44 const CPVT_WordProps& wordProps); | |
45 | |
46 private: | |
47 CPWL_ListBox* m_pList; | |
48 }; | |
49 | |
50 class CPWL_ListBox : public CPWL_Wnd { | |
51 public: | |
52 CPWL_ListBox(); | |
53 ~CPWL_ListBox() override; | |
54 | |
55 // CPWL_Wnd | |
56 CFX_ByteString GetClassName() const override; | |
57 void OnCreated() override; | |
58 void OnDestroy() override; | |
59 void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; | |
60 void DrawThisAppearance(CFX_RenderDevice* pDevice, | |
61 CFX_Matrix* pUser2Device) override; | |
62 FX_BOOL OnKeyDown(uint16_t nChar, FX_DWORD nFlag) override; | |
63 FX_BOOL OnChar(uint16_t nChar, FX_DWORD nFlag) override; | |
64 FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, FX_DWORD nFlag) override; | |
65 FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, FX_DWORD nFlag) override; | |
66 FX_BOOL OnMouseMove(const CFX_FloatPoint& point, FX_DWORD nFlag) override; | |
67 FX_BOOL OnMouseWheel(short zDelta, | |
68 const CFX_FloatPoint& point, | |
69 FX_DWORD nFlag) override; | |
70 void KillFocus() override; | |
71 void OnNotify(CPWL_Wnd* pWnd, | |
72 FX_DWORD msg, | |
73 intptr_t wParam = 0, | |
74 intptr_t lParam = 0) override; | |
75 void RePosChildWnd() override; | |
76 CFX_FloatRect GetFocusRect() const override; | |
77 void SetFontSize(FX_FLOAT fFontSize) override; | |
78 FX_FLOAT GetFontSize() const override; | |
79 | |
80 virtual CFX_WideString GetText() const; | |
81 | |
82 void OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL& bExit, FX_DWORD nFlag); | |
83 | |
84 void AddString(const FX_WCHAR* str); | |
85 void SetTopVisibleIndex(int32_t nItemIndex); | |
86 void ScrollToListItem(int32_t nItemIndex); | |
87 void ResetContent(); | |
88 void Reset(); | |
89 void Select(int32_t nItemIndex); | |
90 void SetCaret(int32_t nItemIndex); | |
91 void SetHoverSel(FX_BOOL bHoverSel); | |
92 | |
93 int32_t GetCount() const; | |
94 FX_BOOL IsMultipleSel() const; | |
95 int32_t GetCaretIndex() const; | |
96 int32_t GetCurSel() const; | |
97 FX_BOOL IsItemSelected(int32_t nItemIndex) const; | |
98 int32_t GetTopVisibleIndex() const; | |
99 int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const; | |
100 CFX_FloatRect GetContentRect() const; | |
101 FX_FLOAT GetFirstHeight() const; | |
102 CFX_FloatRect GetListRect() const; | |
103 | |
104 void SetFillerNotify(IPWL_Filler_Notify* pNotify) { | |
105 m_pFillerNotify = pNotify; | |
106 } | |
107 | |
108 protected: | |
109 IFX_List* m_pList; | |
110 CPWL_List_Notify* m_pListNotify; | |
111 FX_BOOL m_bMouseDown; | |
112 FX_BOOL m_bHoverSel; | |
113 IPWL_Filler_Notify* m_pFillerNotify; | |
114 | |
115 public: | |
116 void AttachFFLData(void* pData) { m_pFormFiller = pData; } | |
117 | |
118 private: | |
119 void* m_pFormFiller; | |
120 }; | |
121 | |
122 #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_LISTBOX_H_ | |
OLD | NEW |