Initial commit.
[pdfium.git] / fpdfsdk / src / pdfwindow / PWL_ListBox.cpp
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4  \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #include "../../include/pdfwindow/PDFWindow.h"\r
8 #include "../../include/pdfwindow/PWL_Wnd.h"\r
9 #include "../../include/pdfwindow/PWL_ListBox.h"\r
10 #include "../../include/pdfwindow/PWL_Utils.h"\r
11 #include "../../include/pdfwindow/PWL_ScrollBar.h"\r
12 #include "../../include/pdfwindow/PWL_EditCtrl.h"\r
13 #include "../../include/pdfwindow/PWL_Edit.h"\r
14 \r
15 #define IsFloatZero(f)                                          ((f) < 0.0001 && (f) > -0.0001)\r
16 #define IsFloatBigger(fa,fb)                            ((fa) > (fb) && !IsFloatZero((fa) - (fb)))\r
17 #define IsFloatSmaller(fa,fb)                           ((fa) < (fb) && !IsFloatZero((fa) - (fb)))\r
18 #define IsFloatEqual(fa,fb)                                     IsFloatZero((fa)-(fb))\r
19 \r
20 /* ------------------------ CPWL_List_Notify ----------------------- */\r
21 \r
22 CPWL_List_Notify::CPWL_List_Notify(CPWL_ListBox* pList) : m_pList(pList)\r
23 {\r
24         ASSERT(m_pList != NULL);\r
25 }\r
26 \r
27 CPWL_List_Notify::~CPWL_List_Notify()\r
28 {\r
29 }\r
30 \r
31 void CPWL_List_Notify::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, \r
32                                                                                                 FX_FLOAT fContentMin, FX_FLOAT fContentMax, \r
33                                                                                                 FX_FLOAT fSmallStep, FX_FLOAT fBigStep)\r
34 {\r
35         PWL_SCROLL_INFO Info;\r
36 \r
37         Info.fPlateWidth = fPlateMax - fPlateMin;\r
38         Info.fContentMin = fContentMin;\r
39         Info.fContentMax = fContentMax;\r
40         Info.fSmallStep = fSmallStep;\r
41         Info.fBigStep = fBigStep;\r
42 \r
43         m_pList->OnNotify(m_pList,PNM_SETSCROLLINFO,SBT_VSCROLL,(FX_INTPTR)&Info);\r
44 \r
45         if (CPWL_ScrollBar * pScroll = m_pList->GetVScrollBar())\r
46         {\r
47                 if (IsFloatBigger(Info.fPlateWidth,Info.fContentMax-Info.fContentMin)\r
48                         || IsFloatEqual(Info.fPlateWidth,Info.fContentMax-Info.fContentMin))\r
49                 {\r
50                         if (pScroll->IsVisible())\r
51                         {\r
52                                 pScroll->SetVisible(FALSE);\r
53                                 m_pList->RePosChildWnd();\r
54                         }                       \r
55                 }\r
56                 else\r
57                 {\r
58                         if (!pScroll->IsVisible())\r
59                         {\r
60                                 pScroll->SetVisible(TRUE);      \r
61                                 m_pList->RePosChildWnd();\r
62                         }\r
63                 }\r
64         }       \r
65 }\r
66 \r
67 void CPWL_List_Notify::IOnSetScrollPosY(FX_FLOAT fy)\r
68 {\r
69         m_pList->OnNotify(m_pList,PNM_SETSCROLLPOS,SBT_VSCROLL,(FX_INTPTR)&fy);\r
70 }\r
71 \r
72 void CPWL_List_Notify::IOnInvalidateRect(CPDF_Rect * pRect)\r
73 {\r
74         m_pList->InvalidateRect(pRect);\r
75 }\r
76 \r
77 /* --------------------------- CPWL_ListBox ---------------------------- */\r
78 \r
79 CPWL_ListBox::CPWL_ListBox() :\r
80         m_pList(NULL),\r
81         m_pListNotify(NULL),\r
82         m_bMouseDown(FALSE),\r
83         m_bHoverSel(FALSE),\r
84         m_pFillerNotify(NULL)\r
85 {\r
86         m_pList = IFX_List::NewList();\r
87 \r
88         ASSERT(m_pList != NULL);\r
89 }\r
90 \r
91 CPWL_ListBox::~CPWL_ListBox()\r
92 {\r
93         IFX_List::DelList(m_pList);\r
94         \r
95         if (m_pListNotify)\r
96         {\r
97                 delete m_pListNotify;\r
98                 m_pListNotify = NULL;\r
99         }\r
100 }\r
101 \r
102 CFX_ByteString CPWL_ListBox::GetClassName() const\r
103 {       \r
104         return "CPWL_ListBox";\r
105 }\r
106 \r
107 void CPWL_ListBox::OnCreated()\r
108 {\r
109         if (m_pList)\r
110         {\r
111                 if (m_pListNotify) delete m_pListNotify;\r
112 \r
113                 m_pList->SetFontMap(GetFontMap());\r
114                 m_pList->SetNotify(m_pListNotify = new CPWL_List_Notify(this));\r
115         \r
116                 SetHoverSel(HasFlag(PLBS_HOVERSEL));    \r
117                 m_pList->SetMultipleSel(HasFlag(PLBS_MULTIPLESEL));\r
118                 m_pList->SetFontSize(this->GetCreationParam().fFontSize);       \r
119 \r
120                 m_bHoverSel = HasFlag(PLBS_HOVERSEL);\r
121         }\r
122 }\r
123 \r
124 void CPWL_ListBox::OnDestroy()\r
125 {\r
126         if (m_pListNotify)\r
127         {\r
128                 delete m_pListNotify;\r
129                 m_pListNotify = NULL;\r
130         }\r
131 }\r
132 \r
133 void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream)\r
134 {\r
135         CPWL_Wnd::GetThisAppearanceStream(sAppStream);\r
136 \r
137         CFX_ByteTextBuf sListItems;\r
138 \r
139         if (m_pList)\r
140         {\r
141                 CPDF_Rect rcPlate = m_pList->GetPlateRect();\r
142                 for (FX_INT32 i=0,sz=m_pList->GetCount(); i<sz; i++)\r
143                 {\r
144                         CPDF_Rect rcItem = m_pList->GetItemRect(i);\r
145 \r
146                         if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom) continue;\r
147                         \r
148                         CPDF_Point ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f);\r
149                         if (m_pList->IsItemSelected(i))\r
150                         {\r
151                                 sListItems << CPWL_Utils::GetRectFillAppStream(rcItem,PWL_DEFAULT_SELBACKCOLOR);\r
152                                 CFX_ByteString sItem = CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);\r
153                                 if (sItem.GetLength() > 0)\r
154                                 {\r
155                                         sListItems << "BT\n" << CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELTEXTCOLOR) << sItem << "ET\n";\r
156                                 }\r
157                         }\r
158                         else\r
159                         {\r
160                                 CFX_ByteString sItem = CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);\r
161                                 if (sItem.GetLength() > 0)\r
162                                 {\r
163                                         sListItems << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sItem << "ET\n";\r
164                                 }\r
165                         }\r
166                 }\r
167         }\r
168 \r
169         if (sListItems.GetLength() > 0)\r
170         {\r
171                 CFX_ByteTextBuf sClip;                  \r
172                 CPDF_Rect rcClient = this->GetClientRect();\r
173 \r
174                 sClip << "q\n";\r
175                 sClip << rcClient.left << " " << rcClient.bottom << " "\r
176                         << rcClient.right - rcClient.left << " " <<     rcClient.top - rcClient.bottom << " re W n\n";\r
177 \r
178                 sClip << sListItems << "Q\n";\r
179 \r
180                 sAppStream << "/Tx BMC\n" << sClip << "EMC\n";\r
181         }\r
182 }\r
183 \r
184 void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device)\r
185 {\r
186         CPWL_Wnd::DrawThisAppearance(pDevice,pUser2Device);\r
187 \r
188         if (m_pList)\r
189         {\r
190                 CPDF_Rect rcPlate = m_pList->GetPlateRect();\r
191                 CPDF_Rect rcList = GetListRect();\r
192                 CPDF_Rect rcClient = GetClientRect();\r
193 \r
194                 for (FX_INT32 i=0,sz=m_pList->GetCount(); i<sz; i++)\r
195                 {\r
196                         CPDF_Rect rcItem = m_pList->GetItemRect(i);\r
197                         if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom) continue;\r
198                         \r
199                         CPDF_Point ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f);\r
200                         if (IFX_Edit* pEdit = m_pList->GetItemEdit(i))\r
201                         {\r
202                                 CPDF_Rect rcContent = pEdit->GetContentRect();\r
203                                 if (rcContent.Width() > rcClient.Width())\r
204                                         rcItem.Intersect(rcList);\r
205                                 else\r
206                                         rcItem.Intersect(rcClient);\r
207                         }\r
208 \r
209                         if (m_pList->IsItemSelected(i))\r
210                         {\r
211                         //      CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcItem, ArgbEncode(255,0,51,113));\r
212                                 IFX_SystemHandler* pSysHandler = GetSystemHandler();\r
213                                 if(pSysHandler && pSysHandler->IsSelectionImplemented())\r
214                                 {\r
215                                         IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), CPWL_Utils::PWLColorToFXColor(GetTextColor()), CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()),\r
216                                                 rcList, ptOffset, NULL,pSysHandler, m_pFormFiller);\r
217                                         pSysHandler->OutputSelectedRect(m_pFormFiller, rcItem);\r
218                                 }\r
219                                 else\r
220                                 {\r
221                                         CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcItem, ArgbEncode(255,0,51,113));\r
222                                         IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), ArgbEncode(255,255,255,255), 0,\r
223                                                 rcList, ptOffset, NULL, pSysHandler, m_pFormFiller);\r
224                                 }\r
225                         }\r
226                         else\r
227                         {\r
228                                 IFX_SystemHandler* pSysHandler = GetSystemHandler();\r
229                                 IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), \r
230                                                 CPWL_Utils::PWLColorToFXColor(GetTextColor()),\r
231                                                 CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()),\r
232                                                 rcList, ptOffset, NULL,pSysHandler, NULL);\r
233 \r
234                         }\r
235                 }\r
236         }\r
237 }\r
238 \r
239 FX_BOOL CPWL_ListBox::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag)\r
240 {\r
241         CPWL_Wnd::OnKeyDown(nChar, nFlag);\r
242 \r
243         if (!m_pList) return FALSE;\r
244 \r
245         switch (nChar)\r
246         {\r
247         default:\r
248                 return FALSE;\r
249         case FWL_VKEY_Up:\r
250         case FWL_VKEY_Down:\r
251         case FWL_VKEY_Home:\r
252         case FWL_VKEY_Left:\r
253         case FWL_VKEY_End:\r
254         case FWL_VKEY_Right:\r
255                 break;  \r
256         }\r
257 \r
258         switch (nChar)\r
259         {\r
260         case FWL_VKEY_Up:\r
261                 m_pList->OnVK_UP(IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag));\r
262                 break;\r
263         case FWL_VKEY_Down:\r
264                 m_pList->OnVK_DOWN(IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag));\r
265                 break;\r
266         case FWL_VKEY_Home:\r
267                 m_pList->OnVK_HOME(IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag));\r
268                 break;\r
269         case FWL_VKEY_Left:\r
270                 m_pList->OnVK_LEFT(IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag));\r
271                 break;\r
272         case FWL_VKEY_End:\r
273                 m_pList->OnVK_END(IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag));\r
274                 break;\r
275         case FWL_VKEY_Right:\r
276                 m_pList->OnVK_RIGHT(IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag));\r
277                 break;\r
278         case FWL_VKEY_Delete:\r
279                 break;\r
280         }\r
281 \r
282         FX_BOOL bExit = FALSE;\r
283         OnNotifySelChanged(TRUE,bExit,nFlag);\r
284 \r
285         return TRUE;\r
286 }\r
287 \r
288 FX_BOOL CPWL_ListBox::OnChar(FX_WORD nChar, FX_DWORD nFlag)\r
289 {\r
290         CPWL_Wnd::OnChar(nChar,nFlag);\r
291 \r
292         if (!m_pList) return FALSE;\r
293 \r
294         if (!m_pList->OnChar(nChar,IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag))) return FALSE;\r
295 \r
296         FX_BOOL bExit = FALSE;\r
297         OnNotifySelChanged(TRUE,bExit, nFlag);\r
298 \r
299         return TRUE;\r
300 }\r
301 \r
302 FX_BOOL CPWL_ListBox::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag)\r
303 {\r
304         CPWL_Wnd::OnLButtonDown(point,nFlag);\r
305 \r
306         if (ClientHitTest(point))\r
307         {\r
308                 m_bMouseDown = TRUE;\r
309                 SetFocus();\r
310                 SetCapture();\r
311 \r
312                 if (m_pList)\r
313                         m_pList->OnMouseDown(point,IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag));\r
314         }\r
315 \r
316         return TRUE;\r
317 }\r
318 \r
319 FX_BOOL CPWL_ListBox::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag)\r
320 {\r
321         CPWL_Wnd::OnLButtonUp(point,nFlag);\r
322 \r
323         if (m_bMouseDown)\r
324         {\r
325                 ReleaseCapture();\r
326                 m_bMouseDown = FALSE;\r
327         }\r
328 \r
329         FX_BOOL bExit = FALSE;\r
330         OnNotifySelChanged(FALSE,bExit,nFlag);\r
331 \r
332         return TRUE;\r
333 }\r
334 \r
335 void CPWL_ListBox::SetHoverSel(FX_BOOL bHoverSel)\r
336 {\r
337         m_bHoverSel = bHoverSel;\r
338 }\r
339 \r
340 FX_BOOL CPWL_ListBox::OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag)\r
341 {\r
342         CPWL_Wnd::OnMouseMove(point, nFlag);\r
343 \r
344         if (m_bHoverSel && !IsCaptureMouse() && ClientHitTest(point))\r
345         {\r
346                 if (m_pList)\r
347                         m_pList->Select(m_pList->GetItemIndex(point));\r
348         }\r
349 \r
350         if (m_bMouseDown)\r
351         {\r
352                 if (m_pList)\r
353                         m_pList->OnMouseMove(point,IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag));\r
354         }       \r
355 \r
356         return TRUE;\r
357 }\r
358 \r
359 void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_INTPTR lParam)\r
360 {\r
361         CPWL_Wnd::OnNotify(pWnd,msg,wParam,lParam);\r
362 \r
363         FX_FLOAT fPos;  \r
364         \r
365         switch (msg)\r
366         {\r
367         case PNM_SETSCROLLINFO:\r
368                 switch (wParam)\r
369                 {\r
370                 case SBT_VSCROLL:\r
371                         if (CPWL_Wnd * pChild = GetVScrollBar())\r
372                         {\r
373                                 pChild->OnNotify(pWnd,PNM_SETSCROLLINFO,wParam,lParam);\r
374                         }\r
375                         break;\r
376                 }\r
377                 break;\r
378         case PNM_SETSCROLLPOS:                  \r
379                 switch (wParam)\r
380                 {\r
381                 case SBT_VSCROLL:\r
382                         if (CPWL_Wnd * pChild = GetVScrollBar())\r
383                         {\r
384                                 pChild->OnNotify(pWnd,PNM_SETSCROLLPOS,wParam,lParam);\r
385                         }\r
386                         break;\r
387                 }\r
388                 break;\r
389         case PNM_SCROLLWINDOW:\r
390                 fPos = *(FX_FLOAT*)lParam;\r
391                 switch (wParam)\r
392                 {\r
393                 case SBT_VSCROLL:\r
394                         if (m_pList)\r
395                                 m_pList->SetScrollPos(CPDF_Point(0,fPos));\r
396                         break;\r
397                 }\r
398                 break;\r
399         }\r
400 }\r
401 \r
402 void CPWL_ListBox::KillFocus()\r
403 {\r
404         CPWL_Wnd::KillFocus();\r
405 \r
406         /*\r
407         if (this->IsMultipleSel())\r
408         {\r
409                 for(FX_INT32 i=0;i<this->GetCount();i++)\r
410                 {\r
411                         if (this->IsListItemSelected(i))\r
412                         {\r
413                                 if (!IsListItemVisible(i))\r
414                                         this->ScrollToListItem(i);\r
415                                 break;\r
416                         }\r
417                 }\r
418         }\r
419         else\r
420         {\r
421                 if (!IsListItemVisible(this->GetCurSel()))\r
422                         this->ScrollToListItem(this->GetCurSel());\r
423         }\r
424 \r
425         SetListItemCaret(m_nCaretIndex,FALSE);\r
426         */\r
427 }\r
428 \r
429 void CPWL_ListBox::RePosChildWnd()\r
430 {\r
431         CPWL_Wnd::RePosChildWnd();\r
432 \r
433         if (m_pList)\r
434                 m_pList->SetPlateRect(GetListRect());\r
435 }\r
436 \r
437 void CPWL_ListBox::OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL & bExit,  FX_DWORD nFlag)\r
438 {\r
439         if (m_pFillerNotify)\r
440         {               \r
441                 FX_BOOL bRC = TRUE;\r
442                 CFX_WideString swChange = GetText();\r
443                 CFX_WideString strChangeEx;\r
444                 int nSelStart = 0;\r
445                 int nSelEnd = swChange.GetLength();\r
446                 m_pFillerNotify->OnBeforeKeyStroke(FALSE, GetAttachedData(), 0, swChange, strChangeEx, nSelStart, nSelEnd, bKeyDown, bRC, bExit, nFlag);\r
447                 if (bExit) return;\r
448 \r
449                 m_pFillerNotify->OnAfterKeyStroke(FALSE, GetAttachedData(), bExit,nFlag);\r
450         }\r
451 }\r
452 \r
453 CPDF_Rect CPWL_ListBox::GetFocusRect() const\r
454 {\r
455         if (m_pList && m_pList->IsMultipleSel())\r
456         {\r
457                 CPDF_Rect rcCaret = m_pList->GetItemRect(m_pList->GetCaret());\r
458                 rcCaret.Intersect(GetClientRect());\r
459                 return rcCaret;\r
460         }\r
461         \r
462         return CPWL_Wnd::GetFocusRect();\r
463 }\r
464 \r
465 void CPWL_ListBox::AddString(FX_LPCWSTR string)\r
466 {\r
467         if (m_pList)\r
468         {               \r
469                 m_pList->AddString(string);\r
470         }\r
471 }\r
472 \r
473 void CPWL_ListBox::SetText(FX_LPCWSTR csText,FX_BOOL bRefresh)\r
474 {\r
475         //return CPDF_List::SetText(csText,bRefresh);\r
476 }\r
477 \r
478 CFX_WideString CPWL_ListBox::GetText() const\r
479 {\r
480         if (m_pList)\r
481                 return m_pList->GetText();\r
482 \r
483         return L"";\r
484 }\r
485 \r
486 void CPWL_ListBox::SetFontSize(FX_FLOAT fFontSize)\r
487 {\r
488         if (m_pList)\r
489                 m_pList->SetFontSize(fFontSize);\r
490 }\r
491 \r
492 FX_FLOAT CPWL_ListBox::GetFontSize() const\r
493 {\r
494         if (m_pList)\r
495                 return m_pList->GetFontSize();\r
496         return 0.0f;\r
497 }\r
498 \r
499 void CPWL_ListBox::Select(FX_INT32 nItemIndex)\r
500 {\r
501         if (m_pList)\r
502                 m_pList->Select(nItemIndex);\r
503 }\r
504 \r
505 void CPWL_ListBox::SetCaret(FX_INT32 nItemIndex)\r
506 {\r
507         if (m_pList)\r
508                 m_pList->SetCaret(nItemIndex);\r
509 }\r
510 \r
511 void CPWL_ListBox::SetTopVisibleIndex(FX_INT32 nItemIndex)\r
512 {\r
513         if (m_pList)\r
514                 m_pList->SetTopItem(nItemIndex);\r
515 }\r
516 \r
517 void CPWL_ListBox::ScrollToListItem(FX_INT32 nItemIndex)\r
518 {\r
519         if (m_pList)\r
520                 m_pList->ScrollToListItem(nItemIndex);\r
521 }\r
522 \r
523 void CPWL_ListBox::ResetContent()\r
524 {\r
525         if (m_pList)\r
526                 m_pList->Empty();\r
527 }\r
528 \r
529 void CPWL_ListBox::Reset()\r
530 {\r
531         if (m_pList)\r
532                 m_pList->Cancel();\r
533 }\r
534 \r
535 FX_BOOL CPWL_ListBox::IsMultipleSel() const\r
536 {\r
537         if (m_pList)\r
538                 return m_pList->IsMultipleSel();\r
539 \r
540         return FALSE;\r
541 }\r
542 \r
543 FX_INT32 CPWL_ListBox::GetCaretIndex() const\r
544 {\r
545         if (m_pList)\r
546                 return m_pList->GetCaret();\r
547 \r
548         return -1;\r
549 }\r
550 \r
551 FX_INT32 CPWL_ListBox::GetCurSel() const\r
552 {\r
553         if (m_pList)\r
554                 return m_pList->GetSelect();\r
555 \r
556         return -1;\r
557 }\r
558 \r
559 FX_BOOL CPWL_ListBox::IsItemSelected(FX_INT32 nItemIndex) const\r
560 {\r
561         if (m_pList)\r
562                 return m_pList->IsItemSelected(nItemIndex);\r
563 \r
564         return FALSE;\r
565 }\r
566 \r
567 FX_INT32 CPWL_ListBox::GetTopVisibleIndex() const\r
568 {\r
569         if (m_pList)\r
570         {\r
571                 m_pList->ScrollToListItem(m_pList->GetFirstSelected());\r
572                 return m_pList->GetTopItem();\r
573         }\r
574 \r
575         return -1;\r
576 }\r
577 \r
578 FX_INT32 CPWL_ListBox::GetCount() const\r
579 {\r
580         if (m_pList)\r
581                 return m_pList->GetCount();\r
582 \r
583         return 0;\r
584 }\r
585 \r
586 FX_INT32 CPWL_ListBox::FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const\r
587 {\r
588         if (m_pList)\r
589                 return m_pList->FindNext(nIndex,nChar);\r
590 \r
591         return nIndex;\r
592 }\r
593 \r
594 CPDF_Rect CPWL_ListBox::GetContentRect() const\r
595 {\r
596         if (m_pList)\r
597                 return m_pList->GetContentRect();\r
598 \r
599         return CPDF_Rect();\r
600 }\r
601 \r
602 FX_FLOAT CPWL_ListBox::GetFirstHeight() const\r
603 {\r
604         if (m_pList)\r
605                 return m_pList->GetFirstHeight();\r
606 \r
607         return 0.0f;\r
608 }\r
609 \r
610 CPDF_Rect CPWL_ListBox::GetListRect() const\r
611 {\r
612         return CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT)(GetBorderWidth()+GetInnerBorderWidth()));\r
613 }\r
614 \r
615 FX_BOOL CPWL_ListBox::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag)\r
616 {\r
617         if (!m_pList) return FALSE;\r
618 \r
619         if (zDelta < 0)\r
620         {\r
621                 m_pList->OnVK_DOWN(IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag));\r
622         }\r
623         else\r
624         {\r
625                 m_pList->OnVK_UP(IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag));\r
626         }\r
627 \r
628         FX_BOOL bExit = FALSE;\r
629         OnNotifySelChanged(FALSE,bExit, nFlag);\r
630         return TRUE;\r
631 }\r
632 \r