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