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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202
return C
LST_Rect(ptLeftTop.x,ptLeftTop.y,ptRightBottom.x,ptRightBottom.y);} | 202
return C
LST_Rect(ptLeftTop.x,ptLeftTop.y,ptRightBottom.x,ptRightBottom.y);} |
203 private: | 203 private: |
204 CPDF_Rect m_rcPlate; | 204 CPDF_Rect m_rcPlate; |
205 CLST_Rect m_rcContent;
//positive forever! | 205 CLST_Rect m_rcContent;
//positive forever! |
206 }; | 206 }; |
207 | 207 |
208 template<class TYPE> class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE> | 208 template<class TYPE> class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE> |
209 { | 209 { |
210 public: | 210 public: |
211 FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; } | 211 FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; } |
212 » TYPE GetAt(FX_INT32 nIndex) const { if (nIndex >= 0 && nIndex < CFX_Arra
yTemplate<TYPE>::GetSize()) return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); retur
n NULL;} | 212 » TYPE GetAt(int32_t nIndex) const { if (nIndex >= 0 && nIndex < CFX_Array
Template<TYPE>::GetSize()) return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); return
NULL;} |
213 » void RemoveAt(FX_INT32 nIndex){if (nIndex >= 0 && nIndex < CFX_ArrayTemp
late<TYPE>::GetSize()) CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);} | 213 » void RemoveAt(int32_t nIndex){if (nIndex >= 0 && nIndex < CFX_ArrayTempl
ate<TYPE>::GetSize()) CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);} |
214 }; | 214 }; |
215 | 215 |
216 class CFX_List : protected CFX_ListContainer , public IFX_List | 216 class CFX_List : protected CFX_ListContainer , public IFX_List |
217 { | 217 { |
218 public: | 218 public: |
219 CFX_List(); | 219 CFX_List(); |
220 virtual ~CFX_List(); | 220 virtual ~CFX_List(); |
221 | 221 |
222 public: | 222 public: |
223 virtual void SetFontMap(IFX_Edit_Font
Map * pFontMap); | 223 virtual void SetFontMap(IFX_Edit_Font
Map * pFontMap); |
224 virtual void SetFontSize(FX_FLOAT fFo
ntSize); | 224 virtual void SetFontSize(FX_FLOAT fFo
ntSize); |
225 | 225 |
226 virtual CPDF_Rect GetPlateRect() const; | 226 virtual CPDF_Rect GetPlateRect() const; |
227 virtual CPDF_Rect GetContentRect() const; | 227 virtual CPDF_Rect GetContentRect() const; |
228 | 228 |
229 virtual FX_FLOAT GetFontSize() const; | 229 virtual FX_FLOAT GetFontSize() const; |
230 » virtual IFX_Edit*» » » » GetItemEdit(FX_INT32 nIn
dex) const; | 230 » virtual IFX_Edit*» » » » GetItemEdit(int32_t nInd
ex) const; |
231 » virtual FX_INT32» » » » GetCount() const; | 231 » virtual int32_t»» » » GetCount() const; |
232 » virtual FX_BOOL»» » » » IsItemSelected(FX_INT32
nIndex) const; | 232 » virtual FX_BOOL»» » » » IsItemSelected(int32_t n
Index) const; |
233 virtual FX_FLOAT GetFirstHeight() const; | 233 virtual FX_FLOAT GetFirstHeight() const; |
234 | 234 |
235 virtual void SetMultipleSel(FX_BOOL b
Multiple); | 235 virtual void SetMultipleSel(FX_BOOL b
Multiple); |
236 virtual FX_BOOL IsMultipleSel() const; | 236 virtual FX_BOOL IsMultipleSel() const; |
237 » virtual FX_BOOL»» » » » IsValid(FX_INT32 nItemIn
dex) const; | 237 » virtual FX_BOOL»» » » » IsValid(int32_t nItemInd
ex) const; |
238 » virtual FX_INT32» » » » FindNext(FX_INT32 nIndex
,FX_WCHAR nChar) const; | 238 » virtual int32_t»» » » FindNext(int32_t nIndex,FX_WCHAR
nChar) const; |
239 | 239 |
240 protected: | 240 protected: |
241 virtual void Empty(); | 241 virtual void Empty(); |
242 | 242 |
243 void AddItem(FX_LPCWS
TR str); | 243 void AddItem(FX_LPCWS
TR str); |
244 » virtual void» » » » » ReArrange(FX_INT32 nItem
Index); | 244 » virtual void» » » » » ReArrange(int32_t nItemI
ndex); |
245 | 245 |
246 » virtual CPDF_Rect» » » » GetItemRect(FX_INT32 nIn
dex) const; | 246 » virtual CPDF_Rect» » » » GetItemRect(int32_t nInd
ex) const; |
247 » CFX_WideString» » » » » GetItemText(FX_INT32 nIn
dex) const; | 247 » CFX_WideString» » » » » GetItemText(int32_t nInd
ex) const; |
248 | 248 |
249 » void» » » » » » » SetItemSelect(FX
_INT32 nItemIndex, FX_BOOL bSelected); | 249 » void» » » » » » » SetItemSelect(in
t32_t nItemIndex, FX_BOOL bSelected); |
250 » void» » » » » » » SetItemCaret(FX_
INT32 nItemIndex, FX_BOOL bCaret); | 250 » void» » » » » » » SetItemCaret(int
32_t nItemIndex, FX_BOOL bCaret); |
251 | 251 |
252 » virtual FX_INT32» » » » GetItemIndex(const CPDF_
Point & point) const; | 252 » virtual int32_t»» » » GetItemIndex(const CPDF_Point &
point) const; |
253 » FX_INT32» » » » » » GetFirstSelected
() const; | 253 » int32_t»» » » » » GetFirstSelected() const
; |
254 » FX_INT32» » » » » » GetLastSelected(
) const; | 254 » int32_t»» » » » » GetLastSelected() const; |
255 FX_WCHAR Toupper(FX_WCHAR
c) const; | 255 FX_WCHAR Toupper(FX_WCHAR
c) const; |
256 | 256 |
257 private: | 257 private: |
258 CLST_ArrayTemplate<CFX_ListItem*> m_aListItems; | 258 CLST_ArrayTemplate<CFX_ListItem*> m_aListItems; |
259 FX_FLOAT m_fFontS
ize; | 259 FX_FLOAT m_fFontS
ize; |
260 IFX_Edit_FontMap* m_pFontMap; | 260 IFX_Edit_FontMap* m_pFontMap; |
261 FX_BOOL m_bMulti
ple; | 261 FX_BOOL m_bMulti
ple; |
262 }; | 262 }; |
263 | 263 |
264 struct CPLST_Select_Item | 264 struct CPLST_Select_Item |
265 { | 265 { |
266 » CPLST_Select_Item(FX_INT32 nItemIndex,FX_INT32 nState) | 266 » CPLST_Select_Item(int32_t nItemIndex,int32_t nState) |
267 { | 267 { |
268 this->nItemIndex = nItemIndex; | 268 this->nItemIndex = nItemIndex; |
269 this->nState = nState; | 269 this->nState = nState; |
270 } | 270 } |
271 | 271 |
272 » FX_INT32» » nItemIndex; | 272 » int32_t»» nItemIndex; |
273 » FX_INT32» » nState; //0:normal select -1:to deselect 1: to s
elect | 273 » int32_t»» nState; //0:normal select -1:to deselect 1: to select |
274 }; | 274 }; |
275 | 275 |
276 class CPLST_Select | 276 class CPLST_Select |
277 { | 277 { |
278 public: | 278 public: |
279 CPLST_Select(); | 279 CPLST_Select(); |
280 virtual ~CPLST_Select(); | 280 virtual ~CPLST_Select(); |
281 | 281 |
282 public: | 282 public: |
283 » void» » » » » » » Add(FX_INT32 nIt
emIndex); | 283 » void» » » » » » » Add(int32_t nIte
mIndex); |
284 » void» » » » » » » Add(FX_INT32 nBe
ginIndex, FX_INT32 nEndIndex); | 284 » void» » » » » » » Add(int32_t nBeg
inIndex, int32_t nEndIndex); |
285 » void» » » » » » » Sub(FX_INT32 nIt
emIndex); | 285 » void» » » » » » » Sub(int32_t nIte
mIndex); |
286 » void» » » » » » » Sub(FX_INT32 nBe
ginIndex, FX_INT32 nEndIndex); | 286 » void» » » » » » » Sub(int32_t nBeg
inIndex, int32_t nEndIndex); |
287 » FX_BOOL»» » » » » » IsExist(FX_INT32
nItemIndex) const; | 287 » FX_BOOL»» » » » » » IsExist(int32_t
nItemIndex) const; |
288 » FX_INT32» » » » » » Find(FX_INT32 nI
temIndex) const; | 288 » int32_t»» » » » » Find(int32_t nItemIndex)
const; |
289 » FX_INT32» » » » » » GetCount() const
; | 289 » int32_t»» » » » » GetCount() const; |
290 » FX_INT32» » » » » » GetItemIndex(FX_
INT32 nIndex) const; | 290 » int32_t»» » » » » GetItemIndex(int32_t nIn
dex) const; |
291 » FX_INT32» » » » » » GetState(FX_INT3
2 nIndex) const; | 291 » int32_t»» » » » » GetState(int32_t nIndex)
const; |
292 void Done(); | 292 void Done(); |
293 void DeselectAll(); | 293 void DeselectAll(); |
294 | 294 |
295 private: | 295 private: |
296 CFX_ArrayTemplate<CPLST_Select_Item*> m_aItems; | 296 CFX_ArrayTemplate<CPLST_Select_Item*> m_aItems; |
297 }; | 297 }; |
298 | 298 |
299 class CFX_ListCtrl : public CFX_List | 299 class CFX_ListCtrl : public CFX_List |
300 { | 300 { |
301 public: | 301 public: |
302 CFX_ListCtrl(); | 302 CFX_ListCtrl(); |
303 virtual ~CFX_ListCtrl(); | 303 virtual ~CFX_ListCtrl(); |
304 | 304 |
305 public: | 305 public: |
306 void SetNotify(IFX_Li
st_Notify * pNotify); | 306 void SetNotify(IFX_Li
st_Notify * pNotify); |
307 | 307 |
308 void OnMouseDown(cons
t CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl); | 308 void OnMouseDown(cons
t CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl); |
309 void OnMouseMove(cons
t CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl); | 309 void OnMouseMove(cons
t CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl); |
310 void OnVK_UP(FX_BOOL
bShift,FX_BOOL bCtrl); | 310 void OnVK_UP(FX_BOOL
bShift,FX_BOOL bCtrl); |
311 void OnVK_DOWN(FX_BOO
L bShift,FX_BOOL bCtrl); | 311 void OnVK_DOWN(FX_BOO
L bShift,FX_BOOL bCtrl); |
312 void OnVK_LEFT(FX_BOO
L bShift,FX_BOOL bCtrl); | 312 void OnVK_LEFT(FX_BOO
L bShift,FX_BOOL bCtrl); |
313 void OnVK_RIGHT(FX_BO
OL bShift,FX_BOOL bCtrl); | 313 void OnVK_RIGHT(FX_BO
OL bShift,FX_BOOL bCtrl); |
314 void OnVK_HOME(FX_BOO
L bShift,FX_BOOL bCtrl); | 314 void OnVK_HOME(FX_BOO
L bShift,FX_BOOL bCtrl); |
315 void OnVK_END(FX_BOOL
bShift,FX_BOOL bCtrl); | 315 void OnVK_END(FX_BOOL
bShift,FX_BOOL bCtrl); |
316 » void» » » » » » » OnVK(FX_INT32 nI
temIndex,FX_BOOL bShift,FX_BOOL bCtrl); | 316 » void» » » » » » » OnVK(int32_t nIt
emIndex,FX_BOOL bShift,FX_BOOL bCtrl); |
317 FX_BOOL OnChar(FX_WORD n
Char,FX_BOOL bShift,FX_BOOL bCtrl); | 317 FX_BOOL OnChar(FX_WORD n
Char,FX_BOOL bShift,FX_BOOL bCtrl); |
318 | 318 |
319 virtual CPDF_Point InToOut(const CPDF_Point
& point) const; | 319 virtual CPDF_Point InToOut(const CPDF_Point
& point) const; |
320 virtual CPDF_Point OutToIn(const CPDF_Point
& point) const; | 320 virtual CPDF_Point OutToIn(const CPDF_Point
& point) const; |
321 virtual CPDF_Rect InToOut(const CPDF_Rect
& rect) const; | 321 virtual CPDF_Rect InToOut(const CPDF_Rect
& rect) const; |
322 virtual CPDF_Rect OutToIn(const CPDF_Rect
& rect) const; | 322 virtual CPDF_Rect OutToIn(const CPDF_Rect
& rect) const; |
323 | 323 |
324 virtual void SetPlateRect(const CPDF_
Rect & rect); | 324 virtual void SetPlateRect(const CPDF_
Rect & rect); |
325 void SetScrollPos(con
st CPDF_Point & point); | 325 void SetScrollPos(con
st CPDF_Point & point); |
326 » void» » » » » » » ScrollToListItem
(FX_INT32 nItemIndex); | 326 » void» » » » » » » ScrollToListItem
(int32_t nItemIndex); |
327 » virtual CPDF_Rect» » » » GetItemRect(FX_INT32 nIn
dex) const; | 327 » virtual CPDF_Rect» » » » GetItemRect(int32_t nInd
ex) const; |
328 » FX_INT32» » » » » » GetCaret() const
{return m_nCaretIndex;} | 328 » int32_t»» » » » » GetCaret() const {return
m_nCaretIndex;} |
329 » FX_INT32» » » » » » GetSelect() cons
t {return m_nSelItem;} | 329 » int32_t»» » » » » GetSelect() const {retur
n m_nSelItem;} |
330 » FX_INT32» » » » » » GetTopItem() con
st; | 330 » int32_t»» » » » » GetTopItem() const; |
331 virtual CPDF_Rect GetContentRect() const; | 331 virtual CPDF_Rect GetContentRect() const; |
332 » virtual FX_INT32» » » » GetItemIndex(const CPDF_
Point & point) const; | 332 » virtual int32_t»» » » GetItemIndex(const CPDF_Point &
point) const; |
333 | 333 |
334 void AddString(FX_LPC
WSTR string); | 334 void AddString(FX_LPC
WSTR string); |
335 » void» » » » » » » SetTopItem(FX_IN
T32 nIndex); | 335 » void» » » » » » » SetTopItem(int32
_t nIndex); |
336 » void» » » » » » » Select(FX_INT32
nItemIndex); | 336 » void» » » » » » » Select(int32_t n
ItemIndex); |
337 » virtual void» » » » » SetCaret(FX_INT32 nItemI
ndex); | 337 » virtual void» » » » » SetCaret(int32_t nItemIn
dex); |
338 virtual void Empty(); | 338 virtual void Empty(); |
339 virtual void Cancel(); | 339 virtual void Cancel(); |
340 CFX_WideString GetText() const; | 340 CFX_WideString GetText() const; |
341 | 341 |
342 private: | 342 private: |
343 » void» » » » » » » SetMultipleSelec
t(FX_INT32 nItemIndex, FX_BOOL bSelected); | 343 » void» » » » » » » SetMultipleSelec
t(int32_t nItemIndex, FX_BOOL bSelected); |
344 » void» » » » » » » SetSingleSelect(
FX_INT32 nItemIndex); | 344 » void» » » » » » » SetSingleSelect(
int32_t nItemIndex); |
345 » void» » » » » » » InvalidateItem(F
X_INT32 nItemIndex); | 345 » void» » » » » » » InvalidateItem(i
nt32_t nItemIndex); |
346 void SelectItems(); | 346 void SelectItems(); |
347 » FX_BOOL»» » » » » » IsItemVisible(FX
_INT32 nItemIndex) const; | 347 » FX_BOOL»» » » » » » IsItemVisible(in
t32_t nItemIndex) const; |
348 void SetScrollInfo(); | 348 void SetScrollInfo(); |
349 void SetScrollPosY(FX
_FLOAT fy); | 349 void SetScrollPosY(FX
_FLOAT fy); |
350 » virtual void» » » » » ReArrange(FX_INT32 nItem
Index); | 350 » virtual void» » » » » ReArrange(int32_t nItemI
ndex); |
351 | 351 |
352 private: | 352 private: |
353 IFX_List_Notify* m_pNotify; | 353 IFX_List_Notify* m_pNotify; |
354 FX_BOOL m_bNotifyFlag; | 354 FX_BOOL m_bNotifyFlag; |
355 CPDF_Point m_ptScrollPos; | 355 CPDF_Point m_ptScrollPos; |
356 CPLST_Select m_aSelItems; //for mu
ltiple | 356 CPLST_Select m_aSelItems; //for mu
ltiple |
357 » FX_INT32» » » » » » m_nSelItem;»
» //for single | 357 » int32_t»» » » » » m_nSelItem;» »
//for single |
358 » FX_INT32» » » » » » m_nFootIndex;»
//for multiple | 358 » int32_t»» » » » » m_nFootIndex;» //for mu
ltiple |
359 FX_BOOL m_bCtrlSel;
//for multiple | 359 FX_BOOL m_bCtrlSel;
//for multiple |
360 » FX_INT32» » » » » » m_nCaretIndex;»
//for multiple | 360 » int32_t»» » » » » m_nCaretIndex;» //for mu
ltiple |
361 }; | 361 }; |
362 | 362 |
363 #endif // FPDFSDK_INCLUDE_FXEDIT_FXET_LIST_H_ | 363 #endif // FPDFSDK_INCLUDE_FXEDIT_FXET_LIST_H_ |
OLD | NEW |