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