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

Side by Side Diff: fpdfsdk/pdfwindow/PWL_ListBox.cpp

Issue 2453683011: Remove FX_BOOL from fpdfsdk. (Closed)
Patch Set: Regenerate patch after rebase. Created 4 years, 1 month 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 | « fpdfsdk/pdfwindow/PWL_ListBox.h ('k') | fpdfsdk/pdfwindow/PWL_ScrollBar.h » ('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 "fpdfsdk/pdfwindow/PWL_ListBox.h" 7 #include "fpdfsdk/pdfwindow/PWL_ListBox.h"
8 8
9 #include "fpdfsdk/fxedit/fxet_edit.h" 9 #include "fpdfsdk/fxedit/fxet_edit.h"
10 #include "fpdfsdk/fxedit/fxet_list.h" 10 #include "fpdfsdk/fxedit/fxet_list.h"
(...skipping 24 matching lines...) Expand all
35 Info.fContentMax = fContentMax; 35 Info.fContentMax = fContentMax;
36 Info.fSmallStep = fSmallStep; 36 Info.fSmallStep = fSmallStep;
37 Info.fBigStep = fBigStep; 37 Info.fBigStep = fBigStep;
38 38
39 m_pList->OnNotify(m_pList, PNM_SETSCROLLINFO, SBT_VSCROLL, (intptr_t)&Info); 39 m_pList->OnNotify(m_pList, PNM_SETSCROLLINFO, SBT_VSCROLL, (intptr_t)&Info);
40 40
41 if (CPWL_ScrollBar* pScroll = m_pList->GetVScrollBar()) { 41 if (CPWL_ScrollBar* pScroll = m_pList->GetVScrollBar()) {
42 if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) || 42 if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) ||
43 IsFloatEqual(Info.fPlateWidth, Info.fContentMax - Info.fContentMin)) { 43 IsFloatEqual(Info.fPlateWidth, Info.fContentMax - Info.fContentMin)) {
44 if (pScroll->IsVisible()) { 44 if (pScroll->IsVisible()) {
45 pScroll->SetVisible(FALSE); 45 pScroll->SetVisible(false);
46 m_pList->RePosChildWnd(); 46 m_pList->RePosChildWnd();
47 } 47 }
48 } else { 48 } else {
49 if (!pScroll->IsVisible()) { 49 if (!pScroll->IsVisible()) {
50 pScroll->SetVisible(TRUE); 50 pScroll->SetVisible(true);
51 m_pList->RePosChildWnd(); 51 m_pList->RePosChildWnd();
52 } 52 }
53 } 53 }
54 } 54 }
55 } 55 }
56 56
57 void CPWL_List_Notify::IOnSetScrollPosY(FX_FLOAT fy) { 57 void CPWL_List_Notify::IOnSetScrollPosY(FX_FLOAT fy) {
58 m_pList->OnNotify(m_pList, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&fy); 58 m_pList->OnNotify(m_pList, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&fy);
59 } 59 }
60 60
61 void CPWL_List_Notify::IOnInvalidateRect(CFX_FloatRect* pRect) { 61 void CPWL_List_Notify::IOnInvalidateRect(CFX_FloatRect* pRect) {
62 m_pList->InvalidateRect(pRect); 62 m_pList->InvalidateRect(pRect);
63 } 63 }
64 64
65 CPWL_ListBox::CPWL_ListBox() 65 CPWL_ListBox::CPWL_ListBox()
66 : m_pList(new CFX_ListCtrl), 66 : m_pList(new CFX_ListCtrl),
67 m_bMouseDown(FALSE), 67 m_bMouseDown(false),
68 m_bHoverSel(FALSE), 68 m_bHoverSel(false),
69 m_pFillerNotify(nullptr) {} 69 m_pFillerNotify(nullptr) {}
70 70
71 CPWL_ListBox::~CPWL_ListBox() { 71 CPWL_ListBox::~CPWL_ListBox() {
72 } 72 }
73 73
74 CFX_ByteString CPWL_ListBox::GetClassName() const { 74 CFX_ByteString CPWL_ListBox::GetClassName() const {
75 return "CPWL_ListBox"; 75 return "CPWL_ListBox";
76 } 76 }
77 77
78 void CPWL_ListBox::OnCreated() { 78 void CPWL_ListBox::OnCreated() {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } else { 186 } else {
187 CFX_SystemHandler* pSysHandler = GetSystemHandler(); 187 CFX_SystemHandler* pSysHandler = GetSystemHandler();
188 CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), 188 CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
189 CPWL_Utils::PWLColorToFXColor(GetTextColor()), 189 CPWL_Utils::PWLColorToFXColor(GetTextColor()),
190 CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), 190 CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()),
191 rcList, ptOffset, nullptr, pSysHandler, nullptr); 191 rcList, ptOffset, nullptr, pSysHandler, nullptr);
192 } 192 }
193 } 193 }
194 } 194 }
195 195
196 FX_BOOL CPWL_ListBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) { 196 bool CPWL_ListBox::OnKeyDown(uint16_t nChar, uint32_t nFlag) {
197 CPWL_Wnd::OnKeyDown(nChar, nFlag); 197 CPWL_Wnd::OnKeyDown(nChar, nFlag);
198 198
199 switch (nChar) { 199 switch (nChar) {
200 default: 200 default:
201 return FALSE; 201 return false;
202 case FWL_VKEY_Up: 202 case FWL_VKEY_Up:
203 case FWL_VKEY_Down: 203 case FWL_VKEY_Down:
204 case FWL_VKEY_Home: 204 case FWL_VKEY_Home:
205 case FWL_VKEY_Left: 205 case FWL_VKEY_Left:
206 case FWL_VKEY_End: 206 case FWL_VKEY_End:
207 case FWL_VKEY_Right: 207 case FWL_VKEY_Right:
208 break; 208 break;
209 } 209 }
210 210
211 switch (nChar) { 211 switch (nChar) {
(...skipping 12 matching lines...) Expand all
224 case FWL_VKEY_End: 224 case FWL_VKEY_End:
225 m_pList->OnVK_END(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); 225 m_pList->OnVK_END(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag));
226 break; 226 break;
227 case FWL_VKEY_Right: 227 case FWL_VKEY_Right:
228 m_pList->OnVK_RIGHT(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); 228 m_pList->OnVK_RIGHT(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag));
229 break; 229 break;
230 case FWL_VKEY_Delete: 230 case FWL_VKEY_Delete:
231 break; 231 break;
232 } 232 }
233 233
234 FX_BOOL bExit = FALSE; 234 bool bExit = false;
235 OnNotifySelChanged(TRUE, bExit, nFlag); 235 OnNotifySelChanged(true, bExit, nFlag);
236 236
237 return TRUE; 237 return true;
238 } 238 }
239 239
240 FX_BOOL CPWL_ListBox::OnChar(uint16_t nChar, uint32_t nFlag) { 240 bool CPWL_ListBox::OnChar(uint16_t nChar, uint32_t nFlag) {
241 CPWL_Wnd::OnChar(nChar, nFlag); 241 CPWL_Wnd::OnChar(nChar, nFlag);
242 242
243 if (!m_pList->OnChar(nChar, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag))) 243 if (!m_pList->OnChar(nChar, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)))
244 return FALSE; 244 return false;
245 245
246 FX_BOOL bExit = FALSE; 246 bool bExit = false;
247 OnNotifySelChanged(TRUE, bExit, nFlag); 247 OnNotifySelChanged(true, bExit, nFlag);
248 248
249 return TRUE; 249 return true;
250 } 250 }
251 251
252 FX_BOOL CPWL_ListBox::OnLButtonDown(const CFX_FloatPoint& point, 252 bool CPWL_ListBox::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) {
253 uint32_t nFlag) {
254 CPWL_Wnd::OnLButtonDown(point, nFlag); 253 CPWL_Wnd::OnLButtonDown(point, nFlag);
255 254
256 if (ClientHitTest(point)) { 255 if (ClientHitTest(point)) {
257 m_bMouseDown = TRUE; 256 m_bMouseDown = true;
258 SetFocus(); 257 SetFocus();
259 SetCapture(); 258 SetCapture();
260 259
261 m_pList->OnMouseDown(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); 260 m_pList->OnMouseDown(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag));
262 } 261 }
263 262
264 return TRUE; 263 return true;
265 } 264 }
266 265
267 FX_BOOL CPWL_ListBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { 266 bool CPWL_ListBox::OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) {
268 CPWL_Wnd::OnLButtonUp(point, nFlag); 267 CPWL_Wnd::OnLButtonUp(point, nFlag);
269 268
270 if (m_bMouseDown) { 269 if (m_bMouseDown) {
271 ReleaseCapture(); 270 ReleaseCapture();
272 m_bMouseDown = FALSE; 271 m_bMouseDown = false;
273 } 272 }
274 273
275 FX_BOOL bExit = FALSE; 274 bool bExit = false;
276 OnNotifySelChanged(FALSE, bExit, nFlag); 275 OnNotifySelChanged(false, bExit, nFlag);
277 276
278 return TRUE; 277 return true;
279 } 278 }
280 279
281 void CPWL_ListBox::SetHoverSel(FX_BOOL bHoverSel) { 280 void CPWL_ListBox::SetHoverSel(bool bHoverSel) {
282 m_bHoverSel = bHoverSel; 281 m_bHoverSel = bHoverSel;
283 } 282 }
284 283
285 FX_BOOL CPWL_ListBox::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) { 284 bool CPWL_ListBox::OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) {
286 CPWL_Wnd::OnMouseMove(point, nFlag); 285 CPWL_Wnd::OnMouseMove(point, nFlag);
287 286
288 if (m_bHoverSel && !IsCaptureMouse() && ClientHitTest(point)) 287 if (m_bHoverSel && !IsCaptureMouse() && ClientHitTest(point))
289 m_pList->Select(m_pList->GetItemIndex(point)); 288 m_pList->Select(m_pList->GetItemIndex(point));
290 if (m_bMouseDown) 289 if (m_bMouseDown)
291 m_pList->OnMouseMove(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); 290 m_pList->OnMouseMove(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag));
292 291
293 return TRUE; 292 return true;
294 } 293 }
295 294
296 void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, 295 void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd,
297 uint32_t msg, 296 uint32_t msg,
298 intptr_t wParam, 297 intptr_t wParam,
299 intptr_t lParam) { 298 intptr_t lParam) {
300 CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); 299 CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam);
301 300
302 FX_FLOAT fPos; 301 FX_FLOAT fPos;
303 302
(...skipping 30 matching lines...) Expand all
334 void CPWL_ListBox::KillFocus() { 333 void CPWL_ListBox::KillFocus() {
335 CPWL_Wnd::KillFocus(); 334 CPWL_Wnd::KillFocus();
336 } 335 }
337 336
338 void CPWL_ListBox::RePosChildWnd() { 337 void CPWL_ListBox::RePosChildWnd() {
339 CPWL_Wnd::RePosChildWnd(); 338 CPWL_Wnd::RePosChildWnd();
340 339
341 m_pList->SetPlateRect(GetListRect()); 340 m_pList->SetPlateRect(GetListRect());
342 } 341 }
343 342
344 void CPWL_ListBox::OnNotifySelChanged(FX_BOOL bKeyDown, 343 void CPWL_ListBox::OnNotifySelChanged(bool bKeyDown,
345 FX_BOOL& bExit, 344 bool& bExit,
346 uint32_t nFlag) { 345 uint32_t nFlag) {
347 if (!m_pFillerNotify) 346 if (!m_pFillerNotify)
348 return; 347 return;
349 348
350 FX_BOOL bRC = TRUE; 349 bool bRC = true;
351 CFX_WideString swChange = GetText(); 350 CFX_WideString swChange = GetText();
352 CFX_WideString strChangeEx; 351 CFX_WideString strChangeEx;
353 int nSelStart = 0; 352 int nSelStart = 0;
354 int nSelEnd = swChange.GetLength(); 353 int nSelEnd = swChange.GetLength();
355 m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange, strChangeEx, 354 m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange, strChangeEx,
356 nSelStart, nSelEnd, bKeyDown, bRC, bExit, 355 nSelStart, nSelEnd, bKeyDown, bRC, bExit,
357 nFlag); 356 nFlag);
358 } 357 }
359 358
360 CFX_FloatRect CPWL_ListBox::GetFocusRect() const { 359 CFX_FloatRect CPWL_ListBox::GetFocusRect() const {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } 399 }
401 400
402 void CPWL_ListBox::ResetContent() { 401 void CPWL_ListBox::ResetContent() {
403 m_pList->Empty(); 402 m_pList->Empty();
404 } 403 }
405 404
406 void CPWL_ListBox::Reset() { 405 void CPWL_ListBox::Reset() {
407 m_pList->Cancel(); 406 m_pList->Cancel();
408 } 407 }
409 408
410 FX_BOOL CPWL_ListBox::IsMultipleSel() const { 409 bool CPWL_ListBox::IsMultipleSel() const {
411 return m_pList->IsMultipleSel(); 410 return m_pList->IsMultipleSel();
412 } 411 }
413 412
414 int32_t CPWL_ListBox::GetCaretIndex() const { 413 int32_t CPWL_ListBox::GetCaretIndex() const {
415 return m_pList->GetCaret(); 414 return m_pList->GetCaret();
416 } 415 }
417 416
418 int32_t CPWL_ListBox::GetCurSel() const { 417 int32_t CPWL_ListBox::GetCurSel() const {
419 return m_pList->GetSelect(); 418 return m_pList->GetSelect();
420 } 419 }
421 420
422 FX_BOOL CPWL_ListBox::IsItemSelected(int32_t nItemIndex) const { 421 bool CPWL_ListBox::IsItemSelected(int32_t nItemIndex) const {
423 return m_pList->IsItemSelected(nItemIndex); 422 return m_pList->IsItemSelected(nItemIndex);
424 } 423 }
425 424
426 int32_t CPWL_ListBox::GetTopVisibleIndex() const { 425 int32_t CPWL_ListBox::GetTopVisibleIndex() const {
427 m_pList->ScrollToListItem(m_pList->GetFirstSelected()); 426 m_pList->ScrollToListItem(m_pList->GetFirstSelected());
428 return m_pList->GetTopItem(); 427 return m_pList->GetTopItem();
429 } 428 }
430 429
431 int32_t CPWL_ListBox::GetCount() const { 430 int32_t CPWL_ListBox::GetCount() const {
432 return m_pList->GetCount(); 431 return m_pList->GetCount();
433 } 432 }
434 433
435 int32_t CPWL_ListBox::FindNext(int32_t nIndex, FX_WCHAR nChar) const { 434 int32_t CPWL_ListBox::FindNext(int32_t nIndex, FX_WCHAR nChar) const {
436 return m_pList->FindNext(nIndex, nChar); 435 return m_pList->FindNext(nIndex, nChar);
437 } 436 }
438 437
439 CFX_FloatRect CPWL_ListBox::GetContentRect() const { 438 CFX_FloatRect CPWL_ListBox::GetContentRect() const {
440 return m_pList->GetContentRect(); 439 return m_pList->GetContentRect();
441 } 440 }
442 441
443 FX_FLOAT CPWL_ListBox::GetFirstHeight() const { 442 FX_FLOAT CPWL_ListBox::GetFirstHeight() const {
444 return m_pList->GetFirstHeight(); 443 return m_pList->GetFirstHeight();
445 } 444 }
446 445
447 CFX_FloatRect CPWL_ListBox::GetListRect() const { 446 CFX_FloatRect CPWL_ListBox::GetListRect() const {
448 return CPWL_Utils::DeflateRect( 447 return CPWL_Utils::DeflateRect(
449 GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); 448 GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth()));
450 } 449 }
451 450
452 FX_BOOL CPWL_ListBox::OnMouseWheel(short zDelta, 451 bool CPWL_ListBox::OnMouseWheel(short zDelta,
453 const CFX_FloatPoint& point, 452 const CFX_FloatPoint& point,
454 uint32_t nFlag) { 453 uint32_t nFlag) {
455 if (zDelta < 0) 454 if (zDelta < 0)
456 m_pList->OnVK_DOWN(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); 455 m_pList->OnVK_DOWN(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag));
457 else 456 else
458 m_pList->OnVK_UP(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); 457 m_pList->OnVK_UP(IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag));
459 458
460 FX_BOOL bExit = FALSE; 459 bool bExit = false;
461 OnNotifySelChanged(FALSE, bExit, nFlag); 460 OnNotifySelChanged(false, bExit, nFlag);
462 return TRUE; 461 return true;
463 } 462 }
OLDNEW
« no previous file with comments | « fpdfsdk/pdfwindow/PWL_ListBox.h ('k') | fpdfsdk/pdfwindow/PWL_ScrollBar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698