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

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

Issue 2556873004: Convert GetWidgetRect to return rect. (Closed)
Patch Set: Review feedback 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/core/cfwl_datetimepicker.h ('k') | xfa/fwl/core/cfwl_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 "xfa/fwl/core/cfwl_datetimepicker.h" 7 #include "xfa/fwl/core/cfwl_datetimepicker.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 11
12 #include "third_party/base/ptr_util.h" 12 #include "third_party/base/ptr_util.h"
13 #include "xfa/fwl/core/cfwl_event.h" 13 #include "xfa/fwl/core/cfwl_event.h"
14 #include "xfa/fwl/core/cfwl_evtselectchanged.h" 14 #include "xfa/fwl/core/cfwl_evtselectchanged.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_msgsetfocus.h" 17 #include "xfa/fwl/core/cfwl_msgsetfocus.h"
18 #include "xfa/fwl/core/cfwl_notedriver.h" 18 #include "xfa/fwl/core/cfwl_notedriver.h"
19 #include "xfa/fwl/core/cfwl_spinbutton.h" 19 #include "xfa/fwl/core/cfwl_spinbutton.h"
20 #include "xfa/fwl/core/cfwl_themebackground.h" 20 #include "xfa/fwl/core/cfwl_themebackground.h"
21 #include "xfa/fwl/core/cfwl_widgetmgr.h" 21 #include "xfa/fwl/core/cfwl_widgetmgr.h"
22 #include "xfa/fwl/core/ifwl_themeprovider.h" 22 #include "xfa/fwl/core/ifwl_themeprovider.h"
23 23
24 namespace { 24 namespace {
25 25
26 const int kDateTimePickerWidth = 100;
27 const int kDateTimePickerHeight = 20; 26 const int kDateTimePickerHeight = 20;
28 27
29 } // namespace 28 } // namespace
30 CFWL_DateTimePicker::CFWL_DateTimePicker(const CFWL_App* app) 29 CFWL_DateTimePicker::CFWL_DateTimePicker(const CFWL_App* app)
31 : CFWL_Widget(app, pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr), 30 : CFWL_Widget(app, pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr),
32 m_iBtnState(1), 31 m_iBtnState(1),
33 m_iYear(-1), 32 m_iYear(-1),
34 m_iMonth(-1), 33 m_iMonth(-1),
35 m_iDay(-1), 34 m_iDay(-1),
36 m_bLBtnDown(false) { 35 m_bLBtnDown(false) {
37 m_rtBtn.Set(0, 0, 0, 0); 36 m_rtBtn.Set(0, 0, 0, 0);
38 37
39 m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; 38 m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat;
40 39
41 auto monthProp = pdfium::MakeUnique<CFWL_WidgetProperties>(); 40 auto monthProp = pdfium::MakeUnique<CFWL_WidgetProperties>();
42 monthProp->m_dwStyles = FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border; 41 monthProp->m_dwStyles = FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border;
43 monthProp->m_dwStates = FWL_WGTSTATE_Invisible; 42 monthProp->m_dwStates = FWL_WGTSTATE_Invisible;
44 monthProp->m_pParent = this; 43 monthProp->m_pParent = this;
45 monthProp->m_pThemeProvider = m_pProperties->m_pThemeProvider; 44 monthProp->m_pThemeProvider = m_pProperties->m_pThemeProvider;
46 m_pMonthCal.reset( 45 m_pMonthCal.reset(
47 new CFWL_MonthCalendar(m_pOwnerApp, std::move(monthProp), this)); 46 new CFWL_MonthCalendar(m_pOwnerApp, std::move(monthProp), this));
48 47
49 CFX_RectF rtMonthCal; 48 CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect();
50 m_pMonthCal->GetWidgetRect(rtMonthCal, true);
51 rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height); 49 rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height);
52 m_pMonthCal->SetWidgetRect(rtMonthCal); 50 m_pMonthCal->SetWidgetRect(rtMonthCal);
53 51
54 auto editProp = pdfium::MakeUnique<CFWL_WidgetProperties>(); 52 auto editProp = pdfium::MakeUnique<CFWL_WidgetProperties>();
55 editProp->m_pParent = this; 53 editProp->m_pParent = this;
56 editProp->m_pThemeProvider = m_pProperties->m_pThemeProvider; 54 editProp->m_pThemeProvider = m_pProperties->m_pThemeProvider;
57 55
58 m_pEdit.reset(new CFWL_DateTimeEdit(m_pOwnerApp, std::move(editProp), this)); 56 m_pEdit.reset(new CFWL_DateTimeEdit(m_pOwnerApp, std::move(editProp), this));
59 RegisterEventTarget(m_pMonthCal.get()); 57 RegisterEventTarget(m_pMonthCal.get());
60 RegisterEventTarget(m_pEdit.get()); 58 RegisterEventTarget(m_pEdit.get());
61 } 59 }
62 60
63 CFWL_DateTimePicker::~CFWL_DateTimePicker() { 61 CFWL_DateTimePicker::~CFWL_DateTimePicker() {
64 UnregisterEventTarget(); 62 UnregisterEventTarget();
65 } 63 }
66 64
67 FWL_Type CFWL_DateTimePicker::GetClassID() const { 65 FWL_Type CFWL_DateTimePicker::GetClassID() const {
68 return FWL_Type::DateTimePicker; 66 return FWL_Type::DateTimePicker;
69 } 67 }
70 68
71 void CFWL_DateTimePicker::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
72 if (m_pWidgetMgr->IsFormDisabled()) {
73 DisForm_GetWidgetRect(rect, bAutoSize);
74 return;
75 }
76 if (!bAutoSize) {
77 rect = m_pProperties->m_rtWidget;
78 return;
79 }
80
81 rect.Set(0, 0, kDateTimePickerWidth, kDateTimePickerHeight);
82 InflateWidgetRect(rect);
83 }
84
85 void CFWL_DateTimePicker::Update() { 69 void CFWL_DateTimePicker::Update() {
86 if (m_pWidgetMgr->IsFormDisabled()) { 70 if (m_pWidgetMgr->IsFormDisabled()) {
87 DisForm_Update(); 71 DisForm_Update();
88 return; 72 return;
89 } 73 }
90 if (m_iLock) 74 if (m_iLock)
91 return; 75 return;
92 if (!m_pProperties->m_pThemeProvider) 76 if (!m_pProperties->m_pThemeProvider)
93 m_pProperties->m_pThemeProvider = GetAvailableTheme(); 77 m_pProperties->m_pThemeProvider = GetAvailableTheme();
94 78
(...skipping 10 matching lines...) Expand all
105 89
106 CFX_RectF rtEdit; 90 CFX_RectF rtEdit;
107 rtEdit.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn, 91 rtEdit.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn,
108 m_rtClient.height); 92 m_rtClient.height);
109 m_pEdit->SetWidgetRect(rtEdit); 93 m_pEdit->SetWidgetRect(rtEdit);
110 ResetEditAlignment(); 94 ResetEditAlignment();
111 m_pEdit->Update(); 95 m_pEdit->Update();
112 if (!(m_pMonthCal->GetThemeProvider())) 96 if (!(m_pMonthCal->GetThemeProvider()))
113 m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider); 97 m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider);
114 98
115 CFX_RectF rtMonthCal; 99 CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect();
116 m_pMonthCal->GetWidgetRect(rtMonthCal, true);
117 CFX_RectF rtPopUp; 100 CFX_RectF rtPopUp;
118 rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight, 101 rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight,
119 rtMonthCal.width, rtMonthCal.height); 102 rtMonthCal.width, rtMonthCal.height);
120 m_pMonthCal->SetWidgetRect(rtPopUp); 103 m_pMonthCal->SetWidgetRect(rtPopUp);
121 m_pMonthCal->Update(); 104 m_pMonthCal->Update();
122 return; 105 return;
123 } 106 }
124 107
125 FWL_WidgetHit CFWL_DateTimePicker::HitTest(FX_FLOAT fx, FX_FLOAT fy) { 108 FWL_WidgetHit CFWL_DateTimePicker::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
126 if (m_pWidgetMgr->IsFormDisabled()) 109 if (m_pWidgetMgr->IsFormDisabled())
127 return DisForm_HitTest(fx, fy); 110 return DisForm_HitTest(fx, fy);
128 if (m_rtClient.Contains(fx, fy)) 111 if (m_rtClient.Contains(fx, fy))
129 return FWL_WidgetHit::Client; 112 return FWL_WidgetHit::Client;
130 if (IsMonthCalendarVisible()) { 113 if (IsMonthCalendarVisible()) {
131 CFX_RectF rect; 114 CFX_RectF rect = m_pMonthCal->GetWidgetRect();
132 m_pMonthCal->GetWidgetRect(rect, false);
133 if (rect.Contains(fx, fy)) 115 if (rect.Contains(fx, fy))
134 return FWL_WidgetHit::Client; 116 return FWL_WidgetHit::Client;
135 } 117 }
136 return FWL_WidgetHit::Unknown; 118 return FWL_WidgetHit::Unknown;
137 } 119 }
138 120
139 void CFWL_DateTimePicker::DrawWidget(CFX_Graphics* pGraphics, 121 void CFWL_DateTimePicker::DrawWidget(CFX_Graphics* pGraphics,
140 const CFX_Matrix* pMatrix) { 122 const CFX_Matrix* pMatrix) {
141 if (!pGraphics) 123 if (!pGraphics)
142 return; 124 return;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 183 }
202 184
203 void CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) const { 185 void CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) const {
204 if (m_pWidgetMgr->IsFormDisabled()) { 186 if (m_pWidgetMgr->IsFormDisabled()) {
205 DisForm_GetBBox(rect); 187 DisForm_GetBBox(rect);
206 return; 188 return;
207 } 189 }
208 190
209 rect = m_pProperties->m_rtWidget; 191 rect = m_pProperties->m_rtWidget;
210 if (IsMonthCalendarVisible()) { 192 if (IsMonthCalendarVisible()) {
211 CFX_RectF rtMonth; 193 CFX_RectF rtMonth = m_pMonthCal->GetWidgetRect();
212 m_pMonthCal->GetWidgetRect(rtMonth, false);
213 rtMonth.Offset(m_pProperties->m_rtWidget.left, 194 rtMonth.Offset(m_pProperties->m_rtWidget.left,
214 m_pProperties->m_rtWidget.top); 195 m_pProperties->m_rtWidget.top);
215 rect.Union(rtMonth); 196 rect.Union(rtMonth);
216 } 197 }
217 } 198 }
218 199
219 void CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, 200 void CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded,
220 uint32_t dwStylesExRemoved) { 201 uint32_t dwStylesExRemoved) {
221 m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); 202 m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
222 } 203 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 if (IsMonthCalendarVisible() == bActivate) 240 if (IsMonthCalendarVisible() == bActivate)
260 return; 241 return;
261 if (!m_pForm) 242 if (!m_pForm)
262 InitProxyForm(); 243 InitProxyForm();
263 244
264 if (!bActivate) { 245 if (!bActivate) {
265 m_pForm->EndDoModal(); 246 m_pForm->EndDoModal();
266 return; 247 return;
267 } 248 }
268 249
269 CFX_RectF rtMonth; 250 CFX_RectF rtMonth = m_pMonthCal->GetWidgetRect();
270 m_pMonthCal->GetWidgetRect(rtMonth, false);
271 251
272 CFX_RectF rtAnchor; 252 CFX_RectF rtAnchor;
273 rtAnchor.Set(0, 0, m_pProperties->m_rtWidget.width, 253 rtAnchor.Set(0, 0, m_pProperties->m_rtWidget.width,
274 m_pProperties->m_rtWidget.height); 254 m_pProperties->m_rtWidget.height);
275 GetPopupPos(0, rtMonth.height, rtAnchor, rtMonth); 255 GetPopupPos(0, rtMonth.height, rtAnchor, rtMonth);
276 m_pForm->SetWidgetRect(rtMonth); 256 m_pForm->SetWidgetRect(rtMonth);
277 257
278 rtMonth.left = rtMonth.top = 0; 258 rtMonth.left = rtMonth.top = 0;
279 if (bActivate) 259 if (bActivate)
280 m_pMonthCal->RemoveStates(FWL_WGTSTATE_Invisible); 260 m_pMonthCal->RemoveStates(FWL_WGTSTATE_Invisible);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 if (!m_pMonthCal) 356 if (!m_pMonthCal)
377 return false; 357 return false;
378 return !(m_pMonthCal->GetStates() & FWL_WGTSTATE_Invisible); 358 return !(m_pMonthCal->GetStates() & FWL_WGTSTATE_Invisible);
379 } 359 }
380 360
381 void CFWL_DateTimePicker::DisForm_ShowMonthCalendar(bool bActivate) { 361 void CFWL_DateTimePicker::DisForm_ShowMonthCalendar(bool bActivate) {
382 if (IsMonthCalendarVisible() == bActivate) 362 if (IsMonthCalendarVisible() == bActivate)
383 return; 363 return;
384 364
385 if (bActivate) { 365 if (bActivate) {
386 CFX_RectF rtMonthCal; 366 CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect();
387 m_pMonthCal->GetWidgetRect(rtMonthCal, true);
388 FX_FLOAT fPopupMin = rtMonthCal.height; 367 FX_FLOAT fPopupMin = rtMonthCal.height;
389 FX_FLOAT fPopupMax = rtMonthCal.height; 368 FX_FLOAT fPopupMax = rtMonthCal.height;
390 CFX_RectF rtAnchor(m_pProperties->m_rtWidget); 369 CFX_RectF rtAnchor(m_pProperties->m_rtWidget);
391 rtAnchor.width = rtMonthCal.width; 370 rtAnchor.width = rtMonthCal.width;
392 rtMonthCal.left = m_rtClient.left; 371 rtMonthCal.left = m_rtClient.left;
393 rtMonthCal.top = rtAnchor.Height(); 372 rtMonthCal.top = rtAnchor.Height();
394 GetPopupPos(fPopupMin, fPopupMax, rtAnchor, rtMonthCal); 373 GetPopupPos(fPopupMin, fPopupMax, rtAnchor, rtMonthCal);
395 m_pMonthCal->SetWidgetRect(rtMonthCal); 374 m_pMonthCal->SetWidgetRect(rtMonthCal);
396 if (m_iYear > 0 && m_iMonth > 0 && m_iDay > 0) 375 if (m_iYear > 0 && m_iMonth > 0 && m_iDay > 0)
397 m_pMonthCal->SetSelect(m_iYear, m_iMonth, m_iDay); 376 m_pMonthCal->SetSelect(m_iYear, m_iMonth, m_iDay);
398 m_pMonthCal->Update(); 377 m_pMonthCal->Update();
399 } 378 }
400 if (bActivate) 379 if (bActivate)
401 m_pMonthCal->RemoveStates(FWL_WGTSTATE_Invisible); 380 m_pMonthCal->RemoveStates(FWL_WGTSTATE_Invisible);
402 else 381 else
403 m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible); 382 m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible);
404 383
405 if (bActivate) { 384 if (bActivate) {
406 CFWL_MsgSetFocus msg(m_pEdit.get(), m_pMonthCal.get()); 385 CFWL_MsgSetFocus msg(m_pEdit.get(), m_pMonthCal.get());
407 m_pEdit->GetDelegate()->OnProcessMessage(&msg); 386 m_pEdit->GetDelegate()->OnProcessMessage(&msg);
408 } 387 }
409 388
410 CFX_RectF rtInvalidate, rtCal; 389 CFX_RectF rtInvalidate;
411 rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, 390 rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width,
412 m_pProperties->m_rtWidget.height); 391 m_pProperties->m_rtWidget.height);
413 m_pMonthCal->GetWidgetRect(rtCal, false); 392
393 CFX_RectF rtCal = m_pMonthCal->GetWidgetRect();
414 rtInvalidate.Union(rtCal); 394 rtInvalidate.Union(rtCal);
415 rtInvalidate.Inflate(2, 2); 395 rtInvalidate.Inflate(2, 2);
416 Repaint(&rtInvalidate); 396 Repaint(&rtInvalidate);
417 } 397 }
418 398
419 FWL_WidgetHit CFWL_DateTimePicker::DisForm_HitTest(FX_FLOAT fx, 399 FWL_WidgetHit CFWL_DateTimePicker::DisForm_HitTest(FX_FLOAT fx,
420 FX_FLOAT fy) const { 400 FX_FLOAT fy) const {
421 CFX_RectF rect; 401 CFX_RectF rect;
422 rect.Set(0, 0, m_pProperties->m_rtWidget.width, 402 rect.Set(0, 0, m_pProperties->m_rtWidget.width,
423 m_pProperties->m_rtWidget.height); 403 m_pProperties->m_rtWidget.height);
424 if (rect.Contains(fx, fy)) 404 if (rect.Contains(fx, fy))
425 return FWL_WidgetHit::Edit; 405 return FWL_WidgetHit::Edit;
426 if (DisForm_IsNeedShowButton()) 406 if (DisForm_IsNeedShowButton())
427 rect.width += m_fBtn; 407 rect.width += m_fBtn;
428 if (rect.Contains(fx, fy)) 408 if (rect.Contains(fx, fy))
429 return FWL_WidgetHit::Client; 409 return FWL_WidgetHit::Client;
430 if (IsMonthCalendarVisible()) { 410 if (IsMonthCalendarVisible()) {
431 m_pMonthCal->GetWidgetRect(rect, false); 411 if (m_pMonthCal->GetWidgetRect().Contains(fx, fy))
432 if (rect.Contains(fx, fy))
433 return FWL_WidgetHit::Client; 412 return FWL_WidgetHit::Client;
434 } 413 }
435 return FWL_WidgetHit::Unknown; 414 return FWL_WidgetHit::Unknown;
436 } 415 }
437 416
438 bool CFWL_DateTimePicker::DisForm_IsNeedShowButton() const { 417 bool CFWL_DateTimePicker::DisForm_IsNeedShowButton() const {
439 return m_pProperties->m_dwStates & FWL_WGTSTATE_Focused || 418 return m_pProperties->m_dwStates & FWL_WGTSTATE_Focused ||
440 m_pMonthCal->GetStates() & FWL_WGTSTATE_Focused || 419 m_pMonthCal->GetStates() & FWL_WGTSTATE_Focused ||
441 m_pEdit->GetStates() & FWL_WGTSTATE_Focused; 420 m_pEdit->GetStates() & FWL_WGTSTATE_Focused;
442 } 421 }
(...skipping 12 matching lines...) Expand all
455 434
456 if (!m_pMonthCal->GetThemeProvider()) 435 if (!m_pMonthCal->GetThemeProvider())
457 m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider); 436 m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider);
458 437
459 FX_FLOAT* pWidth = static_cast<FX_FLOAT*>( 438 FX_FLOAT* pWidth = static_cast<FX_FLOAT*>(
460 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); 439 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
461 if (!pWidth) 440 if (!pWidth)
462 return; 441 return;
463 442
464 m_fBtn = *pWidth; 443 m_fBtn = *pWidth;
465 CFX_RectF rtMonthCal; 444 CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect();
466 m_pMonthCal->GetWidgetRect(rtMonthCal, true);
467
468 CFX_RectF rtPopUp; 445 CFX_RectF rtPopUp;
469 rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight, 446 rtPopUp.Set(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight,
470 rtMonthCal.width, rtMonthCal.height); 447 rtMonthCal.width, rtMonthCal.height);
471 m_pMonthCal->SetWidgetRect(rtPopUp); 448 m_pMonthCal->SetWidgetRect(rtPopUp);
472 m_pMonthCal->Update(); 449 m_pMonthCal->Update();
473 } 450 }
474 451
475 void CFWL_DateTimePicker::DisForm_GetWidgetRect(CFX_RectF& rect,
476 bool bAutoSize) {
477 rect = m_pProperties->m_rtWidget;
478 if (DisForm_IsNeedShowButton())
479 rect.width += m_fBtn;
480 }
481
482 void CFWL_DateTimePicker::DisForm_GetBBox(CFX_RectF& rect) const { 452 void CFWL_DateTimePicker::DisForm_GetBBox(CFX_RectF& rect) const {
483 rect = m_pProperties->m_rtWidget; 453 rect = m_pProperties->m_rtWidget;
484 if (DisForm_IsNeedShowButton()) 454 if (DisForm_IsNeedShowButton())
485 rect.width += m_fBtn; 455 rect.width += m_fBtn;
486 if (!IsMonthCalendarVisible()) 456 if (!IsMonthCalendarVisible())
487 return; 457 return;
488 458
489 CFX_RectF rtMonth; 459 CFX_RectF rtMonth = m_pMonthCal->GetWidgetRect();
490 m_pMonthCal->GetWidgetRect(rtMonth, false);
491 rtMonth.Offset(m_pProperties->m_rtWidget.left, m_pProperties->m_rtWidget.top); 460 rtMonth.Offset(m_pProperties->m_rtWidget.left, m_pProperties->m_rtWidget.top);
492 rect.Union(rtMonth); 461 rect.Union(rtMonth);
493 } 462 }
494 463
495 void CFWL_DateTimePicker::DisForm_DrawWidget(CFX_Graphics* pGraphics, 464 void CFWL_DateTimePicker::DisForm_DrawWidget(CFX_Graphics* pGraphics,
496 const CFX_Matrix* pMatrix) { 465 const CFX_Matrix* pMatrix) {
497 if (!pGraphics) 466 if (!pGraphics)
498 return; 467 return;
499 if (m_pEdit) { 468 if (m_pEdit) {
500 CFX_RectF rtEdit; 469 CFX_RectF rtEdit = m_pEdit->GetWidgetRect();
501 m_pEdit->GetWidgetRect(rtEdit, false);
502 470
503 CFX_Matrix mt; 471 CFX_Matrix mt;
504 mt.Set(1, 0, 0, 1, rtEdit.left, rtEdit.top); 472 mt.Set(1, 0, 0, 1, rtEdit.left, rtEdit.top);
505 if (pMatrix) 473 if (pMatrix)
506 mt.Concat(*pMatrix); 474 mt.Concat(*pMatrix);
507 m_pEdit->DrawWidget(pGraphics, &mt); 475 m_pEdit->DrawWidget(pGraphics, &mt);
508 } 476 }
509 if (!IsMonthCalendarVisible()) 477 if (!IsMonthCalendarVisible())
510 return; 478 return;
511 479
512 CFX_RectF rtMonth; 480 CFX_RectF rtMonth = m_pMonthCal->GetWidgetRect();
513 m_pMonthCal->GetWidgetRect(rtMonth, false);
514 CFX_Matrix mt; 481 CFX_Matrix mt;
515 mt.Set(1, 0, 0, 1, rtMonth.left, rtMonth.top); 482 mt.Set(1, 0, 0, 1, rtMonth.left, rtMonth.top);
516 if (pMatrix) 483 if (pMatrix)
517 mt.Concat(*pMatrix); 484 mt.Concat(*pMatrix);
518 m_pMonthCal->DrawWidget(pGraphics, &mt); 485 m_pMonthCal->DrawWidget(pGraphics, &mt);
519 } 486 }
520 487
521 void CFWL_DateTimePicker::OnProcessMessage(CFWL_Message* pMessage) { 488 void CFWL_DateTimePicker::OnProcessMessage(CFWL_Message* pMessage) {
522 if (!pMessage) 489 if (!pMessage)
523 return; 490 return;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 if (DisForm_IsMonthCalendarVisible()) 616 if (DisForm_IsMonthCalendarVisible())
650 ShowMonthCalendar(false); 617 ShowMonthCalendar(false);
651 if (m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { 618 if (m_pEdit->GetStates() & FWL_WGTSTATE_Focused) {
652 pMsg->m_pSrcTarget = m_pEdit.get(); 619 pMsg->m_pSrcTarget = m_pEdit.get();
653 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); 620 m_pEdit->GetDelegate()->OnProcessMessage(pMsg);
654 } 621 }
655 } 622 }
656 rtInvalidate.Inflate(2, 2); 623 rtInvalidate.Inflate(2, 2);
657 Repaint(&rtInvalidate); 624 Repaint(&rtInvalidate);
658 } 625 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_datetimepicker.h ('k') | xfa/fwl/core/cfwl_edit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698