OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_ |
8 #define XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_ | 8 #define XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "xfa/fwl/basewidget/ifwl_combobox.h" | 12 #include "xfa/fwl/basewidget/ifwl_combobox.h" |
13 #include "xfa/fwl/basewidget/ifwl_edit.h" | 13 #include "xfa/fwl/basewidget/ifwl_edit.h" |
14 #include "xfa/fwl/basewidget/ifwl_listbox.h" | 14 #include "xfa/fwl/basewidget/ifwl_listbox.h" |
15 #include "xfa/fwl/basewidget/ifwl_scrollbar.h" | 15 #include "xfa/fwl/basewidget/ifwl_scrollbar.h" |
16 #include "xfa/fwl/core/fwl_widgetimp.h" | 16 #include "xfa/fwl/core/fwl_widgetimp.h" |
17 | 17 |
18 class CFWL_ListBoxImpDelegate; | 18 class CFWL_ListBoxImpDelegate; |
19 class CFWL_MsgKillFocus; | 19 class CFWL_MsgKillFocus; |
20 class CFWL_MsgMouse; | 20 class CFWL_MsgMouse; |
21 class CFWL_MsgMouseWheel; | 21 class CFWL_MsgMouseWheel; |
22 | 22 |
23 class CFWL_ListBoxImp : public CFWL_WidgetImp { | 23 class CFWL_ListBoxImp : public CFWL_WidgetImp { |
24 public: | 24 public: |
25 CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties, | 25 CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties, |
26 IFWL_Widget* pOuter); | 26 IFWL_Widget* pOuter); |
27 ~CFWL_ListBoxImp(); | 27 ~CFWL_ListBoxImp(); |
28 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; | 28 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; |
29 virtual FX_DWORD GetClassID() const; | 29 virtual uint32_t GetClassID() const; |
30 virtual FWL_ERR Initialize(); | 30 virtual FWL_ERR Initialize(); |
31 virtual FWL_ERR Finalize(); | 31 virtual FWL_ERR Finalize(); |
32 virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 32 virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); |
33 virtual FWL_ERR Update(); | 33 virtual FWL_ERR Update(); |
34 virtual FX_DWORD HitTest(FX_FLOAT fx, FX_FLOAT fy); | 34 virtual uint32_t HitTest(FX_FLOAT fx, FX_FLOAT fy); |
35 virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, | 35 virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, |
36 const CFX_Matrix* pMatrix = NULL); | 36 const CFX_Matrix* pMatrix = NULL); |
37 virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); | 37 virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); |
38 virtual int32_t CountSelItems(); | 38 virtual int32_t CountSelItems(); |
39 virtual FWL_HLISTITEM GetSelItem(int32_t nIndexSel); | 39 virtual FWL_HLISTITEM GetSelItem(int32_t nIndexSel); |
40 virtual int32_t GetSelIndex(int32_t nIndex); | 40 virtual int32_t GetSelIndex(int32_t nIndex); |
41 virtual FWL_ERR SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); | 41 virtual FWL_ERR SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); |
42 virtual FWL_ERR GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); | 42 virtual FWL_ERR GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); |
43 virtual FWL_ERR GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); | 43 virtual FWL_ERR GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); |
44 virtual FWL_ERR* Sort(IFWL_ListBoxCompare* pCom); | 44 virtual FWL_ERR* Sort(IFWL_ListBoxCompare* pCom); |
45 | 45 |
46 protected: | 46 protected: |
47 FWL_HLISTITEM GetItem(FWL_HLISTITEM hItem, FX_DWORD dwKeyCode); | 47 FWL_HLISTITEM GetItem(FWL_HLISTITEM hItem, uint32_t dwKeyCode); |
48 void SetSelection(FWL_HLISTITEM hStart, | 48 void SetSelection(FWL_HLISTITEM hStart, |
49 FWL_HLISTITEM hEnd, | 49 FWL_HLISTITEM hEnd, |
50 FX_BOOL bSelected); | 50 FX_BOOL bSelected); |
51 void SetSelectionDirect(FWL_HLISTITEM hItem, FX_BOOL bSelect); | 51 void SetSelectionDirect(FWL_HLISTITEM hItem, FX_BOOL bSelect); |
52 FX_BOOL IsItemSelected(FWL_HLISTITEM hItem); | 52 FX_BOOL IsItemSelected(FWL_HLISTITEM hItem); |
53 void ClearSelection(); | 53 void ClearSelection(); |
54 void SelectAll(); | 54 void SelectAll(); |
55 FWL_HLISTITEM GetFocusedItem(); | 55 FWL_HLISTITEM GetFocusedItem(); |
56 void SetFocusItem(FWL_HLISTITEM hItem); | 56 void SetFocusItem(FWL_HLISTITEM hItem); |
57 FWL_HLISTITEM GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); | 57 FWL_HLISTITEM GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); |
(...skipping 27 matching lines...) Expand all Loading... |
85 void SortItem(); | 85 void SortItem(); |
86 FX_BOOL IsShowScrollBar(FX_BOOL bVert); | 86 FX_BOOL IsShowScrollBar(FX_BOOL bVert); |
87 void ProcessSelChanged(); | 87 void ProcessSelChanged(); |
88 | 88 |
89 protected: | 89 protected: |
90 CFX_RectF m_rtClient; | 90 CFX_RectF m_rtClient; |
91 CFX_RectF m_rtStatic; | 91 CFX_RectF m_rtStatic; |
92 CFX_RectF m_rtConent; | 92 CFX_RectF m_rtConent; |
93 std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar; | 93 std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar; |
94 std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar; | 94 std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar; |
95 FX_DWORD m_dwTTOStyles; | 95 uint32_t m_dwTTOStyles; |
96 int32_t m_iTTOAligns; | 96 int32_t m_iTTOAligns; |
97 FWL_HLISTITEM m_hAnchor; | 97 FWL_HLISTITEM m_hAnchor; |
98 FX_FLOAT m_fItemHeight; | 98 FX_FLOAT m_fItemHeight; |
99 FX_FLOAT m_fScorllBarWidth; | 99 FX_FLOAT m_fScorllBarWidth; |
100 FX_BOOL m_bLButtonDown; | 100 FX_BOOL m_bLButtonDown; |
101 IFWL_ThemeProvider* m_pScrollBarTP; | 101 IFWL_ThemeProvider* m_pScrollBarTP; |
102 friend class CFWL_ListBoxImpDelegate; | 102 friend class CFWL_ListBoxImpDelegate; |
103 }; | 103 }; |
104 class CFWL_ListBoxImpDelegate : public CFWL_WidgetImpDelegate { | 104 class CFWL_ListBoxImpDelegate : public CFWL_WidgetImpDelegate { |
105 public: | 105 public: |
106 CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner); | 106 CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner); |
107 int32_t OnProcessMessage(CFWL_Message* pMessage) override; | 107 int32_t OnProcessMessage(CFWL_Message* pMessage) override; |
108 FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; | 108 FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; |
109 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, | 109 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, |
110 const CFX_Matrix* pMatrix = NULL) override; | 110 const CFX_Matrix* pMatrix = NULL) override; |
111 | 111 |
112 protected: | 112 protected: |
113 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 113 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
114 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 114 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
115 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 115 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
116 void OnMouseWheel(CFWL_MsgMouseWheel* pMsg); | 116 void OnMouseWheel(CFWL_MsgMouseWheel* pMsg); |
117 void OnKeyDown(CFWL_MsgKey* pMsg); | 117 void OnKeyDown(CFWL_MsgKey* pMsg); |
118 void OnVK(FWL_HLISTITEM hItem, FX_BOOL bShift, FX_BOOL bCtrl); | 118 void OnVK(FWL_HLISTITEM hItem, FX_BOOL bShift, FX_BOOL bCtrl); |
119 FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, FX_DWORD dwCode, FX_FLOAT fPos); | 119 FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); |
120 void DispatchSelChangedEv(); | 120 void DispatchSelChangedEv(); |
121 CFWL_ListBoxImp* m_pOwner; | 121 CFWL_ListBoxImp* m_pOwner; |
122 }; | 122 }; |
123 | 123 |
124 #endif // XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_ | 124 #endif // XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_ |
OLD | NEW |