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

Side by Side Diff: xfa/fwl/cfwl_form.cpp

Issue 2559173002: Move xfa/fwl/core to xfa/fwl. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/cfwl_form.h ('k') | xfa/fwl/cfwl_formproxy.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 "xfa/fwl/core/cfwl_form.h" 7 #include "xfa/fwl/cfwl_form.h"
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "third_party/base/ptr_util.h" 11 #include "third_party/base/ptr_util.h"
12 #include "xfa/fde/tto/fde_textout.h" 12 #include "xfa/fde/tto/fde_textout.h"
13 #include "xfa/fwl/core/cfwl_app.h" 13 #include "xfa/fwl/cfwl_app.h"
14 #include "xfa/fwl/core/cfwl_event.h" 14 #include "xfa/fwl/cfwl_event.h"
15 #include "xfa/fwl/core/cfwl_formproxy.h" 15 #include "xfa/fwl/cfwl_formproxy.h"
16 #include "xfa/fwl/core/cfwl_msgmouse.h" 16 #include "xfa/fwl/cfwl_messagemouse.h"
17 #include "xfa/fwl/core/cfwl_notedriver.h" 17 #include "xfa/fwl/cfwl_notedriver.h"
18 #include "xfa/fwl/core/cfwl_noteloop.h" 18 #include "xfa/fwl/cfwl_noteloop.h"
19 #include "xfa/fwl/core/cfwl_sysbtn.h" 19 #include "xfa/fwl/cfwl_sysbtn.h"
20 #include "xfa/fwl/core/cfwl_themebackground.h" 20 #include "xfa/fwl/cfwl_themebackground.h"
21 #include "xfa/fwl/core/cfwl_themepart.h" 21 #include "xfa/fwl/cfwl_themepart.h"
22 #include "xfa/fwl/core/cfwl_themetext.h" 22 #include "xfa/fwl/cfwl_themetext.h"
23 #include "xfa/fwl/core/cfwl_widgetmgr.h" 23 #include "xfa/fwl/cfwl_widgetmgr.h"
24 #include "xfa/fwl/core/ifwl_themeprovider.h" 24 #include "xfa/fwl/ifwl_themeprovider.h"
25 #include "xfa/fwl/theme/cfwl_widgettp.h" 25 #include "xfa/fwl/theme/cfwl_widgettp.h"
26 26
27 namespace { 27 namespace {
28 28
29 const int kSystemButtonSize = 21; 29 const int kSystemButtonSize = 21;
30 const int kSystemButtonMargin = 5; 30 const int kSystemButtonMargin = 5;
31 const int kSystemButtonSpan = 2; 31 const int kSystemButtonSpan = 2;
32 32
33 } // namespace 33 } // namespace
34 34
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 pDriver->UnRegisterForm(this); 468 pDriver->UnRegisterForm(this);
469 } 469 }
470 470
471 void CFWL_Form::OnProcessMessage(CFWL_Message* pMessage) { 471 void CFWL_Form::OnProcessMessage(CFWL_Message* pMessage) {
472 #ifndef FWL_UseMacSystemBorder 472 #ifndef FWL_UseMacSystemBorder
473 if (!pMessage) 473 if (!pMessage)
474 return; 474 return;
475 475
476 switch (pMessage->GetType()) { 476 switch (pMessage->GetType()) {
477 case CFWL_Message::Type::Mouse: { 477 case CFWL_Message::Type::Mouse: {
478 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 478 CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
479 switch (pMsg->m_dwCmd) { 479 switch (pMsg->m_dwCmd) {
480 case FWL_MouseCommand::LeftButtonDown: 480 case FWL_MouseCommand::LeftButtonDown:
481 OnLButtonDown(pMsg); 481 OnLButtonDown(pMsg);
482 break; 482 break;
483 case FWL_MouseCommand::LeftButtonUp: 483 case FWL_MouseCommand::LeftButtonUp:
484 OnLButtonUp(pMsg); 484 OnLButtonUp(pMsg);
485 break; 485 break;
486 case FWL_MouseCommand::Move: 486 case FWL_MouseCommand::Move:
487 OnMouseMove(pMsg); 487 OnMouseMove(pMsg);
488 break; 488 break;
(...skipping 12 matching lines...) Expand all
501 break; 501 break;
502 } 502 }
503 #endif // FWL_UseMacSystemBorder 503 #endif // FWL_UseMacSystemBorder
504 } 504 }
505 505
506 void CFWL_Form::OnDrawWidget(CFX_Graphics* pGraphics, 506 void CFWL_Form::OnDrawWidget(CFX_Graphics* pGraphics,
507 const CFX_Matrix* pMatrix) { 507 const CFX_Matrix* pMatrix) {
508 DrawWidget(pGraphics, pMatrix); 508 DrawWidget(pGraphics, pMatrix);
509 } 509 }
510 510
511 void CFWL_Form::OnLButtonDown(CFWL_MsgMouse* pMsg) { 511 void CFWL_Form::OnLButtonDown(CFWL_MessageMouse* pMsg) {
512 SetGrab(true); 512 SetGrab(true);
513 m_bLButtonDown = true; 513 m_bLButtonDown = true;
514 514
515 CFWL_SysBtn* pPressBtn = GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy); 515 CFWL_SysBtn* pPressBtn = GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy);
516 m_iCaptureBtn = GetSysBtnIndex(pPressBtn); 516 m_iCaptureBtn = GetSysBtnIndex(pPressBtn);
517 517
518 if (!pPressBtn) 518 if (!pPressBtn)
519 return; 519 return;
520 520
521 pPressBtn->SetPressed(); 521 pPressBtn->SetPressed();
522 Repaint(&pPressBtn->m_rtBtn); 522 Repaint(&pPressBtn->m_rtBtn);
523 } 523 }
524 524
525 void CFWL_Form::OnLButtonUp(CFWL_MsgMouse* pMsg) { 525 void CFWL_Form::OnLButtonUp(CFWL_MessageMouse* pMsg) {
526 SetGrab(false); 526 SetGrab(false);
527 m_bLButtonDown = false; 527 m_bLButtonDown = false;
528 CFWL_SysBtn* pPointBtn = GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy); 528 CFWL_SysBtn* pPointBtn = GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy);
529 CFWL_SysBtn* pPressedBtn = GetSysBtnByIndex(m_iCaptureBtn); 529 CFWL_SysBtn* pPressedBtn = GetSysBtnByIndex(m_iCaptureBtn);
530 if (!pPressedBtn || pPointBtn != pPressedBtn) 530 if (!pPressedBtn || pPointBtn != pPressedBtn)
531 return; 531 return;
532 if (pPressedBtn == GetSysBtnByState(FWL_SYSBUTTONSTATE_Pressed)) 532 if (pPressedBtn == GetSysBtnByState(FWL_SYSBUTTONSTATE_Pressed))
533 pPressedBtn->SetNormal(); 533 pPressedBtn->SetNormal();
534 if (pPressedBtn == m_pMaxBox) { 534 if (pPressedBtn == m_pMaxBox) {
535 if (m_bMaximized) { 535 if (m_bMaximized) {
536 SetWidgetRect(m_rtRestore); 536 SetWidgetRect(m_rtRestore);
537 Update(); 537 Update();
538 Repaint(nullptr); 538 Repaint(nullptr);
539 } else { 539 } else {
540 SetWorkAreaRect(); 540 SetWorkAreaRect();
541 Update(); 541 Update();
542 } 542 }
543 m_bMaximized = !m_bMaximized; 543 m_bMaximized = !m_bMaximized;
544 } else if (pPressedBtn != m_pMinBox) { 544 } else if (pPressedBtn != m_pMinBox) {
545 CFWL_Event eClose(CFWL_Event::Type::Close, this); 545 CFWL_Event eClose(CFWL_Event::Type::Close, this);
546 DispatchEvent(&eClose); 546 DispatchEvent(&eClose);
547 } 547 }
548 } 548 }
549 549
550 void CFWL_Form::OnMouseMove(CFWL_MsgMouse* pMsg) { 550 void CFWL_Form::OnMouseMove(CFWL_MessageMouse* pMsg) {
551 if (m_bLButtonDown) 551 if (m_bLButtonDown)
552 return; 552 return;
553 553
554 CFX_RectF rtInvalidate; 554 CFX_RectF rtInvalidate;
555 rtInvalidate.Reset(); 555 rtInvalidate.Reset();
556 CFWL_SysBtn* pPointBtn = GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy); 556 CFWL_SysBtn* pPointBtn = GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy);
557 CFWL_SysBtn* pOldHover = GetSysBtnByState(FWL_SYSBUTTONSTATE_Hover); 557 CFWL_SysBtn* pOldHover = GetSysBtnByState(FWL_SYSBUTTONSTATE_Hover);
558 558
559 #if _FX_OS_ == _FX_MACOSX_ 559 #if _FX_OS_ == _FX_MACOSX_
560 { 560 {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 else 594 else
595 rtInvalidate.Union(pPointBtn->m_rtBtn); 595 rtInvalidate.Union(pPointBtn->m_rtBtn);
596 } 596 }
597 } 597 }
598 #endif 598 #endif
599 599
600 if (!rtInvalidate.IsEmpty()) 600 if (!rtInvalidate.IsEmpty())
601 Repaint(&rtInvalidate); 601 Repaint(&rtInvalidate);
602 } 602 }
603 603
604 void CFWL_Form::OnMouseLeave(CFWL_MsgMouse* pMsg) { 604 void CFWL_Form::OnMouseLeave(CFWL_MessageMouse* pMsg) {
605 CFWL_SysBtn* pHover = GetSysBtnByState(FWL_SYSBUTTONSTATE_Hover); 605 CFWL_SysBtn* pHover = GetSysBtnByState(FWL_SYSBUTTONSTATE_Hover);
606 if (!pHover) 606 if (!pHover)
607 return; 607 return;
608 608
609 pHover->SetNormal(); 609 pHover->SetNormal();
610 Repaint(&pHover->m_rtBtn); 610 Repaint(&pHover->m_rtBtn);
611 } 611 }
612 612
613 void CFWL_Form::OnLButtonDblClk(CFWL_MsgMouse* pMsg) { 613 void CFWL_Form::OnLButtonDblClk(CFWL_MessageMouse* pMsg) {
614 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_Resize) && 614 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_Resize) &&
615 HitTest(pMsg->m_fx, pMsg->m_fy) == FWL_WidgetHit::Titlebar) { 615 HitTest(pMsg->m_fx, pMsg->m_fy) == FWL_WidgetHit::Titlebar) {
616 if (m_bMaximized) 616 if (m_bMaximized)
617 SetWidgetRect(m_rtRestore); 617 SetWidgetRect(m_rtRestore);
618 else 618 else
619 SetWorkAreaRect(); 619 SetWorkAreaRect();
620 620
621 Update(); 621 Update();
622 m_bMaximized = !m_bMaximized; 622 m_bMaximized = !m_bMaximized;
623 } 623 }
624 } 624 }
OLDNEW
« no previous file with comments | « xfa/fwl/cfwl_form.h ('k') | xfa/fwl/cfwl_formproxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698