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_PDFWINDOW_PWL_ICONLIST_H_ | |
8 #define FPDFSDK_PDFWINDOW_PWL_ICONLIST_H_ | |
9 | |
10 #include "core/fxcrt/include/fx_string.h" | |
11 #include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" | |
12 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" | |
13 | |
14 class CPWL_IconList_Item; | |
15 class CPWL_IconList_Content; | |
16 class CPWL_IconList; | |
17 class CPWL_Label; | |
18 | |
19 class CPWL_IconList_Item : public CPWL_Wnd { | |
20 public: | |
21 CPWL_IconList_Item(); | |
22 ~CPWL_IconList_Item() override; | |
23 | |
24 void SetSelect(FX_BOOL bSelected); | |
25 FX_BOOL IsSelected() const; | |
26 void SetData(void* pData); | |
27 void SetIcon(int32_t nIconIndex); | |
28 void SetText(const CFX_WideString& str); | |
29 void SetIconFillColor(const CPWL_Color& color); | |
30 CFX_WideString GetText() const; | |
31 | |
32 protected: | |
33 // CPWL_Wnd | |
34 CFX_ByteString GetClassName() const override; | |
35 void CreateChildWnd(const PWL_CREATEPARAM& cp) override; | |
36 void RePosChildWnd() override; | |
37 FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) override; | |
38 void DrawThisAppearance(CFX_RenderDevice* pDevice, | |
39 CFX_Matrix* pUser2Device) override; | |
40 void OnEnabled() override; | |
41 void OnDisabled() override; | |
42 | |
43 private: | |
44 int32_t m_nIconIndex; | |
45 void* m_pData; | |
46 FX_BOOL m_bSelected; | |
47 CPWL_Label* m_pText; | |
48 CPWL_Color m_crIcon; | |
49 }; | |
50 | |
51 class CPWL_IconList_Content : public CPWL_ListCtrl { | |
52 public: | |
53 CPWL_IconList_Content(int32_t nListCount); | |
54 ~CPWL_IconList_Content() override; | |
55 | |
56 void SetSelect(int32_t nIndex); | |
57 int32_t GetSelect() const; | |
58 void SetListData(int32_t nItemIndex, void* pData); | |
59 void SetListIcon(int32_t nItemIndex, int32_t nIconIndex); | |
60 void SetListString(int32_t nItemIndex, const CFX_WideString& str); | |
61 void SetIconFillColor(const CPWL_Color& color); | |
62 CFX_WideString GetListString(int32_t nItemIndex) const; | |
63 void ScrollToItem(int32_t nItemIndex); | |
64 | |
65 protected: | |
66 // CPWL_ListCtrl | |
67 void CreateChildWnd(const PWL_CREATEPARAM& cp) override; | |
68 FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; | |
69 FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; | |
70 FX_BOOL OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; | |
71 FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag) override; | |
72 | |
73 private: | |
74 CPWL_IconList_Item* GetListItem(int32_t nItemIndex) const; | |
75 void SelectItem(int32_t nItemIndex, FX_BOOL bSelect); | |
76 int32_t FindItemIndex(const CFX_FloatPoint& point); | |
77 | |
78 int32_t m_nSelectIndex; | |
79 FX_BOOL m_bMouseDown; | |
80 int32_t m_nListCount; | |
81 }; | |
82 | |
83 class CPWL_IconList : public CPWL_Wnd { | |
84 public: | |
85 CPWL_IconList(int32_t nListCount); | |
86 ~CPWL_IconList() override; | |
87 | |
88 void SetSelect(int32_t nIndex); | |
89 void SetTopItem(int32_t nIndex); | |
90 int32_t GetSelect() const; | |
91 void SetListData(int32_t nItemIndex, void* pData); | |
92 void SetListIcon(int32_t nItemIndex, int32_t nIconIndex); | |
93 void SetListString(int32_t nItemIndex, const CFX_WideString& str); | |
94 void SetIconFillColor(const CPWL_Color& color); | |
95 CFX_WideString GetListString(int32_t nItemIndex) const; | |
96 | |
97 protected: | |
98 // CPWL_Wnd | |
99 FX_BOOL OnMouseWheel(short zDelta, | |
100 const CFX_FloatPoint& point, | |
101 uint32_t nFlag) override; | |
102 void OnCreated() override; | |
103 void RePosChildWnd() override; | |
104 void CreateChildWnd(const PWL_CREATEPARAM& cp) override; | |
105 void OnNotify(CPWL_Wnd* pWnd, | |
106 uint32_t msg, | |
107 intptr_t wParam = 0, | |
108 intptr_t lParam = 0) override; | |
109 | |
110 private: | |
111 CPWL_IconList_Content* m_pListContent; | |
112 int32_t m_nListCount; | |
113 }; | |
114 | |
115 #endif // FPDFSDK_PDFWINDOW_PWL_ICONLIST_H_ | |
OLD | NEW |