| 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/ifwl_form.h" | 7 #include "xfa/fwl/core/ifwl_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_evtclose.h" | 14 #include "xfa/fwl/core/cfwl_evtclose.h" |
| 14 #include "xfa/fwl/core/cfwl_msgmouse.h" | 15 #include "xfa/fwl/core/cfwl_msgmouse.h" |
| 15 #include "xfa/fwl/core/cfwl_notedriver.h" | 16 #include "xfa/fwl/core/cfwl_notedriver.h" |
| 16 #include "xfa/fwl/core/cfwl_noteloop.h" | 17 #include "xfa/fwl/core/cfwl_noteloop.h" |
| 17 #include "xfa/fwl/core/cfwl_sysbtn.h" | 18 #include "xfa/fwl/core/cfwl_sysbtn.h" |
| 18 #include "xfa/fwl/core/cfwl_themebackground.h" | 19 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 19 #include "xfa/fwl/core/cfwl_themepart.h" | 20 #include "xfa/fwl/core/cfwl_themepart.h" |
| 20 #include "xfa/fwl/core/cfwl_themetext.h" | 21 #include "xfa/fwl/core/cfwl_themetext.h" |
| 21 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 22 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
| 22 #include "xfa/fwl/core/ifwl_app.h" | |
| 23 #include "xfa/fwl/core/ifwl_formproxy.h" | 23 #include "xfa/fwl/core/ifwl_formproxy.h" |
| 24 #include "xfa/fwl/core/ifwl_themeprovider.h" | 24 #include "xfa/fwl/core/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 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 const uint8_t kCornerEnlarge = 10; | 37 const uint8_t kCornerEnlarge = 10; |
| 38 | 38 |
| 39 } // namespace | 39 } // namespace |
| 40 | 40 |
| 41 IFWL_Form::IFWL_Form(const IFWL_App* app, | 41 IFWL_Form::IFWL_Form(const CFWL_App* app, |
| 42 std::unique_ptr<CFWL_WidgetProperties> properties, | 42 std::unique_ptr<CFWL_WidgetProperties> properties, |
| 43 IFWL_Widget* pOuter) | 43 IFWL_Widget* pOuter) |
| 44 : IFWL_Widget(app, std::move(properties), pOuter), | 44 : IFWL_Widget(app, std::move(properties), pOuter), |
| 45 #if (_FX_OS_ == _FX_MACOSX_) | 45 #if (_FX_OS_ == _FX_MACOSX_) |
| 46 m_bMouseIn(false), | 46 m_bMouseIn(false), |
| 47 #endif | 47 #endif |
| 48 m_pCloseBox(nullptr), | 48 m_pCloseBox(nullptr), |
| 49 m_pMinBox(nullptr), | 49 m_pMinBox(nullptr), |
| 50 m_pMaxBox(nullptr), | 50 m_pMaxBox(nullptr), |
| 51 m_pSubFocus(nullptr), | 51 m_pSubFocus(nullptr), |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 param.m_iPart = CFWL_Part::MinimizeBox; | 261 param.m_iPart = CFWL_Part::MinimizeBox; |
| 262 param.m_dwStates = m_pMinBox->GetPartState(); | 262 param.m_dwStates = m_pMinBox->GetPartState(); |
| 263 param.m_rtPart = m_pMinBox->m_rtBtn; | 263 param.m_rtPart = m_pMinBox->m_rtBtn; |
| 264 pTheme->DrawBackground(¶m); | 264 pTheme->DrawBackground(¶m); |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 #endif | 267 #endif |
| 268 } | 268 } |
| 269 | 269 |
| 270 IFWL_Widget* IFWL_Form::DoModal() { | 270 IFWL_Widget* IFWL_Form::DoModal() { |
| 271 const IFWL_App* pApp = GetOwnerApp(); | 271 const CFWL_App* pApp = GetOwnerApp(); |
| 272 if (!pApp) | 272 if (!pApp) |
| 273 return nullptr; | 273 return nullptr; |
| 274 | 274 |
| 275 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); | 275 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); |
| 276 if (!pDriver) | 276 if (!pDriver) |
| 277 return nullptr; | 277 return nullptr; |
| 278 | 278 |
| 279 m_pNoteLoop = pdfium::MakeUnique<CFWL_NoteLoop>(); | 279 m_pNoteLoop = pdfium::MakeUnique<CFWL_NoteLoop>(); |
| 280 m_pNoteLoop->SetMainForm(this); | 280 m_pNoteLoop->SetMainForm(this); |
| 281 | 281 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 293 } | 293 } |
| 294 | 294 |
| 295 void IFWL_Form::EndDoModal() { | 295 void IFWL_Form::EndDoModal() { |
| 296 if (!m_pNoteLoop) | 296 if (!m_pNoteLoop) |
| 297 return; | 297 return; |
| 298 | 298 |
| 299 m_bDoModalFlag = false; | 299 m_bDoModalFlag = false; |
| 300 | 300 |
| 301 #if (_FX_OS_ == _FX_MACOSX_) | 301 #if (_FX_OS_ == _FX_MACOSX_) |
| 302 m_pNoteLoop->EndModalLoop(); | 302 m_pNoteLoop->EndModalLoop(); |
| 303 const IFWL_App* pApp = GetOwnerApp(); | 303 const CFWL_App* pApp = GetOwnerApp(); |
| 304 if (!pApp) | 304 if (!pApp) |
| 305 return; | 305 return; |
| 306 | 306 |
| 307 CFWL_NoteDriver* pDriver = | 307 CFWL_NoteDriver* pDriver = |
| 308 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 308 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
| 309 if (!pDriver) | 309 if (!pDriver) |
| 310 return; | 310 return; |
| 311 | 311 |
| 312 pDriver->PopNoteLoop(); | 312 pDriver->PopNoteLoop(); |
| 313 SetStates(FWL_WGTSTATE_Invisible, true); | 313 SetStates(FWL_WGTSTATE_Invisible, true); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 } else { | 450 } else { |
| 451 m_pMinBox->m_rtBtn.Set( | 451 m_pMinBox->m_rtBtn.Set( |
| 452 m_rtRelative.right() - kSystemButtonMargin - kSystemButtonSize, | 452 m_rtRelative.right() - kSystemButtonMargin - kSystemButtonSize, |
| 453 kSystemButtonMargin, kSystemButtonSize, kSystemButtonSize); | 453 kSystemButtonMargin, kSystemButtonSize, kSystemButtonSize); |
| 454 } | 454 } |
| 455 m_iSysBox++; | 455 m_iSysBox++; |
| 456 } | 456 } |
| 457 } | 457 } |
| 458 | 458 |
| 459 void IFWL_Form::RegisterForm() { | 459 void IFWL_Form::RegisterForm() { |
| 460 const IFWL_App* pApp = GetOwnerApp(); | 460 const CFWL_App* pApp = GetOwnerApp(); |
| 461 if (!pApp) | 461 if (!pApp) |
| 462 return; | 462 return; |
| 463 | 463 |
| 464 CFWL_NoteDriver* pDriver = | 464 CFWL_NoteDriver* pDriver = |
| 465 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 465 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
| 466 if (!pDriver) | 466 if (!pDriver) |
| 467 return; | 467 return; |
| 468 | 468 |
| 469 pDriver->RegisterForm(this); | 469 pDriver->RegisterForm(this); |
| 470 } | 470 } |
| 471 | 471 |
| 472 void IFWL_Form::UnRegisterForm() { | 472 void IFWL_Form::UnRegisterForm() { |
| 473 const IFWL_App* pApp = GetOwnerApp(); | 473 const CFWL_App* pApp = GetOwnerApp(); |
| 474 if (!pApp) | 474 if (!pApp) |
| 475 return; | 475 return; |
| 476 | 476 |
| 477 CFWL_NoteDriver* pDriver = | 477 CFWL_NoteDriver* pDriver = |
| 478 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 478 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
| 479 if (!pDriver) | 479 if (!pDriver) |
| 480 return; | 480 return; |
| 481 | 481 |
| 482 pDriver->UnRegisterForm(this); | 482 pDriver->UnRegisterForm(this); |
| 483 } | 483 } |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 HitTest(pMsg->m_fx, pMsg->m_fy) == FWL_WidgetHit::Titlebar) { | 630 HitTest(pMsg->m_fx, pMsg->m_fy) == FWL_WidgetHit::Titlebar) { |
| 631 if (m_bMaximized) | 631 if (m_bMaximized) |
| 632 SetWidgetRect(m_rtRestore); | 632 SetWidgetRect(m_rtRestore); |
| 633 else | 633 else |
| 634 SetWorkAreaRect(); | 634 SetWorkAreaRect(); |
| 635 | 635 |
| 636 Update(); | 636 Update(); |
| 637 m_bMaximized = !m_bMaximized; | 637 m_bMaximized = !m_bMaximized; |
| 638 } | 638 } |
| 639 } | 639 } |
| OLD | NEW |