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