Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(895)

Side by Side Diff: xfa/fwl/basewidget/fwl_comboboximp.cpp

Issue 1938163002: More define cleanup. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/fee/fde_txtedtengine.h" 10 #include "xfa/fee/fde_txtedtengine.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 backDefault = FALSE; 152 backDefault = FALSE;
153 break; 153 break;
154 } 154 }
155 case CFWL_MessageType::KillFocus: { 155 case CFWL_MessageType::KillFocus: {
156 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; 156 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
157 backDefault = FALSE; 157 backDefault = FALSE;
158 break; 158 break;
159 } 159 }
160 case CFWL_MessageType::Mouse: { 160 case CFWL_MessageType::Mouse: {
161 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 161 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
162 if ((pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonDown) && 162 if ((pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) &&
163 ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) { 163 ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) {
164 m_pOwner->SetSelected(); 164 m_pOwner->SetSelected();
165 m_pOwner->SetComboBoxFocus(TRUE); 165 m_pOwner->SetComboBoxFocus(TRUE);
166 } 166 }
167 break; 167 break;
168 } 168 }
169 default: 169 default:
170 break; 170 break;
171 } 171 }
172 if (!backDefault) 172 if (!backDefault)
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 CFX_RectF rect; 301 CFX_RectF rect;
302 m_pOwner->m_pVertScrollBar->GetWidgetRect(rect); 302 m_pOwner->m_pVertScrollBar->GetWidgetRect(rect);
303 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { 303 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
304 pMsg->m_fx -= rect.left; 304 pMsg->m_fx -= rect.left;
305 pMsg->m_fy -= rect.top; 305 pMsg->m_fy -= rect.top;
306 IFWL_WidgetDelegate* pDelegate = 306 IFWL_WidgetDelegate* pDelegate =
307 m_pOwner->m_pVertScrollBar->SetDelegate(NULL); 307 m_pOwner->m_pVertScrollBar->SetDelegate(NULL);
308 return pDelegate->OnProcessMessage(pMsg); 308 return pDelegate->OnProcessMessage(pMsg);
309 } 309 }
310 } 310 }
311 uint32_t dwCmd = pMsg->m_dwCmd; 311 switch (pMsg->m_dwCmd) {
312 switch (dwCmd) { 312 case FWL_MouseCommand::Move: {
313 case FWL_MSGMOUSECMD_MouseMove: {
314 backDefault = FALSE; 313 backDefault = FALSE;
315 OnDropListMouseMove(pMsg); 314 OnDropListMouseMove(pMsg);
316 break; 315 break;
317 } 316 }
318 case FWL_MSGMOUSECMD_LButtonDown: { 317 case FWL_MouseCommand::LeftButtonDown: {
319 backDefault = FALSE; 318 backDefault = FALSE;
320 OnDropListLButtonDown(pMsg); 319 OnDropListLButtonDown(pMsg);
321 break; 320 break;
322 } 321 }
323 case FWL_MSGMOUSECMD_LButtonUp: { 322 case FWL_MouseCommand::LeftButtonUp: {
324 backDefault = FALSE; 323 backDefault = FALSE;
325 OnDropListLButtonUp(pMsg); 324 OnDropListLButtonUp(pMsg);
326 break; 325 break;
327 } 326 }
328 default: {} 327 default:
328 break;
329 } 329 }
330 } else if (dwHashCode == CFWL_MessageType::Key) { 330 } else if (dwHashCode == CFWL_MessageType::Key) {
331 backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage)); 331 backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage));
332 } 332 }
333 if (!backDefault) 333 if (!backDefault)
334 return 1; 334 return 1;
335 return CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage); 335 return CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage);
336 } 336 }
337 337
338 void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg, 338 void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 if (hItem) { 408 if (hItem) {
409 pOuter->ProcessSelChanged(TRUE); 409 pOuter->ProcessSelChanged(TRUE);
410 } 410 }
411 } 411 }
412 return 1; 412 return 1;
413 } 413 }
414 int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) { 414 int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) {
415 CFWL_ComboBoxImp* pOuter = 415 CFWL_ComboBoxImp* pOuter =
416 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); 416 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
417 FX_BOOL bPropagate = FALSE; 417 FX_BOOL bPropagate = FALSE;
418 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { 418 if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) {
419 uint32_t dwKeyCode = pKey->m_dwKeyCode; 419 uint32_t dwKeyCode = pKey->m_dwKeyCode;
420 switch (dwKeyCode) { 420 switch (dwKeyCode) {
421 case FWL_VKEY_Return: 421 case FWL_VKEY_Return:
422 case FWL_VKEY_Escape: { 422 case FWL_VKEY_Escape: {
423 pOuter->ShowDropList(FALSE); 423 pOuter->ShowDropList(FALSE);
424 return 1; 424 return 1;
425 } 425 }
426 case FWL_VKEY_Up: 426 case FWL_VKEY_Up:
427 case FWL_VKEY_Down: { 427 case FWL_VKEY_Down: {
428 OnDropListKeyDown(pKey); 428 OnDropListKeyDown(pKey);
429 pOuter->SetDelegate(nullptr); 429 pOuter->SetDelegate(nullptr);
430 pOuter->ProcessSelChanged(FALSE); 430 pOuter->ProcessSelChanged(FALSE);
431 return 1; 431 return 1;
432 } 432 }
433 default: { bPropagate = TRUE; } 433 default: { bPropagate = TRUE; }
434 } 434 }
435 } else if (pKey->m_dwCmd == FWL_MSGKEYCMD_Char) { 435 } else if (pKey->m_dwCmd == FWL_KeyCommand::Char) {
436 bPropagate = TRUE; 436 bPropagate = TRUE;
437 } 437 }
438 if (bPropagate) { 438 if (bPropagate) {
439 pKey->m_pDstTarget = m_pOwner->m_pOuter; 439 pKey->m_pDstTarget = m_pOwner->m_pOuter;
440 pOuter->m_pDelegate->OnProcessMessage(pKey); 440 pOuter->m_pDelegate->OnProcessMessage(pKey);
441 return 1; 441 return 1;
442 } 442 }
443 return 0; 443 return 0;
444 } 444 }
445 void CFWL_ComboListImpDelegate::OnDropListKeyDown(CFWL_MsgKey* pKey) { 445 void CFWL_ComboListImpDelegate::OnDropListKeyDown(CFWL_MsgKey* pKey) {
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 OnFocusChanged(pMessage, TRUE); 1377 OnFocusChanged(pMessage, TRUE);
1378 break; 1378 break;
1379 } 1379 }
1380 case CFWL_MessageType::KillFocus: { 1380 case CFWL_MessageType::KillFocus: {
1381 OnFocusChanged(pMessage, FALSE); 1381 OnFocusChanged(pMessage, FALSE);
1382 break; 1382 break;
1383 } 1383 }
1384 case CFWL_MessageType::Mouse: { 1384 case CFWL_MessageType::Mouse: {
1385 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 1385 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
1386 switch (pMsg->m_dwCmd) { 1386 switch (pMsg->m_dwCmd) {
1387 case FWL_MSGMOUSECMD_LButtonDown: { 1387 case FWL_MouseCommand::LeftButtonDown: {
1388 OnLButtonDown(pMsg); 1388 OnLButtonDown(pMsg);
1389 break; 1389 break;
1390 } 1390 }
1391 case FWL_MSGMOUSECMD_LButtonUp: { 1391 case FWL_MouseCommand::LeftButtonUp: {
1392 OnLButtonUp(pMsg); 1392 OnLButtonUp(pMsg);
1393 break; 1393 break;
1394 } 1394 }
1395 case FWL_MSGMOUSECMD_MouseMove: { 1395 case FWL_MouseCommand::Move: {
1396 OnMouseMove(pMsg); 1396 OnMouseMove(pMsg);
1397 break; 1397 break;
1398 } 1398 }
1399 case FWL_MSGMOUSECMD_MouseLeave: { 1399 case FWL_MouseCommand::Leave: {
1400 OnMouseLeave(pMsg); 1400 OnMouseLeave(pMsg);
1401 break; 1401 break;
1402 } 1402 }
1403 default: 1403 default:
1404 break; 1404 break;
1405 } 1405 }
1406 break; 1406 break;
1407 } 1407 }
1408 case CFWL_MessageType::Key: { 1408 case CFWL_MessageType::Key: {
1409 OnKey(static_cast<CFWL_MsgKey*>(pMessage)); 1409 OnKey(static_cast<CFWL_MsgKey*>(pMessage));
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 } 1611 }
1612 case CFWL_MessageType::KillFocus: { 1612 case CFWL_MessageType::KillFocus: {
1613 backDefault = FALSE; 1613 backDefault = FALSE;
1614 DisForm_OnFocusChanged(pMessage, FALSE); 1614 DisForm_OnFocusChanged(pMessage, FALSE);
1615 break; 1615 break;
1616 } 1616 }
1617 case CFWL_MessageType::Mouse: { 1617 case CFWL_MessageType::Mouse: {
1618 backDefault = FALSE; 1618 backDefault = FALSE;
1619 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 1619 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
1620 switch (pMsg->m_dwCmd) { 1620 switch (pMsg->m_dwCmd) {
1621 case FWL_MSGMOUSECMD_LButtonDown: { 1621 case FWL_MouseCommand::LeftButtonDown: {
1622 DisForm_OnLButtonDown(pMsg); 1622 DisForm_OnLButtonDown(pMsg);
1623 break; 1623 break;
1624 } 1624 }
1625 case FWL_MSGMOUSECMD_LButtonUp: { 1625 case FWL_MouseCommand::LeftButtonUp: {
1626 OnLButtonUp(pMsg); 1626 OnLButtonUp(pMsg);
1627 break; 1627 break;
1628 } 1628 }
1629 default: 1629 default:
1630 break; 1630 break;
1631 } 1631 }
1632 break; 1632 break;
1633 } 1633 }
1634 case CFWL_MessageType::Key: { 1634 case CFWL_MessageType::Key: {
1635 backDefault = FALSE; 1635 backDefault = FALSE;
1636 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); 1636 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage);
1637 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyUp) 1637 if (pKey->m_dwCmd == FWL_KeyCommand::KeyUp)
1638 break; 1638 break;
1639 if (m_pOwner->DisForm_IsDropListShowed() && 1639 if (m_pOwner->DisForm_IsDropListShowed() &&
1640 pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { 1640 pKey->m_dwCmd == FWL_KeyCommand::KeyDown) {
1641 FX_BOOL bListKey = pKey->m_dwKeyCode == FWL_VKEY_Up || 1641 FX_BOOL bListKey = pKey->m_dwKeyCode == FWL_VKEY_Up ||
1642 pKey->m_dwKeyCode == FWL_VKEY_Down || 1642 pKey->m_dwKeyCode == FWL_VKEY_Down ||
1643 pKey->m_dwKeyCode == FWL_VKEY_Return || 1643 pKey->m_dwKeyCode == FWL_VKEY_Return ||
1644 pKey->m_dwKeyCode == FWL_VKEY_Escape; 1644 pKey->m_dwKeyCode == FWL_VKEY_Escape;
1645 if (bListKey) { 1645 if (bListKey) {
1646 IFWL_WidgetDelegate* pDelegate = 1646 IFWL_WidgetDelegate* pDelegate =
1647 m_pOwner->m_pListBox->SetDelegate(NULL); 1647 m_pOwner->m_pListBox->SetDelegate(NULL);
1648 pDelegate->OnProcessMessage(pMessage); 1648 pDelegate->OnProcessMessage(pMessage);
1649 break; 1649 break;
1650 } 1650 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 m_pComboBox(pComboBox) {} 1754 m_pComboBox(pComboBox) {}
1755 1755
1756 int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { 1756 int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
1757 if (!pMessage) 1757 if (!pMessage)
1758 return 0; 1758 return 0;
1759 1759
1760 switch (pMessage->GetClassID()) { 1760 switch (pMessage->GetClassID()) {
1761 case CFWL_MessageType::Mouse: { 1761 case CFWL_MessageType::Mouse: {
1762 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 1762 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
1763 switch (pMsg->m_dwCmd) { 1763 switch (pMsg->m_dwCmd) {
1764 case FWL_MSGMOUSECMD_LButtonDown: { 1764 case FWL_MouseCommand::LeftButtonDown: {
1765 OnLButtonDown(pMsg); 1765 OnLButtonDown(pMsg);
1766 break; 1766 break;
1767 } 1767 }
1768 case FWL_MSGMOUSECMD_LButtonUp: { 1768 case FWL_MouseCommand::LeftButtonUp: {
1769 OnLButtonUp(pMsg); 1769 OnLButtonUp(pMsg);
1770 break; 1770 break;
1771 } 1771 }
1772 case FWL_MSGMOUSECMD_MouseMove: { 1772 case FWL_MouseCommand::Move: {
1773 OnMouseMove(pMsg); 1773 OnMouseMove(pMsg);
1774 break; 1774 break;
1775 } 1775 }
1776 default: 1776 default:
1777 break; 1777 break;
1778 } 1778 }
1779 break; 1779 break;
1780 } 1780 }
1781 case CFWL_MessageType::Deactivate: { 1781 case CFWL_MessageType::Deactivate: {
1782 OnDeactive(static_cast<CFWL_MsgDeactivate*>(pMessage)); 1782 OnDeactive(static_cast<CFWL_MsgDeactivate*>(pMessage));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 m_pComboBox->ShowDropList(FALSE); 1846 m_pComboBox->ShowDropList(FALSE);
1847 } 1847 }
1848 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, 1848 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg,
1849 FX_BOOL bSet) { 1849 FX_BOOL bSet) {
1850 if (!bSet) { 1850 if (!bSet) {
1851 if (pMsg->m_pSetFocus == NULL) { 1851 if (pMsg->m_pSetFocus == NULL) {
1852 m_pComboBox->ShowDropList(FALSE); 1852 m_pComboBox->ShowDropList(FALSE);
1853 } 1853 }
1854 } 1854 }
1855 } 1855 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698