| 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 <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h" | 9 #include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h" |
| 10 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" | 10 #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 m_bCreated = FALSE; | 266 m_bCreated = FALSE; |
| 267 } | 267 } |
| 268 | 268 |
| 269 DestroyMsgControl(); | 269 DestroyMsgControl(); |
| 270 | 270 |
| 271 FXSYS_memset(&m_sPrivateParam, 0, sizeof(PWL_CREATEPARAM)); | 271 FXSYS_memset(&m_sPrivateParam, 0, sizeof(PWL_CREATEPARAM)); |
| 272 m_aChildren.RemoveAll(); | 272 m_aChildren.RemoveAll(); |
| 273 m_pVScrollBar = NULL; | 273 m_pVScrollBar = NULL; |
| 274 } | 274 } |
| 275 | 275 |
| 276 void CPWL_Wnd::Move(const CPDF_Rect& rcNew, FX_BOOL bReset, FX_BOOL bRefresh) { | 276 void CPWL_Wnd::Move(const CFX_FloatRect& rcNew, |
| 277 FX_BOOL bReset, |
| 278 FX_BOOL bRefresh) { |
| 277 if (IsValid()) { | 279 if (IsValid()) { |
| 278 CPDF_Rect rcOld = GetWindowRect(); | 280 CFX_FloatRect rcOld = GetWindowRect(); |
| 279 | 281 |
| 280 m_rcWindow = rcNew; | 282 m_rcWindow = rcNew; |
| 281 m_rcWindow.Normalize(); | 283 m_rcWindow.Normalize(); |
| 282 | 284 |
| 283 if (rcOld.left != rcNew.left || rcOld.right != rcNew.right || | 285 if (rcOld.left != rcNew.left || rcOld.right != rcNew.right || |
| 284 rcOld.top != rcNew.top || rcOld.bottom != rcNew.bottom) { | 286 rcOld.top != rcNew.top || rcOld.bottom != rcNew.bottom) { |
| 285 if (bReset) { | 287 if (bReset) { |
| 286 RePosChildWnd(); | 288 RePosChildWnd(); |
| 287 } | 289 } |
| 288 } | 290 } |
| 289 if (bRefresh) { | 291 if (bRefresh) { |
| 290 InvalidateRectMove(rcOld, rcNew); | 292 InvalidateRectMove(rcOld, rcNew); |
| 291 } | 293 } |
| 292 | 294 |
| 293 m_sPrivateParam.rcRectWnd = m_rcWindow; | 295 m_sPrivateParam.rcRectWnd = m_rcWindow; |
| 294 } | 296 } |
| 295 } | 297 } |
| 296 | 298 |
| 297 void CPWL_Wnd::InvalidateRectMove(const CPDF_Rect& rcOld, | 299 void CPWL_Wnd::InvalidateRectMove(const CFX_FloatRect& rcOld, |
| 298 const CPDF_Rect& rcNew) { | 300 const CFX_FloatRect& rcNew) { |
| 299 CPDF_Rect rcUnion = rcOld; | 301 CFX_FloatRect rcUnion = rcOld; |
| 300 rcUnion.Union(rcNew); | 302 rcUnion.Union(rcNew); |
| 301 | 303 |
| 302 InvalidateRect(&rcUnion); | 304 InvalidateRect(&rcUnion); |
| 303 } | 305 } |
| 304 | 306 |
| 305 void CPWL_Wnd::GetAppearanceStream(CFX_ByteTextBuf& sAppStream) { | 307 void CPWL_Wnd::GetAppearanceStream(CFX_ByteTextBuf& sAppStream) { |
| 306 if (IsValid() && IsVisible()) { | 308 if (IsValid() && IsVisible()) { |
| 307 GetThisAppearanceStream(sAppStream); | 309 GetThisAppearanceStream(sAppStream); |
| 308 GetChildAppearanceStream(sAppStream); | 310 GetChildAppearanceStream(sAppStream); |
| 309 } | 311 } |
| 310 } | 312 } |
| 311 | 313 |
| 312 // if don't set,Get default apperance stream | 314 // if don't set,Get default apperance stream |
| 313 void CPWL_Wnd::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { | 315 void CPWL_Wnd::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { |
| 314 CPDF_Rect rectWnd = GetWindowRect(); | 316 CFX_FloatRect rectWnd = GetWindowRect(); |
| 315 if (!rectWnd.IsEmpty()) { | 317 if (!rectWnd.IsEmpty()) { |
| 316 CFX_ByteTextBuf sThis; | 318 CFX_ByteTextBuf sThis; |
| 317 | 319 |
| 318 if (HasFlag(PWS_BACKGROUND)) | 320 if (HasFlag(PWS_BACKGROUND)) |
| 319 sThis << CPWL_Utils::GetRectFillAppStream(rectWnd, GetBackgroundColor()); | 321 sThis << CPWL_Utils::GetRectFillAppStream(rectWnd, GetBackgroundColor()); |
| 320 | 322 |
| 321 if (HasFlag(PWS_BORDER)) { | 323 if (HasFlag(PWS_BORDER)) { |
| 322 sThis << CPWL_Utils::GetBorderAppStream( | 324 sThis << CPWL_Utils::GetBorderAppStream( |
| 323 rectWnd, (FX_FLOAT)GetBorderWidth(), GetBorderColor(), | 325 rectWnd, (FX_FLOAT)GetBorderWidth(), GetBorderColor(), |
| 324 GetBorderLeftTopColor(GetBorderStyle()), | 326 GetBorderLeftTopColor(GetBorderStyle()), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 341 void CPWL_Wnd::DrawAppearance(CFX_RenderDevice* pDevice, | 343 void CPWL_Wnd::DrawAppearance(CFX_RenderDevice* pDevice, |
| 342 CFX_Matrix* pUser2Device) { | 344 CFX_Matrix* pUser2Device) { |
| 343 if (IsValid() && IsVisible()) { | 345 if (IsValid() && IsVisible()) { |
| 344 DrawThisAppearance(pDevice, pUser2Device); | 346 DrawThisAppearance(pDevice, pUser2Device); |
| 345 DrawChildAppearance(pDevice, pUser2Device); | 347 DrawChildAppearance(pDevice, pUser2Device); |
| 346 } | 348 } |
| 347 } | 349 } |
| 348 | 350 |
| 349 void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice, | 351 void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice, |
| 350 CFX_Matrix* pUser2Device) { | 352 CFX_Matrix* pUser2Device) { |
| 351 CPDF_Rect rectWnd = GetWindowRect(); | 353 CFX_FloatRect rectWnd = GetWindowRect(); |
| 352 if (!rectWnd.IsEmpty()) { | 354 if (!rectWnd.IsEmpty()) { |
| 353 if (HasFlag(PWS_BACKGROUND)) { | 355 if (HasFlag(PWS_BACKGROUND)) { |
| 354 CPDF_Rect rcClient = CPWL_Utils::DeflateRect( | 356 CFX_FloatRect rcClient = CPWL_Utils::DeflateRect( |
| 355 rectWnd, (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); | 357 rectWnd, (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); |
| 356 CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient, | 358 CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient, |
| 357 GetBackgroundColor(), GetTransparency()); | 359 GetBackgroundColor(), GetTransparency()); |
| 358 } | 360 } |
| 359 | 361 |
| 360 if (HasFlag(PWS_BORDER)) | 362 if (HasFlag(PWS_BORDER)) |
| 361 CPWL_Utils::DrawBorder(pDevice, pUser2Device, rectWnd, | 363 CPWL_Utils::DrawBorder(pDevice, pUser2Device, rectWnd, |
| 362 (FX_FLOAT)GetBorderWidth(), GetBorderColor(), | 364 (FX_FLOAT)GetBorderWidth(), GetBorderColor(), |
| 363 GetBorderLeftTopColor(GetBorderStyle()), | 365 GetBorderLeftTopColor(GetBorderStyle()), |
| 364 GetBorderRightBottomColor(GetBorderStyle()), | 366 GetBorderRightBottomColor(GetBorderStyle()), |
| 365 GetBorderStyle(), GetTransparency()); | 367 GetBorderStyle(), GetTransparency()); |
| 366 } | 368 } |
| 367 } | 369 } |
| 368 | 370 |
| 369 void CPWL_Wnd::DrawChildAppearance(CFX_RenderDevice* pDevice, | 371 void CPWL_Wnd::DrawChildAppearance(CFX_RenderDevice* pDevice, |
| 370 CFX_Matrix* pUser2Device) { | 372 CFX_Matrix* pUser2Device) { |
| 371 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { | 373 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { |
| 372 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { | 374 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { |
| 373 CFX_Matrix mt = pChild->GetChildMatrix(); | 375 CFX_Matrix mt = pChild->GetChildMatrix(); |
| 374 if (mt.IsIdentity()) { | 376 if (mt.IsIdentity()) { |
| 375 pChild->DrawAppearance(pDevice, pUser2Device); | 377 pChild->DrawAppearance(pDevice, pUser2Device); |
| 376 } else { | 378 } else { |
| 377 mt.Concat(*pUser2Device); | 379 mt.Concat(*pUser2Device); |
| 378 pChild->DrawAppearance(pDevice, &mt); | 380 pChild->DrawAppearance(pDevice, &mt); |
| 379 } | 381 } |
| 380 } | 382 } |
| 381 } | 383 } |
| 382 } | 384 } |
| 383 | 385 |
| 384 void CPWL_Wnd::InvalidateRect(CPDF_Rect* pRect) { | 386 void CPWL_Wnd::InvalidateRect(CFX_FloatRect* pRect) { |
| 385 if (IsValid()) { | 387 if (IsValid()) { |
| 386 CPDF_Rect rcRefresh = pRect ? *pRect : GetWindowRect(); | 388 CFX_FloatRect rcRefresh = pRect ? *pRect : GetWindowRect(); |
| 387 | 389 |
| 388 if (!HasFlag(PWS_NOREFRESHCLIP)) { | 390 if (!HasFlag(PWS_NOREFRESHCLIP)) { |
| 389 CPDF_Rect rcClip = GetClipRect(); | 391 CFX_FloatRect rcClip = GetClipRect(); |
| 390 if (!rcClip.IsEmpty()) { | 392 if (!rcClip.IsEmpty()) { |
| 391 rcRefresh.Intersect(rcClip); | 393 rcRefresh.Intersect(rcClip); |
| 392 } | 394 } |
| 393 } | 395 } |
| 394 | 396 |
| 395 FX_RECT rcWin = PWLtoWnd(rcRefresh); | 397 FX_RECT rcWin = PWLtoWnd(rcRefresh); |
| 396 rcWin.left -= PWL_INVALIDATE_INFLATE; | 398 rcWin.left -= PWL_INVALIDATE_INFLATE; |
| 397 rcWin.top -= PWL_INVALIDATE_INFLATE; | 399 rcWin.top -= PWL_INVALIDATE_INFLATE; |
| 398 rcWin.right += PWL_INVALIDATE_INFLATE; | 400 rcWin.right += PWL_INVALIDATE_INFLATE; |
| 399 rcWin.bottom += PWL_INVALIDATE_INFLATE; | 401 rcWin.bottom += PWL_INVALIDATE_INFLATE; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 416 return pChild->key_method_name(nChar, nFlag); \ | 418 return pChild->key_method_name(nChar, nFlag); \ |
| 417 } \ | 419 } \ |
| 418 } \ | 420 } \ |
| 419 } \ | 421 } \ |
| 420 } \ | 422 } \ |
| 421 } \ | 423 } \ |
| 422 return FALSE; \ | 424 return FALSE; \ |
| 423 } | 425 } |
| 424 | 426 |
| 425 #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name) \ | 427 #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name) \ |
| 426 FX_BOOL CPWL_Wnd::mouse_method_name(const CPDF_Point& point, \ | 428 FX_BOOL CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \ |
| 427 FX_DWORD nFlag) { \ | 429 FX_DWORD nFlag) { \ |
| 428 if (IsValid() && IsVisible() && IsEnabled()) { \ | 430 if (IsValid() && IsVisible() && IsEnabled()) { \ |
| 429 if (IsWndCaptureMouse(this)) { \ | 431 if (IsWndCaptureMouse(this)) { \ |
| 430 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ | 432 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ |
| 431 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \ | 433 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \ |
| 432 if (IsWndCaptureMouse(pChild)) { \ | 434 if (IsWndCaptureMouse(pChild)) { \ |
| 433 return pChild->mouse_method_name(pChild->ParentToChild(point), \ | 435 return pChild->mouse_method_name(pChild->ParentToChild(point), \ |
| 434 nFlag); \ | 436 nFlag); \ |
| 435 } \ | 437 } \ |
| 436 } \ | 438 } \ |
| (...skipping 23 matching lines...) Expand all Loading... |
| 460 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDown) | 462 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonDown) |
| 461 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonUp) | 463 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonUp) |
| 462 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDblClk) | 464 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDblClk) |
| 463 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDown) | 465 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDown) |
| 464 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonUp) | 466 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonUp) |
| 465 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDown) | 467 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDown) |
| 466 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp) | 468 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp) |
| 467 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) | 469 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) |
| 468 | 470 |
| 469 FX_BOOL CPWL_Wnd::OnMouseWheel(short zDelta, | 471 FX_BOOL CPWL_Wnd::OnMouseWheel(short zDelta, |
| 470 const CPDF_Point& point, | 472 const CFX_FloatPoint& point, |
| 471 FX_DWORD nFlag) { | 473 FX_DWORD nFlag) { |
| 472 if (IsValid() && IsVisible() && IsEnabled()) { | 474 if (IsValid() && IsVisible() && IsEnabled()) { |
| 473 SetCursor(); | 475 SetCursor(); |
| 474 if (IsWndCaptureKeyboard(this)) { | 476 if (IsWndCaptureKeyboard(this)) { |
| 475 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { | 477 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { |
| 476 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { | 478 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { |
| 477 if (IsWndCaptureKeyboard(pChild)) { | 479 if (IsWndCaptureKeyboard(pChild)) { |
| 478 return pChild->OnMouseWheel(zDelta, pChild->ParentToChild(point), | 480 return pChild->OnMouseWheel(zDelta, pChild->ParentToChild(point), |
| 479 nFlag); | 481 nFlag); |
| 480 } | 482 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 } | 523 } |
| 522 | 524 |
| 523 const PWL_CREATEPARAM& CPWL_Wnd::GetCreationParam() const { | 525 const PWL_CREATEPARAM& CPWL_Wnd::GetCreationParam() const { |
| 524 return m_sPrivateParam; | 526 return m_sPrivateParam; |
| 525 } | 527 } |
| 526 | 528 |
| 527 CPWL_Wnd* CPWL_Wnd::GetParentWindow() const { | 529 CPWL_Wnd* CPWL_Wnd::GetParentWindow() const { |
| 528 return m_sPrivateParam.pParentWnd; | 530 return m_sPrivateParam.pParentWnd; |
| 529 } | 531 } |
| 530 | 532 |
| 531 CPDF_Rect CPWL_Wnd::GetWindowRect() const { | 533 CFX_FloatRect CPWL_Wnd::GetWindowRect() const { |
| 532 return m_rcWindow; | 534 return m_rcWindow; |
| 533 } | 535 } |
| 534 | 536 |
| 535 CPDF_Rect CPWL_Wnd::GetClientRect() const { | 537 CFX_FloatRect CPWL_Wnd::GetClientRect() const { |
| 536 CPDF_Rect rcWindow = GetWindowRect(); | 538 CFX_FloatRect rcWindow = GetWindowRect(); |
| 537 CPDF_Rect rcClient = CPWL_Utils::DeflateRect( | 539 CFX_FloatRect rcClient = CPWL_Utils::DeflateRect( |
| 538 rcWindow, (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); | 540 rcWindow, (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); |
| 539 if (CPWL_ScrollBar* pVSB = GetVScrollBar()) | 541 if (CPWL_ScrollBar* pVSB = GetVScrollBar()) |
| 540 rcClient.right -= pVSB->GetScrollBarWidth(); | 542 rcClient.right -= pVSB->GetScrollBarWidth(); |
| 541 | 543 |
| 542 rcClient.Normalize(); | 544 rcClient.Normalize(); |
| 543 return rcWindow.Contains(rcClient) ? rcClient : CPDF_Rect(); | 545 return rcWindow.Contains(rcClient) ? rcClient : CFX_FloatRect(); |
| 544 } | 546 } |
| 545 | 547 |
| 546 CPDF_Point CPWL_Wnd::GetCenterPoint() const { | 548 CFX_FloatPoint CPWL_Wnd::GetCenterPoint() const { |
| 547 CPDF_Rect rcClient = GetClientRect(); | 549 CFX_FloatRect rcClient = GetClientRect(); |
| 548 return CPDF_Point((rcClient.left + rcClient.right) * 0.5f, | 550 return CFX_FloatPoint((rcClient.left + rcClient.right) * 0.5f, |
| 549 (rcClient.top + rcClient.bottom) * 0.5f); | 551 (rcClient.top + rcClient.bottom) * 0.5f); |
| 550 } | 552 } |
| 551 | 553 |
| 552 FX_BOOL CPWL_Wnd::HasFlag(FX_DWORD dwFlags) const { | 554 FX_BOOL CPWL_Wnd::HasFlag(FX_DWORD dwFlags) const { |
| 553 return (m_sPrivateParam.dwFlags & dwFlags) != 0; | 555 return (m_sPrivateParam.dwFlags & dwFlags) != 0; |
| 554 } | 556 } |
| 555 | 557 |
| 556 void CPWL_Wnd::RemoveFlag(FX_DWORD dwFlags) { | 558 void CPWL_Wnd::RemoveFlag(FX_DWORD dwFlags) { |
| 557 m_sPrivateParam.dwFlags &= ~dwFlags; | 559 m_sPrivateParam.dwFlags &= ~dwFlags; |
| 558 } | 560 } |
| 559 | 561 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 if (CPWL_MsgControl* pMsgCtrl = GetMsgControl()) { | 677 if (CPWL_MsgControl* pMsgCtrl = GetMsgControl()) { |
| 676 if (pMsgCtrl->IsWndCaptureKeyboard(this)) | 678 if (pMsgCtrl->IsWndCaptureKeyboard(this)) |
| 677 pMsgCtrl->KillFocus(); | 679 pMsgCtrl->KillFocus(); |
| 678 } | 680 } |
| 679 } | 681 } |
| 680 | 682 |
| 681 void CPWL_Wnd::OnSetFocus() {} | 683 void CPWL_Wnd::OnSetFocus() {} |
| 682 | 684 |
| 683 void CPWL_Wnd::OnKillFocus() {} | 685 void CPWL_Wnd::OnKillFocus() {} |
| 684 | 686 |
| 685 FX_BOOL CPWL_Wnd::WndHitTest(const CPDF_Point& point) const { | 687 FX_BOOL CPWL_Wnd::WndHitTest(const CFX_FloatPoint& point) const { |
| 686 return IsValid() && IsVisible() && GetWindowRect().Contains(point.x, point.y); | 688 return IsValid() && IsVisible() && GetWindowRect().Contains(point.x, point.y); |
| 687 } | 689 } |
| 688 | 690 |
| 689 FX_BOOL CPWL_Wnd::ClientHitTest(const CPDF_Point& point) const { | 691 FX_BOOL CPWL_Wnd::ClientHitTest(const CFX_FloatPoint& point) const { |
| 690 return IsValid() && IsVisible() && GetClientRect().Contains(point.x, point.y); | 692 return IsValid() && IsVisible() && GetClientRect().Contains(point.x, point.y); |
| 691 } | 693 } |
| 692 | 694 |
| 693 const CPWL_Wnd* CPWL_Wnd::GetRootWnd() const { | 695 const CPWL_Wnd* CPWL_Wnd::GetRootWnd() const { |
| 694 if (m_sPrivateParam.pParentWnd) | 696 if (m_sPrivateParam.pParentWnd) |
| 695 return m_sPrivateParam.pParentWnd->GetRootWnd(); | 697 return m_sPrivateParam.pParentWnd->GetRootWnd(); |
| 696 | 698 |
| 697 return this; | 699 return this; |
| 698 } | 700 } |
| 699 | 701 |
| 700 void CPWL_Wnd::SetVisible(FX_BOOL bVisible) { | 702 void CPWL_Wnd::SetVisible(FX_BOOL bVisible) { |
| 701 if (IsValid()) { | 703 if (IsValid()) { |
| 702 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { | 704 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { |
| 703 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { | 705 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { |
| 704 pChild->SetVisible(bVisible); | 706 pChild->SetVisible(bVisible); |
| 705 } | 707 } |
| 706 } | 708 } |
| 707 | 709 |
| 708 if (bVisible != m_bVisible) { | 710 if (bVisible != m_bVisible) { |
| 709 m_bVisible = bVisible; | 711 m_bVisible = bVisible; |
| 710 RePosChildWnd(); | 712 RePosChildWnd(); |
| 711 InvalidateRect(); | 713 InvalidateRect(); |
| 712 } | 714 } |
| 713 } | 715 } |
| 714 } | 716 } |
| 715 | 717 |
| 716 void CPWL_Wnd::SetClipRect(const CPDF_Rect& rect) { | 718 void CPWL_Wnd::SetClipRect(const CFX_FloatRect& rect) { |
| 717 m_rcClip = rect; | 719 m_rcClip = rect; |
| 718 m_rcClip.Normalize(); | 720 m_rcClip.Normalize(); |
| 719 } | 721 } |
| 720 | 722 |
| 721 const CPDF_Rect& CPWL_Wnd::GetClipRect() const { | 723 const CFX_FloatRect& CPWL_Wnd::GetClipRect() const { |
| 722 return m_rcClip; | 724 return m_rcClip; |
| 723 } | 725 } |
| 724 | 726 |
| 725 FX_BOOL CPWL_Wnd::IsReadOnly() const { | 727 FX_BOOL CPWL_Wnd::IsReadOnly() const { |
| 726 return HasFlag(PWS_READONLY); | 728 return HasFlag(PWS_READONLY); |
| 727 } | 729 } |
| 728 | 730 |
| 729 void CPWL_Wnd::RePosChildWnd() { | 731 void CPWL_Wnd::RePosChildWnd() { |
| 730 CPDF_Rect rcContent = CPWL_Utils::DeflateRect( | 732 CFX_FloatRect rcContent = CPWL_Utils::DeflateRect( |
| 731 GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); | 733 GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); |
| 732 | 734 |
| 733 CPWL_ScrollBar* pVSB = GetVScrollBar(); | 735 CPWL_ScrollBar* pVSB = GetVScrollBar(); |
| 734 | 736 |
| 735 CPDF_Rect rcVScroll = | 737 CFX_FloatRect rcVScroll = |
| 736 CPDF_Rect(rcContent.right - PWL_SCROLLBAR_WIDTH, rcContent.bottom, | 738 CFX_FloatRect(rcContent.right - PWL_SCROLLBAR_WIDTH, rcContent.bottom, |
| 737 rcContent.right - 1.0f, rcContent.top); | 739 rcContent.right - 1.0f, rcContent.top); |
| 738 | 740 |
| 739 if (pVSB) | 741 if (pVSB) |
| 740 pVSB->Move(rcVScroll, TRUE, FALSE); | 742 pVSB->Move(rcVScroll, TRUE, FALSE); |
| 741 } | 743 } |
| 742 | 744 |
| 743 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM& cp) {} | 745 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM& cp) {} |
| 744 | 746 |
| 745 void CPWL_Wnd::SetCursor() { | 747 void CPWL_Wnd::SetCursor() { |
| 746 if (IsValid()) { | 748 if (IsValid()) { |
| 747 if (IFX_SystemHandler* pSH = GetSystemHandler()) { | 749 if (IFX_SystemHandler* pSH = GetSystemHandler()) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 return FALSE; | 786 return FALSE; |
| 785 } | 787 } |
| 786 | 788 |
| 787 FX_BOOL CPWL_Wnd::IsFocused() const { | 789 FX_BOOL CPWL_Wnd::IsFocused() const { |
| 788 if (CPWL_MsgControl* pCtrl = GetMsgControl()) | 790 if (CPWL_MsgControl* pCtrl = GetMsgControl()) |
| 789 return pCtrl->IsMainCaptureKeyboard(this); | 791 return pCtrl->IsMainCaptureKeyboard(this); |
| 790 | 792 |
| 791 return FALSE; | 793 return FALSE; |
| 792 } | 794 } |
| 793 | 795 |
| 794 CPDF_Rect CPWL_Wnd::GetFocusRect() const { | 796 CFX_FloatRect CPWL_Wnd::GetFocusRect() const { |
| 795 return CPWL_Utils::InflateRect(GetWindowRect(), 1); | 797 return CPWL_Utils::InflateRect(GetWindowRect(), 1); |
| 796 } | 798 } |
| 797 | 799 |
| 798 FX_FLOAT CPWL_Wnd::GetFontSize() const { | 800 FX_FLOAT CPWL_Wnd::GetFontSize() const { |
| 799 return m_sPrivateParam.fFontSize; | 801 return m_sPrivateParam.fFontSize; |
| 800 } | 802 } |
| 801 | 803 |
| 802 void CPWL_Wnd::SetFontSize(FX_FLOAT fFontSize) { | 804 void CPWL_Wnd::SetFontSize(FX_FLOAT fFontSize) { |
| 803 m_sPrivateParam.fFontSize = fFontSize; | 805 m_sPrivateParam.fFontSize = fFontSize; |
| 804 } | 806 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 CFX_Matrix mt = GetChildToRoot(); | 881 CFX_Matrix mt = GetChildToRoot(); |
| 880 | 882 |
| 881 if (IPWL_Provider* pProvider = GetProvider()) { | 883 if (IPWL_Provider* pProvider = GetProvider()) { |
| 882 mt.Concat(pProvider->GetWindowMatrix(GetAttachedData())); | 884 mt.Concat(pProvider->GetWindowMatrix(GetAttachedData())); |
| 883 return mt; | 885 return mt; |
| 884 } | 886 } |
| 885 | 887 |
| 886 return mt; | 888 return mt; |
| 887 } | 889 } |
| 888 | 890 |
| 889 void CPWL_Wnd::PWLtoWnd(const CPDF_Point& point, int32_t& x, int32_t& y) const { | 891 void CPWL_Wnd::PWLtoWnd(const CFX_FloatPoint& point, |
| 892 int32_t& x, |
| 893 int32_t& y) const { |
| 890 CFX_Matrix mt = GetWindowMatrix(); | 894 CFX_Matrix mt = GetWindowMatrix(); |
| 891 CPDF_Point pt = point; | 895 CFX_FloatPoint pt = point; |
| 892 mt.Transform(pt.x, pt.y); | 896 mt.Transform(pt.x, pt.y); |
| 893 x = (int32_t)(pt.x + 0.5); | 897 x = (int32_t)(pt.x + 0.5); |
| 894 y = (int32_t)(pt.y + 0.5); | 898 y = (int32_t)(pt.y + 0.5); |
| 895 } | 899 } |
| 896 | 900 |
| 897 FX_RECT CPWL_Wnd::PWLtoWnd(const CPDF_Rect& rect) const { | 901 FX_RECT CPWL_Wnd::PWLtoWnd(const CFX_FloatRect& rect) const { |
| 898 CPDF_Rect rcTemp = rect; | 902 CFX_FloatRect rcTemp = rect; |
| 899 CFX_Matrix mt = GetWindowMatrix(); | 903 CFX_Matrix mt = GetWindowMatrix(); |
| 900 mt.TransformRect(rcTemp); | 904 mt.TransformRect(rcTemp); |
| 901 return FX_RECT((int32_t)(rcTemp.left + 0.5), (int32_t)(rcTemp.bottom + 0.5), | 905 return FX_RECT((int32_t)(rcTemp.left + 0.5), (int32_t)(rcTemp.bottom + 0.5), |
| 902 (int32_t)(rcTemp.right + 0.5), (int32_t)(rcTemp.top + 0.5)); | 906 (int32_t)(rcTemp.right + 0.5), (int32_t)(rcTemp.top + 0.5)); |
| 903 } | 907 } |
| 904 | 908 |
| 905 FX_HWND CPWL_Wnd::GetAttachedHWnd() const { | 909 FX_HWND CPWL_Wnd::GetAttachedHWnd() const { |
| 906 return m_sPrivateParam.hAttachedWnd; | 910 return m_sPrivateParam.hAttachedWnd; |
| 907 } | 911 } |
| 908 | 912 |
| 909 CPDF_Point CPWL_Wnd::ChildToParent(const CPDF_Point& point) const { | 913 CFX_FloatPoint CPWL_Wnd::ChildToParent(const CFX_FloatPoint& point) const { |
| 910 CFX_Matrix mt = GetChildMatrix(); | 914 CFX_Matrix mt = GetChildMatrix(); |
| 911 if (mt.IsIdentity()) | 915 if (mt.IsIdentity()) |
| 912 return point; | 916 return point; |
| 913 | 917 |
| 914 CPDF_Point pt = point; | 918 CFX_FloatPoint pt = point; |
| 915 mt.Transform(pt.x, pt.y); | 919 mt.Transform(pt.x, pt.y); |
| 916 return pt; | 920 return pt; |
| 917 } | 921 } |
| 918 | 922 |
| 919 CPDF_Rect CPWL_Wnd::ChildToParent(const CPDF_Rect& rect) const { | 923 CFX_FloatRect CPWL_Wnd::ChildToParent(const CFX_FloatRect& rect) const { |
| 920 CFX_Matrix mt = GetChildMatrix(); | 924 CFX_Matrix mt = GetChildMatrix(); |
| 921 if (mt.IsIdentity()) | 925 if (mt.IsIdentity()) |
| 922 return rect; | 926 return rect; |
| 923 | 927 |
| 924 CPDF_Rect rc = rect; | 928 CFX_FloatRect rc = rect; |
| 925 mt.TransformRect(rc); | 929 mt.TransformRect(rc); |
| 926 return rc; | 930 return rc; |
| 927 } | 931 } |
| 928 | 932 |
| 929 CPDF_Point CPWL_Wnd::ParentToChild(const CPDF_Point& point) const { | 933 CFX_FloatPoint CPWL_Wnd::ParentToChild(const CFX_FloatPoint& point) const { |
| 930 CFX_Matrix mt = GetChildMatrix(); | 934 CFX_Matrix mt = GetChildMatrix(); |
| 931 if (mt.IsIdentity()) | 935 if (mt.IsIdentity()) |
| 932 return point; | 936 return point; |
| 933 | 937 |
| 934 mt.SetReverse(mt); | 938 mt.SetReverse(mt); |
| 935 CPDF_Point pt = point; | 939 CFX_FloatPoint pt = point; |
| 936 mt.Transform(pt.x, pt.y); | 940 mt.Transform(pt.x, pt.y); |
| 937 return pt; | 941 return pt; |
| 938 } | 942 } |
| 939 | 943 |
| 940 CPDF_Rect CPWL_Wnd::ParentToChild(const CPDF_Rect& rect) const { | 944 CFX_FloatRect CPWL_Wnd::ParentToChild(const CFX_FloatRect& rect) const { |
| 941 CFX_Matrix mt = GetChildMatrix(); | 945 CFX_Matrix mt = GetChildMatrix(); |
| 942 if (mt.IsIdentity()) | 946 if (mt.IsIdentity()) |
| 943 return rect; | 947 return rect; |
| 944 | 948 |
| 945 mt.SetReverse(mt); | 949 mt.SetReverse(mt); |
| 946 CPDF_Rect rc = rect; | 950 CFX_FloatRect rc = rect; |
| 947 mt.TransformRect(rc); | 951 mt.TransformRect(rc); |
| 948 return rc; | 952 return rc; |
| 949 } | 953 } |
| 950 | 954 |
| 951 CFX_Matrix CPWL_Wnd::GetChildToRoot() const { | 955 CFX_Matrix CPWL_Wnd::GetChildToRoot() const { |
| 952 CFX_Matrix mt(1, 0, 0, 1, 0, 0); | 956 CFX_Matrix mt(1, 0, 0, 1, 0, 0); |
| 953 if (HasFlag(PWS_CHILD)) { | 957 if (HasFlag(PWS_CHILD)) { |
| 954 const CPWL_Wnd* pParent = this; | 958 const CPWL_Wnd* pParent = this; |
| 955 while (pParent) { | 959 while (pParent) { |
| 956 mt.Concat(pParent->GetChildMatrix()); | 960 mt.Concat(pParent->GetChildMatrix()); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 return FALSE; | 1032 return FALSE; |
| 1029 } | 1033 } |
| 1030 | 1034 |
| 1031 FX_BOOL CPWL_Wnd::IsINSERTpressed(FX_DWORD nFlag) const { | 1035 FX_BOOL CPWL_Wnd::IsINSERTpressed(FX_DWORD nFlag) const { |
| 1032 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) { | 1036 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) { |
| 1033 return pSystemHandler->IsINSERTKeyDown(nFlag); | 1037 return pSystemHandler->IsINSERTKeyDown(nFlag); |
| 1034 } | 1038 } |
| 1035 | 1039 |
| 1036 return FALSE; | 1040 return FALSE; |
| 1037 } | 1041 } |
| OLD | NEW |