merge to XFA: Fix -Wnon-virtual-dtor compiler warnings.
[pdfium.git] / fpdfsdk / include / pdfwindow / PWL_IconList.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_IconList_H_
8 #define _PWL_IconList_H_
9
10 class IPWL_IconList_Notify;
11 class CPWL_IconList_Item;
12 class CPWL_IconList_Content;
13 class CPWL_IconList;
14 class CPWL_Label;
15
16 class IPWL_IconList_Notify
17 {
18 public:
19         virtual ~IPWL_IconList_Notify() { }
20         virtual void                                            OnNoteListSelChanged(FX_INT32 nItemIndex) = 0;
21 };
22
23 class CPWL_IconList_Item : public CPWL_Wnd
24 {
25 public:
26         CPWL_IconList_Item();
27         virtual ~CPWL_IconList_Item();
28
29         virtual CFX_ByteString                          GetClassName() const;
30         virtual void                                            CreateChildWnd(const PWL_CREATEPARAM & cp);
31         virtual void                                            RePosChildWnd();
32
33         void                                                            SetSelect(FX_BOOL bSelected);
34         FX_BOOL                                                         IsSelected() const;
35         void                                                            SetData(void* pData);
36         void                                                            SetIcon(FX_INT32 nIconIndex);
37         void                                                            SetText(const CFX_WideString& str);
38         void                                                            SetIconFillColor(const CPWL_Color& color);
39         CFX_WideString                                          GetText() const;
40
41 protected:
42         virtual FX_FLOAT                                        GetItemHeight(FX_FLOAT fLimitWidth);
43         virtual void                                            DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
44
45         virtual void                                            OnEnabled();
46         virtual void                                            OnDisabled();
47
48 private:
49         FX_INT32                                                        m_nIconIndex;
50         void*                                                           m_pData;
51         FX_BOOL                                                         m_bSelected;
52         CPWL_Label*                                                     m_pText;
53         CPWL_Color                                                      m_crIcon;
54 };
55
56 class CPWL_IconList_Content : public CPWL_ListCtrl
57 {
58 public:
59         CPWL_IconList_Content(FX_INT32 nListCount);
60         virtual ~CPWL_IconList_Content();
61
62         void                                                            SetSelect(FX_INT32 nIndex);
63         FX_INT32                                                        GetSelect() const;
64         void                                                            SetNotify(IPWL_IconList_Notify* pNotify);
65         void                                                            EnableNotify(FX_BOOL bNotify);
66         void                                                            SetListData(FX_INT32 nItemIndex, void* pData);
67         void                                                            SetListIcon(FX_INT32 nItemIndex, FX_INT32 nIconIndex);
68         void                                                            SetListString(FX_INT32 nItemIndex, const CFX_WideString& str);
69         void                                                            SetIconFillColor(const CPWL_Color& color);
70         CFX_WideString                                          GetListString(FX_INT32 nItemIndex) const;
71         IPWL_IconList_Notify*                           GetNotify() const;
72         void                                                            ScrollToItem(FX_INT32 nItemIndex);
73
74 protected:
75         virtual void                                            CreateChildWnd(const PWL_CREATEPARAM & cp);
76         virtual FX_BOOL                                         OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
77         virtual FX_BOOL                                         OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
78         virtual FX_BOOL                                         OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);
79         virtual FX_BOOL                                         OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
80
81 private:
82         CPWL_IconList_Item*                                     GetListItem(FX_INT32 nItemIndex) const;
83         void                                                            SelectItem(FX_INT32 nItemIndex, FX_BOOL bSelect);
84         FX_INT32                                                        FindItemIndex(const CPDF_Point& point);
85         
86         FX_BOOL                                                         m_nSelectIndex;
87         IPWL_IconList_Notify*                           m_pNotify;
88         FX_BOOL                                                         m_bEnableNotify;
89         FX_BOOL                                                         m_bMouseDown;
90         FX_INT32                                                        m_nListCount;
91 };
92
93 class PWL_CLASS CPWL_IconList : public CPWL_Wnd
94 {
95 public:
96         CPWL_IconList(FX_INT32 nListCount);
97         virtual ~CPWL_IconList();
98
99         virtual FX_BOOL                                         OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
100
101         void                                                            SetSelect(FX_INT32 nIndex);
102         void                                                            SetTopItem(FX_INT32 nIndex);
103         FX_INT32                                                        GetSelect() const;
104         void                                                            SetNotify(IPWL_IconList_Notify* pNotify);
105         void                                                            EnableNotify(FX_BOOL bNotify);
106         void                                                            SetListData(FX_INT32 nItemIndex, void* pData);
107         void                                                            SetListIcon(FX_INT32 nItemIndex, FX_INT32 nIconIndex);
108         void                                                            SetListString(FX_INT32 nItemIndex, const CFX_WideString& str);
109         void                                                            SetIconFillColor(const CPWL_Color& color);
110         CFX_WideString                                          GetListString(FX_INT32 nItemIndex) const;
111
112 protected:
113         virtual void                                            OnCreated();
114         virtual void                                            RePosChildWnd();
115         virtual void                                            CreateChildWnd(const PWL_CREATEPARAM & cp);
116         
117         virtual void                                            OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam = 0, FX_INTPTR lParam = 0);
118
119 private:
120         CPWL_IconList_Content*                          m_pListContent;
121         FX_INT32                                                        m_nListCount;
122 };
123  
124 #endif //_PWL_IconList_H_
125
126