Index: xfa/fwl/core/ifwl_datetimepicker.h |
diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.h b/xfa/fwl/core/ifwl_datetimepicker.h |
similarity index 56% |
rename from xfa/fwl/basewidget/fwl_datetimepickerimp.h |
rename to xfa/fwl/core/ifwl_datetimepicker.h |
index 8306a26ba8d1773424a85a222e991ed61e2d52d0..e14073df09153fa5a0edec0b38918988b0790e94 100644 |
--- a/xfa/fwl/basewidget/fwl_datetimepickerimp.h |
+++ b/xfa/fwl/core/ifwl_datetimepicker.h |
@@ -4,119 +4,73 @@ |
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
-#ifndef XFA_FWL_BASEWIDGET_FWL_DATETIMEPICKERIMP_H_ |
-#define XFA_FWL_BASEWIDGET_FWL_DATETIMEPICKERIMP_H_ |
- |
-#include <memory> |
- |
-#include "xfa/fwl/basewidget/fwl_editimp.h" |
-#include "xfa/fwl/basewidget/fwl_monthcalendarimp.h" |
-#include "xfa/fwl/basewidget/ifwl_datetimepicker.h" |
-#include "xfa/fwl/basewidget/ifwl_edit.h" |
-#include "xfa/fwl/basewidget/ifwl_monthcalendar.h" |
-#include "xfa/fwl/core/ifwl_form.h" |
- |
-class CFWL_WidgetImp; |
-class CFWL_WidgetImpProperties; |
-class CFWL_WidgetImpDelegate; |
-class CFWL_DateTimeEdit; |
-class CFWL_DateTimeEditImpDelegate; |
-class CFWL_DateTimeCalendar; |
-class CFWL_DateTimeCalendarImpDelegate; |
-class CFWL_DateTimePickerImp; |
-class CFWL_DateTimePickerImpDelegate; |
- |
-class IFWL_DateTimeForm : public IFWL_Form { |
+#ifndef XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ |
+#define XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ |
+ |
+#include "xfa/fwl/core/cfwl_event.h" |
+#include "xfa/fwl/core/cfwl_widgetimpproperties.h" |
+#include "xfa/fwl/core/ifwl_dataprovider.h" |
+#include "xfa/fwl/core/ifwl_monthcalendar.h" |
+#include "xfa/fwl/core/ifwl_widget.h" |
+ |
+#define FWL_CLASS_DateTimePicker L"FWL_DATETIMEPICKER" |
+#define FWL_STYLEEXT_DTP_AllowEdit (1L << 0) |
+#define FWL_STYLEEXT_DTP_LongDateFormat (0L << 1) |
+#define FWL_STYLEEXT_DTP_ShortDateFormat (1L << 1) |
+#define FWL_STYLEEXT_DTP_TimeFormat (2L << 1) |
+#define FWL_STYLEEXT_DTP_Spin (1L << 3) |
+#define FWL_STYLEEXT_DTP_EditHNear (0L << 4) |
+#define FWL_STYLEEXT_DTP_EditHCenter (1L << 4) |
+#define FWL_STYLEEXT_DTP_EditHFar (2L << 4) |
+#define FWL_STYLEEXT_DTP_EditVNear (0L << 6) |
+#define FWL_STYLEEXT_DTP_EditVCenter (1L << 6) |
+#define FWL_STYLEEXT_DTP_EditVFar (2L << 6) |
+#define FWL_STYLEEXT_DTP_EditJustified (1L << 8) |
+#define FWL_STYLEEXT_DTP_EditDistributed (2L << 8) |
+#define FWL_STYLEEXT_DTP_EditHAlignMask (3L << 4) |
+#define FWL_STYLEEXT_DTP_EditVAlignMask (3L << 6) |
+#define FWL_STYLEEXT_DTP_EditHAlignModeMask (3L << 8) |
+ |
+class IFWL_DateTimeCalendar; |
+class IFWL_DateTimeEdit; |
+class IFWL_FormProxy; |
+ |
+FWL_EVENT_DEF(CFWL_Event_DtpDropDown, CFWL_EventType::DropDown) |
+ |
+FWL_EVENT_DEF(CFWL_Event_DtpCloseUp, CFWL_EventType::CloseUp) |
+ |
+FWL_EVENT_DEF(CFWL_Event_DtpEditChanged, |
+ CFWL_EventType::EditChanged, |
+ CFX_WideString m_wsText;) |
+ |
+FWL_EVENT_DEF(CFWL_Event_DtpHoverChanged, |
+ CFWL_EventType::HoverChanged, |
+ int32_t hoverday;) |
+ |
+FWL_EVENT_DEF(CFWL_Event_DtpSelectChanged, |
+ CFWL_EventType::SelectChanged, |
+ int32_t iYear; |
+ int32_t iMonth; |
+ int32_t iDay;) |
+ |
+class IFWL_DateTimePickerDP : public IFWL_DataProvider { |
public: |
- static IFWL_DateTimeForm* Create(const CFWL_WidgetImpProperties& properties, |
- IFWL_Widget* pOuter); |
- |
- protected: |
- IFWL_DateTimeForm() {} |
-}; |
- |
-class IFWL_DateTimeCalender : public IFWL_MonthCalendar { |
- public: |
- static IFWL_DateTimeCalender* Create( |
- const CFWL_WidgetImpProperties& properties, |
- IFWL_Widget* pOuter); |
- |
- protected: |
- IFWL_DateTimeCalender() {} |
-}; |
- |
-class IFWL_DateTimeEdit : public IFWL_Edit { |
- public: |
- static IFWL_DateTimeEdit* Create(const CFWL_WidgetImpProperties& properties, |
- IFWL_Widget* pOuter); |
- |
- protected: |
- IFWL_DateTimeEdit() {} |
-}; |
- |
-class CFWL_DateTimeEdit : public CFWL_EditImp { |
- public: |
- CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties, |
- IFWL_Widget* pOuter); |
- |
- // CFWL_EditImp |
- FWL_Error Initialize() override; |
- FWL_Error Finalize() override; |
- |
- protected: |
- friend class CFWL_DateTimeEditImpDelegate; |
-}; |
- |
-class CFWL_DateTimeEditImpDelegate : public CFWL_EditImpDelegate { |
- public: |
- CFWL_DateTimeEditImpDelegate(CFWL_DateTimeEdit* pOwner); |
- void OnProcessMessage(CFWL_Message* pMessage) override; |
- |
- protected: |
- CFWL_DateTimeEdit* m_pOwner; |
- |
- private: |
- void DisForm_OnProcessMessage(CFWL_Message* pMessage); |
+ virtual FWL_Error GetToday(IFWL_Widget* pWidget, |
+ int32_t& iYear, |
+ int32_t& iMonth, |
+ int32_t& iDay) = 0; |
}; |
-class CFWL_DateTimeCalendar : public CFWL_MonthCalendarImp { |
+class IFWL_DateTimePicker : public IFWL_Widget { |
public: |
- CFWL_DateTimeCalendar(const CFWL_WidgetImpProperties& properties, |
- IFWL_Widget* pOuter); |
+ static IFWL_DateTimePicker* Create(const CFWL_WidgetImpProperties& properties, |
+ IFWL_Widget* pOuter); |
- // CFWL_MonthCalendarImp |
- FWL_Error Initialize() override; |
- FWL_Error Finalize() override; |
- |
- protected: |
- friend class CFWL_DateTimeCalendarImpDelegate; |
-}; |
- |
-class CFWL_DateTimeCalendarImpDelegate : public CFWL_MonthCalendarImpDelegate { |
- public: |
- CFWL_DateTimeCalendarImpDelegate(CFWL_DateTimeCalendar* pOwner); |
- void OnProcessMessage(CFWL_Message* pMessage) override; |
- |
- void OnLButtonDownEx(CFWL_MsgMouse* pMsg); |
- void OnLButtonUpEx(CFWL_MsgMouse* pMsg); |
- void OnMouseMoveEx(CFWL_MsgMouse* pMsg); |
- |
- protected: |
- CFWL_DateTimeCalendar* m_pOwner; |
- FX_BOOL m_bFlag; |
- |
- private: |
- void DisForm_OnProcessMessage(CFWL_Message* pMessage); |
- void DisForm_OnLButtonUpEx(CFWL_MsgMouse* pMsg); |
-}; |
- |
-class CFWL_DateTimePickerImp : public CFWL_WidgetImp { |
- public: |
- CFWL_DateTimePickerImp(const CFWL_WidgetImpProperties& properties, |
- IFWL_Widget* pOuter); |
- ~CFWL_DateTimePickerImp() override; |
+ IFWL_DateTimePicker(const CFWL_WidgetImpProperties& properties, |
+ IFWL_Widget* pOuter); |
+ ~IFWL_DateTimePicker() override; |
- // CFWL_WidgetImp |
+ // IFWL_Widget |
FWL_Error GetClassName(CFX_WideString& wsClass) const override; |
FWL_Type GetClassID() const override; |
FWL_Error Initialize() override; |
@@ -134,6 +88,8 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { |
FWL_Error GetEditText(CFX_WideString& wsText, |
int32_t nStart = 0, |
int32_t nCount = -1) const; |
+ int32_t CountSelRanges(); |
+ int32_t GetSelRange(int32_t nIndex, int32_t& nStart); |
FX_BOOL CanUndo(); |
FX_BOOL CanRedo(); |
@@ -156,7 +112,7 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { |
protected: |
friend class CFWL_DateTimeEditImpDelegate; |
- friend class CFWL_DateTimeCalendar; |
+ friend class IFWL_DateTimeCalendar; |
friend class CFWL_DateTimeCalendarImpDelegate; |
friend class CFWL_DateTimePickerImpDelegate; |
@@ -199,8 +155,8 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { |
int32_t m_iDay; |
FX_BOOL m_bLBtnDown; |
std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; |
- std::unique_ptr<IFWL_DateTimeCalender> m_pMonthCal; |
- std::unique_ptr<IFWL_DateTimeForm> m_pForm; |
+ std::unique_ptr<IFWL_DateTimeCalendar> m_pMonthCal; |
+ std::unique_ptr<IFWL_FormProxy> m_pForm; |
FX_FLOAT m_fBtn; |
CFWL_MonthCalendarImpDP m_MonthCalendarDP; |
@@ -221,7 +177,7 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { |
class CFWL_DateTimePickerImpDelegate : public CFWL_WidgetImpDelegate { |
public: |
- CFWL_DateTimePickerImpDelegate(CFWL_DateTimePickerImp* pOwner); |
+ CFWL_DateTimePickerImpDelegate(IFWL_DateTimePicker* pOwner); |
// CFWL_WidgetImpDelegate |
void OnProcessMessage(CFWL_Message* pMessage) override; |
@@ -235,10 +191,10 @@ class CFWL_DateTimePickerImpDelegate : public CFWL_WidgetImpDelegate { |
void OnMouseMove(CFWL_MsgMouse* pMsg); |
void OnMouseLeave(CFWL_MsgMouse* pMsg); |
- CFWL_DateTimePickerImp* m_pOwner; |
+ IFWL_DateTimePicker* m_pOwner; |
private: |
void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
}; |
-#endif // XFA_FWL_BASEWIDGET_FWL_DATETIMEPICKERIMP_H_ |
+#endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ |