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