OLD | NEW |
| (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_BASEWIDGET_IFWL_DATETIMEPICKER_H_ | |
8 #define XFA_FWL_BASEWIDGET_IFWL_DATETIMEPICKER_H_ | |
9 | |
10 #include "xfa/fwl/core/cfwl_event.h" | |
11 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" | |
12 #include "xfa/fwl/core/ifwl_dataprovider.h" | |
13 #include "xfa/fwl/core/ifwl_widget.h" | |
14 | |
15 #define FWL_CLASS_DateTimePicker L"FWL_DATETIMEPICKER" | |
16 #define FWL_STYLEEXT_DTP_AllowEdit (1L << 0) | |
17 #define FWL_STYLEEXT_DTP_LongDateFormat (0L << 1) | |
18 #define FWL_STYLEEXT_DTP_ShortDateFormat (1L << 1) | |
19 #define FWL_STYLEEXT_DTP_TimeFormat (2L << 1) | |
20 #define FWL_STYLEEXT_DTP_Spin (1L << 3) | |
21 #define FWL_STYLEEXT_DTP_EditHNear (0L << 4) | |
22 #define FWL_STYLEEXT_DTP_EditHCenter (1L << 4) | |
23 #define FWL_STYLEEXT_DTP_EditHFar (2L << 4) | |
24 #define FWL_STYLEEXT_DTP_EditVNear (0L << 6) | |
25 #define FWL_STYLEEXT_DTP_EditVCenter (1L << 6) | |
26 #define FWL_STYLEEXT_DTP_EditVFar (2L << 6) | |
27 #define FWL_STYLEEXT_DTP_EditJustified (1L << 8) | |
28 #define FWL_STYLEEXT_DTP_EditDistributed (2L << 8) | |
29 #define FWL_STYLEEXT_DTP_EditHAlignMask (3L << 4) | |
30 #define FWL_STYLEEXT_DTP_EditVAlignMask (3L << 6) | |
31 #define FWL_STYLEEXT_DTP_EditHAlignModeMask (3L << 8) | |
32 | |
33 FWL_EVENT_DEF(CFWL_Event_DtpDropDown, CFWL_EventType::DropDown) | |
34 | |
35 FWL_EVENT_DEF(CFWL_Event_DtpCloseUp, CFWL_EventType::CloseUp) | |
36 | |
37 FWL_EVENT_DEF(CFWL_Event_DtpEditChanged, | |
38 CFWL_EventType::EditChanged, | |
39 CFX_WideString m_wsText;) | |
40 | |
41 FWL_EVENT_DEF(CFWL_Event_DtpHoverChanged, | |
42 CFWL_EventType::HoverChanged, | |
43 int32_t hoverday;) | |
44 | |
45 FWL_EVENT_DEF(CFWL_Event_DtpSelectChanged, | |
46 CFWL_EventType::SelectChanged, | |
47 int32_t iYear; | |
48 int32_t iMonth; | |
49 int32_t iDay;) | |
50 | |
51 class IFWL_DateTimePickerDP : public IFWL_DataProvider { | |
52 public: | |
53 virtual FWL_Error GetToday(IFWL_Widget* pWidget, | |
54 int32_t& iYear, | |
55 int32_t& iMonth, | |
56 int32_t& iDay) = 0; | |
57 }; | |
58 | |
59 class IFWL_DateTimePicker : public IFWL_Widget { | |
60 public: | |
61 static IFWL_DateTimePicker* Create(const CFWL_WidgetImpProperties& properties, | |
62 IFWL_Widget* pOuter); | |
63 | |
64 FWL_Error GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); | |
65 FWL_Error SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); | |
66 FWL_Error SetEditText(const CFX_WideString& wsText); | |
67 FWL_Error GetEditText(CFX_WideString& wsText, | |
68 int32_t nStart = 0, | |
69 int32_t nCount = -1) const; | |
70 int32_t CountSelRanges(); | |
71 int32_t GetSelRange(int32_t nIndex, int32_t& nStart); | |
72 FX_BOOL CanUndo(); | |
73 FX_BOOL CanRedo(); | |
74 FX_BOOL Undo(); | |
75 FX_BOOL Redo(); | |
76 FX_BOOL CanCopy(); | |
77 FX_BOOL CanCut(); | |
78 FX_BOOL CanSelectAll(); | |
79 FX_BOOL Copy(CFX_WideString& wsCopy); | |
80 FX_BOOL Cut(CFX_WideString& wsCut); | |
81 FX_BOOL Paste(const CFX_WideString& wsPaste); | |
82 FX_BOOL SelectAll(); | |
83 FX_BOOL Delete(); | |
84 FX_BOOL DeSelect(); | |
85 FWL_Error GetBBox(CFX_RectF& rect); | |
86 FWL_Error SetEditLimit(int32_t nLimit); | |
87 FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, | |
88 uint32_t dwStylesExRemoved); | |
89 | |
90 protected: | |
91 IFWL_DateTimePicker(); | |
92 }; | |
93 | |
94 #endif // XFA_FWL_BASEWIDGET_IFWL_DATETIMEPICKER_H_ | |
OLD | NEW |