• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 _FWL_DATETIMEPICKER_H
8 #define _FWL_DATETIMEPICKER_H
9 class CFWL_WidgetImpProperties;
10 class IFWL_Widget;
11 class IFWL_DateTimePickerDP;
12 class IFWL_DateTimePicker;
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 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpDropDown, FWL_EVTHASH_DTP_DropDown)
50 END_FWL_EVENT_DEF
51 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpCloseUp, FWL_EVTHASH_DTP_CloseUp)
52 END_FWL_EVENT_DEF
53 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpEditChanged, FWL_EVTHASH_DTP_EditChanged)
54 CFX_WideString m_wsText;
55 END_FWL_EVENT_DEF
56 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpHoverChanged, FWL_EVTHASH_DTP_HoverChanged)
57 int32_t hoverday;
58 END_FWL_EVENT_DEF
59 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpSelectChanged, FWL_EVTHASH_DTP_SelectChanged)
60 int32_t iYear;
61 int32_t iMonth;
62 int32_t iDay;
63 END_FWL_EVENT_DEF
64 class IFWL_DateTimePickerDP : public IFWL_DataProvider {
65  public:
66   virtual FWL_ERR GetToday(IFWL_Widget* pWidget,
67                            int32_t& iYear,
68                            int32_t& iMonth,
69                            int32_t& iDay) = 0;
70 };
71 class IFWL_DateTimePicker : public IFWL_Widget {
72  public:
73   static IFWL_DateTimePicker* Create(const CFWL_WidgetImpProperties& properties,
74                                      IFWL_Widget* pOuter);
75 
76   FWL_ERR GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay);
77   FWL_ERR SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay);
78   FWL_ERR SetEditText(const CFX_WideString& wsText);
79   FWL_ERR GetEditText(CFX_WideString& wsText,
80                       int32_t nStart = 0,
81                       int32_t nCount = -1) const;
82   int32_t CountSelRanges();
83   int32_t GetSelRange(int32_t nIndex, int32_t& nStart);
84   FX_BOOL CanUndo();
85   FX_BOOL CanRedo();
86   FX_BOOL Undo();
87   FX_BOOL Redo();
88   FX_BOOL CanCopy();
89   FX_BOOL CanCut();
90   FX_BOOL CanSelectAll();
91   FX_BOOL Copy(CFX_WideString& wsCopy);
92   FX_BOOL Cut(CFX_WideString& wsCut);
93   FX_BOOL Paste(const CFX_WideString& wsPaste);
94   FX_BOOL SelectAll();
95   FX_BOOL Delete();
96   FX_BOOL DeSelect();
97   FWL_ERR GetBBox(CFX_RectF& rect);
98   FWL_ERR SetEditLimit(int32_t nLimit);
99   FWL_ERR ModifyEditStylesEx(FX_DWORD dwStylesExAdded,
100                              FX_DWORD dwStylesExRemoved);
101 
102  protected:
103   IFWL_DateTimePicker();
104 };
105 #endif
106