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 #include "../../include/pdfwindow/PDFWindow.h" | 7 #include "../../include/pdfwindow/PDFWindow.h" |
8 #include "../../include/pdfwindow/PWL_Wnd.h" | 8 #include "../../include/pdfwindow/PWL_Wnd.h" |
9 #include "../../include/pdfwindow/PWL_EditCtrl.h" | 9 #include "../../include/pdfwindow/PWL_EditCtrl.h" |
10 #include "../../include/pdfwindow/PWL_Edit.h" | 10 #include "../../include/pdfwindow/PWL_Edit.h" |
11 #include "../../include/pdfwindow/PWL_ListBox.h" | 11 #include "../../include/pdfwindow/PWL_ListBox.h" |
12 #include "../../include/pdfwindow/PWL_ComboBox.h" | 12 #include "../../include/pdfwindow/PWL_ComboBox.h" |
13 #include "../../include/pdfwindow/PWL_Utils.h" | 13 #include "../../include/pdfwindow/PWL_Utils.h" |
14 | 14 |
15 #define PWLCB_DEFAULTFONTSIZE 12.0f | 15 #define PWLCB_DEFAULTFONTSIZE 12.0f |
16 | 16 |
17 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) | 17 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) |
18 #define IsFloatBigger(fa,fb) ((fa) > (fb) && !IsFloatZero((fa) -
(fb))) | 18 #define IsFloatBigger(fa,fb) ((fa) > (fb) && !IsFloatZero((fa) -
(fb))) |
19 #define IsFloatSmaller(fa,fb) ((fa) < (fb) && !IsFloatZero((fa) -
(fb))) | 19 #define IsFloatSmaller(fa,fb) ((fa) < (fb) && !IsFloatZero((fa) -
(fb))) |
20 #define IsFloatEqual(fa,fb) IsFloatZero((fa)-(fb)) | 20 #define IsFloatEqual(fa,fb) IsFloatZero((fa)-(fb)) |
21 | 21 |
22 | 22 |
23 /* ---------------------------- CPWL_CBListBox ---------------------------- */ | 23 /* ---------------------------- CPWL_CBListBox ---------------------------- */ |
24 | 24 |
25 FX_BOOL CPWL_CBListBox::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) | 25 bool CPWL_CBListBox::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) |
26 { | 26 { |
27 CPWL_Wnd::OnLButtonUp(point,nFlag); | 27 CPWL_Wnd::OnLButtonUp(point,nFlag); |
28 | 28 |
29 if (m_bMouseDown) | 29 if (m_bMouseDown) |
30 { | 30 { |
31 ReleaseCapture(); | 31 ReleaseCapture(); |
32 m_bMouseDown = FALSE; | 32 m_bMouseDown = false; |
33 | 33 |
34 if (ClientHitTest(point)) | 34 if (ClientHitTest(point)) |
35 { | 35 { |
36 if (CPWL_Wnd * pParent = GetParentWindow()) | 36 if (CPWL_Wnd * pParent = GetParentWindow()) |
37 { | 37 { |
38 pParent->OnNotify(this,PNM_LBUTTONUP,0,PWL_MAKEDWORD(point.x,poi
nt.y)); | 38 pParent->OnNotify(this,PNM_LBUTTONUP,0,PWL_MAKEDWORD(point.x,poi
nt.y)); |
39 } | 39 } |
40 | 40 |
41 FX_BOOL bExit = FALSE; | 41 bool bExit = false; |
42 OnNotifySelChanged(FALSE,bExit, nFlag); | 42 OnNotifySelChanged(false,bExit, nFlag); |
43 if (bExit) return FALSE; | 43 if (bExit) return false; |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 return TRUE; | 47 return true; |
48 } | 48 } |
49 | 49 |
50 FX_BOOL CPWL_CBListBox::OnKeyDownWithExit(FX_WORD nChar, FX_BOOL & bExit, FX_DWO
RD nFlag) | 50 bool CPWL_CBListBox::OnKeyDownWithExit(FX_WORD nChar, bool & bExit, FX_DWORD nFl
ag) |
51 { | 51 { |
52 if (!m_pList) return FALSE; | 52 if (!m_pList) return false; |
53 | 53 |
54 switch (nChar) | 54 switch (nChar) |
55 { | 55 { |
56 default: | 56 default: |
57 return FALSE; | 57 return false; |
58 case FWL_VKEY_Up: | 58 case FWL_VKEY_Up: |
59 case FWL_VKEY_Down: | 59 case FWL_VKEY_Down: |
60 case FWL_VKEY_Home: | 60 case FWL_VKEY_Home: |
61 case FWL_VKEY_Left: | 61 case FWL_VKEY_Left: |
62 case FWL_VKEY_End: | 62 case FWL_VKEY_End: |
63 case FWL_VKEY_Right: | 63 case FWL_VKEY_Right: |
64 break; | 64 break; |
65 } | 65 } |
66 | 66 |
67 switch (nChar) | 67 switch (nChar) |
(...skipping 13 matching lines...) Expand all Loading... |
81 case FWL_VKEY_End: | 81 case FWL_VKEY_End: |
82 m_pList->OnVK_END(IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag)); | 82 m_pList->OnVK_END(IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag)); |
83 break; | 83 break; |
84 case FWL_VKEY_Right: | 84 case FWL_VKEY_Right: |
85 m_pList->OnVK_RIGHT(IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag)); | 85 m_pList->OnVK_RIGHT(IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag)); |
86 break; | 86 break; |
87 case FWL_VKEY_Delete: | 87 case FWL_VKEY_Delete: |
88 break; | 88 break; |
89 } | 89 } |
90 | 90 |
91 OnNotifySelChanged(TRUE,bExit, nFlag); | 91 OnNotifySelChanged(true,bExit, nFlag); |
92 | 92 |
93 return TRUE; | 93 return true; |
94 } | 94 } |
95 | 95 |
96 FX_BOOL CPWL_CBListBox::OnCharWithExit(FX_WORD nChar, FX_BOOL & bExit, FX_DWORD
nFlag) | 96 bool CPWL_CBListBox::OnCharWithExit(FX_WORD nChar, bool & bExit, FX_DWORD nFlag) |
97 { | 97 { |
98 if (!m_pList) return FALSE; | 98 if (!m_pList) return false; |
99 | 99 |
100 if (!m_pList->OnChar(nChar,IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag))) retu
rn FALSE; | 100 if (!m_pList->OnChar(nChar,IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag))) retu
rn false; |
101 | 101 |
102 if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetParentWindow()) | 102 if (CPWL_ComboBox* pComboBox = (CPWL_ComboBox*)GetParentWindow()) |
103 { | 103 { |
104 pComboBox->SetSelectText(); | 104 pComboBox->SetSelectText(); |
105 } | 105 } |
106 | 106 |
107 OnNotifySelChanged(TRUE,bExit,nFlag); | 107 OnNotifySelChanged(true,bExit,nFlag); |
108 | 108 |
109 return TRUE; | 109 return true; |
110 } | 110 } |
111 | 111 |
112 /* ---------------------------- CPWL_CBButton ---------------------------- */ | 112 /* ---------------------------- CPWL_CBButton ---------------------------- */ |
113 | 113 |
114 void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) | 114 void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) |
115 { | 115 { |
116 CPWL_Wnd::GetThisAppearanceStream(sAppStream); | 116 CPWL_Wnd::GetThisAppearanceStream(sAppStream); |
117 | 117 |
118 CPDF_Rect rectWnd = CPWL_Wnd::GetWindowRect(); | 118 CPDF_Rect rectWnd = CPWL_Wnd::GetWindowRect(); |
119 | 119 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); | 170 path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); |
171 path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); | 171 path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); |
172 | 172 |
173 pDevice->DrawPath(&path, pUser2Device, NULL, | 173 pDevice->DrawPath(&path, pUser2Device, NULL, |
174 CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,GetTranspar
ency()), | 174 CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,GetTranspar
ency()), |
175 0, FXFILL_ALTERNATE); | 175 0, FXFILL_ALTERNATE); |
176 } | 176 } |
177 } | 177 } |
178 } | 178 } |
179 | 179 |
180 FX_BOOL CPWL_CBButton::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) | 180 bool CPWL_CBButton::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) |
181 { | 181 { |
182 CPWL_Wnd::OnLButtonDown(point,nFlag); | 182 CPWL_Wnd::OnLButtonDown(point,nFlag); |
183 | 183 |
184 SetCapture(); | 184 SetCapture(); |
185 | 185 |
186 if (CPWL_Wnd * pParent = GetParentWindow()) | 186 if (CPWL_Wnd * pParent = GetParentWindow()) |
187 { | 187 { |
188 pParent->OnNotify(this,PNM_LBUTTONDOWN,0,PWL_MAKEDWORD(point.x,point.y))
; | 188 pParent->OnNotify(this,PNM_LBUTTONDOWN,0,PWL_MAKEDWORD(point.x,point.y))
; |
189 } | 189 } |
190 | 190 |
191 return TRUE; | 191 return true; |
192 } | 192 } |
193 | 193 |
194 FX_BOOL CPWL_CBButton::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) | 194 bool CPWL_CBButton::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) |
195 { | 195 { |
196 CPWL_Wnd::OnLButtonUp(point, nFlag); | 196 CPWL_Wnd::OnLButtonUp(point, nFlag); |
197 | 197 |
198 ReleaseCapture(); | 198 ReleaseCapture(); |
199 | 199 |
200 return TRUE; | 200 return true; |
201 } | 201 } |
202 | 202 |
203 /* ---------------------------- CPWL_ComboBox ---------------------------- */ | 203 /* ---------------------------- CPWL_ComboBox ---------------------------- */ |
204 | 204 |
205 CPWL_ComboBox::CPWL_ComboBox() : m_pEdit(NULL), | 205 CPWL_ComboBox::CPWL_ComboBox() : m_pEdit(NULL), |
206 m_pButton(NULL), | 206 m_pButton(NULL), |
207 m_pList(NULL), | 207 m_pList(NULL), |
208 m_bPopup(FALSE), | 208 m_bPopup(false), |
209 m_nPopupWhere(0), | 209 m_nPopupWhere(0), |
210 m_nSelectItem(-1), | 210 m_nSelectItem(-1), |
211 m_pFillerNotify(NULL) | 211 m_pFillerNotify(NULL) |
212 { | 212 { |
213 } | 213 } |
214 | 214 |
215 CFX_ByteString CPWL_ComboBox::GetClassName() const | 215 CFX_ByteString CPWL_ComboBox::GetClassName() const |
216 { | 216 { |
217 return "CPWL_ComboBox"; | 217 return "CPWL_ComboBox"; |
218 } | 218 } |
219 | 219 |
220 void CPWL_ComboBox::OnCreate(PWL_CREATEPARAM & cp) | 220 void CPWL_ComboBox::OnCreate(PWL_CREATEPARAM & cp) |
221 { | 221 { |
222 cp.dwFlags &= ~PWS_HSCROLL; | 222 cp.dwFlags &= ~PWS_HSCROLL; |
223 cp.dwFlags &= ~PWS_VSCROLL; | 223 cp.dwFlags &= ~PWS_VSCROLL; |
224 } | 224 } |
225 | 225 |
226 void CPWL_ComboBox::SetFocus() | 226 void CPWL_ComboBox::SetFocus() |
227 { | 227 { |
228 if (m_pEdit) | 228 if (m_pEdit) |
229 m_pEdit->SetFocus(); | 229 m_pEdit->SetFocus(); |
230 } | 230 } |
231 | 231 |
232 void CPWL_ComboBox::KillFocus() | 232 void CPWL_ComboBox::KillFocus() |
233 { | 233 { |
234 SetPopup(FALSE); | 234 SetPopup(false); |
235 CPWL_Wnd::KillFocus(); | 235 CPWL_Wnd::KillFocus(); |
236 } | 236 } |
237 | 237 |
238 CFX_WideString CPWL_ComboBox::GetText() const | 238 CFX_WideString CPWL_ComboBox::GetText() const |
239 { | 239 { |
240 if (m_pEdit) | 240 if (m_pEdit) |
241 { | 241 { |
242 return m_pEdit->GetText(); | 242 return m_pEdit->GetText(); |
243 } | 243 } |
244 return CFX_WideString(); | 244 return CFX_WideString(); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 rcEdit.right = rcEdit.left; | 432 rcEdit.right = rcEdit.left; |
433 | 433 |
434 rcEdit.top = rcEdit.bottom + fOldClientHeight; | 434 rcEdit.top = rcEdit.bottom + fOldClientHeight; |
435 | 435 |
436 rcList.bottom += fOldWindowHeight; | 436 rcList.bottom += fOldWindowHeight; |
437 | 437 |
438 break; | 438 break; |
439 } | 439 } |
440 | 440 |
441 if (m_pButton) | 441 if (m_pButton) |
442 m_pButton->Move(rcButton,TRUE,FALSE); | 442 m_pButton->Move(rcButton,true,false); |
443 | 443 |
444 if (m_pEdit) | 444 if (m_pEdit) |
445 m_pEdit->Move(rcEdit,TRUE,FALSE); | 445 m_pEdit->Move(rcEdit,true,false); |
446 | 446 |
447 if (m_pList) | 447 if (m_pList) |
448 { | 448 { |
449 m_pList->SetVisible(TRUE); | 449 m_pList->SetVisible(true); |
450 m_pList->Move(rcList,TRUE,FALSE); | 450 m_pList->Move(rcList,true,false); |
451 m_pList->ScrollToListItem(m_nSelectItem); | 451 m_pList->ScrollToListItem(m_nSelectItem); |
452 } | 452 } |
453 } | 453 } |
454 else | 454 else |
455 { | 455 { |
456 CPDF_Rect rcButton = rcClient; | 456 CPDF_Rect rcButton = rcClient; |
457 | 457 |
458 rcButton.left = rcButton.right - PWL_COMBOBOX_BUTTON_WIDTH; | 458 rcButton.left = rcButton.right - PWL_COMBOBOX_BUTTON_WIDTH; |
459 | 459 |
460 if (rcButton.left < rcClient.left) | 460 if (rcButton.left < rcClient.left) |
461 rcButton.left = rcClient.left; | 461 rcButton.left = rcClient.left; |
462 | 462 |
463 if (m_pButton) | 463 if (m_pButton) |
464 m_pButton->Move(rcButton,TRUE,FALSE); | 464 m_pButton->Move(rcButton,true,false); |
465 | 465 |
466 CPDF_Rect rcEdit = rcClient; | 466 CPDF_Rect rcEdit = rcClient; |
467 rcEdit.right = rcButton.left - 1.0f; | 467 rcEdit.right = rcButton.left - 1.0f; |
468 | 468 |
469 if (rcEdit.left < rcClient.left) | 469 if (rcEdit.left < rcClient.left) |
470 rcEdit.left = rcClient.left; | 470 rcEdit.left = rcClient.left; |
471 | 471 |
472 if (rcEdit.right < rcEdit.left) | 472 if (rcEdit.right < rcEdit.left) |
473 rcEdit.right = rcEdit.left; | 473 rcEdit.right = rcEdit.left; |
474 | 474 |
475 if (m_pEdit) | 475 if (m_pEdit) |
476 m_pEdit->Move(rcEdit,TRUE,FALSE); | 476 m_pEdit->Move(rcEdit,true,false); |
477 | 477 |
478 if (m_pList) | 478 if (m_pList) |
479 m_pList->SetVisible(FALSE); | 479 m_pList->SetVisible(false); |
480 } | 480 } |
481 } | 481 } |
482 | 482 |
483 void CPWL_ComboBox::SelectAll() | 483 void CPWL_ComboBox::SelectAll() |
484 { | 484 { |
485 if (m_pEdit && HasFlag(PCBS_ALLOWCUSTOMTEXT)) | 485 if (m_pEdit && HasFlag(PCBS_ALLOWCUSTOMTEXT)) |
486 m_pEdit->SelectAll(); | 486 m_pEdit->SelectAll(); |
487 } | 487 } |
488 | 488 |
489 CPDF_Rect CPWL_ComboBox::GetFocusRect() const | 489 CPDF_Rect CPWL_ComboBox::GetFocusRect() const |
490 { | 490 { |
491 return CPDF_Rect(); | 491 return CPDF_Rect(); |
492 } | 492 } |
493 | 493 |
494 void CPWL_ComboBox::SetPopup(FX_BOOL bPopup) | 494 void CPWL_ComboBox::SetPopup(bool bPopup) |
495 { | 495 { |
496 if (!m_pList) return; | 496 if (!m_pList) return; |
497 if (bPopup == m_bPopup) return; | 497 if (bPopup == m_bPopup) return; |
498 FX_FLOAT fListHeight = m_pList->GetContentRect().Height(); | 498 FX_FLOAT fListHeight = m_pList->GetContentRect().Height(); |
499 if (!IsFloatBigger(fListHeight,0.0f)) return; | 499 if (!IsFloatBigger(fListHeight,0.0f)) return; |
500 | 500 |
501 if (bPopup) | 501 if (bPopup) |
502 { | 502 { |
503 if (m_pFillerNotify) | 503 if (m_pFillerNotify) |
504 { | 504 { |
(...skipping 16 matching lines...) Expand all Loading... |
521 default: | 521 default: |
522 case 0: | 522 case 0: |
523 rcWindow.bottom -= fPopupRet; | 523 rcWindow.bottom -= fPopupRet; |
524 break; | 524 break; |
525 case 1: | 525 case 1: |
526 rcWindow.top += fPopupRet; | 526 rcWindow.top += fPopupRet; |
527 break; | 527 break; |
528 } | 528 } |
529 | 529 |
530 m_nPopupWhere = nWhere; | 530 m_nPopupWhere = nWhere; |
531 Move(rcWindow, TRUE, TRUE); | 531 Move(rcWindow, true, true); |
532 } | 532 } |
533 } | 533 } |
534 } | 534 } |
535 else | 535 else |
536 { | 536 { |
537 m_bPopup = bPopup; | 537 m_bPopup = bPopup; |
538 Move(m_rcOldWindow, TRUE, TRUE); | 538 Move(m_rcOldWindow, true, true); |
539 } | 539 } |
540 } | 540 } |
541 | 541 |
542 FX_BOOL CPWL_ComboBox::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) | 542 bool CPWL_ComboBox::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) |
543 { | 543 { |
544 if (!m_pList) return FALSE; | 544 if (!m_pList) return false; |
545 if (!m_pEdit) return FALSE; | 545 if (!m_pEdit) return false; |
546 | 546 |
547 m_nSelectItem = -1; | 547 m_nSelectItem = -1; |
548 | 548 |
549 switch (nChar) | 549 switch (nChar) |
550 { | 550 { |
551 case FWL_VKEY_Up: | 551 case FWL_VKEY_Up: |
552 if (m_pList->GetCurSel() > 0) | 552 if (m_pList->GetCurSel() > 0) |
553 { | 553 { |
554 FX_BOOL bExit = FALSE; | 554 bool bExit = false; |
555 if (m_pList->OnKeyDownWithExit(nChar,bExit,nFlag)) | 555 if (m_pList->OnKeyDownWithExit(nChar,bExit,nFlag)) |
556 { | 556 { |
557 if (bExit) return FALSE; | 557 if (bExit) return false; |
558 SetSelectText(); | 558 SetSelectText(); |
559 } | 559 } |
560 } | 560 } |
561 return TRUE; | 561 return true; |
562 case FWL_VKEY_Down: | 562 case FWL_VKEY_Down: |
563 if (m_pList->GetCurSel() < m_pList->GetCount() - 1) | 563 if (m_pList->GetCurSel() < m_pList->GetCount() - 1) |
564 { | 564 { |
565 FX_BOOL bExit = FALSE; | 565 bool bExit = false; |
566 if (m_pList->OnKeyDownWithExit(nChar,bExit,nFlag)) | 566 if (m_pList->OnKeyDownWithExit(nChar,bExit,nFlag)) |
567 { | 567 { |
568 if (bExit) return FALSE; | 568 if (bExit) return false; |
569 SetSelectText(); | 569 SetSelectText(); |
570 } | 570 } |
571 } | 571 } |
572 return TRUE; | 572 return true; |
573 } | 573 } |
574 | 574 |
575 if (HasFlag(PCBS_ALLOWCUSTOMTEXT)) | 575 if (HasFlag(PCBS_ALLOWCUSTOMTEXT)) |
576 return m_pEdit->OnKeyDown(nChar,nFlag); | 576 return m_pEdit->OnKeyDown(nChar,nFlag); |
577 | 577 |
578 return FALSE; | 578 return false; |
579 } | 579 } |
580 | 580 |
581 FX_BOOL CPWL_ComboBox::OnChar(FX_WORD nChar, FX_DWORD nFlag) | 581 bool CPWL_ComboBox::OnChar(FX_WORD nChar, FX_DWORD nFlag) |
582 { | 582 { |
583 if (!m_pList) | 583 if (!m_pList) |
584 return FALSE; | 584 return false; |
585 | 585 |
586 if (!m_pEdit) | 586 if (!m_pEdit) |
587 return FALSE; | 587 return false; |
588 | 588 |
589 m_nSelectItem = -1; | 589 m_nSelectItem = -1; |
590 if (HasFlag(PCBS_ALLOWCUSTOMTEXT)) | 590 if (HasFlag(PCBS_ALLOWCUSTOMTEXT)) |
591 return m_pEdit->OnChar(nChar,nFlag); | 591 return m_pEdit->OnChar(nChar,nFlag); |
592 | 592 |
593 FX_BOOL bExit = FALSE; | 593 bool bExit = false; |
594 return m_pList->OnCharWithExit(nChar,bExit,nFlag) ? bExit : FALSE; | 594 return m_pList->OnCharWithExit(nChar,bExit,nFlag) ? bExit : false; |
595 } | 595 } |
596 | 596 |
597 void CPWL_ComboBox::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp
tr_t lParam) | 597 void CPWL_ComboBox::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp
tr_t lParam) |
598 { | 598 { |
599 switch (msg) | 599 switch (msg) |
600 { | 600 { |
601 case PNM_LBUTTONDOWN: | 601 case PNM_LBUTTONDOWN: |
602 if (pWnd == m_pButton) | 602 if (pWnd == m_pButton) |
603 { | 603 { |
604 SetPopup(!m_bPopup); | 604 SetPopup(!m_bPopup); |
605 return; | 605 return; |
606 } | 606 } |
607 break; | 607 break; |
608 case PNM_LBUTTONUP: | 608 case PNM_LBUTTONUP: |
609 if (m_pEdit && m_pList) | 609 if (m_pEdit && m_pList) |
610 { | 610 { |
611 if (pWnd == m_pList) | 611 if (pWnd == m_pList) |
612 { | 612 { |
613 SetSelectText(); | 613 SetSelectText(); |
614 SelectAll(); | 614 SelectAll(); |
615 m_pEdit->SetFocus(); | 615 m_pEdit->SetFocus(); |
616 SetPopup(FALSE); | 616 SetPopup(false); |
617 return; | 617 return; |
618 } | 618 } |
619 } | 619 } |
620 } | 620 } |
621 | 621 |
622 CPWL_Wnd::OnNotify(pWnd,msg,wParam,lParam); | 622 CPWL_Wnd::OnNotify(pWnd,msg,wParam,lParam); |
623 } | 623 } |
624 | 624 |
625 FX_BOOL CPWL_ComboBox::IsPopup() const | 625 bool CPWL_ComboBox::IsPopup() const |
626 { | 626 { |
627 return m_bPopup; | 627 return m_bPopup; |
628 } | 628 } |
629 | 629 |
630 void CPWL_ComboBox::SetSelectText() | 630 void CPWL_ComboBox::SetSelectText() |
631 { | 631 { |
632 CFX_WideString swText = m_pList->GetText(); | 632 CFX_WideString swText = m_pList->GetText(); |
633 m_pEdit->SelectAll(); | 633 m_pEdit->SelectAll(); |
634 m_pEdit->ReplaceSel(m_pList->GetText().c_str()); | 634 m_pEdit->ReplaceSel(m_pList->GetText().c_str()); |
635 m_pEdit->SelectAll(); | 635 m_pEdit->SelectAll(); |
636 | 636 |
637 m_nSelectItem = m_pList->GetCurSel(); | 637 m_nSelectItem = m_pList->GetCurSel(); |
638 } | 638 } |
639 | 639 |
640 FX_BOOL CPWL_ComboBox::IsModified() const | 640 bool CPWL_ComboBox::IsModified() const |
641 { | 641 { |
642 return m_pEdit->IsModified(); | 642 return m_pEdit->IsModified(); |
643 } | 643 } |
644 | 644 |
645 void CPWL_ComboBox::SetFillerNotify(IPWL_Filler_Notify* pNotify) | 645 void CPWL_ComboBox::SetFillerNotify(IPWL_Filler_Notify* pNotify) |
646 { | 646 { |
647 m_pFillerNotify = pNotify; | 647 m_pFillerNotify = pNotify; |
648 | 648 |
649 if (m_pEdit) | 649 if (m_pEdit) |
650 m_pEdit->SetFillerNotify(pNotify); | 650 m_pEdit->SetFillerNotify(pNotify); |
651 | 651 |
652 if (m_pList) | 652 if (m_pList) |
653 m_pList->SetFillerNotify(pNotify); | 653 m_pList->SetFillerNotify(pNotify); |
654 } | 654 } |
OLD | NEW |