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 "xfa/fwl/core/cfwl_form.h" | 7 #include "xfa/fwl/core/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/core/cfwl_app.h" |
14 #include "xfa/fwl/core/cfwl_evtclose.h" | 14 #include "xfa/fwl/core/cfwl_event.h" |
15 #include "xfa/fwl/core/cfwl_formproxy.h" | 15 #include "xfa/fwl/core/cfwl_formproxy.h" |
16 #include "xfa/fwl/core/cfwl_msgmouse.h" | 16 #include "xfa/fwl/core/cfwl_msgmouse.h" |
17 #include "xfa/fwl/core/cfwl_notedriver.h" | 17 #include "xfa/fwl/core/cfwl_notedriver.h" |
18 #include "xfa/fwl/core/cfwl_noteloop.h" | 18 #include "xfa/fwl/core/cfwl_noteloop.h" |
19 #include "xfa/fwl/core/cfwl_sysbtn.h" | 19 #include "xfa/fwl/core/cfwl_sysbtn.h" |
20 #include "xfa/fwl/core/cfwl_themebackground.h" | 20 #include "xfa/fwl/core/cfwl_themebackground.h" |
21 #include "xfa/fwl/core/cfwl_themepart.h" | 21 #include "xfa/fwl/core/cfwl_themepart.h" |
22 #include "xfa/fwl/core/cfwl_themetext.h" | 22 #include "xfa/fwl/core/cfwl_themetext.h" |
23 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 23 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
24 #include "xfa/fwl/core/ifwl_themeprovider.h" | 24 #include "xfa/fwl/core/ifwl_themeprovider.h" |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 return; | 480 return; |
481 | 481 |
482 pDriver->UnRegisterForm(this); | 482 pDriver->UnRegisterForm(this); |
483 } | 483 } |
484 | 484 |
485 void CFWL_Form::OnProcessMessage(CFWL_Message* pMessage) { | 485 void CFWL_Form::OnProcessMessage(CFWL_Message* pMessage) { |
486 #ifndef FWL_UseMacSystemBorder | 486 #ifndef FWL_UseMacSystemBorder |
487 if (!pMessage) | 487 if (!pMessage) |
488 return; | 488 return; |
489 | 489 |
490 switch (pMessage->GetClassID()) { | 490 switch (pMessage->GetType()) { |
491 case CFWL_MessageType::Mouse: { | 491 case CFWL_Message::Type::Mouse: { |
492 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 492 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
493 switch (pMsg->m_dwCmd) { | 493 switch (pMsg->m_dwCmd) { |
494 case FWL_MouseCommand::LeftButtonDown: | 494 case FWL_MouseCommand::LeftButtonDown: |
495 OnLButtonDown(pMsg); | 495 OnLButtonDown(pMsg); |
496 break; | 496 break; |
497 case FWL_MouseCommand::LeftButtonUp: | 497 case FWL_MouseCommand::LeftButtonUp: |
498 OnLButtonUp(pMsg); | 498 OnLButtonUp(pMsg); |
499 break; | 499 break; |
500 case FWL_MouseCommand::Move: | 500 case FWL_MouseCommand::Move: |
501 OnMouseMove(pMsg); | 501 OnMouseMove(pMsg); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 if (m_bMaximized) { | 549 if (m_bMaximized) { |
550 SetWidgetRect(m_rtRestore); | 550 SetWidgetRect(m_rtRestore); |
551 Update(); | 551 Update(); |
552 Repaint(); | 552 Repaint(); |
553 } else { | 553 } else { |
554 SetWorkAreaRect(); | 554 SetWorkAreaRect(); |
555 Update(); | 555 Update(); |
556 } | 556 } |
557 m_bMaximized = !m_bMaximized; | 557 m_bMaximized = !m_bMaximized; |
558 } else if (pPressedBtn != m_pMinBox) { | 558 } else if (pPressedBtn != m_pMinBox) { |
559 CFWL_EvtClose eClose; | 559 CFWL_Event eClose(CFWL_Event::Type::Close, this); |
560 eClose.m_pSrcTarget = this; | |
561 DispatchEvent(&eClose); | 560 DispatchEvent(&eClose); |
562 } | 561 } |
563 } | 562 } |
564 | 563 |
565 void CFWL_Form::OnMouseMove(CFWL_MsgMouse* pMsg) { | 564 void CFWL_Form::OnMouseMove(CFWL_MsgMouse* pMsg) { |
566 if (m_bLButtonDown) | 565 if (m_bLButtonDown) |
567 return; | 566 return; |
568 | 567 |
569 CFX_RectF rtInvalidate; | 568 CFX_RectF rtInvalidate; |
570 rtInvalidate.Reset(); | 569 rtInvalidate.Reset(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 HitTest(pMsg->m_fx, pMsg->m_fy) == FWL_WidgetHit::Titlebar) { | 629 HitTest(pMsg->m_fx, pMsg->m_fy) == FWL_WidgetHit::Titlebar) { |
631 if (m_bMaximized) | 630 if (m_bMaximized) |
632 SetWidgetRect(m_rtRestore); | 631 SetWidgetRect(m_rtRestore); |
633 else | 632 else |
634 SetWorkAreaRect(); | 633 SetWorkAreaRect(); |
635 | 634 |
636 Update(); | 635 Update(); |
637 m_bMaximized = !m_bMaximized; | 636 m_bMaximized = !m_bMaximized; |
638 } | 637 } |
639 } | 638 } |
OLD | NEW |