1e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Copyright 2014 PDFium Authors. All rights reserved. 2e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Use of this source code is governed by a BSD-style license that can be 3e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// found in the LICENSE file. 4ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 5e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 7e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#ifndef FPDFSDK_INCLUDE_PDFWINDOW_PWL_LISTBOX_H_ 8e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define FPDFSDK_INCLUDE_PDFWINDOW_PWL_LISTBOX_H_ 9e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 10e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#include "PWL_Wnd.h" 11ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#include "fpdfsdk/include/fxedit/fx_edit.h" 12e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 13e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass CPDF_ListCtrl; 14e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass CPWL_List_Notify; 15e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass CPWL_ListBox; 16e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IPWL_Filler_Notify; 17e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 18ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannclass CPWL_List_Notify : public IFX_List_Notify { 19ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann public: 20ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann CPWL_List_Notify(CPWL_ListBox* pList); 21ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann ~CPWL_List_Notify() override; 22ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 23ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // IFX_List_Notify 24ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void IOnSetScrollInfoX(FX_FLOAT fPlateMin, 25ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_FLOAT fPlateMax, 26ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_FLOAT fContentMin, 27ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_FLOAT fContentMax, 28ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_FLOAT fSmallStep, 29ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_FLOAT fBigStep) override {} 30ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void IOnSetScrollInfoY(FX_FLOAT fPlateMin, 31ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_FLOAT fPlateMax, 32ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_FLOAT fContentMin, 33ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_FLOAT fContentMax, 34ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_FLOAT fSmallStep, 35ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_FLOAT fBigStep) override; 36ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void IOnSetScrollPosX(FX_FLOAT fx) override {} 37ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void IOnSetScrollPosY(FX_FLOAT fy) override; 38ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void IOnInvalidateRect(CPDF_Rect* pRect) override; 39ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 40ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void IOnSetCaret(FX_BOOL bVisible, 41ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann const CPDF_Point& ptHead, 42ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann const CPDF_Point& ptFoot, 43ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann const CPVT_WordPlace& place); 44ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void IOnCaretChange(const CPVT_SecProps& secProps, 45ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann const CPVT_WordProps& wordProps); 46ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 47ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann private: 48ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann CPWL_ListBox* m_pList; 49e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov}; 50e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 51ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannclass CPWL_ListBox : public CPWL_Wnd { 52ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann public: 53ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann CPWL_ListBox(); 54ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann ~CPWL_ListBox() override; 55ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 56ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann // CPWL_Wnd 57ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann CFX_ByteString GetClassName() const override; 58ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void OnCreated() override; 59ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void OnDestroy() override; 60ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; 61ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void DrawThisAppearance(CFX_RenderDevice* pDevice, 62ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann CFX_Matrix* pUser2Device) override; 63ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) override; 64ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag) override; 65ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) override; 66ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; 67ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag) override; 68ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_BOOL OnMouseWheel(short zDelta, 69ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann const CPDF_Point& point, 70ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_DWORD nFlag) override; 71ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void KillFocus() override; 72ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void OnNotify(CPWL_Wnd* pWnd, 73ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_DWORD msg, 74ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann intptr_t wParam = 0, 75ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann intptr_t lParam = 0) override; 76ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void RePosChildWnd() override; 77ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann CPDF_Rect GetFocusRect() const override; 78ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void SetFontSize(FX_FLOAT fFontSize) override; 79ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_FLOAT GetFontSize() const override; 80ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 81ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann virtual CFX_WideString GetText() const; 82ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 83ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL& bExit, FX_DWORD nFlag); 84ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 85ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void AddString(const FX_WCHAR* string); 86ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void SetTopVisibleIndex(int32_t nItemIndex); 87ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void ScrollToListItem(int32_t nItemIndex); 88ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void ResetContent(); 89ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void Reset(); 90ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void Select(int32_t nItemIndex); 91ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void SetCaret(int32_t nItemIndex); 92ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void SetHoverSel(FX_BOOL bHoverSel); 93ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 94ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int32_t GetCount() const; 95ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_BOOL IsMultipleSel() const; 96ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int32_t GetCaretIndex() const; 97ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int32_t GetCurSel() const; 98ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_BOOL IsItemSelected(int32_t nItemIndex) const; 99ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int32_t GetTopVisibleIndex() const; 100ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const; 101ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann CPDF_Rect GetContentRect() const; 102ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_FLOAT GetFirstHeight() const; 103ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann CPDF_Rect GetListRect() const; 104ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 105ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void SetFillerNotify(IPWL_Filler_Notify* pNotify) { 106ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann m_pFillerNotify = pNotify; 107ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann } 108ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 109ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann protected: 110ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann IFX_List* m_pList; 111ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann CPWL_List_Notify* m_pListNotify; 112ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_BOOL m_bMouseDown; 113ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann FX_BOOL m_bHoverSel; 114ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann IPWL_Filler_Notify* m_pFillerNotify; 115ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 116ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann public: 117ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void AttachFFLData(void* pData) { m_pFormFiller = pData; } 118ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann 119ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann private: 120ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann void* m_pFormFiller; 121e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov}; 122e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 123e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_LISTBOX_H_ 124