| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 CFWL_ComboEditImp::CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties, | 136 CFWL_ComboEditImp::CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties, |
| 137 IFWL_Widget* pOuter) | 137 IFWL_Widget* pOuter) |
| 138 : CFWL_EditImp(properties, pOuter) { | 138 : CFWL_EditImp(properties, pOuter) { |
| 139 m_pOuter = static_cast<CFWL_ComboBoxImp*>(pOuter->GetImpl()); | 139 m_pOuter = static_cast<CFWL_ComboBoxImp*>(pOuter->GetImpl()); |
| 140 } | 140 } |
| 141 | 141 |
| 142 CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner) | 142 CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner) |
| 143 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} | 143 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} |
| 144 |
| 144 int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 145 int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 145 if (!pMessage) | 146 if (!pMessage) |
| 146 return 0; | 147 return 0; |
| 147 uint32_t dwMsgCode = pMessage->GetClassID(); | 148 |
| 148 FX_BOOL backDefault = TRUE; | 149 FX_BOOL backDefault = TRUE; |
| 149 switch (dwMsgCode) { | 150 switch (pMessage->GetClassID()) { |
| 150 case FWL_MSGHASH_SetFocus: | 151 case CFWL_MessageType::SetFocus: { |
| 151 case FWL_MSGHASH_KillFocus: { | 152 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; |
| 152 if (dwMsgCode == FWL_MSGHASH_SetFocus) { | |
| 153 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; | |
| 154 } else { | |
| 155 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; | |
| 156 } | |
| 157 backDefault = FALSE; | 153 backDefault = FALSE; |
| 158 break; | 154 break; |
| 159 } | 155 } |
| 160 case FWL_MSGHASH_Mouse: { | 156 case CFWL_MessageType::KillFocus: { |
| 157 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; |
| 158 backDefault = FALSE; |
| 159 break; |
| 160 } |
| 161 case CFWL_MessageType::Mouse: { |
| 161 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 162 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| 162 if ((pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonDown) && | 163 if ((pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonDown) && |
| 163 ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) { | 164 ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) { |
| 164 m_pOwner->SetSelected(); | 165 m_pOwner->SetSelected(); |
| 165 m_pOwner->SetComboBoxFocus(TRUE); | 166 m_pOwner->SetComboBoxFocus(TRUE); |
| 166 } | 167 } |
| 167 break; | 168 break; |
| 168 } | 169 } |
| 169 default: {} | 170 default: |
| 171 break; |
| 170 } | 172 } |
| 171 if (!backDefault) { | 173 if (!backDefault) |
| 172 return 1; | 174 return 1; |
| 173 } | |
| 174 return CFWL_EditImpDelegate::OnProcessMessage(pMessage); | 175 return CFWL_EditImpDelegate::OnProcessMessage(pMessage); |
| 175 } | 176 } |
| 177 |
| 176 void CFWL_ComboEditImp::ClearSelected() { | 178 void CFWL_ComboEditImp::ClearSelected() { |
| 177 ClearSelections(); | 179 ClearSelections(); |
| 178 Repaint(&m_rtClient); | 180 Repaint(&m_rtClient); |
| 179 } | 181 } |
| 180 void CFWL_ComboEditImp::SetSelected() { | 182 void CFWL_ComboEditImp::SetSelected() { |
| 181 FlagFocus(TRUE); | 183 FlagFocus(TRUE); |
| 182 EndCaret(); | 184 EndCaret(); |
| 183 AddSelRange(0); | 185 AddSelRange(0); |
| 184 } | 186 } |
| 185 void CFWL_ComboEditImp::EndCaret() { | 187 void CFWL_ComboEditImp::EndCaret() { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 void CFWL_ComboListImp::ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy) { | 276 void CFWL_ComboListImp::ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy) { |
| 275 fx += m_pProperties->m_rtWidget.left, fy += m_pProperties->m_rtWidget.top; | 277 fx += m_pProperties->m_rtWidget.left, fy += m_pProperties->m_rtWidget.top; |
| 276 IFWL_Widget* pOwner = GetOwner(); | 278 IFWL_Widget* pOwner = GetOwner(); |
| 277 if (!pOwner) | 279 if (!pOwner) |
| 278 return; | 280 return; |
| 279 pOwner->TransformTo(m_pOuter, fx, fy); | 281 pOwner->TransformTo(m_pOuter, fx, fy); |
| 280 } | 282 } |
| 281 void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) { | 283 void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) { |
| 282 CFWL_WidgetImp::SetFocus(bSet); | 284 CFWL_WidgetImp::SetFocus(bSet); |
| 283 } | 285 } |
| 286 |
| 284 CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner) | 287 CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner) |
| 285 : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) {} | 288 : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) {} |
| 289 |
| 286 int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 290 int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 287 if (!pMessage) | 291 if (!pMessage) |
| 288 return 0; | 292 return 0; |
| 289 uint32_t dwHashCode = pMessage->GetClassID(); | 293 |
| 294 CFWL_MessageType dwHashCode = pMessage->GetClassID(); |
| 290 FX_BOOL backDefault = TRUE; | 295 FX_BOOL backDefault = TRUE; |
| 291 if (dwHashCode == FWL_MSGHASH_SetFocus || | 296 if (dwHashCode == CFWL_MessageType::SetFocus || |
| 292 dwHashCode == FWL_MSGHASH_KillFocus) { | 297 dwHashCode == CFWL_MessageType::KillFocus) { |
| 293 OnDropListFocusChanged(pMessage, dwHashCode == FWL_MSGHASH_SetFocus); | 298 OnDropListFocusChanged(pMessage, dwHashCode == CFWL_MessageType::SetFocus); |
| 294 } else if (dwHashCode == FWL_MSGHASH_Mouse) { | 299 } else if (dwHashCode == CFWL_MessageType::Mouse) { |
| 295 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 300 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| 296 if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) { | 301 if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) { |
| 297 CFX_RectF rect; | 302 CFX_RectF rect; |
| 298 m_pOwner->m_pVertScrollBar->GetWidgetRect(rect); | 303 m_pOwner->m_pVertScrollBar->GetWidgetRect(rect); |
| 299 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { | 304 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { |
| 300 pMsg->m_fx -= rect.left; | 305 pMsg->m_fx -= rect.left; |
| 301 pMsg->m_fy -= rect.top; | 306 pMsg->m_fy -= rect.top; |
| 302 IFWL_WidgetDelegate* pDelegate = | 307 IFWL_WidgetDelegate* pDelegate = |
| 303 m_pOwner->m_pVertScrollBar->SetDelegate(NULL); | 308 m_pOwner->m_pVertScrollBar->SetDelegate(NULL); |
| 304 return pDelegate->OnProcessMessage(pMsg); | 309 return pDelegate->OnProcessMessage(pMsg); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 316 OnDropListLButtonDown(pMsg); | 321 OnDropListLButtonDown(pMsg); |
| 317 break; | 322 break; |
| 318 } | 323 } |
| 319 case FWL_MSGMOUSECMD_LButtonUp: { | 324 case FWL_MSGMOUSECMD_LButtonUp: { |
| 320 backDefault = FALSE; | 325 backDefault = FALSE; |
| 321 OnDropListLButtonUp(pMsg); | 326 OnDropListLButtonUp(pMsg); |
| 322 break; | 327 break; |
| 323 } | 328 } |
| 324 default: {} | 329 default: {} |
| 325 } | 330 } |
| 326 } else if (dwHashCode == FWL_MSGHASH_Key) { | 331 } else if (dwHashCode == CFWL_MessageType::Key) { |
| 327 backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage)); | 332 backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage)); |
| 328 } | 333 } |
| 329 if (!backDefault) { | 334 if (!backDefault) |
| 330 return 1; | 335 return 1; |
| 331 } | |
| 332 return CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage); | 336 return CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage); |
| 333 } | 337 } |
| 338 |
| 334 void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg, | 339 void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg, |
| 335 FX_BOOL bSet) { | 340 FX_BOOL bSet) { |
| 336 if (!bSet) { | 341 if (!bSet) { |
| 337 CFWL_MsgKillFocus* pKill = static_cast<CFWL_MsgKillFocus*>(pMsg); | 342 CFWL_MsgKillFocus* pKill = static_cast<CFWL_MsgKillFocus*>(pMsg); |
| 338 CFWL_ComboBoxImp* pOuter = | 343 CFWL_ComboBoxImp* pOuter = |
| 339 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); | 344 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); |
| 340 if (pKill->m_pSetFocus == m_pOwner->m_pOuter || | 345 if (pKill->m_pSetFocus == m_pOwner->m_pOuter || |
| 341 pKill->m_pSetFocus == pOuter->m_pEdit.get()) { | 346 pKill->m_pSetFocus == pOuter->m_pEdit.get()) { |
| 342 pOuter->ShowDropList(FALSE); | 347 pOuter->ShowDropList(FALSE); |
| 343 } | 348 } |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); | 1354 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); |
| 1350 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) | 1355 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) |
| 1351 ->GetItemText(hItem, wsText); | 1356 ->GetItemText(hItem, wsText); |
| 1352 m_pEdit->LockUpdate(); | 1357 m_pEdit->LockUpdate(); |
| 1353 m_pEdit->SetText(wsText); | 1358 m_pEdit->SetText(wsText); |
| 1354 m_pEdit->UnlockUpdate(); | 1359 m_pEdit->UnlockUpdate(); |
| 1355 } | 1360 } |
| 1356 m_pEdit->Update(); | 1361 m_pEdit->Update(); |
| 1357 } | 1362 } |
| 1358 } | 1363 } |
| 1364 |
| 1359 CFWL_ComboBoxImpDelegate::CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner) | 1365 CFWL_ComboBoxImpDelegate::CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner) |
| 1360 : m_pOwner(pOwner) {} | 1366 : m_pOwner(pOwner) {} |
| 1367 |
| 1361 int32_t CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 1368 int32_t CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 1362 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { | 1369 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) |
| 1363 return DisForm_OnProcessMessage(pMessage); | 1370 return DisForm_OnProcessMessage(pMessage); |
| 1364 } | 1371 |
| 1365 if (!pMessage) | 1372 if (!pMessage) |
| 1366 return 0; | 1373 return 0; |
| 1367 uint32_t dwMsgCode = pMessage->GetClassID(); | 1374 |
| 1368 FX_BOOL iRet = 1; | 1375 FX_BOOL iRet = 1; |
| 1369 switch (dwMsgCode) { | 1376 switch (pMessage->GetClassID()) { |
| 1370 case FWL_MSGHASH_SetFocus: | 1377 case CFWL_MessageType::SetFocus: { |
| 1371 case FWL_MSGHASH_KillFocus: { | 1378 OnFocusChanged(pMessage, TRUE); |
| 1372 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | |
| 1373 break; | 1379 break; |
| 1374 } | 1380 } |
| 1375 case FWL_MSGHASH_Mouse: { | 1381 case CFWL_MessageType::KillFocus: { |
| 1382 OnFocusChanged(pMessage, FALSE); |
| 1383 break; |
| 1384 } |
| 1385 case CFWL_MessageType::Mouse: { |
| 1376 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 1386 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| 1377 uint32_t dwCmd = pMsg->m_dwCmd; | 1387 switch (pMsg->m_dwCmd) { |
| 1378 switch (dwCmd) { | |
| 1379 case FWL_MSGMOUSECMD_LButtonDown: { | 1388 case FWL_MSGMOUSECMD_LButtonDown: { |
| 1380 OnLButtonDown(pMsg); | 1389 OnLButtonDown(pMsg); |
| 1381 break; | 1390 break; |
| 1382 } | 1391 } |
| 1383 case FWL_MSGMOUSECMD_LButtonUp: { | 1392 case FWL_MSGMOUSECMD_LButtonUp: { |
| 1384 OnLButtonUp(pMsg); | 1393 OnLButtonUp(pMsg); |
| 1385 break; | 1394 break; |
| 1386 } | 1395 } |
| 1387 case FWL_MSGMOUSECMD_MouseMove: { | 1396 case FWL_MSGMOUSECMD_MouseMove: { |
| 1388 OnMouseMove(pMsg); | 1397 OnMouseMove(pMsg); |
| 1389 break; | 1398 break; |
| 1390 } | 1399 } |
| 1391 case FWL_MSGMOUSECMD_MouseLeave: { | 1400 case FWL_MSGMOUSECMD_MouseLeave: { |
| 1392 OnMouseLeave(pMsg); | 1401 OnMouseLeave(pMsg); |
| 1393 break; | 1402 break; |
| 1394 } | 1403 } |
| 1395 default: {} | 1404 default: |
| 1405 break; |
| 1396 } | 1406 } |
| 1397 break; | 1407 break; |
| 1398 } | 1408 } |
| 1399 case FWL_MSGHASH_Key: { | 1409 case CFWL_MessageType::Key: { |
| 1400 OnKey(static_cast<CFWL_MsgKey*>(pMessage)); | 1410 OnKey(static_cast<CFWL_MsgKey*>(pMessage)); |
| 1401 break; | 1411 break; |
| 1402 } | 1412 } |
| 1403 default: { iRet = 0; } | 1413 default: { |
| 1414 iRet = 0; |
| 1415 break; |
| 1416 } |
| 1404 } | 1417 } |
| 1418 |
| 1405 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 1419 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
| 1406 return iRet; | 1420 return iRet; |
| 1407 } | 1421 } |
| 1422 |
| 1408 FWL_ERR CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 1423 FWL_ERR CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
| 1409 uint32_t dwFlag = pEvent->GetClassID(); | 1424 CFWL_EventType dwFlag = pEvent->GetClassID(); |
| 1410 if (dwFlag == FWL_EVTHASH_LTB_DrawItem) { | 1425 if (dwFlag == CFWL_EventType::DrawItem) { |
| 1411 CFWL_EvtLtbDrawItem* pDrawItemEvent = | 1426 CFWL_EvtLtbDrawItem* pDrawItemEvent = |
| 1412 static_cast<CFWL_EvtLtbDrawItem*>(pEvent); | 1427 static_cast<CFWL_EvtLtbDrawItem*>(pEvent); |
| 1413 CFWL_EvtCmbDrawItem pTemp; | 1428 CFWL_EvtCmbDrawItem pTemp; |
| 1414 pTemp.m_pSrcTarget = m_pOwner->m_pInterface; | 1429 pTemp.m_pSrcTarget = m_pOwner->m_pInterface; |
| 1415 pTemp.m_pGraphics = pDrawItemEvent->m_pGraphics; | 1430 pTemp.m_pGraphics = pDrawItemEvent->m_pGraphics; |
| 1416 pTemp.m_index = pDrawItemEvent->m_index; | 1431 pTemp.m_index = pDrawItemEvent->m_index; |
| 1417 pTemp.m_rtItem = pDrawItemEvent->m_rect; | 1432 pTemp.m_rtItem = pDrawItemEvent->m_rect; |
| 1418 m_pOwner->DispatchEvent(&pTemp); | 1433 m_pOwner->DispatchEvent(&pTemp); |
| 1419 } else if (dwFlag == FWL_EVTHASH_Scroll) { | 1434 } else if (dwFlag == CFWL_EventType::Scroll) { |
| 1420 CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); | 1435 CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); |
| 1421 CFWL_EvtScroll pScrollEv; | 1436 CFWL_EvtScroll pScrollEv; |
| 1422 pScrollEv.m_pSrcTarget = m_pOwner->m_pInterface; | 1437 pScrollEv.m_pSrcTarget = m_pOwner->m_pInterface; |
| 1423 pScrollEv.m_iScrollCode = pScrollEvent->m_iScrollCode; | 1438 pScrollEv.m_iScrollCode = pScrollEvent->m_iScrollCode; |
| 1424 pScrollEv.m_fPos = pScrollEvent->m_fPos; | 1439 pScrollEv.m_fPos = pScrollEvent->m_fPos; |
| 1425 m_pOwner->DispatchEvent(&pScrollEv); | 1440 m_pOwner->DispatchEvent(&pScrollEv); |
| 1426 } else if (dwFlag == FWL_EVTHASH_EDT_TextChanged) { | 1441 } else if (dwFlag == CFWL_EventType::TextChanged) { |
| 1427 CFWL_EvtEdtTextChanged* pTextChangedEvent = | 1442 CFWL_EvtEdtTextChanged* pTextChangedEvent = |
| 1428 static_cast<CFWL_EvtEdtTextChanged*>(pEvent); | 1443 static_cast<CFWL_EvtEdtTextChanged*>(pEvent); |
| 1429 CFWL_EvtCmbEditChanged pTemp; | 1444 CFWL_EvtCmbEditChanged pTemp; |
| 1430 pTemp.m_pSrcTarget = m_pOwner->m_pInterface; | 1445 pTemp.m_pSrcTarget = m_pOwner->m_pInterface; |
| 1431 pTemp.wsInsert = pTextChangedEvent->wsInsert; | 1446 pTemp.wsInsert = pTextChangedEvent->wsInsert; |
| 1432 pTemp.wsDelete = pTextChangedEvent->wsDelete; | 1447 pTemp.wsDelete = pTextChangedEvent->wsDelete; |
| 1433 pTemp.nChangeType = pTextChangedEvent->nChangeType; | 1448 pTemp.nChangeType = pTextChangedEvent->nChangeType; |
| 1434 m_pOwner->DispatchEvent(&pTemp); | 1449 m_pOwner->DispatchEvent(&pTemp); |
| 1435 } | 1450 } |
| 1436 return FWL_ERR_Succeeded; | 1451 return FWL_ERR_Succeeded; |
| 1437 } | 1452 } |
| 1453 |
| 1438 FWL_ERR CFWL_ComboBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1454 FWL_ERR CFWL_ComboBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 1439 const CFX_Matrix* pMatrix) { | 1455 const CFX_Matrix* pMatrix) { |
| 1440 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 1456 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
| 1441 } | 1457 } |
| 1442 void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, | 1458 void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, |
| 1443 FX_BOOL bSet) { | 1459 FX_BOOL bSet) { |
| 1444 IFWL_Target* pDstTarget = pMsg->m_pDstTarget; | 1460 IFWL_Target* pDstTarget = pMsg->m_pDstTarget; |
| 1445 IFWL_Target* pSrcTarget = pMsg->m_pSrcTarget; | 1461 IFWL_Target* pSrcTarget = pMsg->m_pSrcTarget; |
| 1446 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle(); | 1462 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle(); |
| 1447 if (bSet) { | 1463 if (bSet) { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle(); | 1595 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle(); |
| 1580 if (bDropDown) { | 1596 if (bDropDown) { |
| 1581 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); | 1597 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); |
| 1582 pDelegate->OnProcessMessage(pMsg); | 1598 pDelegate->OnProcessMessage(pMsg); |
| 1583 } | 1599 } |
| 1584 } | 1600 } |
| 1585 int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( | 1601 int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( |
| 1586 CFWL_Message* pMessage) { | 1602 CFWL_Message* pMessage) { |
| 1587 if (!pMessage) | 1603 if (!pMessage) |
| 1588 return 0; | 1604 return 0; |
| 1589 uint32_t dwMsgCode = pMessage->GetClassID(); | 1605 |
| 1590 FX_BOOL backDefault = TRUE; | 1606 FX_BOOL backDefault = TRUE; |
| 1591 switch (dwMsgCode) { | 1607 switch (pMessage->GetClassID()) { |
| 1592 case FWL_MSGHASH_SetFocus: | 1608 case CFWL_MessageType::SetFocus: { |
| 1593 case FWL_MSGHASH_KillFocus: { | |
| 1594 backDefault = FALSE; | 1609 backDefault = FALSE; |
| 1595 DisForm_OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | 1610 DisForm_OnFocusChanged(pMessage, TRUE); |
| 1596 break; | 1611 break; |
| 1597 } | 1612 } |
| 1598 case FWL_MSGHASH_Mouse: { | 1613 case CFWL_MessageType::KillFocus: { |
| 1614 backDefault = FALSE; |
| 1615 DisForm_OnFocusChanged(pMessage, FALSE); |
| 1616 break; |
| 1617 } |
| 1618 case CFWL_MessageType::Mouse: { |
| 1599 backDefault = FALSE; | 1619 backDefault = FALSE; |
| 1600 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 1620 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| 1601 uint32_t dwCmd = pMsg->m_dwCmd; | 1621 switch (pMsg->m_dwCmd) { |
| 1602 switch (dwCmd) { | |
| 1603 case FWL_MSGMOUSECMD_LButtonDown: { | 1622 case FWL_MSGMOUSECMD_LButtonDown: { |
| 1604 DisForm_OnLButtonDown(pMsg); | 1623 DisForm_OnLButtonDown(pMsg); |
| 1605 break; | 1624 break; |
| 1606 } | 1625 } |
| 1607 case FWL_MSGMOUSECMD_LButtonUp: { | 1626 case FWL_MSGMOUSECMD_LButtonUp: { |
| 1608 OnLButtonUp(pMsg); | 1627 OnLButtonUp(pMsg); |
| 1609 break; | 1628 break; |
| 1610 } | 1629 } |
| 1611 default: {} | 1630 default: |
| 1631 break; |
| 1612 } | 1632 } |
| 1613 break; | 1633 break; |
| 1614 } | 1634 } |
| 1615 case FWL_MSGHASH_Key: { | 1635 case CFWL_MessageType::Key: { |
| 1616 backDefault = FALSE; | 1636 backDefault = FALSE; |
| 1617 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); | 1637 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); |
| 1618 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyUp) { | 1638 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyUp) |
| 1619 break; | 1639 break; |
| 1620 } | |
| 1621 if (m_pOwner->DisForm_IsDropListShowed() && | 1640 if (m_pOwner->DisForm_IsDropListShowed() && |
| 1622 pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { | 1641 pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { |
| 1623 uint32_t dwKeyCode = pKey->m_dwKeyCode; | 1642 FX_BOOL bListKey = pKey->m_dwKeyCode == FWL_VKEY_Up || |
| 1624 FX_BOOL bListKey = | 1643 pKey->m_dwKeyCode == FWL_VKEY_Down || |
| 1625 dwKeyCode == FWL_VKEY_Up || dwKeyCode == FWL_VKEY_Down || | 1644 pKey->m_dwKeyCode == FWL_VKEY_Return || |
| 1626 dwKeyCode == FWL_VKEY_Return || dwKeyCode == FWL_VKEY_Escape; | 1645 pKey->m_dwKeyCode == FWL_VKEY_Escape; |
| 1627 if (bListKey) { | 1646 if (bListKey) { |
| 1628 IFWL_WidgetDelegate* pDelegate = | 1647 IFWL_WidgetDelegate* pDelegate = |
| 1629 m_pOwner->m_pListBox->SetDelegate(NULL); | 1648 m_pOwner->m_pListBox->SetDelegate(NULL); |
| 1630 pDelegate->OnProcessMessage(pMessage); | 1649 pDelegate->OnProcessMessage(pMessage); |
| 1631 break; | 1650 break; |
| 1632 } | 1651 } |
| 1633 } | 1652 } |
| 1634 DisForm_OnKey(pKey); | 1653 DisForm_OnKey(pKey); |
| 1635 break; | 1654 break; |
| 1636 } | 1655 } |
| 1637 default: {} | 1656 default: |
| 1657 break; |
| 1638 } | 1658 } |
| 1639 if (!backDefault) { | 1659 if (!backDefault) |
| 1640 return 1; | 1660 return 1; |
| 1641 } | |
| 1642 return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 1661 return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
| 1643 } | 1662 } |
| 1663 |
| 1644 void CFWL_ComboBoxImpDelegate::DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg) { | 1664 void CFWL_ComboBoxImpDelegate::DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg) { |
| 1645 FX_BOOL bDropDown = m_pOwner->DisForm_IsDropListShowed(); | 1665 FX_BOOL bDropDown = m_pOwner->DisForm_IsDropListShowed(); |
| 1646 CFX_RectF& rtBtn = bDropDown ? m_pOwner->m_rtBtn : m_pOwner->m_rtClient; | 1666 CFX_RectF& rtBtn = bDropDown ? m_pOwner->m_rtBtn : m_pOwner->m_rtClient; |
| 1647 FX_BOOL bClickBtn = rtBtn.Contains(pMsg->m_fx, pMsg->m_fy); | 1667 FX_BOOL bClickBtn = rtBtn.Contains(pMsg->m_fx, pMsg->m_fy); |
| 1648 if (bClickBtn) { | 1668 if (bClickBtn) { |
| 1649 if (m_pOwner->DisForm_IsDropListShowed()) { | 1669 if (m_pOwner->DisForm_IsDropListShowed()) { |
| 1650 m_pOwner->DisForm_ShowDropList(FALSE); | 1670 m_pOwner->DisForm_ShowDropList(FALSE); |
| 1651 return; | 1671 return; |
| 1652 } | 1672 } |
| 1653 { | 1673 { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 } | 1737 } |
| 1718 m_pOwner->m_iCurSel = iCurSel; | 1738 m_pOwner->m_iCurSel = iCurSel; |
| 1719 m_pOwner->SynchrEditText(m_pOwner->m_iCurSel); | 1739 m_pOwner->SynchrEditText(m_pOwner->m_iCurSel); |
| 1720 return; | 1740 return; |
| 1721 } | 1741 } |
| 1722 if (m_pOwner->m_pEdit) { | 1742 if (m_pOwner->m_pEdit) { |
| 1723 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); | 1743 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); |
| 1724 pDelegate->OnProcessMessage(pMsg); | 1744 pDelegate->OnProcessMessage(pMsg); |
| 1725 } | 1745 } |
| 1726 } | 1746 } |
| 1747 |
| 1727 CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate( | 1748 CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate( |
| 1728 IFWL_Form* pForm, | 1749 IFWL_Form* pForm, |
| 1729 CFWL_ComboBoxImp* pComboBox) | 1750 CFWL_ComboBoxImp* pComboBox) |
| 1730 : m_bLButtonDown(FALSE), | 1751 : m_bLButtonDown(FALSE), |
| 1731 m_bLButtonUpSelf(FALSE), | 1752 m_bLButtonUpSelf(FALSE), |
| 1732 m_fStartPos(0), | 1753 m_fStartPos(0), |
| 1733 m_pForm(pForm), | 1754 m_pForm(pForm), |
| 1734 m_pComboBox(pComboBox) {} | 1755 m_pComboBox(pComboBox) {} |
| 1756 |
| 1735 int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 1757 int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 1736 if (!pMessage) | 1758 if (!pMessage) |
| 1737 return 0; | 1759 return 0; |
| 1738 uint32_t dwMsgCode = pMessage->GetClassID(); | 1760 |
| 1739 if (dwMsgCode == FWL_MSGHASH_Mouse) { | 1761 switch (pMessage->GetClassID()) { |
| 1740 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 1762 case CFWL_MessageType::Mouse: { |
| 1741 uint32_t dwCmd = pMsg->m_dwCmd; | 1763 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| 1742 switch (dwCmd) { | 1764 switch (pMsg->m_dwCmd) { |
| 1743 case FWL_MSGMOUSECMD_LButtonDown: { | 1765 case FWL_MSGMOUSECMD_LButtonDown: { |
| 1744 OnLButtonDown(pMsg); | 1766 OnLButtonDown(pMsg); |
| 1745 break; | 1767 break; |
| 1768 } |
| 1769 case FWL_MSGMOUSECMD_LButtonUp: { |
| 1770 OnLButtonUp(pMsg); |
| 1771 break; |
| 1772 } |
| 1773 case FWL_MSGMOUSECMD_MouseMove: { |
| 1774 OnMouseMove(pMsg); |
| 1775 break; |
| 1776 } |
| 1777 default: |
| 1778 break; |
| 1746 } | 1779 } |
| 1747 case FWL_MSGMOUSECMD_LButtonUp: { | 1780 break; |
| 1748 OnLButtonUp(pMsg); | |
| 1749 break; | |
| 1750 } | |
| 1751 case FWL_MSGMOUSECMD_MouseMove: { | |
| 1752 OnMouseMove(pMsg); | |
| 1753 break; | |
| 1754 } | |
| 1755 default: {} | |
| 1756 } | 1781 } |
| 1757 } | 1782 case CFWL_MessageType::Deactivate: { |
| 1758 if (dwMsgCode == FWL_MSGHASH_Deactivate) { | 1783 OnDeactive(static_cast<CFWL_MsgDeactivate*>(pMessage)); |
| 1759 OnDeactive(static_cast<CFWL_MsgDeactivate*>(pMessage)); | 1784 break; |
| 1760 } | 1785 } |
| 1761 if (dwMsgCode == FWL_MSGHASH_KillFocus || dwMsgCode == FWL_MSGHASH_SetFocus) { | 1786 case CFWL_MessageType::KillFocus: { |
| 1762 OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), | 1787 OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), FALSE); |
| 1763 dwMsgCode == FWL_MSGHASH_SetFocus); | 1788 break; |
| 1789 } |
| 1790 case CFWL_MessageType::SetFocus: { |
| 1791 OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), TRUE); |
| 1792 break; |
| 1793 } |
| 1794 default: |
| 1795 break; |
| 1764 } | 1796 } |
| 1765 return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 1797 return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
| 1766 } | 1798 } |
| 1799 |
| 1767 FWL_ERR CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1800 FWL_ERR CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 1768 const CFX_Matrix* pMatrix) { | 1801 const CFX_Matrix* pMatrix) { |
| 1769 m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); | 1802 m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); |
| 1770 return FWL_ERR_Succeeded; | 1803 return FWL_ERR_Succeeded; |
| 1771 } | 1804 } |
| 1772 void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { | 1805 void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { |
| 1773 IFWL_Thread* pThread = m_pForm->GetOwnerThread(); | 1806 IFWL_Thread* pThread = m_pForm->GetOwnerThread(); |
| 1774 if (!pThread) | 1807 if (!pThread) |
| 1775 return; | 1808 return; |
| 1776 CFWL_NoteDriver* pDriver = | 1809 CFWL_NoteDriver* pDriver = |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1812 m_pComboBox->ShowDropList(FALSE); | 1845 m_pComboBox->ShowDropList(FALSE); |
| 1813 } | 1846 } |
| 1814 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, | 1847 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, |
| 1815 FX_BOOL bSet) { | 1848 FX_BOOL bSet) { |
| 1816 if (!bSet) { | 1849 if (!bSet) { |
| 1817 if (pMsg->m_pSetFocus == NULL) { | 1850 if (pMsg->m_pSetFocus == NULL) { |
| 1818 m_pComboBox->ShowDropList(FALSE); | 1851 m_pComboBox->ShowDropList(FALSE); |
| 1819 } | 1852 } |
| 1820 } | 1853 } |
| 1821 } | 1854 } |
| OLD | NEW |