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