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_INCLUDE_FXET_LIST_H_ | 7 #ifndef FPDFSDK_FXEDIT_INCLUDE_FXET_LIST_H_ |
8 #define FPDFSDK_FXEDIT_INCLUDE_FXET_LIST_H_ | 8 #define FPDFSDK_FXEDIT_INCLUDE_FXET_LIST_H_ |
9 | 9 |
10 #include "fpdfsdk/fxedit/include/fx_edit.h" | 10 #include "fpdfsdk/fxedit/include/fx_edit.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 CLST_Rect(FX_FLOAT other_left, | 39 CLST_Rect(FX_FLOAT other_left, |
40 FX_FLOAT other_top, | 40 FX_FLOAT other_top, |
41 FX_FLOAT other_right, | 41 FX_FLOAT other_right, |
42 FX_FLOAT other_bottom) { | 42 FX_FLOAT other_bottom) { |
43 left = other_left; | 43 left = other_left; |
44 top = other_top; | 44 top = other_top; |
45 right = other_right; | 45 right = other_right; |
46 bottom = other_bottom; | 46 bottom = other_bottom; |
47 } | 47 } |
48 | 48 |
49 CLST_Rect(const CFX_FloatRect& rect) { | 49 explicit CLST_Rect(const CFX_FloatRect& rect) { |
50 left = rect.left; | 50 left = rect.left; |
51 top = rect.top; | 51 top = rect.top; |
52 right = rect.right; | 52 right = rect.right; |
53 bottom = rect.bottom; | 53 bottom = rect.bottom; |
54 } | 54 } |
55 | 55 |
56 ~CLST_Rect() {} | 56 ~CLST_Rect() {} |
57 | 57 |
58 void Default() { left = top = right = bottom = 0.0f; } | 58 void Default() { left = top = right = bottom = 0.0f; } |
59 | 59 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 return CLST_Rect(left + point.x, top + point.y, right + point.x, | 106 return CLST_Rect(left + point.x, top + point.y, right + point.x, |
107 bottom + point.y); | 107 bottom + point.y); |
108 } | 108 } |
109 | 109 |
110 CLST_Rect operator-(const CFX_FloatPoint& point) const { | 110 CLST_Rect operator-(const CFX_FloatPoint& point) const { |
111 return CLST_Rect(left - point.x, top - point.y, right - point.x, | 111 return CLST_Rect(left - point.x, top - point.y, right - point.x, |
112 bottom - point.y); | 112 bottom - point.y); |
113 } | 113 } |
114 }; | 114 }; |
115 | 115 |
116 class CFX_ListItem { | 116 class CFX_ListItem final { |
117 public: | 117 public: |
118 CFX_ListItem(); | 118 CFX_ListItem(); |
119 virtual ~CFX_ListItem(); | 119 ~CFX_ListItem(); |
120 | 120 |
121 void SetFontMap(IPVT_FontMap* pFontMap); | 121 void SetFontMap(IPVT_FontMap* pFontMap); |
122 IFX_Edit_Iterator* GetIterator() const; | |
123 IFX_Edit* GetEdit() const; | 122 IFX_Edit* GetEdit() const; |
124 | 123 |
125 public: | |
126 void SetRect(const CLST_Rect& rect); | 124 void SetRect(const CLST_Rect& rect); |
127 void SetSelect(FX_BOOL bSelected); | 125 void SetSelect(FX_BOOL bSelected); |
128 void SetCaret(FX_BOOL bCaret); | |
129 void SetText(const FX_WCHAR* text); | 126 void SetText(const FX_WCHAR* text); |
130 void SetFontSize(FX_FLOAT fFontSize); | 127 void SetFontSize(FX_FLOAT fFontSize); |
131 CFX_WideString GetText() const; | 128 CFX_WideString GetText() const; |
132 | 129 |
133 CLST_Rect GetRect() const; | 130 CLST_Rect GetRect() const; |
134 FX_BOOL IsSelected() const; | 131 FX_BOOL IsSelected() const; |
135 FX_BOOL IsCaret() const; | |
136 FX_FLOAT GetItemHeight() const; | 132 FX_FLOAT GetItemHeight() const; |
137 uint16_t GetFirstChar() const; | 133 uint16_t GetFirstChar() const; |
138 | 134 |
139 private: | 135 private: |
| 136 IFX_Edit_Iterator* GetIterator() const; |
| 137 |
140 IFX_Edit* m_pEdit; | 138 IFX_Edit* m_pEdit; |
141 FX_BOOL m_bSelected; | 139 FX_BOOL m_bSelected; |
142 FX_BOOL m_bCaret; | |
143 CLST_Rect m_rcListItem; | 140 CLST_Rect m_rcListItem; |
144 }; | 141 }; |
145 | 142 |
146 class CFX_ListContainer { | 143 class CFX_ListContainer { |
147 public: | 144 public: |
148 CFX_ListContainer() | 145 CFX_ListContainer() |
149 : m_rcPlate(0.0f, 0.0f, 0.0f, 0.0f), | 146 : m_rcPlate(0.0f, 0.0f, 0.0f, 0.0f), |
150 m_rcContent(0.0f, 0.0f, 0.0f, 0.0f) {} | 147 m_rcContent(0.0f, 0.0f, 0.0f, 0.0f) {} |
151 virtual ~CFX_ListContainer() {} | 148 virtual ~CFX_ListContainer() {} |
152 virtual void SetPlateRect(const CFX_FloatRect& rect) { m_rcPlate = rect; } | 149 virtual void SetPlateRect(const CFX_FloatRect& rect) { m_rcPlate = rect; } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 void Empty() override; | 223 void Empty() override; |
227 CFX_FloatRect GetItemRect(int32_t nIndex) const override; | 224 CFX_FloatRect GetItemRect(int32_t nIndex) const override; |
228 int32_t GetItemIndex(const CFX_FloatPoint& point) const override; | 225 int32_t GetItemIndex(const CFX_FloatPoint& point) const override; |
229 int32_t GetFirstSelected() const override; | 226 int32_t GetFirstSelected() const override; |
230 | 227 |
231 protected: | 228 protected: |
232 void AddItem(const FX_WCHAR* str); | 229 void AddItem(const FX_WCHAR* str); |
233 virtual void ReArrange(int32_t nItemIndex); | 230 virtual void ReArrange(int32_t nItemIndex); |
234 CFX_WideString GetItemText(int32_t nIndex) const; | 231 CFX_WideString GetItemText(int32_t nIndex) const; |
235 void SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected); | 232 void SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected); |
236 void SetItemCaret(int32_t nItemIndex, FX_BOOL bCaret); | |
237 int32_t GetLastSelected() const; | 233 int32_t GetLastSelected() const; |
238 FX_WCHAR Toupper(FX_WCHAR c) const; | 234 FX_WCHAR Toupper(FX_WCHAR c) const; |
239 | 235 |
240 private: | 236 private: |
241 CLST_ArrayTemplate<CFX_ListItem*> m_aListItems; | 237 CLST_ArrayTemplate<CFX_ListItem*> m_aListItems; |
242 FX_FLOAT m_fFontSize; | 238 FX_FLOAT m_fFontSize; |
243 IPVT_FontMap* m_pFontMap; | 239 IPVT_FontMap* m_pFontMap; |
244 FX_BOOL m_bMultiple; | 240 FX_BOOL m_bMultiple; |
245 }; | 241 }; |
246 | 242 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 FX_BOOL m_bNotifyFlag; | 330 FX_BOOL m_bNotifyFlag; |
335 CFX_FloatPoint m_ptScrollPos; | 331 CFX_FloatPoint m_ptScrollPos; |
336 CPLST_Select m_aSelItems; // for multiple | 332 CPLST_Select m_aSelItems; // for multiple |
337 int32_t m_nSelItem; // for single | 333 int32_t m_nSelItem; // for single |
338 int32_t m_nFootIndex; // for multiple | 334 int32_t m_nFootIndex; // for multiple |
339 FX_BOOL m_bCtrlSel; // for multiple | 335 FX_BOOL m_bCtrlSel; // for multiple |
340 int32_t m_nCaretIndex; // for multiple | 336 int32_t m_nCaretIndex; // for multiple |
341 }; | 337 }; |
342 | 338 |
343 #endif // FPDFSDK_FXEDIT_INCLUDE_FXET_LIST_H_ | 339 #endif // FPDFSDK_FXEDIT_INCLUDE_FXET_LIST_H_ |
OLD | NEW |