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