| 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 FPDFSDK_FXEDIT_FXET_LIST_H_ | 7 #ifndef FPDFSDK_FXEDIT_FXET_LIST_H_ |
| 8 #define FPDFSDK_FXEDIT_FXET_LIST_H_ | 8 #define FPDFSDK_FXEDIT_FXET_LIST_H_ |
| 9 | 9 |
| 10 #include "core/fxcrt/fx_coordinates.h" | 10 #include "core/fxcrt/fx_coordinates.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 class CFX_ListItem final { | 98 class CFX_ListItem final { |
| 99 public: | 99 public: |
| 100 CFX_ListItem(); | 100 CFX_ListItem(); |
| 101 ~CFX_ListItem(); | 101 ~CFX_ListItem(); |
| 102 | 102 |
| 103 void SetFontMap(IPVT_FontMap* pFontMap); | 103 void SetFontMap(IPVT_FontMap* pFontMap); |
| 104 CFX_Edit* GetEdit() const; | 104 CFX_Edit* GetEdit() const; |
| 105 | 105 |
| 106 void SetRect(const CLST_Rect& rect); | 106 void SetRect(const CLST_Rect& rect); |
| 107 void SetSelect(FX_BOOL bSelected); | 107 void SetSelect(bool bSelected); |
| 108 void SetText(const CFX_WideString& text); | 108 void SetText(const CFX_WideString& text); |
| 109 void SetFontSize(FX_FLOAT fFontSize); | 109 void SetFontSize(FX_FLOAT fFontSize); |
| 110 CFX_WideString GetText() const; | 110 CFX_WideString GetText() const; |
| 111 | 111 |
| 112 CLST_Rect GetRect() const; | 112 CLST_Rect GetRect() const; |
| 113 FX_BOOL IsSelected() const; | 113 bool IsSelected() const; |
| 114 FX_FLOAT GetItemHeight() const; | 114 FX_FLOAT GetItemHeight() const; |
| 115 uint16_t GetFirstChar() const; | 115 uint16_t GetFirstChar() const; |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 CFX_Edit_Iterator* GetIterator() const; | 118 CFX_Edit_Iterator* GetIterator() const; |
| 119 | 119 |
| 120 std::unique_ptr<CFX_Edit> m_pEdit; | 120 std::unique_ptr<CFX_Edit> m_pEdit; |
| 121 FX_BOOL m_bSelected; | 121 bool m_bSelected; |
| 122 CLST_Rect m_rcListItem; | 122 CLST_Rect m_rcListItem; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 class CFX_ListContainer { | 125 class CFX_ListContainer { |
| 126 public: | 126 public: |
| 127 CFX_ListContainer(); | 127 CFX_ListContainer(); |
| 128 virtual ~CFX_ListContainer(); | 128 virtual ~CFX_ListContainer(); |
| 129 | 129 |
| 130 virtual void SetPlateRect(const CFX_FloatRect& rect); | 130 virtual void SetPlateRect(const CFX_FloatRect& rect); |
| 131 | 131 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 164 } |
| 165 | 165 |
| 166 private: | 166 private: |
| 167 CFX_FloatRect m_rcPlate; | 167 CFX_FloatRect m_rcPlate; |
| 168 CLST_Rect m_rcContent; // positive forever! | 168 CLST_Rect m_rcContent; // positive forever! |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 template <class TYPE> | 171 template <class TYPE> |
| 172 class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE> { | 172 class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE> { |
| 173 public: | 173 public: |
| 174 FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; } | 174 bool IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; } |
| 175 TYPE GetAt(int32_t nIndex) const { | 175 TYPE GetAt(int32_t nIndex) const { |
| 176 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) | 176 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) |
| 177 return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); | 177 return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); |
| 178 return nullptr; | 178 return nullptr; |
| 179 } | 179 } |
| 180 void RemoveAt(int32_t nIndex) { | 180 void RemoveAt(int32_t nIndex) { |
| 181 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) | 181 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) |
| 182 CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex); | 182 CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex); |
| 183 } | 183 } |
| 184 }; | 184 }; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 196 class CPLST_Select { | 196 class CPLST_Select { |
| 197 public: | 197 public: |
| 198 CPLST_Select(); | 198 CPLST_Select(); |
| 199 virtual ~CPLST_Select(); | 199 virtual ~CPLST_Select(); |
| 200 | 200 |
| 201 public: | 201 public: |
| 202 void Add(int32_t nItemIndex); | 202 void Add(int32_t nItemIndex); |
| 203 void Add(int32_t nBeginIndex, int32_t nEndIndex); | 203 void Add(int32_t nBeginIndex, int32_t nEndIndex); |
| 204 void Sub(int32_t nItemIndex); | 204 void Sub(int32_t nItemIndex); |
| 205 void Sub(int32_t nBeginIndex, int32_t nEndIndex); | 205 void Sub(int32_t nBeginIndex, int32_t nEndIndex); |
| 206 FX_BOOL IsExist(int32_t nItemIndex) const; | 206 bool IsExist(int32_t nItemIndex) const; |
| 207 int32_t Find(int32_t nItemIndex) const; | 207 int32_t Find(int32_t nItemIndex) const; |
| 208 int32_t GetCount() const; | 208 int32_t GetCount() const; |
| 209 int32_t GetItemIndex(int32_t nIndex) const; | 209 int32_t GetItemIndex(int32_t nIndex) const; |
| 210 int32_t GetState(int32_t nIndex) const; | 210 int32_t GetState(int32_t nIndex) const; |
| 211 void Done(); | 211 void Done(); |
| 212 void DeselectAll(); | 212 void DeselectAll(); |
| 213 | 213 |
| 214 private: | 214 private: |
| 215 CFX_ArrayTemplate<CPLST_Select_Item*> m_aItems; | 215 CFX_ArrayTemplate<CPLST_Select_Item*> m_aItems; |
| 216 }; | 216 }; |
| 217 | 217 |
| 218 class CFX_ListCtrl : protected CFX_ListContainer { | 218 class CFX_ListCtrl : protected CFX_ListContainer { |
| 219 public: | 219 public: |
| 220 CFX_ListCtrl(); | 220 CFX_ListCtrl(); |
| 221 ~CFX_ListCtrl() override; | 221 ~CFX_ListCtrl() override; |
| 222 | 222 |
| 223 // CFX_ListContainer | 223 // CFX_ListContainer |
| 224 void SetPlateRect(const CFX_FloatRect& rect) override; | 224 void SetPlateRect(const CFX_FloatRect& rect) override; |
| 225 | 225 |
| 226 void SetNotify(CPWL_List_Notify* pNotify); | 226 void SetNotify(CPWL_List_Notify* pNotify); |
| 227 void OnMouseDown(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); | 227 void OnMouseDown(const CFX_FloatPoint& point, bool bShift, bool bCtrl); |
| 228 void OnMouseMove(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); | 228 void OnMouseMove(const CFX_FloatPoint& point, bool bShift, bool bCtrl); |
| 229 void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl); | 229 void OnVK_UP(bool bShift, bool bCtrl); |
| 230 void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl); | 230 void OnVK_DOWN(bool bShift, bool bCtrl); |
| 231 void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl); | 231 void OnVK_LEFT(bool bShift, bool bCtrl); |
| 232 void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl); | 232 void OnVK_RIGHT(bool bShift, bool bCtrl); |
| 233 void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl); | 233 void OnVK_HOME(bool bShift, bool bCtrl); |
| 234 void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl); | 234 void OnVK_END(bool bShift, bool bCtrl); |
| 235 void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl); | 235 void OnVK(int32_t nItemIndex, bool bShift, bool bCtrl); |
| 236 FX_BOOL OnChar(uint16_t nChar, FX_BOOL bShift, FX_BOOL bCtrl); | 236 bool OnChar(uint16_t nChar, bool bShift, bool bCtrl); |
| 237 | 237 |
| 238 void SetScrollPos(const CFX_FloatPoint& point); | 238 void SetScrollPos(const CFX_FloatPoint& point); |
| 239 void ScrollToListItem(int32_t nItemIndex); | 239 void ScrollToListItem(int32_t nItemIndex); |
| 240 CFX_FloatRect GetItemRect(int32_t nIndex) const; | 240 CFX_FloatRect GetItemRect(int32_t nIndex) const; |
| 241 int32_t GetCaret() const; | 241 int32_t GetCaret() const; |
| 242 int32_t GetSelect() const; | 242 int32_t GetSelect() const; |
| 243 int32_t GetTopItem() const; | 243 int32_t GetTopItem() const; |
| 244 CFX_FloatRect GetContentRect() const; | 244 CFX_FloatRect GetContentRect() const; |
| 245 int32_t GetItemIndex(const CFX_FloatPoint& point) const; | 245 int32_t GetItemIndex(const CFX_FloatPoint& point) const; |
| 246 void AddString(const CFX_WideString& str); | 246 void AddString(const CFX_WideString& str); |
| 247 void SetTopItem(int32_t nIndex); | 247 void SetTopItem(int32_t nIndex); |
| 248 void Select(int32_t nItemIndex); | 248 void Select(int32_t nItemIndex); |
| 249 void SetCaret(int32_t nItemIndex); | 249 void SetCaret(int32_t nItemIndex); |
| 250 void Empty(); | 250 void Empty(); |
| 251 void Cancel(); | 251 void Cancel(); |
| 252 CFX_WideString GetText() const; | 252 CFX_WideString GetText() const; |
| 253 | 253 |
| 254 void SetFontMap(IPVT_FontMap* pFontMap); | 254 void SetFontMap(IPVT_FontMap* pFontMap); |
| 255 void SetFontSize(FX_FLOAT fFontSize); | 255 void SetFontSize(FX_FLOAT fFontSize); |
| 256 CFX_FloatRect GetPlateRect() const; | 256 CFX_FloatRect GetPlateRect() const; |
| 257 FX_FLOAT GetFontSize() const; | 257 FX_FLOAT GetFontSize() const; |
| 258 CFX_Edit* GetItemEdit(int32_t nIndex) const; | 258 CFX_Edit* GetItemEdit(int32_t nIndex) const; |
| 259 int32_t GetCount() const; | 259 int32_t GetCount() const; |
| 260 FX_BOOL IsItemSelected(int32_t nIndex) const; | 260 bool IsItemSelected(int32_t nIndex) const; |
| 261 FX_FLOAT GetFirstHeight() const; | 261 FX_FLOAT GetFirstHeight() const; |
| 262 void SetMultipleSel(FX_BOOL bMultiple); | 262 void SetMultipleSel(bool bMultiple); |
| 263 FX_BOOL IsMultipleSel() const; | 263 bool IsMultipleSel() const; |
| 264 FX_BOOL IsValid(int32_t nItemIndex) const; | 264 bool IsValid(int32_t nItemIndex) const; |
| 265 int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const; | 265 int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const; |
| 266 int32_t GetFirstSelected() const; | 266 int32_t GetFirstSelected() const; |
| 267 | 267 |
| 268 CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const; | 268 CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const; |
| 269 CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const; | 269 CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const; |
| 270 CFX_FloatRect InToOut(const CFX_FloatRect& rect) const; | 270 CFX_FloatRect InToOut(const CFX_FloatRect& rect) const; |
| 271 CFX_FloatRect OutToIn(const CFX_FloatRect& rect) const; | 271 CFX_FloatRect OutToIn(const CFX_FloatRect& rect) const; |
| 272 | 272 |
| 273 private: | 273 private: |
| 274 void ReArrange(int32_t nItemIndex); | 274 void ReArrange(int32_t nItemIndex); |
| 275 CFX_FloatRect GetItemRectInternal(int32_t nIndex) const; | 275 CFX_FloatRect GetItemRectInternal(int32_t nIndex) const; |
| 276 CFX_FloatRect GetContentRectInternal() const; | 276 CFX_FloatRect GetContentRectInternal() const; |
| 277 void SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected); | 277 void SetMultipleSelect(int32_t nItemIndex, bool bSelected); |
| 278 void SetSingleSelect(int32_t nItemIndex); | 278 void SetSingleSelect(int32_t nItemIndex); |
| 279 void InvalidateItem(int32_t nItemIndex); | 279 void InvalidateItem(int32_t nItemIndex); |
| 280 void SelectItems(); | 280 void SelectItems(); |
| 281 FX_BOOL IsItemVisible(int32_t nItemIndex) const; | 281 bool IsItemVisible(int32_t nItemIndex) const; |
| 282 void SetScrollInfo(); | 282 void SetScrollInfo(); |
| 283 void SetScrollPosY(FX_FLOAT fy); | 283 void SetScrollPosY(FX_FLOAT fy); |
| 284 void AddItem(const CFX_WideString& str); | 284 void AddItem(const CFX_WideString& str); |
| 285 CFX_WideString GetItemText(int32_t nIndex) const; | 285 CFX_WideString GetItemText(int32_t nIndex) const; |
| 286 void SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected); | 286 void SetItemSelect(int32_t nItemIndex, bool bSelected); |
| 287 int32_t GetLastSelected() const; | 287 int32_t GetLastSelected() const; |
| 288 FX_WCHAR Toupper(FX_WCHAR c) const; | 288 FX_WCHAR Toupper(FX_WCHAR c) const; |
| 289 | 289 |
| 290 CPWL_List_Notify* m_pNotify; | 290 CPWL_List_Notify* m_pNotify; |
| 291 FX_BOOL m_bNotifyFlag; | 291 bool m_bNotifyFlag; |
| 292 CFX_FloatPoint m_ptScrollPos; | 292 CFX_FloatPoint m_ptScrollPos; |
| 293 CPLST_Select m_aSelItems; // for multiple | 293 CPLST_Select m_aSelItems; // for multiple |
| 294 int32_t m_nSelItem; // for single | 294 int32_t m_nSelItem; // for single |
| 295 int32_t m_nFootIndex; // for multiple | 295 int32_t m_nFootIndex; // for multiple |
| 296 FX_BOOL m_bCtrlSel; // for multiple | 296 bool m_bCtrlSel; // for multiple |
| 297 int32_t m_nCaretIndex; // for multiple | 297 int32_t m_nCaretIndex; // for multiple |
| 298 CLST_ArrayTemplate<CFX_ListItem*> m_aListItems; | 298 CLST_ArrayTemplate<CFX_ListItem*> m_aListItems; |
| 299 FX_FLOAT m_fFontSize; | 299 FX_FLOAT m_fFontSize; |
| 300 IPVT_FontMap* m_pFontMap; | 300 IPVT_FontMap* m_pFontMap; |
| 301 FX_BOOL m_bMultiple; | 301 bool m_bMultiple; |
| 302 }; | 302 }; |
| 303 | 303 |
| 304 #endif // FPDFSDK_FXEDIT_FXET_LIST_H_ | 304 #endif // FPDFSDK_FXEDIT_FXET_LIST_H_ |
| OLD | NEW |