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

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

Issue 2524173002: Merge IFWL and CFWL classes. (Closed)
Patch Set: make chrome build happy 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
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_
8 #define XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_
9
10 #include <memory>
11
12 #include "xfa/fwl/core/cfwl_datetimeedit.h"
13 #include "xfa/fwl/core/cfwl_event.h"
14 #include "xfa/fwl/core/cfwl_monthcalendar.h"
15 #include "xfa/fwl/core/cfwl_widgetproperties.h"
16 #include "xfa/fwl/core/ifwl_widget.h"
17
18 #define FWL_STYLEEXT_DTP_AllowEdit (1L << 0)
19 #define FWL_STYLEEXT_DTP_LongDateFormat (0L << 1)
20 #define FWL_STYLEEXT_DTP_ShortDateFormat (1L << 1)
21 #define FWL_STYLEEXT_DTP_TimeFormat (2L << 1)
22 #define FWL_STYLEEXT_DTP_Spin (1L << 3)
23 #define FWL_STYLEEXT_DTP_EditHNear (0L << 4)
24 #define FWL_STYLEEXT_DTP_EditHCenter (1L << 4)
25 #define FWL_STYLEEXT_DTP_EditHFar (2L << 4)
26 #define FWL_STYLEEXT_DTP_EditVNear (0L << 6)
27 #define FWL_STYLEEXT_DTP_EditVCenter (1L << 6)
28 #define FWL_STYLEEXT_DTP_EditVFar (2L << 6)
29 #define FWL_STYLEEXT_DTP_EditJustified (1L << 8)
30 #define FWL_STYLEEXT_DTP_EditDistributed (2L << 8)
31 #define FWL_STYLEEXT_DTP_EditHAlignMask (3L << 4)
32 #define FWL_STYLEEXT_DTP_EditVAlignMask (3L << 6)
33 #define FWL_STYLEEXT_DTP_EditHAlignModeMask (3L << 8)
34
35 class CFWL_DateTimeEdit;
36 class CFWL_FormProxy;
37
38 class IFWL_DateTimePicker : public IFWL_Widget {
39 public:
40 explicit IFWL_DateTimePicker(
41 const CFWL_App* app,
42 std::unique_ptr<CFWL_WidgetProperties> properties);
43 ~IFWL_DateTimePicker() override;
44
45 // IFWL_Widget
46 FWL_Type GetClassID() const override;
47 void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override;
48 void Update() override;
49 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
50 void DrawWidget(CFX_Graphics* pGraphics,
51 const CFX_Matrix* pMatrix = nullptr) override;
52 void SetThemeProvider(IFWL_ThemeProvider* pTP) override;
53 void OnProcessMessage(CFWL_Message* pMessage) override;
54 void OnDrawWidget(CFX_Graphics* pGraphics,
55 const CFX_Matrix* pMatrix) override;
56
57 void GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay);
58 void SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay);
59
60 void SetEditText(const CFX_WideString& wsText);
61 void GetEditText(CFX_WideString& wsText,
62 int32_t nStart = 0,
63 int32_t nCount = -1) const;
64
65 int32_t CountSelRanges() const { return m_pEdit->CountSelRanges(); }
66 int32_t GetSelRange(int32_t nIndex, int32_t& nStart) const {
67 return m_pEdit->GetSelRange(nIndex, nStart);
68 }
69
70 void GetBBox(CFX_RectF& rect) const;
71 void SetEditLimit(int32_t nLimit) { m_pEdit->SetLimit(nLimit); }
72 void ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved);
73
74 bool IsMonthCalendarVisible() const;
75 void ShowMonthCalendar(bool bActivate);
76 void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay);
77
78 CFWL_FormProxy* GetFormProxy() const { return m_pForm.get(); }
79
80 private:
81 void DrawDropDownButton(CFX_Graphics* pGraphics,
82 IFWL_ThemeProvider* pTheme,
83 const CFX_Matrix* pMatrix);
84 void FormatDateString(int32_t iYear,
85 int32_t iMonth,
86 int32_t iDay,
87 CFX_WideString& wsText);
88 void ResetEditAlignment();
89 void InitProxyForm();
90
91 bool DisForm_IsMonthCalendarVisible() const;
92 void DisForm_ShowMonthCalendar(bool bActivate);
93 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) const;
94 bool DisForm_IsNeedShowButton() const;
95 void DisForm_Update();
96 void DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false);
97 void DisForm_GetBBox(CFX_RectF& rect) const;
98 void DisForm_DrawWidget(CFX_Graphics* pGraphics,
99 const CFX_Matrix* pMatrix = nullptr);
100 void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet);
101 void OnFocusChanged(CFWL_Message* pMsg, bool bSet);
102 void OnLButtonDown(CFWL_MsgMouse* pMsg);
103 void OnLButtonUp(CFWL_MsgMouse* pMsg);
104 void OnMouseMove(CFWL_MsgMouse* pMsg);
105 void OnMouseLeave(CFWL_MsgMouse* pMsg);
106
107 CFX_RectF m_rtBtn;
108 CFX_RectF m_rtClient;
109 int32_t m_iBtnState;
110 int32_t m_iYear;
111 int32_t m_iMonth;
112 int32_t m_iDay;
113 bool m_bLBtnDown;
114 std::unique_ptr<CFWL_DateTimeEdit> m_pEdit;
115 std::unique_ptr<CFWL_MonthCalendar> m_pMonthCal;
116 std::unique_ptr<CFWL_FormProxy> m_pForm;
117 FX_FLOAT m_fBtn;
118 };
119
120 #endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698