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_INCLUDE_FWL_BASEWIDGET_FWL_DATETIMEPICKER_H_ | |
8 #define XFA_INCLUDE_FWL_BASEWIDGET_FWL_DATETIMEPICKER_H_ | |
9 | |
10 #include "xfa/include/fwl/core/fwl_note.h" | |
11 #include "xfa/include/fwl/core/fwl_widget.h" | |
12 | |
13 #define FWL_CLASS_DateTimePicker L"FWL_DATETIMEPICKER" | |
14 #define FWL_CLASSHASH_DateTimePicker 3851176257 | |
15 #define FWL_STYLEEXT_DTP_AllowEdit (1L << 0) | |
16 #define FWL_STYLEEXT_DTP_LongDateFormat (0L << 1) | |
17 #define FWL_STYLEEXT_DTP_ShortDateFormat (1L << 1) | |
18 #define FWL_STYLEEXT_DTP_TimeFormat (2L << 1) | |
19 #define FWL_STYLEEXT_DTP_Spin (1L << 3) | |
20 #define FWL_STYLEEXT_DTP_EditHNear (0L << 4) | |
21 #define FWL_STYLEEXT_DTP_EditHCenter (1L << 4) | |
22 #define FWL_STYLEEXT_DTP_EditHFar (2L << 4) | |
23 #define FWL_STYLEEXT_DTP_EditVNear (0L << 6) | |
24 #define FWL_STYLEEXT_DTP_EditVCenter (1L << 6) | |
25 #define FWL_STYLEEXT_DTP_EditVFar (2L << 6) | |
26 #define FWL_STYLEEXT_DTP_EditJustified (1L << 8) | |
27 #define FWL_STYLEEXT_DTP_EditDistributed (2L << 8) | |
28 #define FWL_STYLEEXT_DTP_EditHAlignMask (3L << 4) | |
29 #define FWL_STYLEEXT_DTP_EditVAlignMask (3L << 6) | |
30 #define FWL_STYLEEXT_DTP_EditHAlignModeMask (3L << 8) | |
31 #define FWL_PART_DTP_Border 1 | |
32 #define FWL_PART_DTP_Edge 2 | |
33 #define FWL_PART_DTP_Background 3 | |
34 #define FWL_PART_DTP_DropDownButton 4 | |
35 #define FWL_PARTSTATE_DTP_Normal (0L << 0) | |
36 #define FWL_PARTSTATE_DTP_Hovered (1L << 0) | |
37 #define FWL_PARTSTATE_DTP_Pressed (2L << 0) | |
38 #define FWL_PARTSTATE_DTP_Disabled (3L << 0) | |
39 #define FWL_EVT_DTP_DropDown L"FWL_EVENT_DTP_DropDown" | |
40 #define FWL_EVTHASH_DTP_DropDown 264728733 | |
41 #define FWL_EVT_DTP_CloseUp L"FWL_EVENT_DTP_CloseUp" | |
42 #define FWL_EVTHASH_DTP_CloseUp 4280973803 | |
43 #define FWL_EVT_DTP_EditChanged L"FWL_EVENT_DTP_EditChanged" | |
44 #define FWL_EVTHASH_DTP_EditChanged 4009610944 | |
45 #define FWL_EVT_DTP_HoverChanged L"FWL_EVENT_DTP_HoverChanged" | |
46 #define FWL_EVTHASH_DTP_HoverChanged 686674750 | |
47 #define FWL_EVT_DTP_SelectChanged L"FWL_EVENT_DTP_SelectChanged" | |
48 #define FWL_EVTHASH_DTP_SelectChanged 1589616858 | |
49 | |
50 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpDropDown, FWL_EVTHASH_DTP_DropDown) | |
51 END_FWL_EVENT_DEF | |
52 | |
53 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpCloseUp, FWL_EVTHASH_DTP_CloseUp) | |
54 END_FWL_EVENT_DEF | |
55 | |
56 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpEditChanged, FWL_EVTHASH_DTP_EditChanged) | |
57 CFX_WideString m_wsText; | |
58 END_FWL_EVENT_DEF | |
59 | |
60 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpHoverChanged, FWL_EVTHASH_DTP_HoverChanged) | |
61 int32_t hoverday; | |
62 END_FWL_EVENT_DEF | |
63 | |
64 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpSelectChanged, FWL_EVTHASH_DTP_SelectChanged) | |
65 int32_t iYear; | |
66 int32_t iMonth; | |
67 int32_t iDay; | |
68 END_FWL_EVENT_DEF | |
69 | |
70 class IFWL_DateTimePickerDP : public IFWL_DataProvider { | |
71 public: | |
72 virtual FWL_ERR GetToday(IFWL_Widget* pWidget, | |
73 int32_t& iYear, | |
74 int32_t& iMonth, | |
75 int32_t& iDay) = 0; | |
76 }; | |
77 class IFWL_DateTimePicker : public IFWL_Widget { | |
78 public: | |
79 static IFWL_DateTimePicker* Create(const CFWL_WidgetImpProperties& properties, | |
80 IFWL_Widget* pOuter); | |
81 | |
82 FWL_ERR GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); | |
83 FWL_ERR SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); | |
84 FWL_ERR SetEditText(const CFX_WideString& wsText); | |
85 FWL_ERR GetEditText(CFX_WideString& wsText, | |
86 int32_t nStart = 0, | |
87 int32_t nCount = -1) const; | |
88 int32_t CountSelRanges(); | |
89 int32_t GetSelRange(int32_t nIndex, int32_t& nStart); | |
90 FX_BOOL CanUndo(); | |
91 FX_BOOL CanRedo(); | |
92 FX_BOOL Undo(); | |
93 FX_BOOL Redo(); | |
94 FX_BOOL CanCopy(); | |
95 FX_BOOL CanCut(); | |
96 FX_BOOL CanSelectAll(); | |
97 FX_BOOL Copy(CFX_WideString& wsCopy); | |
98 FX_BOOL Cut(CFX_WideString& wsCut); | |
99 FX_BOOL Paste(const CFX_WideString& wsPaste); | |
100 FX_BOOL SelectAll(); | |
101 FX_BOOL Delete(); | |
102 FX_BOOL DeSelect(); | |
103 FWL_ERR GetBBox(CFX_RectF& rect); | |
104 FWL_ERR SetEditLimit(int32_t nLimit); | |
105 FWL_ERR ModifyEditStylesEx(FX_DWORD dwStylesExAdded, | |
106 FX_DWORD dwStylesExRemoved); | |
107 | |
108 protected: | |
109 IFWL_DateTimePicker(); | |
110 }; | |
111 | |
112 #endif // XFA_INCLUDE_FWL_BASEWIDGET_FWL_DATETIMEPICKER_H_ | |
OLD | NEW |