| 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. |
| 11 #include "fx_edit.h" | 11 #include "fx_edit.h" |
| 12 | 12 |
| 13 class IFX_Edit; | 13 class IFX_Edit; |
| 14 | 14 |
| 15 class CLST_Size | 15 class CLST_Size { |
| 16 { | 16 public: |
| 17 public: | 17 CLST_Size() : x(0.0f), y(0.0f) {} |
| 18 CLST_Size() : x(0.0f), y(0.0f) | 18 |
| 19 { | 19 CLST_Size(FX_FLOAT other_x, FX_FLOAT other_y) { |
| 20 } | 20 x = other_x; |
| 21 | 21 y = other_y; |
| 22 CLST_Size(FX_FLOAT other_x, FX_FLOAT other_y) | 22 } |
| 23 { | 23 |
| 24 x = other_x; | 24 void Default() { |
| 25 y = other_y; | 25 x = 0.0f; |
| 26 } | 26 y = 0.0f; |
| 27 | 27 } |
| 28 void Default() | 28 |
| 29 { | 29 FX_BOOL operator!=(const CLST_Size& size) const { |
| 30 x = 0.0f; | 30 return FXSYS_memcmp(this, &size, sizeof(CLST_Size)) != 0; |
| 31 y = 0.0f; | 31 } |
| 32 } | 32 |
| 33 | 33 FX_FLOAT x, y; |
| 34 FX_BOOL operator != (const CLST_Size & size) const | 34 }; |
| 35 { | 35 |
| 36 return FXSYS_memcmp(this, &size, sizeof(CLST_Size)) != 0; | 36 class CLST_Rect : public CPDF_Rect { |
| 37 } | 37 public: |
| 38 | 38 CLST_Rect() { left = top = right = bottom = 0.0f; } |
| 39 FX_FLOAT x,y; | 39 |
| 40 }; | 40 CLST_Rect(FX_FLOAT other_left, |
| 41 | 41 FX_FLOAT other_top, |
| 42 class CLST_Rect : public CPDF_Rect | 42 FX_FLOAT other_right, |
| 43 { | 43 FX_FLOAT other_bottom) { |
| 44 public: | 44 left = other_left; |
| 45 CLST_Rect() | 45 top = other_top; |
| 46 { | 46 right = other_right; |
| 47 left = top = right = bottom = 0.0f; | 47 bottom = other_bottom; |
| 48 } | 48 } |
| 49 | 49 |
| 50 CLST_Rect(FX_FLOAT other_left, | 50 CLST_Rect(const CPDF_Rect& rect) { |
| 51 FX_FLOAT other_top, | 51 left = rect.left; |
| 52 FX_FLOAT other_right, | 52 top = rect.top; |
| 53 FX_FLOAT other_bottom) | 53 right = rect.right; |
| 54 { | 54 bottom = rect.bottom; |
| 55 left = other_left; | 55 } |
| 56 top = other_top; | 56 |
| 57 right = other_right; | 57 void Default() { left = top = right = bottom = 0.0f; } |
| 58 bottom = other_bottom; | 58 |
| 59 } | 59 const CLST_Rect operator=(const CPDF_Rect& rect) { |
| 60 | 60 left = rect.left; |
| 61 CLST_Rect(const CPDF_Rect & rect) | 61 top = rect.top; |
| 62 { | 62 right = rect.right; |
| 63 left = rect.left; | 63 bottom = rect.bottom; |
| 64 top = rect.top; | 64 |
| 65 right = rect.right; | 65 return *this; |
| 66 bottom = rect.bottom; | 66 } |
| 67 } | 67 |
| 68 | 68 FX_BOOL operator==(const CLST_Rect& rect) const { |
| 69 void Default() | 69 return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) == 0; |
| 70 { | 70 } |
| 71 left = top = right = bottom = 0.0f; | 71 |
| 72 } | 72 FX_BOOL operator!=(const CLST_Rect& rect) const { |
| 73 | 73 return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) != 0; |
| 74 const CLST_Rect operator = (const CPDF_Rect & rect) | 74 } |
| 75 { | 75 |
| 76 left = rect.left; | 76 FX_FLOAT Width() const { return right - left; } |
| 77 top = rect.top; | 77 |
| 78 right = rect.right; | 78 FX_FLOAT Height() const { |
| 79 bottom = rect.bottom; | 79 if (top > bottom) |
| 80 | 80 return top - bottom; |
| 81 return *this; | 81 return bottom - top; |
| 82 } | 82 } |
| 83 | 83 |
| 84 FX_BOOL operator == (const CLST_Rect & rect) const | 84 CPDF_Point LeftTop() const { return CPDF_Point(left, top); } |
| 85 { | 85 |
| 86 return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) == 0; | 86 CPDF_Point RightBottom() const { return CPDF_Point(right, bottom); } |
| 87 } | 87 |
| 88 | 88 const CLST_Rect operator+=(const CPDF_Point& point) { |
| 89 FX_BOOL operator != (const CLST_Rect & rect) const | 89 left += point.x; |
| 90 { | 90 right += point.x; |
| 91 return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) != 0; | 91 top += point.y; |
| 92 } | 92 bottom += point.y; |
| 93 | 93 |
| 94 FX_FLOAT Width() const | 94 return *this; |
| 95 { | 95 } |
| 96 return right - left; | 96 |
| 97 } | 97 const CLST_Rect operator-=(const CPDF_Point& point) { |
| 98 | 98 left -= point.x; |
| 99 FX_FLOAT Height() const | 99 right -= point.x; |
| 100 { | 100 top -= point.y; |
| 101 if (top > bottom) | 101 bottom -= point.y; |
| 102 return top - bottom; | 102 |
| 103 return bottom - top; | 103 return *this; |
| 104 } | 104 } |
| 105 | 105 |
| 106 CPDF_Point LeftTop() const | 106 CLST_Rect operator+(const CPDF_Point& point) const { |
| 107 { | 107 return CLST_Rect(left + point.x, top + point.y, right + point.x, |
| 108 return CPDF_Point(left,top); | 108 bottom + point.y); |
| 109 } | 109 } |
| 110 | 110 |
| 111 CPDF_Point RightBottom() const | 111 CLST_Rect operator-(const CPDF_Point& point) const { |
| 112 { | 112 return CLST_Rect(left - point.x, top - point.y, right - point.x, |
| 113 return CPDF_Point(right,bottom); | 113 bottom - point.y); |
| 114 } | 114 } |
| 115 | 115 }; |
| 116 const CLST_Rect operator += (const CPDF_Point & point) | 116 |
| 117 { | 117 class CFX_ListItem { |
| 118 left += point.x; | 118 public: |
| 119 right += point.x; | 119 CFX_ListItem(); |
| 120 top += point.y; | 120 virtual ~CFX_ListItem(); |
| 121 bottom += point.y; | 121 |
| 122 | 122 void SetFontMap(IFX_Edit_FontMap* pFontMap); |
| 123 return *this; | 123 IFX_Edit_Iterator* GetIterator() const; |
| 124 } | 124 IFX_Edit* GetEdit() const; |
| 125 | 125 |
| 126 const CLST_Rect operator -= (const CPDF_Point & point) | 126 public: |
| 127 { | 127 void SetRect(const CLST_Rect& rect); |
| 128 left -= point.x; | 128 void SetSelect(FX_BOOL bSelected); |
| 129 right -= point.x; | 129 void SetCaret(FX_BOOL bCaret); |
| 130 top -= point.y; | 130 void SetText(const FX_WCHAR* text); |
| 131 bottom -= point.y; | 131 void SetFontSize(FX_FLOAT fFontSize); |
| 132 | 132 CFX_WideString GetText() const; |
| 133 return *this; | 133 |
| 134 } | 134 CLST_Rect GetRect() const; |
| 135 | 135 FX_BOOL IsSelected() const; |
| 136 CLST_Rect operator + (const CPDF_Point & point) const | 136 FX_BOOL IsCaret() const; |
| 137 { | 137 FX_FLOAT GetItemHeight() const; |
| 138 return CLST_Rect(left + point.x, | 138 FX_WORD GetFirstChar() const; |
| 139 top + point.y, | 139 |
| 140 right + point.x, | 140 private: |
| 141 bottom + point.y); | 141 IFX_Edit* m_pEdit; |
| 142 } | 142 FX_BOOL m_bSelected; |
| 143 | 143 FX_BOOL m_bCaret; |
| 144 CLST_Rect operator - (const CPDF_Point & point) const | 144 CLST_Rect m_rcListItem; |
| 145 { | 145 }; |
| 146 return CLST_Rect(left - point.x, | 146 |
| 147 top - point.y, | 147 class CFX_ListContainer { |
| 148 right - point.x, | 148 public: |
| 149 bottom - point.y); | 149 CFX_ListContainer() |
| 150 } | 150 : m_rcPlate(0.0f, 0.0f, 0.0f, 0.0f), |
| 151 }; | 151 m_rcContent(0.0f, 0.0f, 0.0f, 0.0f) {} |
| 152 | 152 virtual ~CFX_ListContainer() {} |
| 153 class CFX_ListItem | 153 virtual void SetPlateRect(const CPDF_Rect& rect) { m_rcPlate = rect; } |
| 154 { | 154 CPDF_Rect GetPlateRect() const { return m_rcPlate; } |
| 155 public: | 155 void SetContentRect(const CLST_Rect& rect) { m_rcContent = rect; } |
| 156 CFX_ListItem(); | 156 CLST_Rect GetContentRect() const { return m_rcContent; } |
| 157 virtual ~CFX_ListItem(); | 157 CPDF_Point GetBTPoint() const { |
| 158 | 158 return CPDF_Point(m_rcPlate.left, m_rcPlate.top); |
| 159 void SetFontMap(IFX_E
dit_FontMap * pFontMap); | 159 } |
| 160 IFX_Edit_Iterator* GetIterator() const; | 160 CPDF_Point GetETPoint() const { |
| 161 IFX_Edit* GetEdit() const; | 161 return CPDF_Point(m_rcPlate.right, m_rcPlate.bottom); |
| 162 | 162 } |
| 163 public: | 163 |
| 164 void SetRect(const CL
ST_Rect & rect); | 164 public: |
| 165 void SetSelect(FX_BOO
L bSelected); | 165 CPDF_Point InnerToOuter(const CPDF_Point& point) const { |
| 166 void SetCaret(FX_BOOL
bCaret); | 166 return CPDF_Point(point.x + GetBTPoint().x, GetBTPoint().y - point.y); |
| 167 void SetText(const FX
_WCHAR* text); | 167 } |
| 168 void SetFontSize(FX_F
LOAT fFontSize); | 168 CPDF_Point OuterToInner(const CPDF_Point& point) const { |
| 169 CFX_WideString GetText() const; | 169 return CPDF_Point(point.x - GetBTPoint().x, GetBTPoint().y - point.y); |
| 170 | 170 } |
| 171 CLST_Rect GetRect() const; | 171 CPDF_Rect InnerToOuter(const CLST_Rect& rect) const { |
| 172 FX_BOOL IsSelected() con
st; | 172 CPDF_Point ptLeftTop = InnerToOuter(CPDF_Point(rect.left, rect.top)); |
| 173 FX_BOOL IsCaret() const; | 173 CPDF_Point ptRightBottom = |
| 174 FX_FLOAT GetItemHeight()
const; | 174 InnerToOuter(CPDF_Point(rect.right, rect.bottom)); |
| 175 FX_WORD GetFirstChar() c
onst; | 175 return CPDF_Rect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, |
| 176 | 176 ptLeftTop.y); |
| 177 private: | 177 } |
| 178 IFX_Edit* m_pEdit; | 178 CLST_Rect OuterToInner(const CPDF_Rect& rect) const { |
| 179 FX_BOOL m_bSelected; | 179 CPDF_Point ptLeftTop = OuterToInner(CPDF_Point(rect.left, rect.top)); |
| 180 FX_BOOL m_bCaret; | 180 CPDF_Point ptRightBottom = |
| 181 CLST_Rect m_rcListItem; | 181 OuterToInner(CPDF_Point(rect.right, rect.bottom)); |
| 182 }; | 182 return CLST_Rect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, |
| 183 | 183 ptRightBottom.y); |
| 184 class CFX_ListContainer | 184 } |
| 185 { | 185 |
| 186 public: | 186 private: |
| 187 CFX_ListContainer() : m_rcPlate(0.0f,0.0f,0.0f,0.0f), m_rcContent(0.0f,0
.0f,0.0f,0.0f){} | 187 CPDF_Rect m_rcPlate; |
| 188 virtual ~CFX_ListContainer(){} | 188 CLST_Rect m_rcContent; // positive forever! |
| 189 virtual void SetPlateRect(const CPDF_
Rect & rect){m_rcPlate = rect;} | 189 }; |
| 190 CPDF_Rect GetPlateRect() c
onst{return m_rcPlate;} | 190 |
| 191 void SetContentRect(c
onst CLST_Rect & rect){m_rcContent = rect;} | 191 template <class TYPE> |
| 192 CLST_Rect GetContentRect()
const{return m_rcContent;} | 192 class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE> { |
| 193 CPDF_Point GetBTPoint() con
st{return CPDF_Point(m_rcPlate.left,m_rcPlate.top);} | 193 public: |
| 194 CPDF_Point GetETPoint() con
st{return CPDF_Point(m_rcPlate.right,m_rcPlate.bottom);} | 194 FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; } |
| 195 public: | 195 TYPE GetAt(int32_t nIndex) const { |
| 196 CPDF_Point InnerToOuter(con
st CPDF_Point & point) const{return CPDF_Point(point.x + GetBTPoint().x,GetBTPoi
nt().y - point.y);} | 196 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) |
| 197 CPDF_Point OuterToInner(con
st CPDF_Point & point) const{return CPDF_Point(point.x - GetBTPoint().x,GetBTPoi
nt().y - point.y);} | 197 return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); |
| 198 CPDF_Rect InnerToOuter(con
st CLST_Rect & rect) const{CPDF_Point ptLeftTop = InnerToOuter(CPDF_Point(rect.l
eft,rect.top)); | 198 return NULL; |
| 199
CPDF_Poi
nt ptRightBottom = InnerToOuter(CPDF_Point(rect.right,rect.bottom)); | 199 } |
| 200
return C
PDF_Rect(ptLeftTop.x,ptRightBottom.y,ptRightBottom.x,ptLeftTop.y);} | 200 void RemoveAt(int32_t nIndex) { |
| 201 CLST_Rect OuterToInner(con
st CPDF_Rect & rect) const{CPDF_Point ptLeftTop = OuterToInner(CPDF_Point(rect.l
eft,rect.top)); | 201 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) |
| 202
CPDF_Poi
nt ptRightBottom = OuterToInner(CPDF_Point(rect.right,rect.bottom)); | 202 CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex); |
| 203
return C
LST_Rect(ptLeftTop.x,ptLeftTop.y,ptRightBottom.x,ptRightBottom.y);} | 203 } |
| 204 private: | 204 }; |
| 205 CPDF_Rect m_rcPlate; | 205 |
| 206 CLST_Rect m_rcContent;
//positive forever! | 206 class CFX_List : protected CFX_ListContainer, public IFX_List { |
| 207 }; | 207 public: |
| 208 | 208 CFX_List(); |
| 209 template<class TYPE> class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE> | 209 virtual ~CFX_List(); |
| 210 { | 210 |
| 211 public: | 211 public: |
| 212 FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; } | 212 virtual void SetFontMap(IFX_Edit_FontMap* pFontMap); |
| 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 virtual void SetFontSize(FX_FLOAT fFontSize); |
| 214 void RemoveAt(int32_t nIndex){if (nIndex >= 0 && nIndex < CFX_ArrayTempl
ate<TYPE>::GetSize()) CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);} | 214 |
| 215 }; | 215 virtual CPDF_Rect GetPlateRect() const; |
| 216 | 216 virtual CPDF_Rect GetContentRect() const; |
| 217 class CFX_List : protected CFX_ListContainer , public IFX_List | 217 |
| 218 { | 218 virtual FX_FLOAT GetFontSize() const; |
| 219 public: | 219 virtual IFX_Edit* GetItemEdit(int32_t nIndex) const; |
| 220 CFX_List(); | 220 virtual int32_t GetCount() const; |
| 221 virtual ~CFX_List(); | 221 virtual FX_BOOL IsItemSelected(int32_t nIndex) const; |
| 222 | 222 virtual FX_FLOAT GetFirstHeight() const; |
| 223 public: | 223 |
| 224 virtual void SetFontMap(IFX_Edit_Font
Map * pFontMap); | 224 virtual void SetMultipleSel(FX_BOOL bMultiple); |
| 225 virtual void SetFontSize(FX_FLOAT fFo
ntSize); | 225 virtual FX_BOOL IsMultipleSel() const; |
| 226 | 226 virtual FX_BOOL IsValid(int32_t nItemIndex) const; |
| 227 virtual CPDF_Rect GetPlateRect() const; | 227 virtual int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const; |
| 228 virtual CPDF_Rect GetContentRect() const; | 228 |
| 229 | 229 protected: |
| 230 virtual FX_FLOAT GetFontSize() const; | 230 virtual void Empty(); |
| 231 virtual IFX_Edit* GetItemEdit(int32_t nInd
ex) const; | 231 |
| 232 virtual int32_t GetCount() const; | 232 void AddItem(const FX_WCHAR* str); |
| 233 virtual FX_BOOL IsItemSelected(int32_t n
Index) const; | 233 virtual void ReArrange(int32_t nItemIndex); |
| 234 virtual FX_FLOAT GetFirstHeight() const; | 234 |
| 235 | 235 virtual CPDF_Rect GetItemRect(int32_t nIndex) const; |
| 236 virtual void SetMultipleSel(FX_BOOL b
Multiple); | 236 CFX_WideString GetItemText(int32_t nIndex) const; |
| 237 virtual FX_BOOL IsMultipleSel() const; | 237 |
| 238 virtual FX_BOOL IsValid(int32_t nItemInd
ex) const; | 238 void SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected); |
| 239 virtual int32_t FindNext(int32_t nIndex,FX_WCHAR
nChar) const; | 239 void SetItemCaret(int32_t nItemIndex, FX_BOOL bCaret); |
| 240 | 240 |
| 241 protected: | 241 virtual int32_t GetItemIndex(const CPDF_Point& point) const; |
| 242 virtual void Empty(); | 242 int32_t GetFirstSelected() const; |
| 243 | 243 int32_t GetLastSelected() const; |
| 244 void AddItem(const FX
_WCHAR* str); | 244 FX_WCHAR Toupper(FX_WCHAR c) const; |
| 245 virtual void ReArrange(int32_t nItemI
ndex); | 245 |
| 246 | 246 private: |
| 247 virtual CPDF_Rect GetItemRect(int32_t nInd
ex) const; | 247 CLST_ArrayTemplate<CFX_ListItem*> m_aListItems; |
| 248 CFX_WideString GetItemText(int32_t nInd
ex) const; | 248 FX_FLOAT m_fFontSize; |
| 249 | 249 IFX_Edit_FontMap* m_pFontMap; |
| 250 void SetItemSelect(in
t32_t nItemIndex, FX_BOOL bSelected); | 250 FX_BOOL m_bMultiple; |
| 251 void SetItemCaret(int
32_t nItemIndex, FX_BOOL bCaret); | 251 }; |
| 252 | 252 |
| 253 virtual int32_t GetItemIndex(const CPDF_Point &
point) const; | 253 struct CPLST_Select_Item { |
| 254 int32_t GetFirstSelected() const
; | 254 CPLST_Select_Item(int32_t other_nItemIndex, int32_t other_nState) { |
| 255 int32_t GetLastSelected() const; | 255 nItemIndex = other_nItemIndex; |
| 256 FX_WCHAR Toupper(FX_WCHAR
c) const; | 256 nState = other_nState; |
| 257 | 257 } |
| 258 private: | 258 |
| 259 CLST_ArrayTemplate<CFX_ListItem*> m_aListItems; | 259 int32_t nItemIndex; |
| 260 FX_FLOAT m_fFontS
ize; | 260 int32_t nState; // 0:normal select -1:to deselect 1: to select |
| 261 IFX_Edit_FontMap* m_pFontMap; | 261 }; |
| 262 FX_BOOL m_bMulti
ple; | 262 |
| 263 }; | 263 class CPLST_Select { |
| 264 | 264 public: |
| 265 struct CPLST_Select_Item | 265 CPLST_Select(); |
| 266 { | 266 virtual ~CPLST_Select(); |
| 267 CPLST_Select_Item(int32_t other_nItemIndex, int32_t other_nState) | 267 |
| 268 { | 268 public: |
| 269 nItemIndex = other_nItemIndex; | 269 void Add(int32_t nItemIndex); |
| 270 nState = other_nState; | 270 void Add(int32_t nBeginIndex, int32_t nEndIndex); |
| 271 } | 271 void Sub(int32_t nItemIndex); |
| 272 | 272 void Sub(int32_t nBeginIndex, int32_t nEndIndex); |
| 273 int32_t nItemIndex; | 273 FX_BOOL IsExist(int32_t nItemIndex) const; |
| 274 int32_t nState; //0:normal select -1:to deselect 1: to select | 274 int32_t Find(int32_t nItemIndex) const; |
| 275 }; | 275 int32_t GetCount() const; |
| 276 | 276 int32_t GetItemIndex(int32_t nIndex) const; |
| 277 class CPLST_Select | 277 int32_t GetState(int32_t nIndex) const; |
| 278 { | 278 void Done(); |
| 279 public: | 279 void DeselectAll(); |
| 280 CPLST_Select(); | 280 |
| 281 virtual ~CPLST_Select(); | 281 private: |
| 282 | 282 CFX_ArrayTemplate<CPLST_Select_Item*> m_aItems; |
| 283 public: | 283 }; |
| 284 void Add(int32_t nIte
mIndex); | 284 |
| 285 void Add(int32_t nBeg
inIndex, int32_t nEndIndex); | 285 class CFX_ListCtrl : public CFX_List { |
| 286 void Sub(int32_t nIte
mIndex); | 286 public: |
| 287 void Sub(int32_t nBeg
inIndex, int32_t nEndIndex); | 287 CFX_ListCtrl(); |
| 288 FX_BOOL IsExist(int32_t
nItemIndex) const; | 288 virtual ~CFX_ListCtrl(); |
| 289 int32_t Find(int32_t nItemIndex)
const; | 289 |
| 290 int32_t GetCount() const; | 290 public: |
| 291 int32_t GetItemIndex(int32_t nIn
dex) const; | 291 void SetNotify(IFX_List_Notify* pNotify); |
| 292 int32_t GetState(int32_t nIndex)
const; | 292 |
| 293 void Done(); | 293 void OnMouseDown(const CPDF_Point& point, FX_BOOL bShift, FX_BOOL bCtrl); |
| 294 void DeselectAll(); | 294 void OnMouseMove(const CPDF_Point& point, FX_BOOL bShift, FX_BOOL bCtrl); |
| 295 | 295 void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl); |
| 296 private: | 296 void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl); |
| 297 CFX_ArrayTemplate<CPLST_Select_Item*> m_aItems; | 297 void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl); |
| 298 }; | 298 void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl); |
| 299 | 299 void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl); |
| 300 class CFX_ListCtrl : public CFX_List | 300 void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl); |
| 301 { | 301 void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl); |
| 302 public: | 302 FX_BOOL OnChar(FX_WORD nChar, FX_BOOL bShift, FX_BOOL bCtrl); |
| 303 CFX_ListCtrl(); | 303 |
| 304 virtual ~CFX_ListCtrl(); | 304 virtual CPDF_Point InToOut(const CPDF_Point& point) const; |
| 305 | 305 virtual CPDF_Point OutToIn(const CPDF_Point& point) const; |
| 306 public: | 306 virtual CPDF_Rect InToOut(const CPDF_Rect& rect) const; |
| 307 void SetNotify(IFX_Li
st_Notify * pNotify); | 307 virtual CPDF_Rect OutToIn(const CPDF_Rect& rect) const; |
| 308 | 308 |
| 309 void OnMouseDown(cons
t CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl); | 309 virtual void SetPlateRect(const CPDF_Rect& rect); |
| 310 void OnMouseMove(cons
t CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl); | 310 void SetScrollPos(const CPDF_Point& point); |
| 311 void OnVK_UP(FX_BOOL
bShift,FX_BOOL bCtrl); | 311 void ScrollToListItem(int32_t nItemIndex); |
| 312 void OnVK_DOWN(FX_BOO
L bShift,FX_BOOL bCtrl); | 312 virtual CPDF_Rect GetItemRect(int32_t nIndex) const; |
| 313 void OnVK_LEFT(FX_BOO
L bShift,FX_BOOL bCtrl); | 313 int32_t GetCaret() const { return m_nCaretIndex; } |
| 314 void OnVK_RIGHT(FX_BO
OL bShift,FX_BOOL bCtrl); | 314 int32_t GetSelect() const { return m_nSelItem; } |
| 315 void OnVK_HOME(FX_BOO
L bShift,FX_BOOL bCtrl); | 315 int32_t GetTopItem() const; |
| 316 void OnVK_END(FX_BOOL
bShift,FX_BOOL bCtrl); | 316 virtual CPDF_Rect GetContentRect() const; |
| 317 void OnVK(int32_t nIt
emIndex,FX_BOOL bShift,FX_BOOL bCtrl); | 317 virtual int32_t GetItemIndex(const CPDF_Point& point) const; |
| 318 FX_BOOL OnChar(FX_WORD n
Char,FX_BOOL bShift,FX_BOOL bCtrl); | 318 |
| 319 | 319 void AddString(const FX_WCHAR* string); |
| 320 virtual CPDF_Point InToOut(const CPDF_Point
& point) const; | 320 void SetTopItem(int32_t nIndex); |
| 321 virtual CPDF_Point OutToIn(const CPDF_Point
& point) const; | 321 void Select(int32_t nItemIndex); |
| 322 virtual CPDF_Rect InToOut(const CPDF_Rect
& rect) const; | 322 virtual void SetCaret(int32_t nItemIndex); |
| 323 virtual CPDF_Rect OutToIn(const CPDF_Rect
& rect) const; | 323 virtual void Empty(); |
| 324 | 324 virtual void Cancel(); |
| 325 virtual void SetPlateRect(const CPDF_
Rect & rect); | 325 CFX_WideString GetText() const; |
| 326 void SetScrollPos(con
st CPDF_Point & point); | 326 |
| 327 void ScrollToListItem
(int32_t nItemIndex); | 327 private: |
| 328 virtual CPDF_Rect GetItemRect(int32_t nInd
ex) const; | 328 void SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected); |
| 329 int32_t GetCaret() const {return
m_nCaretIndex;} | 329 void SetSingleSelect(int32_t nItemIndex); |
| 330 int32_t GetSelect() const {retur
n m_nSelItem;} | 330 void InvalidateItem(int32_t nItemIndex); |
| 331 int32_t GetTopItem() const; | 331 void SelectItems(); |
| 332 virtual CPDF_Rect GetContentRect() const; | 332 FX_BOOL IsItemVisible(int32_t nItemIndex) const; |
| 333 virtual int32_t GetItemIndex(const CPDF_Point &
point) const; | 333 void SetScrollInfo(); |
| 334 | 334 void SetScrollPosY(FX_FLOAT fy); |
| 335 void AddString(const
FX_WCHAR* string); | 335 virtual void ReArrange(int32_t nItemIndex); |
| 336 void SetTopItem(int32
_t nIndex); | 336 |
| 337 void Select(int32_t n
ItemIndex); | 337 private: |
| 338 virtual void SetCaret(int32_t nItemIn
dex); | 338 IFX_List_Notify* m_pNotify; |
| 339 virtual void Empty(); | 339 FX_BOOL m_bNotifyFlag; |
| 340 virtual void Cancel(); | 340 CPDF_Point m_ptScrollPos; |
| 341 CFX_WideString GetText() const; | 341 CPLST_Select m_aSelItems; // for multiple |
| 342 | 342 int32_t m_nSelItem; // for single |
| 343 private: | 343 int32_t m_nFootIndex; // for multiple |
| 344 void SetMultipleSelec
t(int32_t nItemIndex, FX_BOOL bSelected); | 344 FX_BOOL m_bCtrlSel; // for multiple |
| 345 void SetSingleSelect(
int32_t nItemIndex); | 345 int32_t m_nCaretIndex; // for multiple |
| 346 void InvalidateItem(i
nt32_t nItemIndex); | |
| 347 void SelectItems(); | |
| 348 FX_BOOL IsItemVisible(in
t32_t nItemIndex) const; | |
| 349 void SetScrollInfo(); | |
| 350 void SetScrollPosY(FX
_FLOAT fy); | |
| 351 virtual void ReArrange(int32_t nItemI
ndex); | |
| 352 | |
| 353 private: | |
| 354 IFX_List_Notify* m_pNotify; | |
| 355 FX_BOOL m_bNotifyFlag; | |
| 356 CPDF_Point m_ptScrollPos; | |
| 357 CPLST_Select m_aSelItems; //for mu
ltiple | |
| 358 int32_t m_nSelItem;
//for single | |
| 359 int32_t m_nFootIndex; //for mu
ltiple | |
| 360 FX_BOOL m_bCtrlSel;
//for multiple | |
| 361 int32_t m_nCaretIndex; //for mu
ltiple | |
| 362 }; | 346 }; |
| 363 | 347 |
| 364 #endif // FPDFSDK_INCLUDE_FXEDIT_FXET_LIST_H_ | 348 #endif // FPDFSDK_INCLUDE_FXEDIT_FXET_LIST_H_ |
| OLD | NEW |