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() override; |
28 virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; | 28 |
29 virtual uint32_t GetClassID() const; | 29 // CFWL_WidgetImp |
30 virtual FWL_Error Initialize(); | 30 FWL_Error GetClassName(CFX_WideString& wsClass) const override; |
31 virtual FWL_Error Finalize(); | 31 FWL_Type GetClassID() const override; |
32 virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 32 FWL_Error Initialize() override; |
33 virtual FWL_Error Update(); | 33 FWL_Error Finalize() override; |
34 virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); | 34 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
35 virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 35 FWL_Error Update() override; |
36 const CFX_Matrix* pMatrix = NULL); | 36 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; |
37 virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); | 37 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
38 virtual int32_t CountSelItems(); | 38 const CFX_Matrix* pMatrix = nullptr) override; |
39 virtual FWL_HLISTITEM GetSelItem(int32_t nIndexSel); | 39 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; |
40 virtual int32_t GetSelIndex(int32_t nIndex); | 40 |
41 virtual FWL_Error SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); | 41 int32_t CountSelItems(); |
42 virtual FWL_Error GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); | 42 FWL_HLISTITEM GetSelItem(int32_t nIndexSel); |
43 virtual FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); | 43 int32_t GetSelIndex(int32_t nIndex); |
| 44 FWL_Error SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); |
| 45 FWL_Error GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); |
| 46 FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); |
| 47 FWL_Error* Sort(IFWL_ListBoxCompare* pCom); |
44 | 48 |
45 protected: | 49 protected: |
| 50 friend class CFWL_ListBoxImpDelegate; |
| 51 |
46 FWL_HLISTITEM GetItem(FWL_HLISTITEM hItem, uint32_t dwKeyCode); | 52 FWL_HLISTITEM GetItem(FWL_HLISTITEM hItem, uint32_t dwKeyCode); |
47 void SetSelection(FWL_HLISTITEM hStart, | 53 void SetSelection(FWL_HLISTITEM hStart, |
48 FWL_HLISTITEM hEnd, | 54 FWL_HLISTITEM hEnd, |
49 FX_BOOL bSelected); | 55 FX_BOOL bSelected); |
50 void SetSelectionDirect(FWL_HLISTITEM hItem, FX_BOOL bSelect); | 56 void SetSelectionDirect(FWL_HLISTITEM hItem, FX_BOOL bSelect); |
51 FX_BOOL IsItemSelected(FWL_HLISTITEM hItem); | 57 FX_BOOL IsItemSelected(FWL_HLISTITEM hItem); |
52 void ClearSelection(); | 58 void ClearSelection(); |
53 void SelectAll(); | 59 void SelectAll(); |
54 FWL_HLISTITEM GetFocusedItem(); | 60 FWL_HLISTITEM GetFocusedItem(); |
55 void SetFocusItem(FWL_HLISTITEM hItem); | 61 void SetFocusItem(FWL_HLISTITEM hItem); |
(...skipping 21 matching lines...) Expand all Loading... |
77 FX_FLOAT fWidth, | 83 FX_FLOAT fWidth, |
78 FX_FLOAT fHeight, | 84 FX_FLOAT fHeight, |
79 FX_BOOL bAutoSize = FALSE); | 85 FX_BOOL bAutoSize = FALSE); |
80 FX_FLOAT GetMaxTextWidth(); | 86 FX_FLOAT GetMaxTextWidth(); |
81 FX_FLOAT GetScrollWidth(); | 87 FX_FLOAT GetScrollWidth(); |
82 FX_FLOAT GetItemHeigt(); | 88 FX_FLOAT GetItemHeigt(); |
83 void InitScrollBar(FX_BOOL bVert = TRUE); | 89 void InitScrollBar(FX_BOOL bVert = TRUE); |
84 FX_BOOL IsShowScrollBar(FX_BOOL bVert); | 90 FX_BOOL IsShowScrollBar(FX_BOOL bVert); |
85 void ProcessSelChanged(); | 91 void ProcessSelChanged(); |
86 | 92 |
87 protected: | |
88 CFX_RectF m_rtClient; | 93 CFX_RectF m_rtClient; |
89 CFX_RectF m_rtStatic; | 94 CFX_RectF m_rtStatic; |
90 CFX_RectF m_rtConent; | 95 CFX_RectF m_rtConent; |
91 std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar; | 96 std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar; |
92 std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar; | 97 std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar; |
93 uint32_t m_dwTTOStyles; | 98 uint32_t m_dwTTOStyles; |
94 int32_t m_iTTOAligns; | 99 int32_t m_iTTOAligns; |
95 FWL_HLISTITEM m_hAnchor; | 100 FWL_HLISTITEM m_hAnchor; |
96 FX_FLOAT m_fItemHeight; | 101 FX_FLOAT m_fItemHeight; |
97 FX_FLOAT m_fScorllBarWidth; | 102 FX_FLOAT m_fScorllBarWidth; |
98 FX_BOOL m_bLButtonDown; | 103 FX_BOOL m_bLButtonDown; |
99 IFWL_ThemeProvider* m_pScrollBarTP; | 104 IFWL_ThemeProvider* m_pScrollBarTP; |
100 friend class CFWL_ListBoxImpDelegate; | |
101 }; | 105 }; |
102 class CFWL_ListBoxImpDelegate : public CFWL_WidgetImpDelegate { | 106 class CFWL_ListBoxImpDelegate : public CFWL_WidgetImpDelegate { |
103 public: | 107 public: |
104 CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner); | 108 CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner); |
105 void OnProcessMessage(CFWL_Message* pMessage) override; | 109 void OnProcessMessage(CFWL_Message* pMessage) override; |
106 void OnProcessEvent(CFWL_Event* pEvent) override; | 110 void OnProcessEvent(CFWL_Event* pEvent) override; |
107 void OnDrawWidget(CFX_Graphics* pGraphics, | 111 void OnDrawWidget(CFX_Graphics* pGraphics, |
108 const CFX_Matrix* pMatrix = NULL) override; | 112 const CFX_Matrix* pMatrix = NULL) override; |
109 | 113 |
110 protected: | 114 protected: |
111 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 115 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
112 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 116 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
113 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 117 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
114 void OnMouseWheel(CFWL_MsgMouseWheel* pMsg); | 118 void OnMouseWheel(CFWL_MsgMouseWheel* pMsg); |
115 void OnKeyDown(CFWL_MsgKey* pMsg); | 119 void OnKeyDown(CFWL_MsgKey* pMsg); |
116 void OnVK(FWL_HLISTITEM hItem, FX_BOOL bShift, FX_BOOL bCtrl); | 120 void OnVK(FWL_HLISTITEM hItem, FX_BOOL bShift, FX_BOOL bCtrl); |
117 FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); | 121 FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); |
118 void DispatchSelChangedEv(); | 122 void DispatchSelChangedEv(); |
119 CFWL_ListBoxImp* m_pOwner; | 123 CFWL_ListBoxImp* m_pOwner; |
120 }; | 124 }; |
121 | 125 |
122 #endif // XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_ | 126 #endif // XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_ |
OLD | NEW |