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