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_CORE_CFWL_LISTBOX_H_ | 7 #ifndef XFA_FWL_CORE_CFWL_LISTBOX_H_ |
8 #define XFA_FWL_CORE_CFWL_LISTBOX_H_ | 8 #define XFA_FWL_CORE_CFWL_LISTBOX_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void GetItemCheckRect(CFWL_Widget* pWidget, | 77 void GetItemCheckRect(CFWL_Widget* pWidget, |
78 CFWL_ListItem* pItem, | 78 CFWL_ListItem* pItem, |
79 CFX_RectF& rtCheck); | 79 CFX_RectF& rtCheck); |
80 void SetItemCheckRect(CFWL_Widget* pWidget, | 80 void SetItemCheckRect(CFWL_Widget* pWidget, |
81 CFWL_ListItem* pItem, | 81 CFWL_ListItem* pItem, |
82 const CFX_RectF& rtCheck); | 82 const CFX_RectF& rtCheck); |
83 uint32_t GetItemCheckState(CFWL_Widget* pWidget, CFWL_ListItem* pItem); | 83 uint32_t GetItemCheckState(CFWL_Widget* pWidget, CFWL_ListItem* pItem); |
84 void SetItemCheckState(CFWL_Widget* pWidget, | 84 void SetItemCheckState(CFWL_Widget* pWidget, |
85 CFWL_ListItem* pItem, | 85 CFWL_ListItem* pItem, |
86 uint32_t dwCheckState); | 86 uint32_t dwCheckState); |
87 CFWL_ListItem* AddString(const CFX_WideStringC& wsAdd, bool bSelect = false); | 87 CFWL_ListItem* AddString(const CFX_WideStringC& wsAdd); |
88 bool RemoveAt(int32_t iIndex); | 88 bool RemoveAt(int32_t iIndex); |
89 bool DeleteString(CFWL_ListItem* pItem); | 89 bool DeleteString(CFWL_ListItem* pItem); |
90 void DeleteAll(); | 90 void DeleteAll(); |
91 | 91 |
92 int32_t CountSelItems(); | 92 int32_t CountSelItems(); |
93 CFWL_ListItem* GetSelItem(int32_t nIndexSel); | 93 CFWL_ListItem* GetSelItem(int32_t nIndexSel); |
94 int32_t GetSelIndex(int32_t nIndex); | 94 int32_t GetSelIndex(int32_t nIndex); |
95 void SetSelItem(CFWL_ListItem* hItem, bool bSelect = true); | 95 void SetSelItem(CFWL_ListItem* hItem, bool bSelect); |
96 CFX_WideString GetDataProviderItemText(CFWL_ListItem* hItem); | 96 CFX_WideString GetDataProviderItemText(CFWL_ListItem* hItem); |
97 | 97 |
98 FX_FLOAT GetItemHeight() const { return m_fItemHeight; } | 98 FX_FLOAT GetItemHeight() const { return m_fItemHeight; } |
99 FX_FLOAT CalcItemHeight(); | 99 FX_FLOAT CalcItemHeight(); |
100 | 100 |
101 protected: | 101 protected: |
102 CFWL_ListItem* GetListItem(CFWL_ListItem* hItem, uint32_t dwKeyCode); | 102 CFWL_ListItem* GetListItem(CFWL_ListItem* hItem, uint32_t dwKeyCode); |
103 void SetSelection(CFWL_ListItem* hStart, CFWL_ListItem* hEnd, bool bSelected); | 103 void SetSelection(CFWL_ListItem* hStart, CFWL_ListItem* hEnd, bool bSelected); |
104 CFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); | 104 CFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); |
105 bool ScrollToVisible(CFWL_ListItem* hItem); | 105 bool ScrollToVisible(CFWL_ListItem* hItem); |
106 void InitScrollBar(bool bVert = true); | 106 void InitVerticalScrollBar(); |
| 107 void InitHorizontalScrollBar(); |
107 bool IsShowScrollBar(bool bVert); | 108 bool IsShowScrollBar(bool bVert); |
108 CFWL_ScrollBar* GetVertScrollBar() const { return m_pVertScrollBar.get(); } | 109 CFWL_ScrollBar* GetVertScrollBar() const { return m_pVertScrollBar.get(); } |
109 const CFX_RectF& GetRTClient() const { return m_rtClient; } | 110 const CFX_RectF& GetRTClient() const { return m_rtClient; } |
110 | 111 |
111 private: | 112 private: |
112 void SetSelectionDirect(CFWL_ListItem* hItem, bool bSelect); | 113 void SetSelectionDirect(CFWL_ListItem* hItem, bool bSelect); |
113 bool IsMultiSelection() const; | 114 bool IsMultiSelection() const; |
114 bool IsItemSelected(CFWL_ListItem* hItem); | 115 bool IsItemSelected(CFWL_ListItem* hItem); |
115 void ClearSelection(); | 116 void ClearSelection(); |
116 void SelectAll(); | 117 void SelectAll(); |
117 CFWL_ListItem* GetFocusedItem(); | 118 CFWL_ListItem* GetFocusedItem(); |
118 void SetFocusItem(CFWL_ListItem* hItem); | 119 void SetFocusItem(CFWL_ListItem* hItem); |
119 bool GetItemCheckRectInternal(CFWL_ListItem* hItem, CFX_RectF& rtCheck); | 120 bool GetItemCheckRectInternal(CFWL_ListItem* hItem, CFX_RectF& rtCheck); |
120 bool SetItemChecked(CFWL_ListItem* hItem, bool bChecked); | 121 bool SetItemChecked(CFWL_ListItem* hItem, bool bChecked); |
121 bool GetItemChecked(CFWL_ListItem* hItem); | 122 bool GetItemChecked(CFWL_ListItem* hItem); |
122 void DrawBkground(CFX_Graphics* pGraphics, | 123 void DrawBkground(CFX_Graphics* pGraphics, |
123 IFWL_ThemeProvider* pTheme, | 124 IFWL_ThemeProvider* pTheme, |
124 const CFX_Matrix* pMatrix = nullptr); | 125 const CFX_Matrix* pMatrix); |
125 void DrawItems(CFX_Graphics* pGraphics, | 126 void DrawItems(CFX_Graphics* pGraphics, |
126 IFWL_ThemeProvider* pTheme, | 127 IFWL_ThemeProvider* pTheme, |
127 const CFX_Matrix* pMatrix = nullptr); | 128 const CFX_Matrix* pMatrix); |
128 void DrawItem(CFX_Graphics* pGraphics, | 129 void DrawItem(CFX_Graphics* pGraphics, |
129 IFWL_ThemeProvider* pTheme, | 130 IFWL_ThemeProvider* pTheme, |
130 CFWL_ListItem* hItem, | 131 CFWL_ListItem* hItem, |
131 int32_t Index, | 132 int32_t Index, |
132 const CFX_RectF& rtItem, | 133 const CFX_RectF& rtItem, |
133 const CFX_Matrix* pMatrix = nullptr); | 134 const CFX_Matrix* pMatrix); |
134 void DrawStatic(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme); | 135 void DrawStatic(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme); |
135 CFX_SizeF CalcSize(bool bAutoSize = false); | 136 CFX_SizeF CalcSize(bool bAutoSize); |
136 void GetItemSize(CFX_SizeF& size, | 137 void GetItemSize(CFX_SizeF& size, |
137 CFWL_ListItem* hItem, | 138 CFWL_ListItem* hItem, |
138 FX_FLOAT fWidth, | 139 FX_FLOAT fWidth, |
139 FX_FLOAT fHeight, | 140 FX_FLOAT fHeight, |
140 bool bAutoSize = false); | 141 bool bAutoSize); |
141 FX_FLOAT GetMaxTextWidth(); | 142 FX_FLOAT GetMaxTextWidth(); |
142 FX_FLOAT GetScrollWidth(); | 143 FX_FLOAT GetScrollWidth(); |
143 | 144 |
144 void OnFocusChanged(CFWL_Message* pMsg, bool bSet = true); | 145 void OnFocusChanged(CFWL_Message* pMsg, bool bSet); |
145 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 146 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
146 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 147 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
147 void OnMouseWheel(CFWL_MsgMouseWheel* pMsg); | 148 void OnMouseWheel(CFWL_MsgMouseWheel* pMsg); |
148 void OnKeyDown(CFWL_MsgKey* pMsg); | 149 void OnKeyDown(CFWL_MsgKey* pMsg); |
149 void OnVK(CFWL_ListItem* hItem, bool bShift, bool bCtrl); | 150 void OnVK(CFWL_ListItem* hItem, bool bShift, bool bCtrl); |
150 bool OnScroll(CFWL_ScrollBar* pScrollBar, | 151 bool OnScroll(CFWL_ScrollBar* pScrollBar, |
151 CFWL_EvtScroll::Code dwCode, | 152 CFWL_EvtScroll::Code dwCode, |
152 FX_FLOAT fPos); | 153 FX_FLOAT fPos); |
153 | 154 |
154 CFX_RectF m_rtClient; | 155 CFX_RectF m_rtClient; |
155 CFX_RectF m_rtStatic; | 156 CFX_RectF m_rtStatic; |
156 CFX_RectF m_rtConent; | 157 CFX_RectF m_rtConent; |
157 std::unique_ptr<CFWL_ScrollBar> m_pHorzScrollBar; | 158 std::unique_ptr<CFWL_ScrollBar> m_pHorzScrollBar; |
158 std::unique_ptr<CFWL_ScrollBar> m_pVertScrollBar; | 159 std::unique_ptr<CFWL_ScrollBar> m_pVertScrollBar; |
159 uint32_t m_dwTTOStyles; | 160 uint32_t m_dwTTOStyles; |
160 int32_t m_iTTOAligns; | 161 int32_t m_iTTOAligns; |
161 CFWL_ListItem* m_hAnchor; | 162 CFWL_ListItem* m_hAnchor; |
162 FX_FLOAT m_fItemHeight; | 163 FX_FLOAT m_fItemHeight; |
163 FX_FLOAT m_fScorllBarWidth; | 164 FX_FLOAT m_fScorllBarWidth; |
164 bool m_bLButtonDown; | 165 bool m_bLButtonDown; |
165 IFWL_ThemeProvider* m_pScrollBarTP; | 166 IFWL_ThemeProvider* m_pScrollBarTP; |
166 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; | 167 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; |
167 }; | 168 }; |
168 | 169 |
169 #endif // XFA_FWL_CORE_CFWL_LISTBOX_H_ | 170 #endif // XFA_FWL_CORE_CFWL_LISTBOX_H_ |
OLD | NEW |