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

Side by Side Diff: xfa/fwl/core/ifwl_datetimepicker.cpp

Issue 2491443003: Fold IFWL_DateTimeCalendar into IFWL_MonthCalendar (Closed)
Patch Set: Rebase to master Created 4 years, 1 month 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/core/ifwl_datetimepicker.h ('k') | xfa/fwl/core/ifwl_monthcalendar.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/ifwl_datetimepicker.h" 7 #include "xfa/fwl/core/ifwl_datetimepicker.h"
8 8
9 #include "third_party/base/ptr_util.h" 9 #include "third_party/base/ptr_util.h"
10 #include "xfa/fwl/core/cfwl_message.h" 10 #include "xfa/fwl/core/cfwl_message.h"
11 #include "xfa/fwl/core/cfwl_themebackground.h" 11 #include "xfa/fwl/core/cfwl_themebackground.h"
12 #include "xfa/fwl/core/cfwl_widgetmgr.h" 12 #include "xfa/fwl/core/cfwl_widgetmgr.h"
13 #include "xfa/fwl/core/fwl_noteimp.h" 13 #include "xfa/fwl/core/fwl_noteimp.h"
14 #include "xfa/fwl/core/ifwl_datetimecalendar.h"
15 #include "xfa/fwl/core/ifwl_datetimeedit.h" 14 #include "xfa/fwl/core/ifwl_datetimeedit.h"
16 #include "xfa/fwl/core/ifwl_formproxy.h" 15 #include "xfa/fwl/core/ifwl_formproxy.h"
17 #include "xfa/fwl/core/ifwl_spinbutton.h" 16 #include "xfa/fwl/core/ifwl_spinbutton.h"
18 #include "xfa/fwl/core/ifwl_themeprovider.h" 17 #include "xfa/fwl/core/ifwl_themeprovider.h"
19 18
20 namespace { 19 namespace {
21 20
22 const int kDateTimePickerWidth = 100; 21 const int kDateTimePickerWidth = 100;
23 const int kDateTimePickerHeight = 20; 22 const int kDateTimePickerHeight = 20;
24 23
(...skipping 14 matching lines...) Expand all
39 m_rtBtn.Set(0, 0, 0, 0); 38 m_rtBtn.Set(0, 0, 0, 0);
40 39
41 m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; 40 m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat;
42 41
43 auto monthProp = pdfium::MakeUnique<CFWL_WidgetProperties>(this); 42 auto monthProp = pdfium::MakeUnique<CFWL_WidgetProperties>(this);
44 monthProp->m_dwStyles = FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border; 43 monthProp->m_dwStyles = FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border;
45 monthProp->m_dwStates = FWL_WGTSTATE_Invisible; 44 monthProp->m_dwStates = FWL_WGTSTATE_Invisible;
46 monthProp->m_pParent = this; 45 monthProp->m_pParent = this;
47 monthProp->m_pThemeProvider = m_pProperties->m_pThemeProvider; 46 monthProp->m_pThemeProvider = m_pProperties->m_pThemeProvider;
48 m_pMonthCal.reset( 47 m_pMonthCal.reset(
49 new IFWL_DateTimeCalendar(m_pOwnerApp, std::move(monthProp), this)); 48 new IFWL_MonthCalendar(m_pOwnerApp, std::move(monthProp), this));
50 49
51 CFX_RectF rtMonthCal; 50 CFX_RectF rtMonthCal;
52 m_pMonthCal->GetWidgetRect(rtMonthCal, true); 51 m_pMonthCal->GetWidgetRect(rtMonthCal, true);
53 rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height); 52 rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height);
54 m_pMonthCal->SetWidgetRect(rtMonthCal); 53 m_pMonthCal->SetWidgetRect(rtMonthCal);
55 54
56 auto editProp = pdfium::MakeUnique<CFWL_WidgetProperties>(); 55 auto editProp = pdfium::MakeUnique<CFWL_WidgetProperties>();
57 editProp->m_pParent = this; 56 editProp->m_pParent = this;
58 editProp->m_pThemeProvider = m_pProperties->m_pThemeProvider; 57 editProp->m_pThemeProvider = m_pProperties->m_pThemeProvider;
59 58
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 new IFWL_FormProxy(m_pOwnerApp, std::move(prop), m_pMonthCal.get())); 446 new IFWL_FormProxy(m_pOwnerApp, std::move(prop), m_pMonthCal.get()));
448 m_pMonthCal->SetParent(m_pForm.get()); 447 m_pMonthCal->SetParent(m_pForm.get());
449 } 448 }
450 449
451 IFWL_DateTimeEdit* IFWL_DateTimePicker::GetDataTimeEdit() { 450 IFWL_DateTimeEdit* IFWL_DateTimePicker::GetDataTimeEdit() {
452 return m_pEdit.get(); 451 return m_pEdit.get();
453 } 452 }
454 453
455 FWL_Error IFWL_DateTimePicker::DisForm_Initialize() { 454 FWL_Error IFWL_DateTimePicker::DisForm_Initialize() {
456 m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; 455 m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat;
457 DisForm_InitDateTimeCalendar(); 456 DisForm_InitMonthCalendar();
458 DisForm_InitDateTimeEdit(); 457 DisForm_InitDateTimeEdit();
459 RegisterEventTarget(m_pMonthCal.get()); 458 RegisterEventTarget(m_pMonthCal.get());
460 RegisterEventTarget(m_pEdit.get()); 459 RegisterEventTarget(m_pEdit.get());
461 return FWL_Error::Succeeded; 460 return FWL_Error::Succeeded;
462 } 461 }
463 462
464 void IFWL_DateTimePicker::DisForm_InitDateTimeCalendar() { 463 void IFWL_DateTimePicker::DisForm_InitMonthCalendar() {
465 if (m_pMonthCal) 464 if (m_pMonthCal)
466 return; 465 return;
467 466
468 auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>(this); 467 auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>(this);
469 prop->m_dwStyles = 468 prop->m_dwStyles =
470 FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border | FWL_WGTSTYLE_EdgeSunken; 469 FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border | FWL_WGTSTYLE_EdgeSunken;
471 prop->m_dwStates = FWL_WGTSTATE_Invisible; 470 prop->m_dwStates = FWL_WGTSTATE_Invisible;
472 prop->m_pParent = this; 471 prop->m_pParent = this;
473 prop->m_pThemeProvider = m_pProperties->m_pThemeProvider; 472 prop->m_pThemeProvider = m_pProperties->m_pThemeProvider;
474 473
475 m_pMonthCal.reset( 474 m_pMonthCal.reset(new IFWL_MonthCalendar(m_pOwnerApp, std::move(prop), this));
476 new IFWL_DateTimeCalendar(m_pOwnerApp, std::move(prop), this));
477 CFX_RectF rtMonthCal; 475 CFX_RectF rtMonthCal;
478 m_pMonthCal->GetWidgetRect(rtMonthCal, true); 476 m_pMonthCal->GetWidgetRect(rtMonthCal, true);
479 rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height); 477 rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height);
480 m_pMonthCal->SetWidgetRect(rtMonthCal); 478 m_pMonthCal->SetWidgetRect(rtMonthCal);
481 } 479 }
482 480
483 void IFWL_DateTimePicker::DisForm_InitDateTimeEdit() { 481 void IFWL_DateTimePicker::DisForm_InitDateTimeEdit() {
484 if (m_pEdit) 482 if (m_pEdit)
485 return; 483 return;
486 484
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 return m_iCurDay; 793 return m_iCurDay;
796 } 794 }
797 795
798 int32_t IFWL_DateTimePicker::GetCurMonth(IFWL_Widget* pWidget) { 796 int32_t IFWL_DateTimePicker::GetCurMonth(IFWL_Widget* pWidget) {
799 return m_iCurMonth; 797 return m_iCurMonth;
800 } 798 }
801 799
802 int32_t IFWL_DateTimePicker::GetCurYear(IFWL_Widget* pWidget) { 800 int32_t IFWL_DateTimePicker::GetCurYear(IFWL_Widget* pWidget) {
803 return m_iCurYear; 801 return m_iCurYear;
804 } 802 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_datetimepicker.h ('k') | xfa/fwl/core/ifwl_monthcalendar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698