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