Cleanup: Get this rid of "this->" in fpdfsdk/
[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 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
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);
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, intptr_t wParam = 0, intptr_t lParam = 0);
61         virtual void                                    RePosChildWnd();
62         virtual CFX_WideString                  GetText() const;
63         virtual CPDF_Rect                               GetFocusRect() const;
64         virtual void                                    SetFontSize(FX_FLOAT fFontSize);
65         virtual FX_FLOAT                                GetFontSize() const;
66
67         void                                                    OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL & bExit , FX_DWORD nFlag);
68
69         void                                                    AddString(const FX_WCHAR* string);
70         void                                                    SetTopVisibleIndex(int32_t nItemIndex);
71         void                                                    ScrollToListItem(int32_t nItemIndex);
72         void                                                    ResetContent();
73         void                                                    Reset();
74         void                                                    Select(int32_t nItemIndex);
75         void                                                    SetCaret(int32_t nItemIndex);
76         void                                                    SetHoverSel(FX_BOOL bHoverSel);
77
78         int32_t                                         GetCount() const;
79         FX_BOOL                                                 IsMultipleSel() const;
80         int32_t                                         GetCaretIndex() const;
81         int32_t                                         GetCurSel() const;
82         FX_BOOL                                                 IsItemSelected(int32_t nItemIndex) const;
83         int32_t                                         GetTopVisibleIndex() const;
84         int32_t                                         FindNext(int32_t nIndex,FX_WCHAR nChar) const;
85         CPDF_Rect                                               GetContentRect() const;
86         FX_FLOAT                                                GetFirstHeight() const;
87         CPDF_Rect                                               GetListRect() const;
88
89         void                                                    SetFillerNotify(IPWL_Filler_Notify* pNotify) {m_pFillerNotify = pNotify;}
90
91 protected:
92         IFX_List*                                               m_pList;
93         CPWL_List_Notify*                               m_pListNotify;
94         FX_BOOL                                                 m_bMouseDown;
95         FX_BOOL                                                 m_bHoverSel;
96         IPWL_Filler_Notify*                             m_pFillerNotify;
97 public:
98         void                                                    AttachFFLData(void* pData) {m_pFormFiller = pData;}
99 private:
100         void*                                                   m_pFormFiller;
101 };
102
103 #endif  // FPDFSDK_INCLUDE_PDFWINDOW_PWL_LISTBOX_H_