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_INCLUDE_FXEDIT_FXET_LIST_H_ | 7 #ifndef FPDFSDK_INCLUDE_FXEDIT_FXET_LIST_H_ |
8 #define FPDFSDK_INCLUDE_FXEDIT_FXET_LIST_H_ | 8 #define FPDFSDK_INCLUDE_FXEDIT_FXET_LIST_H_ |
9 | 9 |
10 #include "../../../core/include/fpdfapi/fpdf_parser.h" // For CPDF_Point. | 10 #include "../../../core/include/fpdfapi/fpdf_parser.h" // For CPDF_Point. |
(...skipping 13 matching lines...) Expand all Loading... |
24 x = other_x; | 24 x = other_x; |
25 y = other_y; | 25 y = other_y; |
26 } | 26 } |
27 | 27 |
28 void Default() | 28 void Default() |
29 { | 29 { |
30 x = 0.0f; | 30 x = 0.0f; |
31 y = 0.0f; | 31 y = 0.0f; |
32 } | 32 } |
33 | 33 |
34 » FX_BOOL operator != (const CLST_Size & size) const | 34 » bool operator != (const CLST_Size & size) const |
35 { | 35 { |
36 return FXSYS_memcmp(this, &size, sizeof(CLST_Size)) != 0; | 36 return FXSYS_memcmp(this, &size, sizeof(CLST_Size)) != 0; |
37 } | 37 } |
38 | 38 |
39 FX_FLOAT x,y; | 39 FX_FLOAT x,y; |
40 }; | 40 }; |
41 | 41 |
42 class CLST_Rect : public CPDF_Rect | 42 class CLST_Rect : public CPDF_Rect |
43 { | 43 { |
44 public: | 44 public: |
(...skipping 29 matching lines...) Expand all Loading... |
74 const CLST_Rect operator = (const CPDF_Rect & rect) | 74 const CLST_Rect operator = (const CPDF_Rect & rect) |
75 { | 75 { |
76 left = rect.left; | 76 left = rect.left; |
77 top = rect.top; | 77 top = rect.top; |
78 right = rect.right; | 78 right = rect.right; |
79 bottom = rect.bottom; | 79 bottom = rect.bottom; |
80 | 80 |
81 return *this; | 81 return *this; |
82 } | 82 } |
83 | 83 |
84 » FX_BOOL operator == (const CLST_Rect & rect) const | 84 » bool operator == (const CLST_Rect & rect) const |
85 { | 85 { |
86 return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) == 0; | 86 return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) == 0; |
87 } | 87 } |
88 | 88 |
89 » FX_BOOL operator != (const CLST_Rect & rect) const | 89 » bool operator != (const CLST_Rect & rect) const |
90 { | 90 { |
91 return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) != 0; | 91 return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) != 0; |
92 } | 92 } |
93 | 93 |
94 FX_FLOAT Width() const | 94 FX_FLOAT Width() const |
95 { | 95 { |
96 return right - left; | 96 return right - left; |
97 } | 97 } |
98 | 98 |
99 FX_FLOAT Height() const | 99 FX_FLOAT Height() const |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 public: | 155 public: |
156 CFX_ListItem(); | 156 CFX_ListItem(); |
157 virtual ~CFX_ListItem(); | 157 virtual ~CFX_ListItem(); |
158 | 158 |
159 void SetFontMap(IFX_E
dit_FontMap * pFontMap); | 159 void SetFontMap(IFX_E
dit_FontMap * pFontMap); |
160 IFX_Edit_Iterator* GetIterator() const; | 160 IFX_Edit_Iterator* GetIterator() const; |
161 IFX_Edit* GetEdit() const; | 161 IFX_Edit* GetEdit() const; |
162 | 162 |
163 public: | 163 public: |
164 void SetRect(const CL
ST_Rect & rect); | 164 void SetRect(const CL
ST_Rect & rect); |
165 » void» » » » » » » SetSelect(FX_BOO
L bSelected); | 165 » void» » » » » » » SetSelect(bool b
Selected); |
166 » void» » » » » » » SetCaret(FX_BOOL
bCaret); | 166 » void» » » » » » » SetCaret(bool bC
aret); |
167 void SetText(const FX
_WCHAR* text); | 167 void SetText(const FX
_WCHAR* text); |
168 void SetFontSize(FX_F
LOAT fFontSize); | 168 void SetFontSize(FX_F
LOAT fFontSize); |
169 CFX_WideString GetText() const; | 169 CFX_WideString GetText() const; |
170 | 170 |
171 CLST_Rect GetRect() const; | 171 CLST_Rect GetRect() const; |
172 » FX_BOOL»» » » » » » IsSelected() con
st; | 172 » bool» » » » » » » IsSelected() con
st; |
173 » FX_BOOL»» » » » » » IsCaret() const; | 173 » bool» » » » » » » IsCaret() const; |
174 FX_FLOAT GetItemHeight()
const; | 174 FX_FLOAT GetItemHeight()
const; |
175 FX_WORD GetFirstChar() c
onst; | 175 FX_WORD GetFirstChar() c
onst; |
176 | 176 |
177 private: | 177 private: |
178 IFX_Edit* m_pEdit; | 178 IFX_Edit* m_pEdit; |
179 » FX_BOOL»» » » » » » m_bSelected; | 179 » bool» » » » » » » m_bSelected; |
180 » FX_BOOL»» » » » » » m_bCaret; | 180 » bool» » » » » » » m_bCaret; |
181 CLST_Rect m_rcListItem; | 181 CLST_Rect m_rcListItem; |
182 }; | 182 }; |
183 | 183 |
184 class CFX_ListContainer | 184 class CFX_ListContainer |
185 { | 185 { |
186 public: | 186 public: |
187 CFX_ListContainer() : m_rcPlate(0.0f,0.0f,0.0f,0.0f), m_rcContent(0.0f,0
.0f,0.0f,0.0f){} | 187 CFX_ListContainer() : m_rcPlate(0.0f,0.0f,0.0f,0.0f), m_rcContent(0.0f,0
.0f,0.0f,0.0f){} |
188 virtual ~CFX_ListContainer(){} | 188 virtual ~CFX_ListContainer(){} |
189 virtual void SetPlateRect(const CPDF_
Rect & rect){m_rcPlate = rect;} | 189 virtual void SetPlateRect(const CPDF_
Rect & rect){m_rcPlate = rect;} |
190 CPDF_Rect GetPlateRect() c
onst{return m_rcPlate;} | 190 CPDF_Rect GetPlateRect() c
onst{return m_rcPlate;} |
(...skipping 11 matching lines...) Expand all Loading... |
202
CPDF_Poi
nt ptRightBottom = OuterToInner(CPDF_Point(rect.right,rect.bottom)); | 202
CPDF_Poi
nt ptRightBottom = OuterToInner(CPDF_Point(rect.right,rect.bottom)); |
203
return C
LST_Rect(ptLeftTop.x,ptLeftTop.y,ptRightBottom.x,ptRightBottom.y);} | 203
return C
LST_Rect(ptLeftTop.x,ptLeftTop.y,ptRightBottom.x,ptRightBottom.y);} |
204 private: | 204 private: |
205 CPDF_Rect m_rcPlate; | 205 CPDF_Rect m_rcPlate; |
206 CLST_Rect m_rcContent;
//positive forever! | 206 CLST_Rect m_rcContent;
//positive forever! |
207 }; | 207 }; |
208 | 208 |
209 template<class TYPE> class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE> | 209 template<class TYPE> class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE> |
210 { | 210 { |
211 public: | 211 public: |
212 » FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; } | 212 » bool IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; } |
213 TYPE GetAt(int32_t nIndex) const { if (nIndex >= 0 && nIndex < CFX_Array
Template<TYPE>::GetSize()) return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); return
NULL;} | 213 TYPE GetAt(int32_t nIndex) const { if (nIndex >= 0 && nIndex < CFX_Array
Template<TYPE>::GetSize()) return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); return
NULL;} |
214 void RemoveAt(int32_t nIndex){if (nIndex >= 0 && nIndex < CFX_ArrayTempl
ate<TYPE>::GetSize()) CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);} | 214 void RemoveAt(int32_t nIndex){if (nIndex >= 0 && nIndex < CFX_ArrayTempl
ate<TYPE>::GetSize()) CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);} |
215 }; | 215 }; |
216 | 216 |
217 class CFX_List : protected CFX_ListContainer , public IFX_List | 217 class CFX_List : protected CFX_ListContainer , public IFX_List |
218 { | 218 { |
219 public: | 219 public: |
220 CFX_List(); | 220 CFX_List(); |
221 virtual ~CFX_List(); | 221 virtual ~CFX_List(); |
222 | 222 |
223 public: | 223 public: |
224 virtual void SetFontMap(IFX_Edit_Font
Map * pFontMap); | 224 virtual void SetFontMap(IFX_Edit_Font
Map * pFontMap); |
225 virtual void SetFontSize(FX_FLOAT fFo
ntSize); | 225 virtual void SetFontSize(FX_FLOAT fFo
ntSize); |
226 | 226 |
227 virtual CPDF_Rect GetPlateRect() const; | 227 virtual CPDF_Rect GetPlateRect() const; |
228 virtual CPDF_Rect GetContentRect() const; | 228 virtual CPDF_Rect GetContentRect() const; |
229 | 229 |
230 virtual FX_FLOAT GetFontSize() const; | 230 virtual FX_FLOAT GetFontSize() const; |
231 virtual IFX_Edit* GetItemEdit(int32_t nInd
ex) const; | 231 virtual IFX_Edit* GetItemEdit(int32_t nInd
ex) const; |
232 virtual int32_t GetCount() const; | 232 virtual int32_t GetCount() const; |
233 » virtual FX_BOOL»» » » » IsItemSelected(int32_t n
Index) const; | 233 » virtual bool» » » » » IsItemSelected(int32_t n
Index) const; |
234 virtual FX_FLOAT GetFirstHeight() const; | 234 virtual FX_FLOAT GetFirstHeight() const; |
235 | 235 |
236 » virtual void» » » » » SetMultipleSel(FX_BOOL b
Multiple); | 236 » virtual void» » » » » SetMultipleSel(bool bMul
tiple); |
237 » virtual FX_BOOL»» » » » IsMultipleSel() const; | 237 » virtual bool» » » » » IsMultipleSel() const; |
238 » virtual FX_BOOL»» » » » IsValid(int32_t nItemInd
ex) const; | 238 » virtual bool» » » » » IsValid(int32_t nItemInd
ex) const; |
239 virtual int32_t FindNext(int32_t nIndex,FX_WCHAR
nChar) const; | 239 virtual int32_t FindNext(int32_t nIndex,FX_WCHAR
nChar) const; |
240 | 240 |
241 protected: | 241 protected: |
242 virtual void Empty(); | 242 virtual void Empty(); |
243 | 243 |
244 void AddItem(const FX
_WCHAR* str); | 244 void AddItem(const FX
_WCHAR* str); |
245 virtual void ReArrange(int32_t nItemI
ndex); | 245 virtual void ReArrange(int32_t nItemI
ndex); |
246 | 246 |
247 virtual CPDF_Rect GetItemRect(int32_t nInd
ex) const; | 247 virtual CPDF_Rect GetItemRect(int32_t nInd
ex) const; |
248 CFX_WideString GetItemText(int32_t nInd
ex) const; | 248 CFX_WideString GetItemText(int32_t nInd
ex) const; |
249 | 249 |
250 » void» » » » » » » SetItemSelect(in
t32_t nItemIndex, FX_BOOL bSelected); | 250 » void» » » » » » » SetItemSelect(in
t32_t nItemIndex, bool bSelected); |
251 » void» » » » » » » SetItemCaret(int
32_t nItemIndex, FX_BOOL bCaret); | 251 » void» » » » » » » SetItemCaret(int
32_t nItemIndex, bool bCaret); |
252 | 252 |
253 virtual int32_t GetItemIndex(const CPDF_Point &
point) const; | 253 virtual int32_t GetItemIndex(const CPDF_Point &
point) const; |
254 int32_t GetFirstSelected() const
; | 254 int32_t GetFirstSelected() const
; |
255 int32_t GetLastSelected() const; | 255 int32_t GetLastSelected() const; |
256 FX_WCHAR Toupper(FX_WCHAR
c) const; | 256 FX_WCHAR Toupper(FX_WCHAR
c) const; |
257 | 257 |
258 private: | 258 private: |
259 CLST_ArrayTemplate<CFX_ListItem*> m_aListItems; | 259 CLST_ArrayTemplate<CFX_ListItem*> m_aListItems; |
260 FX_FLOAT m_fFontS
ize; | 260 FX_FLOAT m_fFontS
ize; |
261 IFX_Edit_FontMap* m_pFontMap; | 261 IFX_Edit_FontMap* m_pFontMap; |
262 » FX_BOOL»» » » » » » » m_bMulti
ple; | 262 » bool» » » » » » » » m_bMulti
ple; |
263 }; | 263 }; |
264 | 264 |
265 struct CPLST_Select_Item | 265 struct CPLST_Select_Item |
266 { | 266 { |
267 CPLST_Select_Item(int32_t other_nItemIndex, int32_t other_nState) | 267 CPLST_Select_Item(int32_t other_nItemIndex, int32_t other_nState) |
268 { | 268 { |
269 nItemIndex = other_nItemIndex; | 269 nItemIndex = other_nItemIndex; |
270 nState = other_nState; | 270 nState = other_nState; |
271 } | 271 } |
272 | 272 |
273 int32_t nItemIndex; | 273 int32_t nItemIndex; |
274 int32_t nState; //0:normal select -1:to deselect 1: to select | 274 int32_t nState; //0:normal select -1:to deselect 1: to select |
275 }; | 275 }; |
276 | 276 |
277 class CPLST_Select | 277 class CPLST_Select |
278 { | 278 { |
279 public: | 279 public: |
280 CPLST_Select(); | 280 CPLST_Select(); |
281 virtual ~CPLST_Select(); | 281 virtual ~CPLST_Select(); |
282 | 282 |
283 public: | 283 public: |
284 void Add(int32_t nIte
mIndex); | 284 void Add(int32_t nIte
mIndex); |
285 void Add(int32_t nBeg
inIndex, int32_t nEndIndex); | 285 void Add(int32_t nBeg
inIndex, int32_t nEndIndex); |
286 void Sub(int32_t nIte
mIndex); | 286 void Sub(int32_t nIte
mIndex); |
287 void Sub(int32_t nBeg
inIndex, int32_t nEndIndex); | 287 void Sub(int32_t nBeg
inIndex, int32_t nEndIndex); |
288 » FX_BOOL»» » » » » » IsExist(int32_t
nItemIndex) const; | 288 » bool» » » » » » » IsExist(int32_t
nItemIndex) const; |
289 int32_t Find(int32_t nItemIndex)
const; | 289 int32_t Find(int32_t nItemIndex)
const; |
290 int32_t GetCount() const; | 290 int32_t GetCount() const; |
291 int32_t GetItemIndex(int32_t nIn
dex) const; | 291 int32_t GetItemIndex(int32_t nIn
dex) const; |
292 int32_t GetState(int32_t nIndex)
const; | 292 int32_t GetState(int32_t nIndex)
const; |
293 void Done(); | 293 void Done(); |
294 void DeselectAll(); | 294 void DeselectAll(); |
295 | 295 |
296 private: | 296 private: |
297 CFX_ArrayTemplate<CPLST_Select_Item*> m_aItems; | 297 CFX_ArrayTemplate<CPLST_Select_Item*> m_aItems; |
298 }; | 298 }; |
299 | 299 |
300 class CFX_ListCtrl : public CFX_List | 300 class CFX_ListCtrl : public CFX_List |
301 { | 301 { |
302 public: | 302 public: |
303 CFX_ListCtrl(); | 303 CFX_ListCtrl(); |
304 virtual ~CFX_ListCtrl(); | 304 virtual ~CFX_ListCtrl(); |
305 | 305 |
306 public: | 306 public: |
307 void SetNotify(IFX_Li
st_Notify * pNotify); | 307 void SetNotify(IFX_Li
st_Notify * pNotify); |
308 | 308 |
309 » void» » » » » » » OnMouseDown(cons
t CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl); | 309 » void» » » » » » » OnMouseDown(cons
t CPDF_Point & point,bool bShift,bool bCtrl); |
310 » void» » » » » » » OnMouseMove(cons
t CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl); | 310 » void» » » » » » » OnMouseMove(cons
t CPDF_Point & point,bool bShift,bool bCtrl); |
311 » void» » » » » » » OnVK_UP(FX_BOOL
bShift,FX_BOOL bCtrl); | 311 » void» » » » » » » OnVK_UP(bool bSh
ift,bool bCtrl); |
312 » void» » » » » » » OnVK_DOWN(FX_BOO
L bShift,FX_BOOL bCtrl); | 312 » void» » » » » » » OnVK_DOWN(bool b
Shift,bool bCtrl); |
313 » void» » » » » » » OnVK_LEFT(FX_BOO
L bShift,FX_BOOL bCtrl); | 313 » void» » » » » » » OnVK_LEFT(bool b
Shift,bool bCtrl); |
314 » void» » » » » » » OnVK_RIGHT(FX_BO
OL bShift,FX_BOOL bCtrl); | 314 » void» » » » » » » OnVK_RIGHT(bool
bShift,bool bCtrl); |
315 » void» » » » » » » OnVK_HOME(FX_BOO
L bShift,FX_BOOL bCtrl); | 315 » void» » » » » » » OnVK_HOME(bool b
Shift,bool bCtrl); |
316 » void» » » » » » » OnVK_END(FX_BOOL
bShift,FX_BOOL bCtrl); | 316 » void» » » » » » » OnVK_END(bool bS
hift,bool bCtrl); |
317 » void» » » » » » » OnVK(int32_t nIt
emIndex,FX_BOOL bShift,FX_BOOL bCtrl); | 317 » void» » » » » » » OnVK(int32_t nIt
emIndex,bool bShift,bool bCtrl); |
318 » FX_BOOL»» » » » » » OnChar(FX_WORD n
Char,FX_BOOL bShift,FX_BOOL bCtrl); | 318 » bool» » » » » » » OnChar(FX_WORD n
Char,bool bShift,bool bCtrl); |
319 | 319 |
320 virtual CPDF_Point InToOut(const CPDF_Point
& point) const; | 320 virtual CPDF_Point InToOut(const CPDF_Point
& point) const; |
321 virtual CPDF_Point OutToIn(const CPDF_Point
& point) const; | 321 virtual CPDF_Point OutToIn(const CPDF_Point
& point) const; |
322 virtual CPDF_Rect InToOut(const CPDF_Rect
& rect) const; | 322 virtual CPDF_Rect InToOut(const CPDF_Rect
& rect) const; |
323 virtual CPDF_Rect OutToIn(const CPDF_Rect
& rect) const; | 323 virtual CPDF_Rect OutToIn(const CPDF_Rect
& rect) const; |
324 | 324 |
325 virtual void SetPlateRect(const CPDF_
Rect & rect); | 325 virtual void SetPlateRect(const CPDF_
Rect & rect); |
326 void SetScrollPos(con
st CPDF_Point & point); | 326 void SetScrollPos(con
st CPDF_Point & point); |
327 void ScrollToListItem
(int32_t nItemIndex); | 327 void ScrollToListItem
(int32_t nItemIndex); |
328 virtual CPDF_Rect GetItemRect(int32_t nInd
ex) const; | 328 virtual CPDF_Rect GetItemRect(int32_t nInd
ex) const; |
329 int32_t GetCaret() const {return
m_nCaretIndex;} | 329 int32_t GetCaret() const {return
m_nCaretIndex;} |
330 int32_t GetSelect() const {retur
n m_nSelItem;} | 330 int32_t GetSelect() const {retur
n m_nSelItem;} |
331 int32_t GetTopItem() const; | 331 int32_t GetTopItem() const; |
332 virtual CPDF_Rect GetContentRect() const; | 332 virtual CPDF_Rect GetContentRect() const; |
333 virtual int32_t GetItemIndex(const CPDF_Point &
point) const; | 333 virtual int32_t GetItemIndex(const CPDF_Point &
point) const; |
334 | 334 |
335 void AddString(const
FX_WCHAR* string); | 335 void AddString(const
FX_WCHAR* string); |
336 void SetTopItem(int32
_t nIndex); | 336 void SetTopItem(int32
_t nIndex); |
337 void Select(int32_t n
ItemIndex); | 337 void Select(int32_t n
ItemIndex); |
338 virtual void SetCaret(int32_t nItemIn
dex); | 338 virtual void SetCaret(int32_t nItemIn
dex); |
339 virtual void Empty(); | 339 virtual void Empty(); |
340 virtual void Cancel(); | 340 virtual void Cancel(); |
341 CFX_WideString GetText() const; | 341 CFX_WideString GetText() const; |
342 | 342 |
343 private: | 343 private: |
344 » void» » » » » » » SetMultipleSelec
t(int32_t nItemIndex, FX_BOOL bSelected); | 344 » void» » » » » » » SetMultipleSelec
t(int32_t nItemIndex, bool bSelected); |
345 void SetSingleSelect(
int32_t nItemIndex); | 345 void SetSingleSelect(
int32_t nItemIndex); |
346 void InvalidateItem(i
nt32_t nItemIndex); | 346 void InvalidateItem(i
nt32_t nItemIndex); |
347 void SelectItems(); | 347 void SelectItems(); |
348 » FX_BOOL»» » » » » » IsItemVisible(in
t32_t nItemIndex) const; | 348 » bool» » » » » » » IsItemVisible(in
t32_t nItemIndex) const; |
349 void SetScrollInfo(); | 349 void SetScrollInfo(); |
350 void SetScrollPosY(FX
_FLOAT fy); | 350 void SetScrollPosY(FX
_FLOAT fy); |
351 virtual void ReArrange(int32_t nItemI
ndex); | 351 virtual void ReArrange(int32_t nItemI
ndex); |
352 | 352 |
353 private: | 353 private: |
354 IFX_List_Notify* m_pNotify; | 354 IFX_List_Notify* m_pNotify; |
355 » FX_BOOL»» » » » » » m_bNotifyFlag; | 355 » bool» » » » » » » m_bNotifyFlag; |
356 CPDF_Point m_ptScrollPos; | 356 CPDF_Point m_ptScrollPos; |
357 CPLST_Select m_aSelItems; //for mu
ltiple | 357 CPLST_Select m_aSelItems; //for mu
ltiple |
358 int32_t m_nSelItem;
//for single | 358 int32_t m_nSelItem;
//for single |
359 int32_t m_nFootIndex; //for mu
ltiple | 359 int32_t m_nFootIndex; //for mu
ltiple |
360 » FX_BOOL»» » » » » » m_bCtrlSel;»
» //for multiple | 360 » bool» » » » » » » m_bCtrlSel;»
» //for multiple |
361 int32_t m_nCaretIndex; //for mu
ltiple | 361 int32_t m_nCaretIndex; //for mu
ltiple |
362 }; | 362 }; |
363 | 363 |
364 #endif // FPDFSDK_INCLUDE_FXEDIT_FXET_LIST_H_ | 364 #endif // FPDFSDK_INCLUDE_FXEDIT_FXET_LIST_H_ |
OLD | NEW |