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

Side by Side Diff: fpdfsdk/src/pdfwindow/PWL_Wnd.cpp

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 6 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 | « fpdfsdk/src/pdfwindow/PWL_Utils.cpp ('k') | public/fpdf_edit.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 "../../include/pdfwindow/PDFWindow.h" 7 #include "../../include/pdfwindow/PDFWindow.h"
8 #include "../../include/pdfwindow/PWL_Wnd.h" 8 #include "../../include/pdfwindow/PWL_Wnd.h"
9 #include "../../include/pdfwindow/PWL_Utils.h" 9 #include "../../include/pdfwindow/PWL_Utils.h"
10 #include "../../include/pdfwindow/PWL_ScrollBar.h" 10 #include "../../include/pdfwindow/PWL_ScrollBar.h"
11 11
12 /* -------------------------- CPWL_Timer -------------------------- */ 12 /* -------------------------- CPWL_Timer -------------------------- */
13 13
14 static CFX_MapPtrTemplate<FX_INT32, CPWL_Timer*>& GetPWLTimeMap() 14 static CFX_MapPtrTemplate<int32_t, CPWL_Timer*>& GetPWLTimeMap()
15 { 15 {
16 // Leak the object at shutdown. 16 // Leak the object at shutdown.
17 static auto timeMap = new CFX_MapPtrTemplate<FX_INT32, CPWL_Timer*>; 17 static auto timeMap = new CFX_MapPtrTemplate<int32_t, CPWL_Timer*>;
18 return *timeMap; 18 return *timeMap;
19 } 19 }
20 20
21 CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemH andler) : 21 CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemH andler) :
22 m_nTimerID(0), 22 m_nTimerID(0),
23 m_pAttached(pAttached), 23 m_pAttached(pAttached),
24 m_pSystemHandler(pSystemHandler) 24 m_pSystemHandler(pSystemHandler)
25 { 25 {
26 ASSERT(m_pAttached != NULL); 26 ASSERT(m_pAttached != NULL);
27 ASSERT(m_pSystemHandler != NULL); 27 ASSERT(m_pSystemHandler != NULL);
28 } 28 }
29 29
30 CPWL_Timer::~CPWL_Timer() 30 CPWL_Timer::~CPWL_Timer()
31 { 31 {
32 KillPWLTimer(); 32 KillPWLTimer();
33 } 33 }
34 34
35 FX_INT32 CPWL_Timer::SetPWLTimer(FX_INT32 nElapse) 35 int32_t CPWL_Timer::SetPWLTimer(int32_t nElapse)
36 { 36 {
37 if (m_nTimerID != 0) KillPWLTimer(); 37 if (m_nTimerID != 0) KillPWLTimer();
38 m_nTimerID = m_pSystemHandler->SetTimer(nElapse, TimerProc); 38 m_nTimerID = m_pSystemHandler->SetTimer(nElapse, TimerProc);
39 GetPWLTimeMap().SetAt(m_nTimerID, this); 39 GetPWLTimeMap().SetAt(m_nTimerID, this);
40 return m_nTimerID; 40 return m_nTimerID;
41 } 41 }
42 42
43 void CPWL_Timer::KillPWLTimer() 43 void CPWL_Timer::KillPWLTimer()
44 { 44 {
45 if (m_nTimerID != 0) 45 if (m_nTimerID != 0)
46 { 46 {
47 m_pSystemHandler->KillTimer(m_nTimerID); 47 m_pSystemHandler->KillTimer(m_nTimerID);
48 GetPWLTimeMap().RemoveKey(m_nTimerID); 48 GetPWLTimeMap().RemoveKey(m_nTimerID);
49 m_nTimerID = 0; 49 m_nTimerID = 0;
50 } 50 }
51 } 51 }
52 52
53 void CPWL_Timer::TimerProc(FX_INT32 idEvent) 53 void CPWL_Timer::TimerProc(int32_t idEvent)
54 { 54 {
55 CPWL_Timer* pTimer = NULL; 55 CPWL_Timer* pTimer = NULL;
56 if (GetPWLTimeMap().Lookup(idEvent, pTimer)) 56 if (GetPWLTimeMap().Lookup(idEvent, pTimer))
57 { 57 {
58 if (pTimer) 58 if (pTimer)
59 { 59 {
60 if (pTimer->m_pAttached) 60 if (pTimer->m_pAttached)
61 pTimer->m_pAttached->TimerProc(); 61 pTimer->m_pAttached->TimerProc();
62 } 62 }
63 } 63 }
64 } 64 }
65 65
66 /* -------------------------- CPWL_TimerHandler -------------------------- */ 66 /* -------------------------- CPWL_TimerHandler -------------------------- */
67 67
68 CPWL_TimerHandler::CPWL_TimerHandler() : m_pTimer(NULL) 68 CPWL_TimerHandler::CPWL_TimerHandler() : m_pTimer(NULL)
69 { 69 {
70 } 70 }
71 71
72 CPWL_TimerHandler::~CPWL_TimerHandler() 72 CPWL_TimerHandler::~CPWL_TimerHandler()
73 { 73 {
74 if (m_pTimer) delete m_pTimer; 74 if (m_pTimer) delete m_pTimer;
75 } 75 }
76 76
77 void CPWL_TimerHandler::BeginTimer(FX_INT32 nElapse) 77 void CPWL_TimerHandler::BeginTimer(int32_t nElapse)
78 { 78 {
79 if (!m_pTimer) 79 if (!m_pTimer)
80 m_pTimer = new CPWL_Timer(this, GetSystemHandler()); 80 m_pTimer = new CPWL_Timer(this, GetSystemHandler());
81 81
82 if (m_pTimer) 82 if (m_pTimer)
83 m_pTimer->SetPWLTimer(nElapse); 83 m_pTimer->SetPWLTimer(nElapse);
84 } 84 }
85 85
86 void CPWL_TimerHandler::EndTimer() 86 void CPWL_TimerHandler::EndTimer()
87 { 87 {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 128
129 FX_BOOL IsMainCaptureMouse(const CPWL_Wnd * pWnd) const 129 FX_BOOL IsMainCaptureMouse(const CPWL_Wnd * pWnd) const
130 { 130 {
131 return pWnd == m_pMainMouseWnd; 131 return pWnd == m_pMainMouseWnd;
132 } 132 }
133 133
134 FX_BOOL IsWndCaptureMouse(const CPWL_Wnd * pWnd) const 134 FX_BOOL IsWndCaptureMouse(const CPWL_Wnd * pWnd) const
135 { 135 {
136 if (pWnd) 136 if (pWnd)
137 » » » for( FX_INT32 i=0,sz=m_aMousePath.GetSize(); i<sz; i++) 137 » » » for( int32_t i=0,sz=m_aMousePath.GetSize(); i<sz; i++)
138 if (m_aMousePath.GetAt(i) == pWnd) 138 if (m_aMousePath.GetAt(i) == pWnd)
139 return TRUE; 139 return TRUE;
140 140
141 return FALSE; 141 return FALSE;
142 } 142 }
143 143
144 FX_BOOL IsMainCaptureKeyboard(const CPWL_Wnd * pWnd) const 144 FX_BOOL IsMainCaptureKeyboard(const CPWL_Wnd * pWnd) const
145 { 145 {
146 return pWnd == m_pMainKeyboardWnd; 146 return pWnd == m_pMainKeyboardWnd;
147 } 147 }
148 148
149 149
150 FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const 150 FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const
151 { 151 {
152 if (pWnd) 152 if (pWnd)
153 » » » for( FX_INT32 i=0,sz=m_aKeyboardPath.GetSize(); i<sz; i+ +) 153 » » » for( int32_t i=0,sz=m_aKeyboardPath.GetSize(); i<sz; i++ )
154 if (m_aKeyboardPath.GetAt(i) == pWnd) 154 if (m_aKeyboardPath.GetAt(i) == pWnd)
155 return TRUE; 155 return TRUE;
156 156
157 return FALSE; 157 return FALSE;
158 } 158 }
159 159
160 void SetFocus(CPWL_Wnd * pWnd) 160 void SetFocus(CPWL_Wnd * pWnd)
161 { 161 {
162 m_aKeyboardPath.RemoveAll(); 162 m_aKeyboardPath.RemoveAll();
163 163
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 } 287 }
288 288
289 void CPWL_Wnd::Destroy() 289 void CPWL_Wnd::Destroy()
290 { 290 {
291 KillFocus(); 291 KillFocus();
292 292
293 OnDestroy(); 293 OnDestroy();
294 294
295 if (m_bCreated) 295 if (m_bCreated)
296 { 296 {
297 » » for (FX_INT32 i = m_aChildren.GetSize()-1; i >= 0; i --) 297 » » for (int32_t i = m_aChildren.GetSize()-1; i >= 0; i --)
298 { 298 {
299 if (CPWL_Wnd * pChild = m_aChildren[i]) 299 if (CPWL_Wnd * pChild = m_aChildren[i])
300 { 300 {
301 pChild->Destroy(); 301 pChild->Destroy();
302 delete pChild; 302 delete pChild;
303 pChild = NULL; 303 pChild = NULL;
304 } 304 }
305 } 305 }
306 306
307 if (m_sPrivateParam.pParentWnd) 307 if (m_sPrivateParam.pParentWnd)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 { 348 {
349 CPDF_Rect rcUnion = rcOld; 349 CPDF_Rect rcUnion = rcOld;
350 rcUnion.Union(rcNew); 350 rcUnion.Union(rcNew);
351 351
352 InvalidateRect(&rcUnion); 352 InvalidateRect(&rcUnion);
353 353
354 /* 354 /*
355 CPDF_Rect SubArray[4]; 355 CPDF_Rect SubArray[4];
356 356
357 rcOld.Substract4(rcNew,SubArray); 357 rcOld.Substract4(rcNew,SubArray);
358 » for (FX_INT32 i=0;i<4;i++) 358 » for (int32_t i=0;i<4;i++)
359 { 359 {
360 if (SubArray[i].left == 0 && 360 if (SubArray[i].left == 0 &&
361 SubArray[i].right == 0 && 361 SubArray[i].right == 0 &&
362 SubArray[i].top == 0 && 362 SubArray[i].top == 0 &&
363 SubArray[i].bottom == 0)continue; 363 SubArray[i].bottom == 0)continue;
364 364
365 InvalidateRect(&CPWL_Utils::InflateRect(SubArray[i],2)); 365 InvalidateRect(&CPWL_Utils::InflateRect(SubArray[i],2));
366 } 366 }
367 367
368 rcNew.Substract4(rcOld,SubArray); 368 rcNew.Substract4(rcOld,SubArray);
369 » for (FX_INT32 j=0;j<4;j++) 369 » for (int32_t j=0;j<4;j++)
370 { 370 {
371 if (SubArray[j].left == 0 && 371 if (SubArray[j].left == 0 &&
372 SubArray[j].right == 0 && 372 SubArray[j].right == 0 &&
373 SubArray[j].top == 0 && 373 SubArray[j].top == 0 &&
374 SubArray[j].bottom == 0)continue; 374 SubArray[j].bottom == 0)continue;
375 375
376 InvalidateRect(&CPWL_Utils::InflateRect(SubArray[j],2)); 376 InvalidateRect(&CPWL_Utils::InflateRect(SubArray[j],2));
377 } 377 }
378 */ 378 */
379 } 379 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 this->Ge tBorderRightBottomColor(this->GetBorderStyle()), 416 this->Ge tBorderRightBottomColor(this->GetBorderStyle()),
417 this->Ge tBorderStyle(), 417 this->Ge tBorderStyle(),
418 this->Ge tBorderDash()); 418 this->Ge tBorderDash());
419 419
420 sAppStream << sThis; 420 sAppStream << sThis;
421 } 421 }
422 } 422 }
423 423
424 void CPWL_Wnd::GetChildAppearanceStream(CFX_ByteTextBuf & sAppStream) 424 void CPWL_Wnd::GetChildAppearanceStream(CFX_ByteTextBuf & sAppStream)
425 { 425 {
426 » for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i<sz; i++) 426 » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
427 { 427 {
428 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i)) 428 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))
429 { 429 {
430 pChild->GetAppearanceStream(sAppStream); 430 pChild->GetAppearanceStream(sAppStream);
431 } 431 }
432 } 432 }
433 } 433 }
434 434
435 void CPWL_Wnd::DrawAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi ce) 435 void CPWL_Wnd::DrawAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devi ce)
436 { 436 {
(...skipping 24 matching lines...) Expand all
461 this->GetBorderL eftTopColor(this->GetBorderStyle()), 461 this->GetBorderL eftTopColor(this->GetBorderStyle()),
462 this->GetBorderR ightBottomColor(this->GetBorderStyle()), 462 this->GetBorderR ightBottomColor(this->GetBorderStyle()),
463 this->GetBorderS tyle(), 463 this->GetBorderS tyle(),
464 this->GetBorderD ash(), 464 this->GetBorderD ash(),
465 GetTransparency( )); 465 GetTransparency( ));
466 } 466 }
467 } 467 }
468 468
469 void CPWL_Wnd::DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser 2Device) 469 void CPWL_Wnd::DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser 2Device)
470 { 470 {
471 » for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i<sz; i++) 471 » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
472 { 472 {
473 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i)) 473 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))
474 { 474 {
475 CPDF_Matrix mt = pChild->GetChildMatrix(); 475 CPDF_Matrix mt = pChild->GetChildMatrix();
476 if (mt.IsIdentity()) 476 if (mt.IsIdentity())
477 { 477 {
478 pChild->DrawAppearance(pDevice,pUser2Device); 478 pChild->DrawAppearance(pDevice,pUser2Device);
479 } 479 }
480 else 480 else
481 { 481 {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 } 517 }
518 } 518 }
519 519
520 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name)\ 520 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name)\
521 FX_BOOL CPWL_Wnd::key_method_name(FX_WORD nChar, FX_DWORD nFlag)\ 521 FX_BOOL CPWL_Wnd::key_method_name(FX_WORD nChar, FX_DWORD nFlag)\
522 {\ 522 {\
523 if (IsValid() && IsVisible() && IsEnabled())\ 523 if (IsValid() && IsVisible() && IsEnabled())\
524 {\ 524 {\
525 if (IsWndCaptureKeyboard(this))\ 525 if (IsWndCaptureKeyboard(this))\
526 {\ 526 {\
527 » » » for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i<sz; i++)\ 527 » » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)\
528 {\ 528 {\
529 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\ 529 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\
530 {\ 530 {\
531 if (IsWndCaptureKeyboard(pChild))\ 531 if (IsWndCaptureKeyboard(pChild))\
532 {\ 532 {\
533 return pChild->key_method_name(n Char,nFlag);\ 533 return pChild->key_method_name(n Char,nFlag);\
534 }\ 534 }\
535 }\ 535 }\
536 }\ 536 }\
537 }\ 537 }\
538 }\ 538 }\
539 return FALSE;\ 539 return FALSE;\
540 } 540 }
541 541
542 #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name)\ 542 #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name)\
543 FX_BOOL CPWL_Wnd::mouse_method_name(const CPDF_Point & point, FX_DWORD nFlag)\ 543 FX_BOOL CPWL_Wnd::mouse_method_name(const CPDF_Point & point, FX_DWORD nFlag)\
544 {\ 544 {\
545 if (IsValid() && IsVisible() && IsEnabled())\ 545 if (IsValid() && IsVisible() && IsEnabled())\
546 {\ 546 {\
547 if (IsWndCaptureMouse(this))\ 547 if (IsWndCaptureMouse(this))\
548 {\ 548 {\
549 » » » for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i<sz; i++)\ 549 » » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)\
550 {\ 550 {\
551 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\ 551 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\
552 {\ 552 {\
553 if (IsWndCaptureMouse(pChild))\ 553 if (IsWndCaptureMouse(pChild))\
554 {\ 554 {\
555 return pChild->mouse_method_name (pChild->ParentToChild(point),nFlag);\ 555 return pChild->mouse_method_name (pChild->ParentToChild(point),nFlag);\
556 }\ 556 }\
557 }\ 557 }\
558 }\ 558 }\
559 SetCursor();\ 559 SetCursor();\
560 }\ 560 }\
561 else\ 561 else\
562 {\ 562 {\
563 » » » for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i<sz; i++)\ 563 » » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)\
564 {\ 564 {\
565 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\ 565 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))\
566 {\ 566 {\
567 if (pChild->WndHitTest(pChild->ParentToC hild(point)))\ 567 if (pChild->WndHitTest(pChild->ParentToC hild(point)))\
568 {\ 568 {\
569 return pChild->mouse_method_name (pChild->ParentToChild(point),nFlag);\ 569 return pChild->mouse_method_name (pChild->ParentToChild(point),nFlag);\
570 }\ 570 }\
571 }\ 571 }\
572 }\ 572 }\
573 if (this->WndHitTest(point))\ 573 if (this->WndHitTest(point))\
(...skipping 18 matching lines...) Expand all
592 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp) 592 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp)
593 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) 593 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove)
594 594
595 FX_BOOL CPWL_Wnd::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag) 595 FX_BOOL CPWL_Wnd::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag)
596 { 596 {
597 if (IsValid() && IsVisible() && IsEnabled()) 597 if (IsValid() && IsVisible() && IsEnabled())
598 { 598 {
599 SetCursor(); 599 SetCursor();
600 if (IsWndCaptureKeyboard(this)) 600 if (IsWndCaptureKeyboard(this))
601 { 601 {
602 » » » for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i<sz; i++) 602 » » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
603 { 603 {
604 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i)) 604 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i))
605 { 605 {
606 if (IsWndCaptureKeyboard(pChild)) 606 if (IsWndCaptureKeyboard(pChild))
607 { 607 {
608 return pChild->OnMouseWheel(zDel ta,pChild->ParentToChild(point), nFlag); 608 return pChild->OnMouseWheel(zDel ta,pChild->ParentToChild(point), nFlag);
609 } 609 }
610 } 610 }
611 } 611 }
612 } 612 }
613 } 613 }
614 return FALSE; 614 return FALSE;
615 } 615 }
616 616
617 void CPWL_Wnd::AddChild(CPWL_Wnd * pWnd) 617 void CPWL_Wnd::AddChild(CPWL_Wnd * pWnd)
618 { 618 {
619 m_aChildren.Add(pWnd); 619 m_aChildren.Add(pWnd);
620 } 620 }
621 621
622 void CPWL_Wnd::RemoveChild(CPWL_Wnd * pWnd) 622 void CPWL_Wnd::RemoveChild(CPWL_Wnd * pWnd)
623 { 623 {
624 » for (FX_INT32 i = m_aChildren.GetSize()-1; i >= 0; i --) 624 » for (int32_t i = m_aChildren.GetSize()-1; i >= 0; i --)
625 { 625 {
626 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 626 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
627 { 627 {
628 if (pChild == pWnd) 628 if (pChild == pWnd)
629 { 629 {
630 m_aChildren.RemoveAt(i); 630 m_aChildren.RemoveAt(i);
631 break; 631 break;
632 } 632 }
633 } 633 }
634 } 634 }
635 } 635 }
636 636
637 void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX_INTPT R lParam) 637 void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t lParam)
638 { 638 {
639 switch (msg) 639 switch (msg)
640 { 640 {
641 case PNM_ADDCHILD: 641 case PNM_ADDCHILD:
642 this->AddChild(pWnd); 642 this->AddChild(pWnd);
643 break; 643 break;
644 case PNM_REMOVECHILD: 644 case PNM_REMOVECHILD:
645 this->RemoveChild(pWnd); 645 this->RemoveChild(pWnd);
646 break; 646 break;
647 default: 647 default:
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 CPWL_Color CPWL_Wnd::GetTextColor() const 746 CPWL_Color CPWL_Wnd::GetTextColor() const
747 { 747 {
748 return m_sPrivateParam.sTextColor; 748 return m_sPrivateParam.sTextColor;
749 } 749 }
750 750
751 CPWL_Color CPWL_Wnd::GetTextStrokeColor() const 751 CPWL_Color CPWL_Wnd::GetTextStrokeColor() const
752 { 752 {
753 return m_sPrivateParam.sTextStrokeColor; 753 return m_sPrivateParam.sTextStrokeColor;
754 } 754 }
755 755
756 FX_INT32 CPWL_Wnd::GetBorderStyle() const 756 int32_t CPWL_Wnd::GetBorderStyle() const
757 { 757 {
758 return m_sPrivateParam.nBorderStyle; 758 return m_sPrivateParam.nBorderStyle;
759 } 759 }
760 760
761 void CPWL_Wnd::SetBorderStyle(FX_INT32 nBorderStyle) 761 void CPWL_Wnd::SetBorderStyle(int32_t nBorderStyle)
762 { 762 {
763 if (HasFlag(PWS_BORDER)) 763 if (HasFlag(PWS_BORDER))
764 m_sPrivateParam.nBorderStyle = nBorderStyle; 764 m_sPrivateParam.nBorderStyle = nBorderStyle;
765 } 765 }
766 766
767 FX_INT32 CPWL_Wnd::GetBorderWidth() const 767 int32_t CPWL_Wnd::GetBorderWidth() const
768 { 768 {
769 if (HasFlag(PWS_BORDER)) 769 if (HasFlag(PWS_BORDER))
770 return m_sPrivateParam.dwBorderWidth; 770 return m_sPrivateParam.dwBorderWidth;
771 771
772 return 0; 772 return 0;
773 } 773 }
774 774
775 FX_INT32 CPWL_Wnd::GetInnerBorderWidth() const 775 int32_t CPWL_Wnd::GetInnerBorderWidth() const
776 { 776 {
777 /* 777 /*
778 switch (GetBorderStyle()) 778 switch (GetBorderStyle())
779 { 779 {
780 case PBS_BEVELED: 780 case PBS_BEVELED:
781 case PBS_INSET: 781 case PBS_INSET:
782 return GetBorderWidth() / 2; 782 return GetBorderWidth() / 2;
783 } 783 }
784 */ 784 */
785 return 0; 785 return 0;
786 } 786 }
787 787
788 void CPWL_Wnd::SetBorderWidth(FX_INT32 nBorderWidth) 788 void CPWL_Wnd::SetBorderWidth(int32_t nBorderWidth)
789 { 789 {
790 if (HasFlag(PWS_BORDER)) 790 if (HasFlag(PWS_BORDER))
791 m_sPrivateParam.dwBorderWidth = nBorderWidth; 791 m_sPrivateParam.dwBorderWidth = nBorderWidth;
792 } 792 }
793 793
794 CPWL_Color CPWL_Wnd::GetBorderColor() const 794 CPWL_Color CPWL_Wnd::GetBorderColor() const
795 { 795 {
796 if (HasFlag(PWS_BORDER)) 796 if (HasFlag(PWS_BORDER))
797 return m_sPrivateParam.sBorderColor; 797 return m_sPrivateParam.sBorderColor;
798 798
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 } 854 }
855 855
856 void CPWL_Wnd::SetCapture() 856 void CPWL_Wnd::SetCapture()
857 { 857 {
858 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) 858 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl())
859 pMsgCtrl->SetCapture(this); 859 pMsgCtrl->SetCapture(this);
860 } 860 }
861 861
862 void CPWL_Wnd::ReleaseCapture() 862 void CPWL_Wnd::ReleaseCapture()
863 { 863 {
864 » for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i<sz; i++) 864 » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
865 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 865 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
866 pChild->ReleaseCapture(); 866 pChild->ReleaseCapture();
867 867
868 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) 868 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl())
869 pMsgCtrl->ReleaseCapture(); 869 pMsgCtrl->ReleaseCapture();
870 } 870 }
871 871
872 void CPWL_Wnd::SetFocus() 872 void CPWL_Wnd::SetFocus()
873 { 873 {
874 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl()) 874 if (CPWL_MsgControl * pMsgCtrl = GetMsgControl())
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 if (m_sPrivateParam.pParentWnd) 911 if (m_sPrivateParam.pParentWnd)
912 return m_sPrivateParam.pParentWnd->GetRootWnd(); 912 return m_sPrivateParam.pParentWnd->GetRootWnd();
913 else 913 else
914 return this; 914 return this;
915 } 915 }
916 916
917 void CPWL_Wnd::SetVisible(FX_BOOL bVisible) 917 void CPWL_Wnd::SetVisible(FX_BOOL bVisible)
918 { 918 {
919 if (IsValid()) 919 if (IsValid())
920 { 920 {
921 » » for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i<sz; i++) 921 » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
922 { 922 {
923 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 923 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
924 { 924 {
925 pChild->SetVisible(bVisible); 925 pChild->SetVisible(bVisible);
926 } 926 }
927 } 927 }
928 928
929 if (bVisible != m_bVisible) 929 if (bVisible != m_bVisible)
930 { 930 {
931 m_bVisible = bVisible; 931 m_bVisible = bVisible;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM & cp) 968 void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM & cp)
969 { 969 {
970 } 970 }
971 971
972 void CPWL_Wnd::SetCursor() 972 void CPWL_Wnd::SetCursor()
973 { 973 {
974 if (IsValid()) 974 if (IsValid())
975 { 975 {
976 if (IFX_SystemHandler* pSH = GetSystemHandler()) 976 if (IFX_SystemHandler* pSH = GetSystemHandler())
977 { 977 {
978 » » » FX_INT32 nCursorType = this->GetCreationParam().eCursorT ype; 978 » » » int32_t nCursorType = this->GetCreationParam().eCursorTy pe;
979 pSH->SetCursor(nCursorType); 979 pSH->SetCursor(nCursorType);
980 } 980 }
981 } 981 }
982 } 982 }
983 983
984 void CPWL_Wnd::CreateMsgControl() 984 void CPWL_Wnd::CreateMsgControl()
985 { 985 {
986 if (!m_sPrivateParam.pMsgControl) 986 if (!m_sPrivateParam.pMsgControl)
987 m_sPrivateParam.pMsgControl = new CPWL_MsgControl(this); 987 m_sPrivateParam.pMsgControl = new CPWL_MsgControl(this);
988 } 988 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 IPWL_Provider* CPWL_Wnd::GetProvider() const 1056 IPWL_Provider* CPWL_Wnd::GetProvider() const
1057 { 1057 {
1058 return m_sPrivateParam.pProvider; 1058 return m_sPrivateParam.pProvider;
1059 } 1059 }
1060 1060
1061 IFX_Edit_FontMap* CPWL_Wnd::GetFontMap() const 1061 IFX_Edit_FontMap* CPWL_Wnd::GetFontMap() const
1062 { 1062 {
1063 return m_sPrivateParam.pFontMap; 1063 return m_sPrivateParam.pFontMap;
1064 } 1064 }
1065 1065
1066 CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(FX_INT32 nBorderStyle) const 1066 CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(int32_t nBorderStyle) const
1067 { 1067 {
1068 CPWL_Color color; 1068 CPWL_Color color;
1069 1069
1070 switch (nBorderStyle) 1070 switch (nBorderStyle)
1071 { 1071 {
1072 case PBS_SOLID: 1072 case PBS_SOLID:
1073 break; 1073 break;
1074 case PBS_DASH: 1074 case PBS_DASH:
1075 break; 1075 break;
1076 case PBS_BEVELED: 1076 case PBS_BEVELED:
1077 color = CPWL_Color(COLORTYPE_GRAY,1); 1077 color = CPWL_Color(COLORTYPE_GRAY,1);
1078 break; 1078 break;
1079 case PBS_INSET: 1079 case PBS_INSET:
1080 color = CPWL_Color(COLORTYPE_GRAY,0.5f); 1080 color = CPWL_Color(COLORTYPE_GRAY,0.5f);
1081 break; 1081 break;
1082 case PBS_UNDERLINED: 1082 case PBS_UNDERLINED:
1083 break; 1083 break;
1084 } 1084 }
1085 1085
1086 return color; 1086 return color;
1087 } 1087 }
1088 1088
1089 CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(FX_INT32 nBorderStyle) const 1089 CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(int32_t nBorderStyle) const
1090 { 1090 {
1091 CPWL_Color color; 1091 CPWL_Color color;
1092 1092
1093 switch (nBorderStyle) 1093 switch (nBorderStyle)
1094 { 1094 {
1095 case PBS_SOLID: 1095 case PBS_SOLID:
1096 break; 1096 break;
1097 case PBS_DASH: 1097 case PBS_DASH:
1098 break; 1098 break;
1099 case PBS_BEVELED: 1099 case PBS_BEVELED:
1100 color = CPWL_Utils::DevideColor(GetBackgroundColor(),2); 1100 color = CPWL_Utils::DevideColor(GetBackgroundColor(),2);
1101 break; 1101 break;
1102 case PBS_INSET: 1102 case PBS_INSET:
1103 color = CPWL_Color(COLORTYPE_GRAY,0.75f); 1103 color = CPWL_Color(COLORTYPE_GRAY,0.75f);
1104 break; 1104 break;
1105 case PBS_UNDERLINED: 1105 case PBS_UNDERLINED:
1106 break; 1106 break;
1107 } 1107 }
1108 1108
1109 return color; 1109 return color;
1110 } 1110 }
1111 1111
1112 /* ----------------------------------------------------------------- */ 1112 /* ----------------------------------------------------------------- */
1113 1113
1114 FX_INT32 CPWL_Wnd::GetTransparency() 1114 int32_t CPWL_Wnd::GetTransparency()
1115 { 1115 {
1116 return m_sPrivateParam.nTransparency; 1116 return m_sPrivateParam.nTransparency;
1117 } 1117 }
1118 1118
1119 void CPWL_Wnd::SetTransparency(FX_INT32 nTransparency) 1119 void CPWL_Wnd::SetTransparency(int32_t nTransparency)
1120 { 1120 {
1121 » for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i<sz; i++) 1121 » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
1122 { 1122 {
1123 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 1123 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
1124 { 1124 {
1125 pChild->SetTransparency(nTransparency); 1125 pChild->SetTransparency(nTransparency);
1126 } 1126 }
1127 } 1127 }
1128 1128
1129 m_sPrivateParam.nTransparency = nTransparency; 1129 m_sPrivateParam.nTransparency = nTransparency;
1130 } 1130 }
1131 1131
(...skipping 16 matching lines...) Expand all
1148 pDocView->GetCurrentMatrix(mtPageView); 1148 pDocView->GetCurrentMatrix(mtPageView);
1149 mt.Concat(mtPageView); 1149 mt.Concat(mtPageView);
1150 return mt; 1150 return mt;
1151 } 1151 }
1152 1152
1153 */ 1153 */
1154 1154
1155 return mt; 1155 return mt;
1156 } 1156 }
1157 1157
1158 void CPWL_Wnd::PWLtoWnd(const CPDF_Point& point, FX_INT32& x, FX_INT32& y) const 1158 void CPWL_Wnd::PWLtoWnd(const CPDF_Point& point, int32_t& x, int32_t& y) const
1159 { 1159 {
1160 CPDF_Matrix mt = GetWindowMatrix(); 1160 CPDF_Matrix mt = GetWindowMatrix();
1161 CPDF_Point pt = point; 1161 CPDF_Point pt = point;
1162 mt.Transform(pt.x,pt.y); 1162 mt.Transform(pt.x,pt.y);
1163 » x = (FX_INT32)(pt.x+0.5); 1163 » x = (int32_t)(pt.x+0.5);
1164 » y = (FX_INT32)(pt.y+0.5); 1164 » y = (int32_t)(pt.y+0.5);
1165 } 1165 }
1166 1166
1167 FX_RECT CPWL_Wnd::PWLtoWnd(const CPDF_Rect & rect) const 1167 FX_RECT CPWL_Wnd::PWLtoWnd(const CPDF_Rect & rect) const
1168 { 1168 {
1169 CPDF_Rect rcTemp = rect; 1169 CPDF_Rect rcTemp = rect;
1170 CPDF_Matrix mt = GetWindowMatrix(); 1170 CPDF_Matrix mt = GetWindowMatrix();
1171 mt.TransformRect(rcTemp); 1171 mt.TransformRect(rcTemp);
1172 » return FX_RECT((FX_INT32)(rcTemp.left+0.5), (FX_INT32)(rcTemp.bottom+0.5 ), (FX_INT32)(rcTemp.right+0.5), (FX_INT32)(rcTemp.top+0.5)); 1172 » return FX_RECT((int32_t)(rcTemp.left+0.5), (int32_t)(rcTemp.bottom+0.5), (int32_t)(rcTemp.right+0.5), (int32_t)(rcTemp.top+0.5));
1173 } 1173 }
1174 1174
1175 FX_HWND CPWL_Wnd::GetAttachedHWnd() const 1175 FX_HWND CPWL_Wnd::GetAttachedHWnd() const
1176 { 1176 {
1177 return m_sPrivateParam.hAttachedWnd; 1177 return m_sPrivateParam.hAttachedWnd;
1178 } 1178 }
1179 1179
1180 CPDF_Point CPWL_Wnd::ChildToParent(const CPDF_Point& point) const 1180 CPDF_Point CPWL_Wnd::ChildToParent(const CPDF_Point& point) const
1181 { 1181 {
1182 CPDF_Matrix mt = GetChildMatrix(); 1182 CPDF_Matrix mt = GetChildMatrix();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 return pMsgCtrl->m_pMainKeyboardWnd; 1268 return pMsgCtrl->m_pMainKeyboardWnd;
1269 } 1269 }
1270 1270
1271 return NULL; 1271 return NULL;
1272 } 1272 }
1273 1273
1274 void CPWL_Wnd::EnableWindow(FX_BOOL bEnable) 1274 void CPWL_Wnd::EnableWindow(FX_BOOL bEnable)
1275 { 1275 {
1276 if (m_bEnabled != bEnable) 1276 if (m_bEnabled != bEnable)
1277 { 1277 {
1278 » » for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i<sz; i++) 1278 » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++)
1279 { 1279 {
1280 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) 1280 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i))
1281 { 1281 {
1282 pChild->EnableWindow(bEnable); 1282 pChild->EnableWindow(bEnable);
1283 } 1283 }
1284 } 1284 }
1285 1285
1286 this->m_bEnabled = bEnable; 1286 this->m_bEnabled = bEnable;
1287 1287
1288 if (bEnable) 1288 if (bEnable)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 FX_BOOL CPWL_Wnd::IsINSERTpressed(FX_DWORD nFlag) const 1338 FX_BOOL CPWL_Wnd::IsINSERTpressed(FX_DWORD nFlag) const
1339 { 1339 {
1340 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) 1340 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler())
1341 { 1341 {
1342 return pSystemHandler->IsINSERTKeyDown(nFlag); 1342 return pSystemHandler->IsINSERTKeyDown(nFlag);
1343 } 1343 }
1344 1344
1345 return FALSE; 1345 return FALSE;
1346 } 1346 }
1347 1347
OLDNEW
« no previous file with comments | « fpdfsdk/src/pdfwindow/PWL_Utils.cpp ('k') | public/fpdf_edit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698