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_ICONLIST_H_ | 7 #ifndef FPDFSDK_PDFWINDOW_PWL_ICONLIST_H_ |
8 #define FPDFSDK_PDFWINDOW_PWL_ICONLIST_H_ | 8 #define FPDFSDK_PDFWINDOW_PWL_ICONLIST_H_ |
9 | 9 |
10 #include "core/fxcrt/include/fx_string.h" | 10 #include "core/fxcrt/include/fx_string.h" |
11 #include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" | 11 #include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" |
12 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" | 12 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" |
13 | 13 |
14 class IPWL_IconList_Notify; | |
15 class CPWL_IconList_Item; | 14 class CPWL_IconList_Item; |
16 class CPWL_IconList_Content; | 15 class CPWL_IconList_Content; |
17 class CPWL_IconList; | 16 class CPWL_IconList; |
18 class CPWL_Label; | 17 class CPWL_Label; |
19 | 18 |
20 class IPWL_IconList_Notify { | |
21 public: | |
22 virtual ~IPWL_IconList_Notify() {} | |
23 virtual void OnNoteListSelChanged(int32_t nItemIndex) = 0; | |
24 }; | |
25 | |
26 class CPWL_IconList_Item : public CPWL_Wnd { | 19 class CPWL_IconList_Item : public CPWL_Wnd { |
27 public: | 20 public: |
28 CPWL_IconList_Item(); | 21 CPWL_IconList_Item(); |
29 ~CPWL_IconList_Item() override; | 22 ~CPWL_IconList_Item() override; |
30 | 23 |
31 void SetSelect(FX_BOOL bSelected); | 24 void SetSelect(FX_BOOL bSelected); |
32 FX_BOOL IsSelected() const; | 25 FX_BOOL IsSelected() const; |
33 void SetData(void* pData); | 26 void SetData(void* pData); |
34 void SetIcon(int32_t nIconIndex); | 27 void SetIcon(int32_t nIconIndex); |
35 void SetText(const CFX_WideString& str); | 28 void SetText(const CFX_WideString& str); |
(...skipping 19 matching lines...) Expand all Loading... |
55 CPWL_Color m_crIcon; | 48 CPWL_Color m_crIcon; |
56 }; | 49 }; |
57 | 50 |
58 class CPWL_IconList_Content : public CPWL_ListCtrl { | 51 class CPWL_IconList_Content : public CPWL_ListCtrl { |
59 public: | 52 public: |
60 CPWL_IconList_Content(int32_t nListCount); | 53 CPWL_IconList_Content(int32_t nListCount); |
61 ~CPWL_IconList_Content() override; | 54 ~CPWL_IconList_Content() override; |
62 | 55 |
63 void SetSelect(int32_t nIndex); | 56 void SetSelect(int32_t nIndex); |
64 int32_t GetSelect() const; | 57 int32_t GetSelect() const; |
65 void SetNotify(IPWL_IconList_Notify* pNotify); | |
66 void EnableNotify(FX_BOOL bNotify); | |
67 void SetListData(int32_t nItemIndex, void* pData); | 58 void SetListData(int32_t nItemIndex, void* pData); |
68 void SetListIcon(int32_t nItemIndex, int32_t nIconIndex); | 59 void SetListIcon(int32_t nItemIndex, int32_t nIconIndex); |
69 void SetListString(int32_t nItemIndex, const CFX_WideString& str); | 60 void SetListString(int32_t nItemIndex, const CFX_WideString& str); |
70 void SetIconFillColor(const CPWL_Color& color); | 61 void SetIconFillColor(const CPWL_Color& color); |
71 CFX_WideString GetListString(int32_t nItemIndex) const; | 62 CFX_WideString GetListString(int32_t nItemIndex) const; |
72 IPWL_IconList_Notify* GetNotify() const; | |
73 void ScrollToItem(int32_t nItemIndex); | 63 void ScrollToItem(int32_t nItemIndex); |
74 | 64 |
75 protected: | 65 protected: |
76 // CPWL_ListCtrl | 66 // CPWL_ListCtrl |
77 void CreateChildWnd(const PWL_CREATEPARAM& cp) override; | 67 void CreateChildWnd(const PWL_CREATEPARAM& cp) override; |
78 FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; | 68 FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; |
79 FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; | 69 FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; |
80 FX_BOOL OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; | 70 FX_BOOL OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; |
81 FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag) override; | 71 FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag) override; |
82 | 72 |
83 private: | 73 private: |
84 CPWL_IconList_Item* GetListItem(int32_t nItemIndex) const; | 74 CPWL_IconList_Item* GetListItem(int32_t nItemIndex) const; |
85 void SelectItem(int32_t nItemIndex, FX_BOOL bSelect); | 75 void SelectItem(int32_t nItemIndex, FX_BOOL bSelect); |
86 int32_t FindItemIndex(const CFX_FloatPoint& point); | 76 int32_t FindItemIndex(const CFX_FloatPoint& point); |
87 | 77 |
88 int32_t m_nSelectIndex; | 78 int32_t m_nSelectIndex; |
89 IPWL_IconList_Notify* m_pNotify; | |
90 FX_BOOL m_bEnableNotify; | |
91 FX_BOOL m_bMouseDown; | 79 FX_BOOL m_bMouseDown; |
92 int32_t m_nListCount; | 80 int32_t m_nListCount; |
93 }; | 81 }; |
94 | 82 |
95 class CPWL_IconList : public CPWL_Wnd { | 83 class CPWL_IconList : public CPWL_Wnd { |
96 public: | 84 public: |
97 CPWL_IconList(int32_t nListCount); | 85 CPWL_IconList(int32_t nListCount); |
98 ~CPWL_IconList() override; | 86 ~CPWL_IconList() override; |
99 | 87 |
100 void SetSelect(int32_t nIndex); | 88 void SetSelect(int32_t nIndex); |
101 void SetTopItem(int32_t nIndex); | 89 void SetTopItem(int32_t nIndex); |
102 int32_t GetSelect() const; | 90 int32_t GetSelect() const; |
103 void SetNotify(IPWL_IconList_Notify* pNotify); | |
104 void EnableNotify(FX_BOOL bNotify); | |
105 void SetListData(int32_t nItemIndex, void* pData); | 91 void SetListData(int32_t nItemIndex, void* pData); |
106 void SetListIcon(int32_t nItemIndex, int32_t nIconIndex); | 92 void SetListIcon(int32_t nItemIndex, int32_t nIconIndex); |
107 void SetListString(int32_t nItemIndex, const CFX_WideString& str); | 93 void SetListString(int32_t nItemIndex, const CFX_WideString& str); |
108 void SetIconFillColor(const CPWL_Color& color); | 94 void SetIconFillColor(const CPWL_Color& color); |
109 CFX_WideString GetListString(int32_t nItemIndex) const; | 95 CFX_WideString GetListString(int32_t nItemIndex) const; |
110 | 96 |
111 protected: | 97 protected: |
112 // CPWL_Wnd | 98 // CPWL_Wnd |
113 FX_BOOL OnMouseWheel(short zDelta, | 99 FX_BOOL OnMouseWheel(short zDelta, |
114 const CFX_FloatPoint& point, | 100 const CFX_FloatPoint& point, |
115 uint32_t nFlag) override; | 101 uint32_t nFlag) override; |
116 void OnCreated() override; | 102 void OnCreated() override; |
117 void RePosChildWnd() override; | 103 void RePosChildWnd() override; |
118 void CreateChildWnd(const PWL_CREATEPARAM& cp) override; | 104 void CreateChildWnd(const PWL_CREATEPARAM& cp) override; |
119 void OnNotify(CPWL_Wnd* pWnd, | 105 void OnNotify(CPWL_Wnd* pWnd, |
120 uint32_t msg, | 106 uint32_t msg, |
121 intptr_t wParam = 0, | 107 intptr_t wParam = 0, |
122 intptr_t lParam = 0) override; | 108 intptr_t lParam = 0) override; |
123 | 109 |
124 private: | 110 private: |
125 CPWL_IconList_Content* m_pListContent; | 111 CPWL_IconList_Content* m_pListContent; |
126 int32_t m_nListCount; | 112 int32_t m_nListCount; |
127 }; | 113 }; |
128 | 114 |
129 #endif // FPDFSDK_PDFWINDOW_PWL_ICONLIST_H_ | 115 #endif // FPDFSDK_PDFWINDOW_PWL_ICONLIST_H_ |
OLD | NEW |