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 "xfa/fwl/basewidget/fwl_comboboximp.h" | 7 #include "xfa/fwl/basewidget/fwl_comboboximp.h" |
8 | 8 |
9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
10 #include "xfa/fwl/basewidget/fwl_editimp.h" | 10 #include "xfa/fwl/basewidget/fwl_editimp.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } | 121 } |
122 FX_BOOL IFWL_ComboBox::EditDelete() { | 122 FX_BOOL IFWL_ComboBox::EditDelete() { |
123 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDelete(); | 123 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDelete(); |
124 } | 124 } |
125 FX_BOOL IFWL_ComboBox::EditDeSelect() { | 125 FX_BOOL IFWL_ComboBox::EditDeSelect() { |
126 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDeSelect(); | 126 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDeSelect(); |
127 } | 127 } |
128 FWL_ERR IFWL_ComboBox::GetBBox(CFX_RectF& rect) { | 128 FWL_ERR IFWL_ComboBox::GetBBox(CFX_RectF& rect) { |
129 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetBBox(rect); | 129 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetBBox(rect); |
130 } | 130 } |
131 FWL_ERR IFWL_ComboBox::EditModifyStylesEx(FX_DWORD dwStylesExAdded, | 131 FWL_ERR IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, |
132 FX_DWORD dwStylesExRemoved) { | 132 uint32_t dwStylesExRemoved) { |
133 return static_cast<CFWL_ComboBoxImp*>(GetImpl()) | 133 return static_cast<CFWL_ComboBoxImp*>(GetImpl()) |
134 ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 134 ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
135 } | 135 } |
136 | 136 |
137 CFWL_ComboEditImp::CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties, | 137 CFWL_ComboEditImp::CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties, |
138 IFWL_Widget* pOuter) | 138 IFWL_Widget* pOuter) |
139 : CFWL_EditImp(properties, pOuter) { | 139 : CFWL_EditImp(properties, pOuter) { |
140 m_pOuter = static_cast<CFWL_ComboBoxImp*>(pOuter->GetImpl()); | 140 m_pOuter = static_cast<CFWL_ComboBoxImp*>(pOuter->GetImpl()); |
141 } | 141 } |
142 | 142 |
143 CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner) | 143 CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner) |
144 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} | 144 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} |
145 int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 145 int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
146 if (!pMessage) | 146 if (!pMessage) |
147 return 0; | 147 return 0; |
148 FX_DWORD dwMsgCode = pMessage->GetClassID(); | 148 uint32_t dwMsgCode = pMessage->GetClassID(); |
149 FX_BOOL backDefault = TRUE; | 149 FX_BOOL backDefault = TRUE; |
150 switch (dwMsgCode) { | 150 switch (dwMsgCode) { |
151 case FWL_MSGHASH_SetFocus: | 151 case FWL_MSGHASH_SetFocus: |
152 case FWL_MSGHASH_KillFocus: { | 152 case FWL_MSGHASH_KillFocus: { |
153 if (dwMsgCode == FWL_MSGHASH_SetFocus) { | 153 if (dwMsgCode == FWL_MSGHASH_SetFocus) { |
154 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; | 154 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; |
155 } else { | 155 } else { |
156 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; | 156 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; |
157 } | 157 } |
158 backDefault = FALSE; | 158 backDefault = FALSE; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 pOwner->TransformTo(m_pOuter, fx, fy); | 280 pOwner->TransformTo(m_pOuter, fx, fy); |
281 } | 281 } |
282 void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) { | 282 void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) { |
283 CFWL_WidgetImp::SetFocus(bSet); | 283 CFWL_WidgetImp::SetFocus(bSet); |
284 } | 284 } |
285 CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner) | 285 CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner) |
286 : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) {} | 286 : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) {} |
287 int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 287 int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
288 if (!pMessage) | 288 if (!pMessage) |
289 return 0; | 289 return 0; |
290 FX_DWORD dwHashCode = pMessage->GetClassID(); | 290 uint32_t dwHashCode = pMessage->GetClassID(); |
291 FX_BOOL backDefault = TRUE; | 291 FX_BOOL backDefault = TRUE; |
292 if (dwHashCode == FWL_MSGHASH_SetFocus || | 292 if (dwHashCode == FWL_MSGHASH_SetFocus || |
293 dwHashCode == FWL_MSGHASH_KillFocus) { | 293 dwHashCode == FWL_MSGHASH_KillFocus) { |
294 OnDropListFocusChanged(pMessage, dwHashCode == FWL_MSGHASH_SetFocus); | 294 OnDropListFocusChanged(pMessage, dwHashCode == FWL_MSGHASH_SetFocus); |
295 } else if (dwHashCode == FWL_MSGHASH_Mouse) { | 295 } else if (dwHashCode == FWL_MSGHASH_Mouse) { |
296 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 296 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
297 if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) { | 297 if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) { |
298 CFX_RectF rect; | 298 CFX_RectF rect; |
299 m_pOwner->m_pVertScrollBar->GetWidgetRect(rect); | 299 m_pOwner->m_pVertScrollBar->GetWidgetRect(rect); |
300 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { | 300 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { |
301 pMsg->m_fx -= rect.left; | 301 pMsg->m_fx -= rect.left; |
302 pMsg->m_fy -= rect.top; | 302 pMsg->m_fy -= rect.top; |
303 IFWL_WidgetDelegate* pDelegate = | 303 IFWL_WidgetDelegate* pDelegate = |
304 m_pOwner->m_pVertScrollBar->SetDelegate(NULL); | 304 m_pOwner->m_pVertScrollBar->SetDelegate(NULL); |
305 return pDelegate->OnProcessMessage(pMsg); | 305 return pDelegate->OnProcessMessage(pMsg); |
306 } | 306 } |
307 } | 307 } |
308 FX_DWORD dwCmd = pMsg->m_dwCmd; | 308 uint32_t dwCmd = pMsg->m_dwCmd; |
309 switch (dwCmd) { | 309 switch (dwCmd) { |
310 case FWL_MSGMOUSECMD_MouseMove: { | 310 case FWL_MSGMOUSECMD_MouseMove: { |
311 backDefault = FALSE; | 311 backDefault = FALSE; |
312 OnDropListMouseMove(pMsg); | 312 OnDropListMouseMove(pMsg); |
313 break; | 313 break; |
314 } | 314 } |
315 case FWL_MSGMOUSECMD_LButtonDown: { | 315 case FWL_MSGMOUSECMD_LButtonDown: { |
316 backDefault = FALSE; | 316 backDefault = FALSE; |
317 OnDropListLButtonDown(pMsg); | 317 OnDropListLButtonDown(pMsg); |
318 break; | 318 break; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 pOuter->ProcessSelChanged(TRUE); | 406 pOuter->ProcessSelChanged(TRUE); |
407 } | 407 } |
408 } | 408 } |
409 return 1; | 409 return 1; |
410 } | 410 } |
411 int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) { | 411 int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) { |
412 CFWL_ComboBoxImp* pOuter = | 412 CFWL_ComboBoxImp* pOuter = |
413 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); | 413 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); |
414 FX_BOOL bPropagate = FALSE; | 414 FX_BOOL bPropagate = FALSE; |
415 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { | 415 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { |
416 FX_DWORD dwKeyCode = pKey->m_dwKeyCode; | 416 uint32_t dwKeyCode = pKey->m_dwKeyCode; |
417 switch (dwKeyCode) { | 417 switch (dwKeyCode) { |
418 case FWL_VKEY_Return: | 418 case FWL_VKEY_Return: |
419 case FWL_VKEY_Escape: { | 419 case FWL_VKEY_Escape: { |
420 pOuter->ShowDropList(FALSE); | 420 pOuter->ShowDropList(FALSE); |
421 return 1; | 421 return 1; |
422 } | 422 } |
423 case FWL_VKEY_Up: | 423 case FWL_VKEY_Up: |
424 case FWL_VKEY_Down: { | 424 case FWL_VKEY_Down: { |
425 OnDropListKeyDown(pKey); | 425 OnDropListKeyDown(pKey); |
426 pOuter->SetDelegate(nullptr); | 426 pOuter->SetDelegate(nullptr); |
427 pOuter->ProcessSelChanged(FALSE); | 427 pOuter->ProcessSelChanged(FALSE); |
428 return 1; | 428 return 1; |
429 } | 429 } |
430 default: { bPropagate = TRUE; } | 430 default: { bPropagate = TRUE; } |
431 } | 431 } |
432 } else if (pKey->m_dwCmd == FWL_MSGKEYCMD_Char) { | 432 } else if (pKey->m_dwCmd == FWL_MSGKEYCMD_Char) { |
433 bPropagate = TRUE; | 433 bPropagate = TRUE; |
434 } | 434 } |
435 if (bPropagate) { | 435 if (bPropagate) { |
436 pKey->m_pDstTarget = m_pOwner->m_pOuter; | 436 pKey->m_pDstTarget = m_pOwner->m_pOuter; |
437 pOuter->m_pDelegate->OnProcessMessage(pKey); | 437 pOuter->m_pDelegate->OnProcessMessage(pKey); |
438 return 1; | 438 return 1; |
439 } | 439 } |
440 return 0; | 440 return 0; |
441 } | 441 } |
442 void CFWL_ComboListImpDelegate::OnDropListKeyDown(CFWL_MsgKey* pKey) { | 442 void CFWL_ComboListImpDelegate::OnDropListKeyDown(CFWL_MsgKey* pKey) { |
443 FX_DWORD dwKeyCode = pKey->m_dwKeyCode; | 443 uint32_t dwKeyCode = pKey->m_dwKeyCode; |
444 switch (dwKeyCode) { | 444 switch (dwKeyCode) { |
445 case FWL_VKEY_Up: | 445 case FWL_VKEY_Up: |
446 case FWL_VKEY_Down: | 446 case FWL_VKEY_Down: |
447 case FWL_VKEY_Home: | 447 case FWL_VKEY_Home: |
448 case FWL_VKEY_End: { | 448 case FWL_VKEY_End: { |
449 CFWL_ComboBoxImp* pOuter = | 449 CFWL_ComboBoxImp* pOuter = |
450 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); | 450 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); |
451 IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>( | 451 IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>( |
452 m_pOwner->m_pProperties->m_pDataProvider); | 452 m_pOwner->m_pProperties->m_pDataProvider); |
453 FWL_HLISTITEM hItem = | 453 FWL_HLISTITEM hItem = |
(...skipping 24 matching lines...) Expand all Loading... |
478 m_bNeedShowList(FALSE) { | 478 m_bNeedShowList(FALSE) { |
479 m_rtClient.Reset(); | 479 m_rtClient.Reset(); |
480 m_rtBtn.Reset(); | 480 m_rtBtn.Reset(); |
481 m_rtHandler.Reset(); | 481 m_rtHandler.Reset(); |
482 } | 482 } |
483 CFWL_ComboBoxImp::~CFWL_ComboBoxImp() {} | 483 CFWL_ComboBoxImp::~CFWL_ComboBoxImp() {} |
484 FWL_ERR CFWL_ComboBoxImp::GetClassName(CFX_WideString& wsClass) const { | 484 FWL_ERR CFWL_ComboBoxImp::GetClassName(CFX_WideString& wsClass) const { |
485 wsClass = FWL_CLASS_ComboBox; | 485 wsClass = FWL_CLASS_ComboBox; |
486 return FWL_ERR_Succeeded; | 486 return FWL_ERR_Succeeded; |
487 } | 487 } |
488 FX_DWORD CFWL_ComboBoxImp::GetClassID() const { | 488 uint32_t CFWL_ComboBoxImp::GetClassID() const { |
489 return FWL_CLASSHASH_ComboBox; | 489 return FWL_CLASSHASH_ComboBox; |
490 } | 490 } |
491 FWL_ERR CFWL_ComboBoxImp::Initialize() { | 491 FWL_ERR CFWL_ComboBoxImp::Initialize() { |
492 if (m_pWidgetMgr->IsFormDisabled()) { | 492 if (m_pWidgetMgr->IsFormDisabled()) { |
493 return DisForm_Initialize(); | 493 return DisForm_Initialize(); |
494 } | 494 } |
495 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) | 495 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) |
496 return FWL_WGTSTATE_Invisible; // Probably a bug; not a FWL_ERR_ value. | 496 return FWL_WGTSTATE_Invisible; // Probably a bug; not a FWL_ERR_ value. |
497 m_pDelegate = new CFWL_ComboBoxImpDelegate(this); | 497 m_pDelegate = new CFWL_ComboBoxImpDelegate(this); |
498 CFWL_WidgetImpProperties prop; | 498 CFWL_WidgetImpProperties prop; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth)); | 542 GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth)); |
543 if (!pFWidth) | 543 if (!pFWidth) |
544 return FWL_ERR_Indefinite; | 544 return FWL_ERR_Indefinite; |
545 rect.Inflate(0, 0, *pFWidth, 0); | 545 rect.Inflate(0, 0, *pFWidth, 0); |
546 CFWL_WidgetImp::GetWidgetRect(rect, TRUE); | 546 CFWL_WidgetImp::GetWidgetRect(rect, TRUE); |
547 } else { | 547 } else { |
548 rect = m_pProperties->m_rtWidget; | 548 rect = m_pProperties->m_rtWidget; |
549 } | 549 } |
550 return FWL_ERR_Succeeded; | 550 return FWL_ERR_Succeeded; |
551 } | 551 } |
552 FWL_ERR CFWL_ComboBoxImp::ModifyStylesEx(FX_DWORD dwStylesExAdded, | 552 FWL_ERR CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded, |
553 FX_DWORD dwStylesExRemoved) { | 553 uint32_t dwStylesExRemoved) { |
554 if (m_pWidgetMgr->IsFormDisabled()) { | 554 if (m_pWidgetMgr->IsFormDisabled()) { |
555 return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 555 return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
556 } | 556 } |
557 FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; | 557 FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; |
558 FX_BOOL bRemoveDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; | 558 FX_BOOL bRemoveDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; |
559 if (bAddDropDown && !m_pEdit) { | 559 if (bAddDropDown && !m_pEdit) { |
560 CFWL_WidgetImpProperties prop; | 560 CFWL_WidgetImpProperties prop; |
561 m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop, nullptr)); | 561 m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop, nullptr)); |
562 m_pEdit->Initialize(); | 562 m_pEdit->Initialize(); |
563 static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface); | 563 static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface); |
(...skipping 19 matching lines...) Expand all Loading... |
583 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 583 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
584 } | 584 } |
585 Layout(); | 585 Layout(); |
586 CFWL_ThemePart part; | 586 CFWL_ThemePart part; |
587 part.m_pWidget = m_pInterface; | 587 part.m_pWidget = m_pInterface; |
588 m_fComboFormHandler = | 588 m_fComboFormHandler = |
589 *static_cast<FX_FLOAT*>(m_pProperties->m_pThemeProvider->GetCapacity( | 589 *static_cast<FX_FLOAT*>(m_pProperties->m_pThemeProvider->GetCapacity( |
590 &part, FWL_WGTCAPACITY_CMB_ComboFormHandler)); | 590 &part, FWL_WGTCAPACITY_CMB_ComboFormHandler)); |
591 return FWL_ERR_Succeeded; | 591 return FWL_ERR_Succeeded; |
592 } | 592 } |
593 FX_DWORD CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 593 uint32_t CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
594 if (m_pWidgetMgr->IsFormDisabled()) { | 594 if (m_pWidgetMgr->IsFormDisabled()) { |
595 return DisForm_HitTest(fx, fy); | 595 return DisForm_HitTest(fx, fy); |
596 } | 596 } |
597 return CFWL_WidgetImp::HitTest(fx, fy); | 597 return CFWL_WidgetImp::HitTest(fx, fy); |
598 } | 598 } |
599 FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, | 599 FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, |
600 const CFX_Matrix* pMatrix) { | 600 const CFX_Matrix* pMatrix) { |
601 if (m_pWidgetMgr->IsFormDisabled()) { | 601 if (m_pWidgetMgr->IsFormDisabled()) { |
602 return DisForm_DrawWidget(pGraphics, pMatrix); | 602 return DisForm_DrawWidget(pGraphics, pMatrix); |
603 } | 603 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iSel); | 712 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iSel); |
713 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) | 713 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) |
714 ->GetItemText(hItem, wsText); | 714 ->GetItemText(hItem, wsText); |
715 m_pEdit->SetText(wsText); | 715 m_pEdit->SetText(wsText); |
716 } | 716 } |
717 m_pEdit->Update(); | 717 m_pEdit->Update(); |
718 } | 718 } |
719 m_iCurSel = bClearSel ? -1 : iSel; | 719 m_iCurSel = bClearSel ? -1 : iSel; |
720 return FWL_ERR_Succeeded; | 720 return FWL_ERR_Succeeded; |
721 } | 721 } |
722 FWL_ERR CFWL_ComboBoxImp::SetStates(FX_DWORD dwStates, FX_BOOL bSet) { | 722 FWL_ERR CFWL_ComboBoxImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { |
723 FX_BOOL bIsDropDown = IsDropDownStyle(); | 723 FX_BOOL bIsDropDown = IsDropDownStyle(); |
724 if (bIsDropDown && m_pEdit) { | 724 if (bIsDropDown && m_pEdit) { |
725 m_pEdit->SetStates(dwStates, bSet); | 725 m_pEdit->SetStates(dwStates, bSet); |
726 } | 726 } |
727 if (m_pListBox) { | 727 if (m_pListBox) { |
728 m_pListBox->SetStates(dwStates, bSet); | 728 m_pListBox->SetStates(dwStates, bSet); |
729 } | 729 } |
730 return CFWL_WidgetImp::SetStates(dwStates, bSet); | 730 return CFWL_WidgetImp::SetStates(dwStates, bSet); |
731 } | 731 } |
732 FWL_ERR CFWL_ComboBoxImp::SetEditText(const CFX_WideString& wsText) { | 732 FWL_ERR CFWL_ComboBoxImp::SetEditText(const CFX_WideString& wsText) { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 } | 856 } |
857 rect = m_pProperties->m_rtWidget; | 857 rect = m_pProperties->m_rtWidget; |
858 if (m_pListBox && IsDropListShowed()) { | 858 if (m_pListBox && IsDropListShowed()) { |
859 CFX_RectF rtList; | 859 CFX_RectF rtList; |
860 m_pListBox->GetWidgetRect(rtList); | 860 m_pListBox->GetWidgetRect(rtList); |
861 rtList.Offset(rect.left, rect.top); | 861 rtList.Offset(rect.left, rect.top); |
862 rect.Union(rtList); | 862 rect.Union(rtList); |
863 } | 863 } |
864 return FWL_ERR_Succeeded; | 864 return FWL_ERR_Succeeded; |
865 } | 865 } |
866 FWL_ERR CFWL_ComboBoxImp::EditModifyStylesEx(FX_DWORD dwStylesExAdded, | 866 FWL_ERR CFWL_ComboBoxImp::EditModifyStylesEx(uint32_t dwStylesExAdded, |
867 FX_DWORD dwStylesExRemoved) { | 867 uint32_t dwStylesExRemoved) { |
868 if (m_pEdit != NULL) { | 868 if (m_pEdit != NULL) { |
869 return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 869 return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
870 } else { | 870 } else { |
871 return FWL_ERR_Parameter_Invalid; | 871 return FWL_ERR_Parameter_Invalid; |
872 } | 872 } |
873 } | 873 } |
874 FX_FLOAT CFWL_ComboBoxImp::GetListHeight() { | 874 FX_FLOAT CFWL_ComboBoxImp::GetListHeight() { |
875 return static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider) | 875 return static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider) |
876 ->GetListHeight(m_pInterface); | 876 ->GetListHeight(m_pInterface); |
877 } | 877 } |
(...skipping 19 matching lines...) Expand all Loading... |
897 return; | 897 return; |
898 } | 898 } |
899 if (!m_pForm) { | 899 if (!m_pForm) { |
900 InitProxyForm(); | 900 InitProxyForm(); |
901 } | 901 } |
902 m_pListProxyDelegate->Reset(); | 902 m_pListProxyDelegate->Reset(); |
903 if (bActivate) { | 903 if (bActivate) { |
904 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) | 904 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) |
905 ->ChangeSelected(m_iCurSel); | 905 ->ChangeSelected(m_iCurSel); |
906 ReSetListItemAlignment(); | 906 ReSetListItemAlignment(); |
907 FX_DWORD dwStyleAdd = m_pProperties->m_dwStyleExes & | 907 uint32_t dwStyleAdd = m_pProperties->m_dwStyleExes & |
908 (FWL_STYLEEXT_CMB_Sort | FWL_STYLEEXT_CMB_OwnerDraw); | 908 (FWL_STYLEEXT_CMB_Sort | FWL_STYLEEXT_CMB_OwnerDraw); |
909 m_pListBox->ModifyStylesEx(dwStyleAdd, 0); | 909 m_pListBox->ModifyStylesEx(dwStyleAdd, 0); |
910 m_pListBox->GetWidgetRect(m_rtList, TRUE); | 910 m_pListBox->GetWidgetRect(m_rtList, TRUE); |
911 FX_FLOAT fHeight = GetListHeight(); | 911 FX_FLOAT fHeight = GetListHeight(); |
912 if (fHeight > 0) { | 912 if (fHeight > 0) { |
913 if (m_rtList.height > GetListHeight()) { | 913 if (m_rtList.height > GetListHeight()) { |
914 m_rtList.height = GetListHeight(); | 914 m_rtList.height = GetListHeight(); |
915 m_pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll, 0); | 915 m_pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll, 0); |
916 } | 916 } |
917 } | 917 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 } | 1042 } |
1043 if (m_pEdit) { | 1043 if (m_pEdit) { |
1044 if (!m_pEdit->GetThemeProvider() && pTheme->IsValidWidget(m_pEdit.get())) { | 1044 if (!m_pEdit->GetThemeProvider() && pTheme->IsValidWidget(m_pEdit.get())) { |
1045 m_pEdit->SetThemeProvider(pTheme); | 1045 m_pEdit->SetThemeProvider(pTheme); |
1046 } | 1046 } |
1047 } | 1047 } |
1048 } | 1048 } |
1049 void CFWL_ComboBoxImp::ReSetEditAlignment() { | 1049 void CFWL_ComboBoxImp::ReSetEditAlignment() { |
1050 if (!m_pEdit) | 1050 if (!m_pEdit) |
1051 return; | 1051 return; |
1052 FX_DWORD dwStylExes = m_pProperties->m_dwStyleExes; | 1052 uint32_t dwStylExes = m_pProperties->m_dwStyleExes; |
1053 FX_DWORD dwAdd = 0; | 1053 uint32_t dwAdd = 0; |
1054 switch (dwStylExes & FWL_STYLEEXT_CMB_EditHAlignMask) { | 1054 switch (dwStylExes & FWL_STYLEEXT_CMB_EditHAlignMask) { |
1055 case FWL_STYLEEXT_CMB_EditHCenter: { | 1055 case FWL_STYLEEXT_CMB_EditHCenter: { |
1056 dwAdd |= FWL_STYLEEXT_EDT_HCenter; | 1056 dwAdd |= FWL_STYLEEXT_EDT_HCenter; |
1057 break; | 1057 break; |
1058 } | 1058 } |
1059 case FWL_STYLEEXT_CMB_EditHFar: { | 1059 case FWL_STYLEEXT_CMB_EditHFar: { |
1060 dwAdd |= FWL_STYLEEXT_EDT_HFar; | 1060 dwAdd |= FWL_STYLEEXT_EDT_HFar; |
1061 break; | 1061 break; |
1062 } | 1062 } |
1063 default: { dwAdd |= FWL_STYLEEXT_EDT_HNear; } | 1063 default: { dwAdd |= FWL_STYLEEXT_EDT_HNear; } |
(...skipping 15 matching lines...) Expand all Loading... |
1079 if (dwStylExes & FWL_STYLEEXT_CMB_EditDistributed) { | 1079 if (dwStylExes & FWL_STYLEEXT_CMB_EditDistributed) { |
1080 dwAdd |= FWL_STYLEEXT_EDT_Distributed; | 1080 dwAdd |= FWL_STYLEEXT_EDT_Distributed; |
1081 } | 1081 } |
1082 m_pEdit->ModifyStylesEx(dwAdd, FWL_STYLEEXT_EDT_HAlignMask | | 1082 m_pEdit->ModifyStylesEx(dwAdd, FWL_STYLEEXT_EDT_HAlignMask | |
1083 FWL_STYLEEXT_EDT_HAlignModeMask | | 1083 FWL_STYLEEXT_EDT_HAlignModeMask | |
1084 FWL_STYLEEXT_EDT_VAlignMask); | 1084 FWL_STYLEEXT_EDT_VAlignMask); |
1085 } | 1085 } |
1086 void CFWL_ComboBoxImp::ReSetListItemAlignment() { | 1086 void CFWL_ComboBoxImp::ReSetListItemAlignment() { |
1087 if (!m_pListBox) | 1087 if (!m_pListBox) |
1088 return; | 1088 return; |
1089 FX_DWORD dwStylExes = m_pProperties->m_dwStyleExes; | 1089 uint32_t dwStylExes = m_pProperties->m_dwStyleExes; |
1090 FX_DWORD dwAdd = 0; | 1090 uint32_t dwAdd = 0; |
1091 switch (dwStylExes & FWL_STYLEEXT_CMB_ListItemAlignMask) { | 1091 switch (dwStylExes & FWL_STYLEEXT_CMB_ListItemAlignMask) { |
1092 case FWL_STYLEEXT_CMB_ListItemCenterAlign: { | 1092 case FWL_STYLEEXT_CMB_ListItemCenterAlign: { |
1093 dwAdd |= FWL_STYLEEXT_LTB_CenterAlign; | 1093 dwAdd |= FWL_STYLEEXT_LTB_CenterAlign; |
1094 } | 1094 } |
1095 case FWL_STYLEEXT_CMB_ListItemRightAlign: { | 1095 case FWL_STYLEEXT_CMB_ListItemRightAlign: { |
1096 dwAdd |= FWL_STYLEEXT_LTB_RightAlign; | 1096 dwAdd |= FWL_STYLEEXT_LTB_RightAlign; |
1097 } | 1097 } |
1098 default: { dwAdd |= FWL_STYLEEXT_LTB_LeftAlign; } | 1098 default: { dwAdd |= FWL_STYLEEXT_LTB_LeftAlign; } |
1099 } | 1099 } |
1100 m_pListBox->ModifyStylesEx(dwAdd, FWL_STYLEEXT_CMB_ListItemAlignMask); | 1100 m_pListBox->ModifyStylesEx(dwAdd, FWL_STYLEEXT_CMB_ListItemAlignMask); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 DispatchEvent(&postEvent); | 1217 DispatchEvent(&postEvent); |
1218 } | 1218 } |
1219 CFX_RectF rect; | 1219 CFX_RectF rect; |
1220 m_pListBox->GetWidgetRect(rect); | 1220 m_pListBox->GetWidgetRect(rect); |
1221 rect.Inflate(2, 2); | 1221 rect.Inflate(2, 2); |
1222 Repaint(&rect); | 1222 Repaint(&rect); |
1223 } | 1223 } |
1224 FX_BOOL CFWL_ComboBoxImp::DisForm_IsDropListShowed() { | 1224 FX_BOOL CFWL_ComboBoxImp::DisForm_IsDropListShowed() { |
1225 return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible); | 1225 return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible); |
1226 } | 1226 } |
1227 FWL_ERR CFWL_ComboBoxImp::DisForm_ModifyStylesEx(FX_DWORD dwStylesExAdded, | 1227 FWL_ERR CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, |
1228 FX_DWORD dwStylesExRemoved) { | 1228 uint32_t dwStylesExRemoved) { |
1229 if (!m_pEdit) { | 1229 if (!m_pEdit) { |
1230 DisForm_InitComboEdit(); | 1230 DisForm_InitComboEdit(); |
1231 } | 1231 } |
1232 FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; | 1232 FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; |
1233 FX_BOOL bDelDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; | 1233 FX_BOOL bDelDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; |
1234 dwStylesExRemoved &= ~FWL_STYLEEXT_CMB_DropDown; | 1234 dwStylesExRemoved &= ~FWL_STYLEEXT_CMB_DropDown; |
1235 m_pProperties->m_dwStyleExes |= FWL_STYLEEXT_CMB_DropDown; | 1235 m_pProperties->m_dwStyleExes |= FWL_STYLEEXT_CMB_DropDown; |
1236 if (bAddDropDown) { | 1236 if (bAddDropDown) { |
1237 m_pEdit->ModifyStylesEx(0, FWL_STYLEEXT_EDT_ReadOnly); | 1237 m_pEdit->ModifyStylesEx(0, FWL_STYLEEXT_EDT_ReadOnly); |
1238 } else if (bDelDropDown) { | 1238 } else if (bDelDropDown) { |
1239 m_pEdit->ModifyStylesEx(FWL_STYLEEXT_EDT_ReadOnly, 0); | 1239 m_pEdit->ModifyStylesEx(FWL_STYLEEXT_EDT_ReadOnly, 0); |
1240 } | 1240 } |
1241 return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 1241 return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
1242 } | 1242 } |
1243 FWL_ERR CFWL_ComboBoxImp::DisForm_Update() { | 1243 FWL_ERR CFWL_ComboBoxImp::DisForm_Update() { |
1244 if (m_iLock) { | 1244 if (m_iLock) { |
1245 return FWL_ERR_Indefinite; | 1245 return FWL_ERR_Indefinite; |
1246 } | 1246 } |
1247 if (m_pEdit) { | 1247 if (m_pEdit) { |
1248 ReSetEditAlignment(); | 1248 ReSetEditAlignment(); |
1249 } | 1249 } |
1250 ReSetTheme(); | 1250 ReSetTheme(); |
1251 Layout(); | 1251 Layout(); |
1252 return FWL_ERR_Succeeded; | 1252 return FWL_ERR_Succeeded; |
1253 } | 1253 } |
1254 FX_DWORD CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 1254 uint32_t CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
1255 CFX_RectF rect; | 1255 CFX_RectF rect; |
1256 rect.Set(0, 0, m_pProperties->m_rtWidget.width - m_rtBtn.width, | 1256 rect.Set(0, 0, m_pProperties->m_rtWidget.width - m_rtBtn.width, |
1257 m_pProperties->m_rtWidget.height); | 1257 m_pProperties->m_rtWidget.height); |
1258 if (rect.Contains(fx, fy)) { | 1258 if (rect.Contains(fx, fy)) { |
1259 return FWL_WGTHITTEST_Edit; | 1259 return FWL_WGTHITTEST_Edit; |
1260 } | 1260 } |
1261 if (m_rtBtn.Contains(fx, fy)) { | 1261 if (m_rtBtn.Contains(fx, fy)) { |
1262 return FWL_WGTHITTEST_Client; | 1262 return FWL_WGTHITTEST_Client; |
1263 } | 1263 } |
1264 if (DisForm_IsDropListShowed()) { | 1264 if (DisForm_IsDropListShowed()) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 } | 1359 } |
1360 } | 1360 } |
1361 CFWL_ComboBoxImpDelegate::CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner) | 1361 CFWL_ComboBoxImpDelegate::CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner) |
1362 : m_pOwner(pOwner) {} | 1362 : m_pOwner(pOwner) {} |
1363 int32_t CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 1363 int32_t CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
1364 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { | 1364 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { |
1365 return DisForm_OnProcessMessage(pMessage); | 1365 return DisForm_OnProcessMessage(pMessage); |
1366 } | 1366 } |
1367 if (!pMessage) | 1367 if (!pMessage) |
1368 return 0; | 1368 return 0; |
1369 FX_DWORD dwMsgCode = pMessage->GetClassID(); | 1369 uint32_t dwMsgCode = pMessage->GetClassID(); |
1370 FX_BOOL iRet = 1; | 1370 FX_BOOL iRet = 1; |
1371 switch (dwMsgCode) { | 1371 switch (dwMsgCode) { |
1372 case FWL_MSGHASH_SetFocus: | 1372 case FWL_MSGHASH_SetFocus: |
1373 case FWL_MSGHASH_KillFocus: { | 1373 case FWL_MSGHASH_KillFocus: { |
1374 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | 1374 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); |
1375 break; | 1375 break; |
1376 } | 1376 } |
1377 case FWL_MSGHASH_Mouse: { | 1377 case FWL_MSGHASH_Mouse: { |
1378 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 1378 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
1379 FX_DWORD dwCmd = pMsg->m_dwCmd; | 1379 uint32_t dwCmd = pMsg->m_dwCmd; |
1380 switch (dwCmd) { | 1380 switch (dwCmd) { |
1381 case FWL_MSGMOUSECMD_LButtonDown: { | 1381 case FWL_MSGMOUSECMD_LButtonDown: { |
1382 OnLButtonDown(pMsg); | 1382 OnLButtonDown(pMsg); |
1383 break; | 1383 break; |
1384 } | 1384 } |
1385 case FWL_MSGMOUSECMD_LButtonUp: { | 1385 case FWL_MSGMOUSECMD_LButtonUp: { |
1386 OnLButtonUp(pMsg); | 1386 OnLButtonUp(pMsg); |
1387 break; | 1387 break; |
1388 } | 1388 } |
1389 case FWL_MSGMOUSECMD_MouseMove: { | 1389 case FWL_MSGMOUSECMD_MouseMove: { |
(...skipping 11 matching lines...) Expand all Loading... |
1401 case FWL_MSGHASH_Key: { | 1401 case FWL_MSGHASH_Key: { |
1402 OnKey(static_cast<CFWL_MsgKey*>(pMessage)); | 1402 OnKey(static_cast<CFWL_MsgKey*>(pMessage)); |
1403 break; | 1403 break; |
1404 } | 1404 } |
1405 default: { iRet = 0; } | 1405 default: { iRet = 0; } |
1406 } | 1406 } |
1407 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 1407 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
1408 return iRet; | 1408 return iRet; |
1409 } | 1409 } |
1410 FWL_ERR CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 1410 FWL_ERR CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
1411 FX_DWORD dwFlag = pEvent->GetClassID(); | 1411 uint32_t dwFlag = pEvent->GetClassID(); |
1412 if (dwFlag == FWL_EVTHASH_LTB_DrawItem) { | 1412 if (dwFlag == FWL_EVTHASH_LTB_DrawItem) { |
1413 CFWL_EvtLtbDrawItem* pDrawItemEvent = | 1413 CFWL_EvtLtbDrawItem* pDrawItemEvent = |
1414 static_cast<CFWL_EvtLtbDrawItem*>(pEvent); | 1414 static_cast<CFWL_EvtLtbDrawItem*>(pEvent); |
1415 CFWL_EvtCmbDrawItem pTemp; | 1415 CFWL_EvtCmbDrawItem pTemp; |
1416 pTemp.m_pSrcTarget = m_pOwner->m_pInterface; | 1416 pTemp.m_pSrcTarget = m_pOwner->m_pInterface; |
1417 pTemp.m_pGraphics = pDrawItemEvent->m_pGraphics; | 1417 pTemp.m_pGraphics = pDrawItemEvent->m_pGraphics; |
1418 pTemp.m_index = pDrawItemEvent->m_index; | 1418 pTemp.m_index = pDrawItemEvent->m_index; |
1419 pTemp.m_rtItem = pDrawItemEvent->m_rect; | 1419 pTemp.m_rtItem = pDrawItemEvent->m_rect; |
1420 m_pOwner->DispatchEvent(&pTemp); | 1420 m_pOwner->DispatchEvent(&pTemp); |
1421 } else if (dwFlag == FWL_EVTHASH_Scroll) { | 1421 } else if (dwFlag == FWL_EVTHASH_Scroll) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1515 } | 1515 } |
1516 void CFWL_ComboBoxImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) { | 1516 void CFWL_ComboBoxImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) { |
1517 if (!m_pOwner->IsDropListShowed() && | 1517 if (!m_pOwner->IsDropListShowed() && |
1518 !((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == | 1518 !((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == |
1519 FWL_WGTSTATE_Disabled)) { | 1519 FWL_WGTSTATE_Disabled)) { |
1520 m_pOwner->m_iBtnState = FWL_PARTSTATE_CMB_Normal; | 1520 m_pOwner->m_iBtnState = FWL_PARTSTATE_CMB_Normal; |
1521 m_pOwner->Repaint(&m_pOwner->m_rtBtn); | 1521 m_pOwner->Repaint(&m_pOwner->m_rtBtn); |
1522 } | 1522 } |
1523 } | 1523 } |
1524 void CFWL_ComboBoxImpDelegate::OnKey(CFWL_MsgKey* pMsg) { | 1524 void CFWL_ComboBoxImpDelegate::OnKey(CFWL_MsgKey* pMsg) { |
1525 FX_DWORD dwKeyCode = pMsg->m_dwKeyCode; | 1525 uint32_t dwKeyCode = pMsg->m_dwKeyCode; |
1526 if (dwKeyCode == FWL_VKEY_Tab) { | 1526 if (dwKeyCode == FWL_VKEY_Tab) { |
1527 m_pOwner->DispatchKeyEvent(pMsg); | 1527 m_pOwner->DispatchKeyEvent(pMsg); |
1528 return; | 1528 return; |
1529 } | 1529 } |
1530 if (pMsg->m_pDstTarget == m_pOwner->m_pInterface) | 1530 if (pMsg->m_pDstTarget == m_pOwner->m_pInterface) |
1531 DoSubCtrlKey(pMsg); | 1531 DoSubCtrlKey(pMsg); |
1532 } | 1532 } |
1533 void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) { | 1533 void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) { |
1534 FX_DWORD dwKeyCode = pMsg->m_dwKeyCode; | 1534 uint32_t dwKeyCode = pMsg->m_dwKeyCode; |
1535 const bool bUp = dwKeyCode == FWL_VKEY_Up; | 1535 const bool bUp = dwKeyCode == FWL_VKEY_Up; |
1536 const bool bDown = dwKeyCode == FWL_VKEY_Down; | 1536 const bool bDown = dwKeyCode == FWL_VKEY_Down; |
1537 if (bUp || bDown) { | 1537 if (bUp || bDown) { |
1538 int32_t iCount = | 1538 int32_t iCount = |
1539 static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()) | 1539 static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()) |
1540 ->CountItems(); | 1540 ->CountItems(); |
1541 if (iCount < 1) { | 1541 if (iCount < 1) { |
1542 return; | 1542 return; |
1543 } | 1543 } |
1544 FX_BOOL bMatchEqual = FALSE; | 1544 FX_BOOL bMatchEqual = FALSE; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle(); | 1582 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle(); |
1583 if (bDropDown) { | 1583 if (bDropDown) { |
1584 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); | 1584 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); |
1585 pDelegate->OnProcessMessage(pMsg); | 1585 pDelegate->OnProcessMessage(pMsg); |
1586 } | 1586 } |
1587 } | 1587 } |
1588 int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( | 1588 int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( |
1589 CFWL_Message* pMessage) { | 1589 CFWL_Message* pMessage) { |
1590 if (!pMessage) | 1590 if (!pMessage) |
1591 return 0; | 1591 return 0; |
1592 FX_DWORD dwMsgCode = pMessage->GetClassID(); | 1592 uint32_t dwMsgCode = pMessage->GetClassID(); |
1593 FX_BOOL backDefault = TRUE; | 1593 FX_BOOL backDefault = TRUE; |
1594 switch (dwMsgCode) { | 1594 switch (dwMsgCode) { |
1595 case FWL_MSGHASH_SetFocus: | 1595 case FWL_MSGHASH_SetFocus: |
1596 case FWL_MSGHASH_KillFocus: { | 1596 case FWL_MSGHASH_KillFocus: { |
1597 backDefault = FALSE; | 1597 backDefault = FALSE; |
1598 DisForm_OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | 1598 DisForm_OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); |
1599 break; | 1599 break; |
1600 } | 1600 } |
1601 case FWL_MSGHASH_Mouse: { | 1601 case FWL_MSGHASH_Mouse: { |
1602 backDefault = FALSE; | 1602 backDefault = FALSE; |
1603 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 1603 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
1604 FX_DWORD dwCmd = pMsg->m_dwCmd; | 1604 uint32_t dwCmd = pMsg->m_dwCmd; |
1605 switch (dwCmd) { | 1605 switch (dwCmd) { |
1606 case FWL_MSGMOUSECMD_LButtonDown: { | 1606 case FWL_MSGMOUSECMD_LButtonDown: { |
1607 DisForm_OnLButtonDown(pMsg); | 1607 DisForm_OnLButtonDown(pMsg); |
1608 break; | 1608 break; |
1609 } | 1609 } |
1610 case FWL_MSGMOUSECMD_LButtonUp: { | 1610 case FWL_MSGMOUSECMD_LButtonUp: { |
1611 OnLButtonUp(pMsg); | 1611 OnLButtonUp(pMsg); |
1612 break; | 1612 break; |
1613 } | 1613 } |
1614 default: {} | 1614 default: {} |
1615 } | 1615 } |
1616 break; | 1616 break; |
1617 } | 1617 } |
1618 case FWL_MSGHASH_Key: { | 1618 case FWL_MSGHASH_Key: { |
1619 backDefault = FALSE; | 1619 backDefault = FALSE; |
1620 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); | 1620 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); |
1621 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyUp) { | 1621 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyUp) { |
1622 break; | 1622 break; |
1623 } | 1623 } |
1624 if (m_pOwner->DisForm_IsDropListShowed() && | 1624 if (m_pOwner->DisForm_IsDropListShowed() && |
1625 pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { | 1625 pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { |
1626 FX_DWORD dwKeyCode = pKey->m_dwKeyCode; | 1626 uint32_t dwKeyCode = pKey->m_dwKeyCode; |
1627 FX_BOOL bListKey = | 1627 FX_BOOL bListKey = |
1628 dwKeyCode == FWL_VKEY_Up || dwKeyCode == FWL_VKEY_Down || | 1628 dwKeyCode == FWL_VKEY_Up || dwKeyCode == FWL_VKEY_Down || |
1629 dwKeyCode == FWL_VKEY_Return || dwKeyCode == FWL_VKEY_Escape; | 1629 dwKeyCode == FWL_VKEY_Return || dwKeyCode == FWL_VKEY_Escape; |
1630 if (bListKey) { | 1630 if (bListKey) { |
1631 IFWL_WidgetDelegate* pDelegate = | 1631 IFWL_WidgetDelegate* pDelegate = |
1632 m_pOwner->m_pListBox->SetDelegate(NULL); | 1632 m_pOwner->m_pListBox->SetDelegate(NULL); |
1633 pDelegate->OnProcessMessage(pMessage); | 1633 pDelegate->OnProcessMessage(pMessage); |
1634 break; | 1634 break; |
1635 } | 1635 } |
1636 } | 1636 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1676 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; | 1676 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; |
1677 m_pOwner->DisForm_ShowDropList(FALSE); | 1677 m_pOwner->DisForm_ShowDropList(FALSE); |
1678 CFWL_MsgKillFocus msg; | 1678 CFWL_MsgKillFocus msg; |
1679 msg.m_pDstTarget = NULL; | 1679 msg.m_pDstTarget = NULL; |
1680 msg.m_pSrcTarget = m_pOwner->m_pEdit.get(); | 1680 msg.m_pSrcTarget = m_pOwner->m_pEdit.get(); |
1681 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); | 1681 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); |
1682 pDelegate->OnProcessMessage(&msg); | 1682 pDelegate->OnProcessMessage(&msg); |
1683 } | 1683 } |
1684 } | 1684 } |
1685 void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) { | 1685 void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) { |
1686 FX_DWORD dwKeyCode = pMsg->m_dwKeyCode; | 1686 uint32_t dwKeyCode = pMsg->m_dwKeyCode; |
1687 const bool bUp = dwKeyCode == FWL_VKEY_Up; | 1687 const bool bUp = dwKeyCode == FWL_VKEY_Up; |
1688 const bool bDown = dwKeyCode == FWL_VKEY_Down; | 1688 const bool bDown = dwKeyCode == FWL_VKEY_Down; |
1689 if (bUp || bDown) { | 1689 if (bUp || bDown) { |
1690 CFWL_ComboListImp* pComboList = | 1690 CFWL_ComboListImp* pComboList = |
1691 static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()); | 1691 static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()); |
1692 int32_t iCount = pComboList->CountItems(); | 1692 int32_t iCount = pComboList->CountItems(); |
1693 if (iCount < 1) { | 1693 if (iCount < 1) { |
1694 return; | 1694 return; |
1695 } | 1695 } |
1696 FX_BOOL bMatchEqual = FALSE; | 1696 FX_BOOL bMatchEqual = FALSE; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 IFWL_Form* pForm, | 1731 IFWL_Form* pForm, |
1732 CFWL_ComboBoxImp* pComboBox) | 1732 CFWL_ComboBoxImp* pComboBox) |
1733 : m_bLButtonDown(FALSE), | 1733 : m_bLButtonDown(FALSE), |
1734 m_bLButtonUpSelf(FALSE), | 1734 m_bLButtonUpSelf(FALSE), |
1735 m_fStartPos(0), | 1735 m_fStartPos(0), |
1736 m_pForm(pForm), | 1736 m_pForm(pForm), |
1737 m_pComboBox(pComboBox) {} | 1737 m_pComboBox(pComboBox) {} |
1738 int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 1738 int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
1739 if (!pMessage) | 1739 if (!pMessage) |
1740 return 0; | 1740 return 0; |
1741 FX_DWORD dwMsgCode = pMessage->GetClassID(); | 1741 uint32_t dwMsgCode = pMessage->GetClassID(); |
1742 if (dwMsgCode == FWL_MSGHASH_Mouse) { | 1742 if (dwMsgCode == FWL_MSGHASH_Mouse) { |
1743 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 1743 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
1744 FX_DWORD dwCmd = pMsg->m_dwCmd; | 1744 uint32_t dwCmd = pMsg->m_dwCmd; |
1745 switch (dwCmd) { | 1745 switch (dwCmd) { |
1746 case FWL_MSGMOUSECMD_LButtonDown: { | 1746 case FWL_MSGMOUSECMD_LButtonDown: { |
1747 OnLButtonDown(pMsg); | 1747 OnLButtonDown(pMsg); |
1748 break; | 1748 break; |
1749 } | 1749 } |
1750 case FWL_MSGMOUSECMD_LButtonUp: { | 1750 case FWL_MSGMOUSECMD_LButtonUp: { |
1751 OnLButtonUp(pMsg); | 1751 OnLButtonUp(pMsg); |
1752 break; | 1752 break; |
1753 } | 1753 } |
1754 case FWL_MSGMOUSECMD_MouseMove: { | 1754 case FWL_MSGMOUSECMD_MouseMove: { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1815 m_pComboBox->ShowDropList(FALSE); | 1815 m_pComboBox->ShowDropList(FALSE); |
1816 } | 1816 } |
1817 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, | 1817 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, |
1818 FX_BOOL bSet) { | 1818 FX_BOOL bSet) { |
1819 if (!bSet) { | 1819 if (!bSet) { |
1820 if (pMsg->m_pSetFocus == NULL) { | 1820 if (pMsg->m_pSetFocus == NULL) { |
1821 m_pComboBox->ShowDropList(FALSE); | 1821 m_pComboBox->ShowDropList(FALSE); |
1822 } | 1822 } |
1823 } | 1823 } |
1824 } | 1824 } |
OLD | NEW |