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 #ifndef XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ | 7 #ifndef XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ |
8 #define XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ | 8 #define XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ |
9 | 9 |
10 #include "xfa/fwl/core/cfwl_event.h" | 10 #include "xfa/fwl/core/cfwl_event.h" |
11 #include "xfa/fwl/core/cfwl_widgetproperties.h" | 11 #include "xfa/fwl/core/cfwl_widgetproperties.h" |
12 #include "xfa/fwl/core/ifwl_dataprovider.h" | 12 #include "xfa/fwl/core/ifwl_dataprovider.h" |
| 13 #include "xfa/fwl/core/ifwl_datetimeedit.h" |
13 #include "xfa/fwl/core/ifwl_monthcalendar.h" | 14 #include "xfa/fwl/core/ifwl_monthcalendar.h" |
14 #include "xfa/fwl/core/ifwl_widget.h" | 15 #include "xfa/fwl/core/ifwl_widget.h" |
15 | 16 |
16 #define FWL_STYLEEXT_DTP_AllowEdit (1L << 0) | 17 #define FWL_STYLEEXT_DTP_AllowEdit (1L << 0) |
17 #define FWL_STYLEEXT_DTP_LongDateFormat (0L << 1) | 18 #define FWL_STYLEEXT_DTP_LongDateFormat (0L << 1) |
18 #define FWL_STYLEEXT_DTP_ShortDateFormat (1L << 1) | 19 #define FWL_STYLEEXT_DTP_ShortDateFormat (1L << 1) |
19 #define FWL_STYLEEXT_DTP_TimeFormat (2L << 1) | 20 #define FWL_STYLEEXT_DTP_TimeFormat (2L << 1) |
20 #define FWL_STYLEEXT_DTP_Spin (1L << 3) | 21 #define FWL_STYLEEXT_DTP_Spin (1L << 3) |
21 #define FWL_STYLEEXT_DTP_EditHNear (0L << 4) | 22 #define FWL_STYLEEXT_DTP_EditHNear (0L << 4) |
22 #define FWL_STYLEEXT_DTP_EditHCenter (1L << 4) | 23 #define FWL_STYLEEXT_DTP_EditHCenter (1L << 4) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 int32_t GetCurYear(IFWL_Widget* pWidget) override; | 84 int32_t GetCurYear(IFWL_Widget* pWidget) override; |
84 | 85 |
85 void GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); | 86 void GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); |
86 void SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); | 87 void SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); |
87 | 88 |
88 void SetEditText(const CFX_WideString& wsText); | 89 void SetEditText(const CFX_WideString& wsText); |
89 void GetEditText(CFX_WideString& wsText, | 90 void GetEditText(CFX_WideString& wsText, |
90 int32_t nStart = 0, | 91 int32_t nStart = 0, |
91 int32_t nCount = -1) const; | 92 int32_t nCount = -1) const; |
92 | 93 |
93 int32_t CountSelRanges(); | 94 int32_t CountSelRanges() const { return m_pEdit->CountSelRanges(); } |
94 int32_t GetSelRange(int32_t nIndex, int32_t& nStart); | 95 int32_t GetSelRange(int32_t nIndex, int32_t& nStart) const { |
| 96 return m_pEdit->GetSelRange(nIndex, nStart); |
| 97 } |
95 | 98 |
96 void GetBBox(CFX_RectF& rect); | 99 void GetBBox(CFX_RectF& rect) const; |
97 void SetEditLimit(int32_t nLimit); | 100 void SetEditLimit(int32_t nLimit) { m_pEdit->SetLimit(nLimit); } |
98 void ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); | 101 void ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); |
99 | 102 |
100 bool IsMonthCalendarVisible(); | 103 bool IsMonthCalendarVisible() const; |
101 void ShowMonthCalendar(bool bActivate); | 104 void ShowMonthCalendar(bool bActivate); |
102 void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay); | 105 void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay); |
103 | 106 |
104 IFWL_FormProxy* GetFormProxy() const { return m_pForm.get(); } | 107 IFWL_FormProxy* GetFormProxy() const { return m_pForm.get(); } |
105 | 108 |
106 private: | 109 private: |
107 void DrawDropDownButton(CFX_Graphics* pGraphics, | 110 void DrawDropDownButton(CFX_Graphics* pGraphics, |
108 IFWL_ThemeProvider* pTheme, | 111 IFWL_ThemeProvider* pTheme, |
109 const CFX_Matrix* pMatrix); | 112 const CFX_Matrix* pMatrix); |
110 void FormatDateString(int32_t iYear, | 113 void FormatDateString(int32_t iYear, |
111 int32_t iMonth, | 114 int32_t iMonth, |
112 int32_t iDay, | 115 int32_t iDay, |
113 CFX_WideString& wsText); | 116 CFX_WideString& wsText); |
114 void ResetEditAlignment(); | 117 void ResetEditAlignment(); |
115 void InitProxyForm(); | 118 void InitProxyForm(); |
116 | 119 |
117 bool DisForm_IsMonthCalendarVisible(); | 120 bool DisForm_IsMonthCalendarVisible() const; |
118 void DisForm_ShowMonthCalendar(bool bActivate); | 121 void DisForm_ShowMonthCalendar(bool bActivate); |
119 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); | 122 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) const; |
120 bool DisForm_IsNeedShowButton(); | 123 bool DisForm_IsNeedShowButton() const; |
121 void DisForm_Update(); | 124 void DisForm_Update(); |
122 void DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); | 125 void DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); |
123 void DisForm_GetBBox(CFX_RectF& rect); | 126 void DisForm_GetBBox(CFX_RectF& rect) const; |
124 void DisForm_DrawWidget(CFX_Graphics* pGraphics, | 127 void DisForm_DrawWidget(CFX_Graphics* pGraphics, |
125 const CFX_Matrix* pMatrix = nullptr); | 128 const CFX_Matrix* pMatrix = nullptr); |
126 void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet); | 129 void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet); |
127 void OnFocusChanged(CFWL_Message* pMsg, bool bSet); | 130 void OnFocusChanged(CFWL_Message* pMsg, bool bSet); |
128 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 131 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
129 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 132 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
130 void OnMouseMove(CFWL_MsgMouse* pMsg); | 133 void OnMouseMove(CFWL_MsgMouse* pMsg); |
131 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 134 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
132 | 135 |
133 CFX_RectF m_rtBtn; | 136 CFX_RectF m_rtBtn; |
134 CFX_RectF m_rtClient; | 137 CFX_RectF m_rtClient; |
135 int32_t m_iBtnState; | 138 int32_t m_iBtnState; |
136 int32_t m_iYear; | 139 int32_t m_iYear; |
137 int32_t m_iMonth; | 140 int32_t m_iMonth; |
138 int32_t m_iDay; | 141 int32_t m_iDay; |
139 int32_t m_iCurYear; | 142 int32_t m_iCurYear; |
140 int32_t m_iCurMonth; | 143 int32_t m_iCurMonth; |
141 int32_t m_iCurDay; | 144 int32_t m_iCurDay; |
142 bool m_bLBtnDown; | 145 bool m_bLBtnDown; |
143 std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; | 146 std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; |
144 std::unique_ptr<IFWL_MonthCalendar> m_pMonthCal; | 147 std::unique_ptr<IFWL_MonthCalendar> m_pMonthCal; |
145 std::unique_ptr<IFWL_FormProxy> m_pForm; | 148 std::unique_ptr<IFWL_FormProxy> m_pForm; |
146 FX_FLOAT m_fBtn; | 149 FX_FLOAT m_fBtn; |
147 }; | 150 }; |
148 | 151 |
149 #endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ | 152 #endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ |
OLD | NEW |