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

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

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

Powered by Google App Engine
This is Rietveld 408576698