| 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" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 ~IFWL_DateTimePicker() override; | 67 ~IFWL_DateTimePicker() override; |
| 68 | 68 |
| 69 // IFWL_Widget | 69 // IFWL_Widget |
| 70 FWL_Type GetClassID() const override; | 70 FWL_Type GetClassID() const override; |
| 71 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 71 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
| 72 FWL_Error Update() override; | 72 FWL_Error Update() override; |
| 73 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; | 73 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; |
| 74 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 74 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
| 75 const CFX_Matrix* pMatrix = nullptr) override; | 75 const CFX_Matrix* pMatrix = nullptr) override; |
| 76 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pTP) override; | 76 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pTP) override; |
| 77 void OnProcessMessage(CFWL_Message* pMessage) override; |
| 78 void OnDrawWidget(CFX_Graphics* pGraphics, |
| 79 const CFX_Matrix* pMatrix) override; |
| 77 | 80 |
| 78 FWL_Error GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); | 81 FWL_Error GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); |
| 79 FWL_Error SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); | 82 FWL_Error SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); |
| 80 FWL_Error SetEditText(const CFX_WideString& wsText); | 83 FWL_Error SetEditText(const CFX_WideString& wsText); |
| 81 FWL_Error GetEditText(CFX_WideString& wsText, | 84 FWL_Error GetEditText(CFX_WideString& wsText, |
| 82 int32_t nStart = 0, | 85 int32_t nStart = 0, |
| 83 int32_t nCount = -1) const; | 86 int32_t nCount = -1) const; |
| 84 int32_t CountSelRanges(); | 87 int32_t CountSelRanges(); |
| 85 int32_t GetSelRange(int32_t nIndex, int32_t& nStart); | 88 int32_t GetSelRange(int32_t nIndex, int32_t& nStart); |
| 86 | 89 |
| 87 FX_BOOL CanUndo(); | 90 FX_BOOL CanUndo(); |
| 88 FX_BOOL CanRedo(); | 91 FX_BOOL CanRedo(); |
| 89 FX_BOOL Undo(); | 92 FX_BOOL Undo(); |
| 90 FX_BOOL Redo(); | 93 FX_BOOL Redo(); |
| 91 FX_BOOL CanCopy(); | 94 FX_BOOL CanCopy(); |
| 92 FX_BOOL CanCut(); | 95 FX_BOOL CanCut(); |
| 93 FX_BOOL CanSelectAll(); | 96 FX_BOOL CanSelectAll(); |
| 94 FX_BOOL Copy(CFX_WideString& wsCopy); | 97 FX_BOOL Copy(CFX_WideString& wsCopy); |
| 95 FX_BOOL Cut(CFX_WideString& wsCut); | 98 FX_BOOL Cut(CFX_WideString& wsCut); |
| 96 FX_BOOL Paste(const CFX_WideString& wsPaste); | 99 FX_BOOL Paste(const CFX_WideString& wsPaste); |
| 97 FX_BOOL SelectAll(); | 100 FX_BOOL SelectAll(); |
| 98 FX_BOOL Delete(); | 101 FX_BOOL Delete(); |
| 99 FX_BOOL DeSelect(); | 102 FX_BOOL DeSelect(); |
| 100 FWL_Error GetBBox(CFX_RectF& rect); | 103 FWL_Error GetBBox(CFX_RectF& rect); |
| 101 FWL_Error SetEditLimit(int32_t nLimit); | 104 FWL_Error SetEditLimit(int32_t nLimit); |
| 102 FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, | 105 FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, |
| 103 uint32_t dwStylesExRemoved); | 106 uint32_t dwStylesExRemoved); |
| 104 IFWL_DateTimeEdit* GetDataTimeEdit(); | 107 IFWL_DateTimeEdit* GetDataTimeEdit(); |
| 105 | 108 |
| 109 FX_BOOL IsMonthCalendarShowed(); |
| 110 void ShowMonthCalendar(FX_BOOL bActivate); |
| 111 void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay); |
| 112 |
| 113 IFWL_FormProxy* GetFormProxy() const { return m_pForm.get(); } |
| 114 |
| 106 protected: | 115 protected: |
| 107 friend class CFWL_DateTimeEditImpDelegate; | |
| 108 friend class IFWL_DateTimeCalendar; | |
| 109 friend class CFWL_DateTimeCalendarImpDelegate; | |
| 110 friend class CFWL_DateTimePickerImpDelegate; | |
| 111 | |
| 112 class CFWL_MonthCalendarImpDP : public IFWL_MonthCalendarDP { | 116 class CFWL_MonthCalendarImpDP : public IFWL_MonthCalendarDP { |
| 113 public: | 117 public: |
| 114 CFWL_MonthCalendarImpDP(); | 118 CFWL_MonthCalendarImpDP(); |
| 115 | 119 |
| 116 // IFWL_DataProvider | 120 // IFWL_DataProvider |
| 117 FWL_Error GetCaption(IFWL_Widget* pWidget, | 121 FWL_Error GetCaption(IFWL_Widget* pWidget, |
| 118 CFX_WideString& wsCaption) override; | 122 CFX_WideString& wsCaption) override; |
| 119 | 123 |
| 120 // IFWL_MonthCalendarDP | 124 // IFWL_MonthCalendarDP |
| 121 int32_t GetCurDay(IFWL_Widget* pWidget) override; | 125 int32_t GetCurDay(IFWL_Widget* pWidget) override; |
| 122 int32_t GetCurMonth(IFWL_Widget* pWidget) override; | 126 int32_t GetCurMonth(IFWL_Widget* pWidget) override; |
| 123 int32_t GetCurYear(IFWL_Widget* pWidget) override; | 127 int32_t GetCurYear(IFWL_Widget* pWidget) override; |
| 124 | 128 |
| 125 int32_t m_iCurDay; | 129 int32_t m_iCurDay; |
| 126 int32_t m_iCurYear; | 130 int32_t m_iCurYear; |
| 127 int32_t m_iCurMonth; | 131 int32_t m_iCurMonth; |
| 128 }; | 132 }; |
| 129 | 133 |
| 130 void DrawDropDownButton(CFX_Graphics* pGraphics, | 134 void DrawDropDownButton(CFX_Graphics* pGraphics, |
| 131 IFWL_ThemeProvider* pTheme, | 135 IFWL_ThemeProvider* pTheme, |
| 132 const CFX_Matrix* pMatrix); | 136 const CFX_Matrix* pMatrix); |
| 133 void FormatDateString(int32_t iYear, | 137 void FormatDateString(int32_t iYear, |
| 134 int32_t iMonth, | 138 int32_t iMonth, |
| 135 int32_t iDay, | 139 int32_t iDay, |
| 136 CFX_WideString& wsText); | 140 CFX_WideString& wsText); |
| 137 void ShowMonthCalendar(FX_BOOL bActivate); | |
| 138 FX_BOOL IsMonthCalendarShowed(); | |
| 139 void ReSetEditAlignment(); | 141 void ReSetEditAlignment(); |
| 140 void InitProxyForm(); | 142 void InitProxyForm(); |
| 141 void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay); | |
| 142 | 143 |
| 143 CFX_RectF m_rtBtn; | 144 CFX_RectF m_rtBtn; |
| 144 CFX_RectF m_rtClient; | 145 CFX_RectF m_rtClient; |
| 145 int32_t m_iBtnState; | 146 int32_t m_iBtnState; |
| 146 int32_t m_iYear; | 147 int32_t m_iYear; |
| 147 int32_t m_iMonth; | 148 int32_t m_iMonth; |
| 148 int32_t m_iDay; | 149 int32_t m_iDay; |
| 149 FX_BOOL m_bLBtnDown; | 150 FX_BOOL m_bLBtnDown; |
| 150 std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; | 151 std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; |
| 151 std::unique_ptr<IFWL_DateTimeCalendar> m_pMonthCal; | 152 std::unique_ptr<IFWL_DateTimeCalendar> m_pMonthCal; |
| 152 std::unique_ptr<IFWL_FormProxy> m_pForm; | 153 std::unique_ptr<IFWL_FormProxy> m_pForm; |
| 153 FX_FLOAT m_fBtn; | 154 FX_FLOAT m_fBtn; |
| 154 CFWL_MonthCalendarImpDP m_MonthCalendarDP; | 155 CFWL_MonthCalendarImpDP m_MonthCalendarDP; |
| 155 | 156 |
| 156 private: | 157 private: |
| 157 FWL_Error DisForm_Initialize(); | 158 FWL_Error DisForm_Initialize(); |
| 158 void DisForm_InitDateTimeCalendar(); | 159 void DisForm_InitDateTimeCalendar(); |
| 159 void DisForm_InitDateTimeEdit(); | 160 void DisForm_InitDateTimeEdit(); |
| 160 FX_BOOL DisForm_IsMonthCalendarShowed(); | 161 FX_BOOL DisForm_IsMonthCalendarShowed(); |
| 161 void DisForm_ShowMonthCalendar(FX_BOOL bActivate); | 162 void DisForm_ShowMonthCalendar(FX_BOOL bActivate); |
| 162 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); | 163 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); |
| 163 FX_BOOL DisForm_IsNeedShowButton(); | 164 FX_BOOL DisForm_IsNeedShowButton(); |
| 164 FWL_Error DisForm_Update(); | 165 FWL_Error DisForm_Update(); |
| 165 FWL_Error DisForm_GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 166 FWL_Error DisForm_GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); |
| 166 FWL_Error DisForm_GetBBox(CFX_RectF& rect); | 167 FWL_Error DisForm_GetBBox(CFX_RectF& rect); |
| 167 FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, | 168 FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, |
| 168 const CFX_Matrix* pMatrix = nullptr); | 169 const CFX_Matrix* pMatrix = nullptr); |
| 169 }; | |
| 170 | 170 |
| 171 class CFWL_DateTimePickerImpDelegate : public CFWL_WidgetImpDelegate { | 171 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet); |
| 172 public: | |
| 173 CFWL_DateTimePickerImpDelegate(IFWL_DateTimePicker* pOwner); | |
| 174 | |
| 175 // CFWL_WidgetImpDelegate | |
| 176 void OnProcessMessage(CFWL_Message* pMessage) override; | |
| 177 void OnDrawWidget(CFX_Graphics* pGraphics, | |
| 178 const CFX_Matrix* pMatrix = nullptr) override; | |
| 179 | |
| 180 protected: | |
| 181 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | |
| 182 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 172 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
| 183 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 173 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
| 184 void OnMouseMove(CFWL_MsgMouse* pMsg); | 174 void OnMouseMove(CFWL_MsgMouse* pMsg); |
| 185 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 175 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
| 186 | 176 void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet); |
| 187 IFWL_DateTimePicker* m_pOwner; | |
| 188 | |
| 189 private: | |
| 190 void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | |
| 191 }; | 177 }; |
| 192 | 178 |
| 193 #endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ | 179 #endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ |
| OLD | NEW |