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

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

Issue 1830323006: Remove FX_DWORD from XFA. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « xfa/fwl/basewidget/fwl_formproxyimp.cpp ('k') | xfa/fwl/basewidget/fwl_monthcalendarimp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_listboximp.h" 7 #include "xfa/fwl/basewidget/fwl_listboximp.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_comboboximp.h" 10 #include "xfa/fwl/basewidget/fwl_comboboximp.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 m_pScrollBarTP(NULL) { 73 m_pScrollBarTP(NULL) {
74 m_rtClient.Reset(); 74 m_rtClient.Reset();
75 m_rtConent.Reset(); 75 m_rtConent.Reset();
76 m_rtStatic.Reset(); 76 m_rtStatic.Reset();
77 } 77 }
78 CFWL_ListBoxImp::~CFWL_ListBoxImp() {} 78 CFWL_ListBoxImp::~CFWL_ListBoxImp() {}
79 FWL_ERR CFWL_ListBoxImp::GetClassName(CFX_WideString& wsClass) const { 79 FWL_ERR CFWL_ListBoxImp::GetClassName(CFX_WideString& wsClass) const {
80 wsClass = FWL_CLASS_ListBox; 80 wsClass = FWL_CLASS_ListBox;
81 return FWL_ERR_Succeeded; 81 return FWL_ERR_Succeeded;
82 } 82 }
83 FX_DWORD CFWL_ListBoxImp::GetClassID() const { 83 uint32_t CFWL_ListBoxImp::GetClassID() const {
84 return FWL_CLASSHASH_ListBox; 84 return FWL_CLASSHASH_ListBox;
85 } 85 }
86 FWL_ERR CFWL_ListBoxImp::Initialize() { 86 FWL_ERR CFWL_ListBoxImp::Initialize() {
87 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) 87 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
88 return FWL_ERR_Indefinite; 88 return FWL_ERR_Indefinite;
89 m_pDelegate = new CFWL_ListBoxImpDelegate(this); 89 m_pDelegate = new CFWL_ListBoxImpDelegate(this);
90 return FWL_ERR_Succeeded; 90 return FWL_ERR_Succeeded;
91 } 91 }
92 FWL_ERR CFWL_ListBoxImp::Finalize() { 92 FWL_ERR CFWL_ListBoxImp::Finalize() {
93 if (m_pVertScrollBar) { 93 if (m_pVertScrollBar) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 if (m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_RTLReading) { 137 if (m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_RTLReading) {
138 m_dwTTOStyles |= FDE_TTOSTYLE_RTL; 138 m_dwTTOStyles |= FDE_TTOSTYLE_RTL;
139 } 139 }
140 m_dwTTOStyles |= FDE_TTOSTYLE_SingleLine; 140 m_dwTTOStyles |= FDE_TTOSTYLE_SingleLine;
141 m_fScorllBarWidth = GetScrollWidth(); 141 m_fScorllBarWidth = GetScrollWidth();
142 SortItem(); 142 SortItem();
143 CalcSize(); 143 CalcSize();
144 return FWL_ERR_Succeeded; 144 return FWL_ERR_Succeeded;
145 } 145 }
146 FX_DWORD CFWL_ListBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { 146 uint32_t CFWL_ListBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
147 if (IsShowScrollBar(FALSE)) { 147 if (IsShowScrollBar(FALSE)) {
148 CFX_RectF rect; 148 CFX_RectF rect;
149 m_pHorzScrollBar->GetWidgetRect(rect); 149 m_pHorzScrollBar->GetWidgetRect(rect);
150 if (rect.Contains(fx, fy)) { 150 if (rect.Contains(fx, fy)) {
151 return FWL_WGTHITTEST_HScrollBar; 151 return FWL_WGTHITTEST_HScrollBar;
152 } 152 }
153 } 153 }
154 if (IsShowScrollBar(TRUE)) { 154 if (IsShowScrollBar(TRUE)) {
155 CFX_RectF rect; 155 CFX_RectF rect;
156 m_pVertScrollBar->GetWidgetRect(rect); 156 m_pVertScrollBar->GetWidgetRect(rect);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 return 0; 210 return 0;
211 int32_t iRet = 0; 211 int32_t iRet = 0;
212 IFWL_ListBoxDP* pData = 212 IFWL_ListBoxDP* pData =
213 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); 213 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
214 int32_t iCount = pData->CountItems(m_pInterface); 214 int32_t iCount = pData->CountItems(m_pInterface);
215 for (int32_t i = 0; i < iCount; i++) { 215 for (int32_t i = 0; i < iCount; i++) {
216 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i); 216 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
217 if (!hItem) { 217 if (!hItem) {
218 continue; 218 continue;
219 } 219 }
220 FX_DWORD dwStyle = pData->GetItemStyles(m_pInterface, hItem); 220 uint32_t dwStyle = pData->GetItemStyles(m_pInterface, hItem);
221 if (dwStyle & FWL_ITEMSTATE_LTB_Selected) { 221 if (dwStyle & FWL_ITEMSTATE_LTB_Selected) {
222 iRet++; 222 iRet++;
223 } 223 }
224 } 224 }
225 return iRet; 225 return iRet;
226 } 226 }
227 FWL_HLISTITEM CFWL_ListBoxImp::GetSelItem(int32_t nIndexSel) { 227 FWL_HLISTITEM CFWL_ListBoxImp::GetSelItem(int32_t nIndexSel) {
228 if (!m_pProperties->m_pDataProvider) 228 if (!m_pProperties->m_pDataProvider)
229 return NULL; 229 return NULL;
230 int32_t index = 0; 230 int32_t index = 0;
231 IFWL_ListBoxDP* pData = 231 IFWL_ListBoxDP* pData =
232 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); 232 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
233 int32_t iCount = pData->CountItems(m_pInterface); 233 int32_t iCount = pData->CountItems(m_pInterface);
234 for (int32_t i = 0; i < iCount; i++) { 234 for (int32_t i = 0; i < iCount; i++) {
235 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i); 235 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
236 if (!hItem) { 236 if (!hItem) {
237 return NULL; 237 return NULL;
238 } 238 }
239 FX_DWORD dwStyle = pData->GetItemStyles(m_pInterface, hItem); 239 uint32_t dwStyle = pData->GetItemStyles(m_pInterface, hItem);
240 if (dwStyle & FWL_ITEMSTATE_LTB_Selected) { 240 if (dwStyle & FWL_ITEMSTATE_LTB_Selected) {
241 if (index == nIndexSel) { 241 if (index == nIndexSel) {
242 return hItem; 242 return hItem;
243 } else { 243 } else {
244 index++; 244 index++;
245 } 245 }
246 } 246 }
247 } 247 }
248 return NULL; 248 return NULL;
249 } 249 }
250 int32_t CFWL_ListBoxImp::GetSelIndex(int32_t nIndex) { 250 int32_t CFWL_ListBoxImp::GetSelIndex(int32_t nIndex) {
251 if (!m_pProperties->m_pDataProvider) 251 if (!m_pProperties->m_pDataProvider)
252 return -1; 252 return -1;
253 int32_t index = 0; 253 int32_t index = 0;
254 IFWL_ListBoxDP* pData = 254 IFWL_ListBoxDP* pData =
255 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); 255 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
256 int32_t iCount = pData->CountItems(m_pInterface); 256 int32_t iCount = pData->CountItems(m_pInterface);
257 for (int32_t i = 0; i < iCount; i++) { 257 for (int32_t i = 0; i < iCount; i++) {
258 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i); 258 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
259 if (!hItem) { 259 if (!hItem) {
260 return -1; 260 return -1;
261 } 261 }
262 FX_DWORD dwStyle = pData->GetItemStyles(m_pInterface, hItem); 262 uint32_t dwStyle = pData->GetItemStyles(m_pInterface, hItem);
263 if (dwStyle & FWL_ITEMSTATE_LTB_Selected) { 263 if (dwStyle & FWL_ITEMSTATE_LTB_Selected) {
264 if (index == nIndex) { 264 if (index == nIndex) {
265 return i; 265 return i;
266 } else { 266 } else {
267 index++; 267 index++;
268 } 268 }
269 } 269 }
270 } 270 }
271 return -1; 271 return -1;
272 } 272 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 pData->GetItem(m_pInterface, j)) > 0) { 320 pData->GetItem(m_pInterface, j)) > 0) {
321 hTemp = pData->GetItem(m_pInterface, i); 321 hTemp = pData->GetItem(m_pInterface, i);
322 pData->SetItemIndex(m_pInterface, pData->GetItem(m_pInterface, j), i); 322 pData->SetItemIndex(m_pInterface, pData->GetItem(m_pInterface, j), i);
323 pData->SetItemIndex(m_pInterface, hTemp, j); 323 pData->SetItemIndex(m_pInterface, hTemp, j);
324 } 324 }
325 } 325 }
326 } 326 }
327 return FWL_ERR_Succeeded; 327 return FWL_ERR_Succeeded;
328 } 328 }
329 FWL_HLISTITEM CFWL_ListBoxImp::GetItem(FWL_HLISTITEM hItem, 329 FWL_HLISTITEM CFWL_ListBoxImp::GetItem(FWL_HLISTITEM hItem,
330 FX_DWORD dwKeyCode) { 330 uint32_t dwKeyCode) {
331 FWL_HLISTITEM hRet = NULL; 331 FWL_HLISTITEM hRet = NULL;
332 switch (dwKeyCode) { 332 switch (dwKeyCode) {
333 case FWL_VKEY_Up: 333 case FWL_VKEY_Up:
334 case FWL_VKEY_Down: 334 case FWL_VKEY_Down:
335 case FWL_VKEY_Home: 335 case FWL_VKEY_Home:
336 case FWL_VKEY_End: { 336 case FWL_VKEY_End: {
337 const bool bUp = dwKeyCode == FWL_VKEY_Up; 337 const bool bUp = dwKeyCode == FWL_VKEY_Up;
338 const bool bDown = dwKeyCode == FWL_VKEY_Down; 338 const bool bDown = dwKeyCode == FWL_VKEY_Down;
339 const bool bHome = dwKeyCode == FWL_VKEY_Home; 339 const bool bHome = dwKeyCode == FWL_VKEY_Home;
340 IFWL_ListBoxDP* pData = 340 IFWL_ListBoxDP* pData =
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } 376 }
377 } 377 }
378 for (; iStart <= iEnd; iStart++) { 378 for (; iStart <= iEnd; iStart++) {
379 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iStart); 379 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iStart);
380 SetSelectionDirect(hItem, bSelected); 380 SetSelectionDirect(hItem, bSelected);
381 } 381 }
382 } 382 }
383 void CFWL_ListBoxImp::SetSelectionDirect(FWL_HLISTITEM hItem, FX_BOOL bSelect) { 383 void CFWL_ListBoxImp::SetSelectionDirect(FWL_HLISTITEM hItem, FX_BOOL bSelect) {
384 IFWL_ListBoxDP* pData = 384 IFWL_ListBoxDP* pData =
385 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); 385 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
386 FX_DWORD dwOldStyle = pData->GetItemStyles(m_pInterface, hItem); 386 uint32_t dwOldStyle = pData->GetItemStyles(m_pInterface, hItem);
387 bSelect ? dwOldStyle |= FWL_ITEMSTATE_LTB_Selected 387 bSelect ? dwOldStyle |= FWL_ITEMSTATE_LTB_Selected
388 : dwOldStyle &= ~FWL_ITEMSTATE_LTB_Selected; 388 : dwOldStyle &= ~FWL_ITEMSTATE_LTB_Selected;
389 pData->SetItemStyles(m_pInterface, hItem, dwOldStyle); 389 pData->SetItemStyles(m_pInterface, hItem, dwOldStyle);
390 } 390 }
391 FX_BOOL CFWL_ListBoxImp::IsItemSelected(FWL_HLISTITEM hItem) { 391 FX_BOOL CFWL_ListBoxImp::IsItemSelected(FWL_HLISTITEM hItem) {
392 IFWL_ListBoxDP* pData = 392 IFWL_ListBoxDP* pData =
393 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); 393 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
394 FX_DWORD dwState = pData->GetItemStyles(m_pInterface, hItem); 394 uint32_t dwState = pData->GetItemStyles(m_pInterface, hItem);
395 return (dwState & FWL_ITEMSTATE_LTB_Selected) != 0; 395 return (dwState & FWL_ITEMSTATE_LTB_Selected) != 0;
396 } 396 }
397 void CFWL_ListBoxImp::ClearSelection() { 397 void CFWL_ListBoxImp::ClearSelection() {
398 FX_BOOL bMulti = 398 FX_BOOL bMulti =
399 m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection; 399 m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection;
400 IFWL_ListBoxDP* pData = 400 IFWL_ListBoxDP* pData =
401 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); 401 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
402 int32_t iCount = pData->CountItems(m_pInterface); 402 int32_t iCount = pData->CountItems(m_pInterface);
403 for (int32_t i = 0; i < iCount; i++) { 403 for (int32_t i = 0; i < iCount; i++) {
404 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i); 404 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
405 FX_DWORD dwState = pData->GetItemStyles(m_pInterface, hItem); 405 uint32_t dwState = pData->GetItemStyles(m_pInterface, hItem);
406 FX_BOOL bFindSel = dwState & FWL_ITEMSTATE_LTB_Selected; 406 FX_BOOL bFindSel = dwState & FWL_ITEMSTATE_LTB_Selected;
407 if (!bFindSel) { 407 if (!bFindSel) {
408 continue; 408 continue;
409 } 409 }
410 SetSelectionDirect(hItem, FALSE); 410 SetSelectionDirect(hItem, FALSE);
411 if (!bMulti) { 411 if (!bMulti) {
412 return; 412 return;
413 } 413 }
414 } 414 }
415 } 415 }
(...skipping 25 matching lines...) Expand all
441 } 441 }
442 } 442 }
443 return NULL; 443 return NULL;
444 } 444 }
445 void CFWL_ListBoxImp::SetFocusItem(FWL_HLISTITEM hItem) { 445 void CFWL_ListBoxImp::SetFocusItem(FWL_HLISTITEM hItem) {
446 IFWL_ListBoxDP* pData = 446 IFWL_ListBoxDP* pData =
447 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); 447 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
448 FWL_HLISTITEM hFocus = GetFocusedItem(); 448 FWL_HLISTITEM hFocus = GetFocusedItem();
449 if (hItem != hFocus) { 449 if (hItem != hFocus) {
450 if (hFocus) { 450 if (hFocus) {
451 FX_DWORD dwStyle = pData->GetItemStyles(m_pInterface, hFocus); 451 uint32_t dwStyle = pData->GetItemStyles(m_pInterface, hFocus);
452 dwStyle &= ~FWL_ITEMSTATE_LTB_Focused; 452 dwStyle &= ~FWL_ITEMSTATE_LTB_Focused;
453 pData->SetItemStyles(m_pInterface, hFocus, dwStyle); 453 pData->SetItemStyles(m_pInterface, hFocus, dwStyle);
454 } 454 }
455 if (hItem) { 455 if (hItem) {
456 FX_DWORD dwStyle = pData->GetItemStyles(m_pInterface, hItem); 456 uint32_t dwStyle = pData->GetItemStyles(m_pInterface, hItem);
457 dwStyle |= FWL_ITEMSTATE_LTB_Focused; 457 dwStyle |= FWL_ITEMSTATE_LTB_Focused;
458 pData->SetItemStyles(m_pInterface, hItem, dwStyle); 458 pData->SetItemStyles(m_pInterface, hItem, dwStyle);
459 } 459 }
460 } 460 }
461 } 461 }
462 FWL_HLISTITEM CFWL_ListBoxImp::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) { 462 FWL_HLISTITEM CFWL_ListBoxImp::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
463 fx -= m_rtConent.left, fy -= m_rtConent.top; 463 fx -= m_rtConent.left, fy -= m_rtConent.top;
464 FX_FLOAT fPosX = 0.0f; 464 FX_FLOAT fPosX = 0.0f;
465 if (m_pHorzScrollBar) { 465 if (m_pHorzScrollBar) {
466 fPosX = m_pHorzScrollBar->GetPos(); 466 fPosX = m_pHorzScrollBar->GetPos();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 } 622 }
623 } 623 }
624 void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics, 624 void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
625 IFWL_ThemeProvider* pTheme, 625 IFWL_ThemeProvider* pTheme,
626 FWL_HLISTITEM hItem, 626 FWL_HLISTITEM hItem,
627 int32_t Index, 627 int32_t Index,
628 const CFX_RectF& rtItem, 628 const CFX_RectF& rtItem,
629 const CFX_Matrix* pMatrix) { 629 const CFX_Matrix* pMatrix) {
630 IFWL_ListBoxDP* pData = 630 IFWL_ListBoxDP* pData =
631 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); 631 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
632 FX_DWORD dwItemStyles = pData->GetItemStyles(m_pInterface, hItem); 632 uint32_t dwItemStyles = pData->GetItemStyles(m_pInterface, hItem);
633 FX_DWORD dwPartStates = FWL_PARTSTATE_LTB_Normal; 633 uint32_t dwPartStates = FWL_PARTSTATE_LTB_Normal;
634 if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) { 634 if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) {
635 dwPartStates = FWL_PARTSTATE_LTB_Disabled; 635 dwPartStates = FWL_PARTSTATE_LTB_Disabled;
636 } else if (dwItemStyles & FWL_ITEMSTATE_LTB_Selected) { 636 } else if (dwItemStyles & FWL_ITEMSTATE_LTB_Selected) {
637 dwPartStates = FWL_PARTSTATE_LTB_Selected; 637 dwPartStates = FWL_PARTSTATE_LTB_Selected;
638 } 638 }
639 if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused && 639 if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused &&
640 dwItemStyles & FWL_ITEMSTATE_LTB_Focused) { 640 dwItemStyles & FWL_ITEMSTATE_LTB_Focused) {
641 dwPartStates |= FWL_PARTSTATE_LTB_Focused; 641 dwPartStates |= FWL_PARTSTATE_LTB_Focused;
642 } 642 }
643 FWL_ListBoxItemData itemData; 643 FWL_ListBoxItemData itemData;
644 itemData.pDataProvider = pData; 644 itemData.pDataProvider = pData;
645 itemData.iIndex = Index; 645 itemData.iIndex = Index;
646 { 646 {
647 CFWL_ThemeBackground param; 647 CFWL_ThemeBackground param;
648 param.m_pWidget = m_pInterface; 648 param.m_pWidget = m_pInterface;
649 param.m_iPart = FWL_PART_LTB_ListItem; 649 param.m_iPart = FWL_PART_LTB_ListItem;
650 param.m_dwStates = dwPartStates; 650 param.m_dwStates = dwPartStates;
651 param.m_pGraphics = pGraphics; 651 param.m_pGraphics = pGraphics;
652 param.m_matrix.Concat(*pMatrix); 652 param.m_matrix.Concat(*pMatrix);
653 param.m_rtPart = rtItem; 653 param.m_rtPart = rtItem;
654 param.m_dwData = (FX_DWORD)(uintptr_t)(&itemData); 654 param.m_dwData = (uint32_t)(uintptr_t)(&itemData);
655 CFX_RectF rtFocus(rtItem); 655 CFX_RectF rtFocus(rtItem);
656 param.m_pData = &rtFocus; 656 param.m_pData = &rtFocus;
657 if (m_pVertScrollBar && !m_pHorzScrollBar && 657 if (m_pVertScrollBar && !m_pHorzScrollBar &&
658 (dwPartStates & FWL_PARTSTATE_LTB_Focused)) { 658 (dwPartStates & FWL_PARTSTATE_LTB_Focused)) {
659 param.m_rtPart.left += 1; 659 param.m_rtPart.left += 1;
660 param.m_rtPart.width -= (m_fScorllBarWidth + 1); 660 param.m_rtPart.width -= (m_fScorllBarWidth + 1);
661 rtFocus.Deflate(0.5, 0.5, 1 + m_fScorllBarWidth, 1); 661 rtFocus.Deflate(0.5, 0.5, 1 + m_fScorllBarWidth, 1);
662 } 662 }
663 pTheme->DrawBackground(&param); 663 pTheme->DrawBackground(&param);
664 } 664 }
665 { 665 {
666 FX_BOOL bHasIcon = GetStylesEx() & FWL_STYLEEXT_LTB_Icon; 666 FX_BOOL bHasIcon = GetStylesEx() & FWL_STYLEEXT_LTB_Icon;
667 if (bHasIcon) { 667 if (bHasIcon) {
668 CFX_RectF rtDIB; 668 CFX_RectF rtDIB;
669 CFX_DIBitmap* pDib = pData->GetItemIcon(m_pInterface, hItem); 669 CFX_DIBitmap* pDib = pData->GetItemIcon(m_pInterface, hItem);
670 rtDIB.Set(rtItem.left, rtItem.top, rtItem.height, rtItem.height); 670 rtDIB.Set(rtItem.left, rtItem.top, rtItem.height, rtItem.height);
671 if (pDib) { 671 if (pDib) {
672 CFWL_ThemeBackground param; 672 CFWL_ThemeBackground param;
673 param.m_pWidget = m_pInterface; 673 param.m_pWidget = m_pInterface;
674 param.m_iPart = FWL_PART_LTB_Icon; 674 param.m_iPart = FWL_PART_LTB_Icon;
675 param.m_pGraphics = pGraphics; 675 param.m_pGraphics = pGraphics;
676 param.m_matrix.Concat(*pMatrix); 676 param.m_matrix.Concat(*pMatrix);
677 param.m_rtPart = rtDIB; 677 param.m_rtPart = rtDIB;
678 param.m_dwData = (FX_DWORD)(uintptr_t)(&itemData); 678 param.m_dwData = (uint32_t)(uintptr_t)(&itemData);
679 param.m_pImage = pDib; 679 param.m_pImage = pDib;
680 pTheme->DrawBackground(&param); 680 pTheme->DrawBackground(&param);
681 } 681 }
682 } 682 }
683 FX_BOOL bHasCheck = GetStylesEx() & FWL_STYLEEXT_LTB_Check; 683 FX_BOOL bHasCheck = GetStylesEx() & FWL_STYLEEXT_LTB_Check;
684 if (bHasCheck) { 684 if (bHasCheck) {
685 CFX_RectF rtCheck; 685 CFX_RectF rtCheck;
686 rtCheck.Set(rtItem.left, rtItem.top, rtItem.height, rtItem.height); 686 rtCheck.Set(rtItem.left, rtItem.top, rtItem.height, rtItem.height);
687 rtCheck.Deflate(2, 2, 2, 2); 687 rtCheck.Deflate(2, 2, 2, 2);
688 pData->SetItemCheckRect(m_pInterface, hItem, rtCheck); 688 pData->SetItemCheckRect(m_pInterface, hItem, rtCheck);
689 CFWL_ThemeBackground param; 689 CFWL_ThemeBackground param;
690 param.m_pWidget = m_pInterface; 690 param.m_pWidget = m_pInterface;
691 param.m_iPart = FWL_PART_LTB_Check; 691 param.m_iPart = FWL_PART_LTB_Check;
692 param.m_pGraphics = pGraphics; 692 param.m_pGraphics = pGraphics;
693 if (GetItemChecked(hItem)) { 693 if (GetItemChecked(hItem)) {
694 param.m_dwStates = FWL_PARTSTATE_LTB_Checked; 694 param.m_dwStates = FWL_PARTSTATE_LTB_Checked;
695 } else { 695 } else {
696 param.m_dwStates = FWL_PARTSTATE_LTB_UnChecked; 696 param.m_dwStates = FWL_PARTSTATE_LTB_UnChecked;
697 } 697 }
698 param.m_matrix.Concat(*pMatrix); 698 param.m_matrix.Concat(*pMatrix);
699 param.m_rtPart = rtCheck; 699 param.m_rtPart = rtCheck;
700 param.m_dwData = (FX_DWORD)(uintptr_t)(&itemData); 700 param.m_dwData = (uint32_t)(uintptr_t)(&itemData);
701 pTheme->DrawBackground(&param); 701 pTheme->DrawBackground(&param);
702 } 702 }
703 CFX_WideString wsText; 703 CFX_WideString wsText;
704 pData->GetItemText(m_pInterface, hItem, wsText); 704 pData->GetItemText(m_pInterface, hItem, wsText);
705 if (wsText.GetLength() <= 0) { 705 if (wsText.GetLength() <= 0) {
706 return; 706 return;
707 } 707 }
708 CFX_RectF rtText(rtItem); 708 CFX_RectF rtText(rtItem);
709 rtText.Deflate(FWL_LISTBOX_ItemTextMargin, FWL_LISTBOX_ItemTextMargin); 709 rtText.Deflate(FWL_LISTBOX_ItemTextMargin, FWL_LISTBOX_ItemTextMargin);
710 if (bHasIcon || bHasCheck) { 710 if (bHasIcon || bHasCheck) {
711 rtText.Deflate(rtItem.height, 0, 0, 0); 711 rtText.Deflate(rtItem.height, 0, 0, 0);
712 } 712 }
713 CFWL_ThemeText textParam; 713 CFWL_ThemeText textParam;
714 textParam.m_pWidget = m_pInterface; 714 textParam.m_pWidget = m_pInterface;
715 textParam.m_iPart = FWL_PART_LTB_ListItem; 715 textParam.m_iPart = FWL_PART_LTB_ListItem;
716 textParam.m_dwStates = dwPartStates; 716 textParam.m_dwStates = dwPartStates;
717 textParam.m_pGraphics = pGraphics; 717 textParam.m_pGraphics = pGraphics;
718 textParam.m_matrix.Concat(*pMatrix); 718 textParam.m_matrix.Concat(*pMatrix);
719 textParam.m_rtPart = rtText; 719 textParam.m_rtPart = rtText;
720 textParam.m_wsText = wsText; 720 textParam.m_wsText = wsText;
721 textParam.m_dwTTOStyles = m_dwTTOStyles; 721 textParam.m_dwTTOStyles = m_dwTTOStyles;
722 textParam.m_iTTOAlign = m_iTTOAligns; 722 textParam.m_iTTOAlign = m_iTTOAligns;
723 textParam.m_dwData = (FX_DWORD)(uintptr_t)(&itemData); 723 textParam.m_dwData = (uint32_t)(uintptr_t)(&itemData);
724 pTheme->DrawText(&textParam); 724 pTheme->DrawText(&textParam);
725 } 725 }
726 } 726 }
727 CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) { 727 CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) {
728 CFX_SizeF fs; 728 CFX_SizeF fs;
729 if (!m_pProperties->m_pThemeProvider) 729 if (!m_pProperties->m_pThemeProvider)
730 return fs; 730 return fs;
731 731
732 GetClientRect(m_rtClient); 732 GetClientRect(m_rtClient);
733 m_rtConent = m_rtClient; 733 m_rtConent = m_rtClient;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 DispatchEvent(&selEvent); 983 DispatchEvent(&selEvent);
984 } 984 }
985 CFWL_ListBoxImpDelegate::CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner) 985 CFWL_ListBoxImpDelegate::CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner)
986 : m_pOwner(pOwner) {} 986 : m_pOwner(pOwner) {}
987 int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { 987 int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
988 if (!pMessage) 988 if (!pMessage)
989 return 0; 989 return 0;
990 if (!m_pOwner->IsEnabled()) { 990 if (!m_pOwner->IsEnabled()) {
991 return 1; 991 return 1;
992 } 992 }
993 FX_DWORD dwMsgCode = pMessage->GetClassID(); 993 uint32_t dwMsgCode = pMessage->GetClassID();
994 int32_t iRet = 1; 994 int32_t iRet = 1;
995 switch (dwMsgCode) { 995 switch (dwMsgCode) {
996 case FWL_MSGHASH_SetFocus: 996 case FWL_MSGHASH_SetFocus:
997 case FWL_MSGHASH_KillFocus: { 997 case FWL_MSGHASH_KillFocus: {
998 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); 998 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus);
999 break; 999 break;
1000 } 1000 }
1001 case FWL_MSGHASH_Mouse: { 1001 case FWL_MSGHASH_Mouse: {
1002 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 1002 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
1003 FX_DWORD dwCmd = pMsg->m_dwCmd; 1003 uint32_t dwCmd = pMsg->m_dwCmd;
1004 switch (dwCmd) { 1004 switch (dwCmd) {
1005 case FWL_MSGMOUSECMD_LButtonDown: { 1005 case FWL_MSGMOUSECMD_LButtonDown: {
1006 OnLButtonDown(pMsg); 1006 OnLButtonDown(pMsg);
1007 break; 1007 break;
1008 } 1008 }
1009 case FWL_MSGMOUSECMD_LButtonUp: { 1009 case FWL_MSGMOUSECMD_LButtonUp: {
1010 OnLButtonUp(pMsg); 1010 OnLButtonUp(pMsg);
1011 break; 1011 break;
1012 } 1012 }
1013 default: {} 1013 default: {}
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 } 1124 }
1125 void CFWL_ListBoxImpDelegate::OnMouseWheel(CFWL_MsgMouseWheel* pMsg) { 1125 void CFWL_ListBoxImpDelegate::OnMouseWheel(CFWL_MsgMouseWheel* pMsg) {
1126 if (!m_pOwner->IsShowScrollBar(TRUE)) { 1126 if (!m_pOwner->IsShowScrollBar(TRUE)) {
1127 return; 1127 return;
1128 } 1128 }
1129 IFWL_WidgetDelegate* pDelegate = 1129 IFWL_WidgetDelegate* pDelegate =
1130 m_pOwner->m_pVertScrollBar->SetDelegate(NULL); 1130 m_pOwner->m_pVertScrollBar->SetDelegate(NULL);
1131 pDelegate->OnProcessMessage(pMsg); 1131 pDelegate->OnProcessMessage(pMsg);
1132 } 1132 }
1133 void CFWL_ListBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { 1133 void CFWL_ListBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) {
1134 FX_DWORD dwKeyCode = pMsg->m_dwKeyCode; 1134 uint32_t dwKeyCode = pMsg->m_dwKeyCode;
1135 switch (dwKeyCode) { 1135 switch (dwKeyCode) {
1136 case FWL_VKEY_Tab: 1136 case FWL_VKEY_Tab:
1137 case FWL_VKEY_Up: 1137 case FWL_VKEY_Up:
1138 case FWL_VKEY_Down: 1138 case FWL_VKEY_Down:
1139 case FWL_VKEY_Home: 1139 case FWL_VKEY_Home:
1140 case FWL_VKEY_End: { 1140 case FWL_VKEY_End: {
1141 FWL_HLISTITEM hItem = m_pOwner->GetFocusedItem(); 1141 FWL_HLISTITEM hItem = m_pOwner->GetFocusedItem();
1142 hItem = m_pOwner->GetItem(hItem, dwKeyCode); 1142 hItem = m_pOwner->GetItem(hItem, dwKeyCode);
1143 FX_BOOL bShift = pMsg->m_dwFlags & FWL_KEYFLAG_Shift; 1143 FX_BOOL bShift = pMsg->m_dwFlags & FWL_KEYFLAG_Shift;
1144 FX_BOOL bCtrl = pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl; 1144 FX_BOOL bCtrl = pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl;
(...skipping 30 matching lines...) Expand all
1175 m_pOwner->SetFocusItem(hItem); 1175 m_pOwner->SetFocusItem(hItem);
1176 m_pOwner->ScrollToVisible(hItem); 1176 m_pOwner->ScrollToVisible(hItem);
1177 { 1177 {
1178 CFX_RectF rtInvalidate; 1178 CFX_RectF rtInvalidate;
1179 rtInvalidate.Set(0, 0, m_pOwner->m_pProperties->m_rtWidget.width, 1179 rtInvalidate.Set(0, 0, m_pOwner->m_pProperties->m_rtWidget.width,
1180 m_pOwner->m_pProperties->m_rtWidget.height); 1180 m_pOwner->m_pProperties->m_rtWidget.height);
1181 m_pOwner->Repaint(&rtInvalidate); 1181 m_pOwner->Repaint(&rtInvalidate);
1182 } 1182 }
1183 } 1183 }
1184 FX_BOOL CFWL_ListBoxImpDelegate::OnScroll(IFWL_ScrollBar* pScrollBar, 1184 FX_BOOL CFWL_ListBoxImpDelegate::OnScroll(IFWL_ScrollBar* pScrollBar,
1185 FX_DWORD dwCode, 1185 uint32_t dwCode,
1186 FX_FLOAT fPos) { 1186 FX_FLOAT fPos) {
1187 CFX_SizeF fs; 1187 CFX_SizeF fs;
1188 pScrollBar->GetRange(fs.x, fs.y); 1188 pScrollBar->GetRange(fs.x, fs.y);
1189 FX_FLOAT iCurPos = pScrollBar->GetPos(); 1189 FX_FLOAT iCurPos = pScrollBar->GetPos();
1190 FX_FLOAT fStep = pScrollBar->GetStepSize(); 1190 FX_FLOAT fStep = pScrollBar->GetStepSize();
1191 switch (dwCode) { 1191 switch (dwCode) {
1192 case FWL_SCBCODE_Min: { 1192 case FWL_SCBCODE_Min: {
1193 fPos = fs.x; 1193 fPos = fs.x;
1194 break; 1194 break;
1195 } 1195 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 pScrollBar->SetTrackPos(fPos); 1236 pScrollBar->SetTrackPos(fPos);
1237 m_pOwner->Repaint(&m_pOwner->m_rtClient); 1237 m_pOwner->Repaint(&m_pOwner->m_rtClient);
1238 } 1238 }
1239 return TRUE; 1239 return TRUE;
1240 } 1240 }
1241 void CFWL_ListBoxImpDelegate::DispatchSelChangedEv() { 1241 void CFWL_ListBoxImpDelegate::DispatchSelChangedEv() {
1242 CFWL_EvtLtbSelChanged ev; 1242 CFWL_EvtLtbSelChanged ev;
1243 ev.m_pSrcTarget = m_pOwner->m_pInterface; 1243 ev.m_pSrcTarget = m_pOwner->m_pInterface;
1244 m_pOwner->DispatchEvent(&ev); 1244 m_pOwner->DispatchEvent(&ev);
1245 } 1245 }
OLDNEW
« no previous file with comments | « xfa/fwl/basewidget/fwl_formproxyimp.cpp ('k') | xfa/fwl/basewidget/fwl_monthcalendarimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698