Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[pdfium.git] / xfa / include / fwl / basewidget / fwl_datetimepicker.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4 \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #ifndef _FWL_DATETIMEPICKER_H\r
8 #define _FWL_DATETIMEPICKER_H\r
9 class CFWL_WidgetImpProperties;\r
10 class IFWL_Widget;\r
11 class IFWL_DateTimePickerDP;\r
12 class IFWL_DateTimePicker;\r
13 #define FWL_CLASS_DateTimePicker                        L"FWL_DATETIMEPICKER"\r
14 #define FWL_CLASSHASH_DateTimePicker            3851176257\r
15 #define FWL_STYLEEXT_DTP_AllowEdit                      (1L << 0)\r
16 #define FWL_STYLEEXT_DTP_LongDateFormat         (0L << 1)\r
17 #define FWL_STYLEEXT_DTP_ShortDateFormat        (1L << 1)\r
18 #define FWL_STYLEEXT_DTP_TimeFormat                     (2L << 1)\r
19 #define FWL_STYLEEXT_DTP_Spin                           (1L << 3)\r
20 #define FWL_STYLEEXT_DTP_EditHNear                      (0L << 4)\r
21 #define FWL_STYLEEXT_DTP_EditHCenter            (1L << 4)\r
22 #define FWL_STYLEEXT_DTP_EditHFar                       (2L     << 4)\r
23 #define FWL_STYLEEXT_DTP_EditVNear                      (0L << 6)\r
24 #define FWL_STYLEEXT_DTP_EditVCenter            (1L << 6)\r
25 #define FWL_STYLEEXT_DTP_EditVFar                       (2L     << 6)\r
26 #define FWL_STYLEEXT_DTP_EditJustified          (1L << 8)\r
27 #define FWL_STYLEEXT_DTP_EditDistributed        (2L << 8)\r
28 #define FWL_STYLEEXT_DTP_EditHAlignMask         (3L << 4)\r
29 #define FWL_STYLEEXT_DTP_EditVAlignMask         (3L << 6)\r
30 #define FWL_STYLEEXT_DTP_EditHAlignModeMask     (3L     << 8)\r
31 #define FWL_PART_DTP_Border                                     1\r
32 #define FWL_PART_DTP_Edge                                       2\r
33 #define FWL_PART_DTP_Background                         3\r
34 #define FWL_PART_DTP_DropDownButton                     4\r
35 #define FWL_PARTSTATE_DTP_Normal                        (0L << 0)\r
36 #define FWL_PARTSTATE_DTP_Hovered                       (1L << 0)\r
37 #define FWL_PARTSTATE_DTP_Pressed                       (2L << 0)\r
38 #define FWL_PARTSTATE_DTP_Disabled                      (3L << 0)\r
39 #define FWL_EVT_DTP_DropDown                            L"FWL_EVENT_DTP_DropDown"\r
40 #define FWL_EVTHASH_DTP_DropDown                        264728733\r
41 #define FWL_EVT_DTP_CloseUp                                     L"FWL_EVENT_DTP_CloseUp"\r
42 #define FWL_EVTHASH_DTP_CloseUp                         4280973803\r
43 #define FWL_EVT_DTP_EditChanged                         L"FWL_EVENT_DTP_EditChanged"\r
44 #define FWL_EVTHASH_DTP_EditChanged                     4009610944\r
45 #define FWL_EVT_DTP_HoverChanged                        L"FWL_EVENT_DTP_HoverChanged"\r
46 #define FWL_EVTHASH_DTP_HoverChanged            686674750\r
47 #define FWL_EVT_DTP_SelectChanged                       L"FWL_EVENT_DTP_SelectChanged"\r
48 #define FWL_EVTHASH_DTP_SelectChanged           1589616858\r
49 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpDropDown, FWL_EVTHASH_DTP_DropDown)\r
50 END_FWL_EVENT_DEF\r
51 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpCloseUp, FWL_EVTHASH_DTP_CloseUp)\r
52 END_FWL_EVENT_DEF\r
53 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpEditChanged, FWL_EVTHASH_DTP_EditChanged)\r
54 CFX_WideString m_wsText;\r
55 END_FWL_EVENT_DEF\r
56 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpHoverChanged, FWL_EVTHASH_DTP_HoverChanged)\r
57 FX_INT32 hoverday;\r
58 END_FWL_EVENT_DEF\r
59 BEGIN_FWL_EVENT_DEF(CFWL_Event_DtpSelectChanged, FWL_EVTHASH_DTP_SelectChanged)\r
60 FX_INT32 iYear;\r
61 FX_INT32 iMonth;\r
62 FX_INT32 iDay;\r
63 END_FWL_EVENT_DEF\r
64 class IFWL_DateTimePickerDP : public IFWL_DataProvider\r
65 {\r
66 public:\r
67     virtual FWL_ERR GetToday(IFWL_Widget *pWidget, FX_INT32 &iYear, FX_INT32 &iMonth, FX_INT32 &iDay) = 0;\r
68 };\r
69 class IFWL_DateTimePicker : public IFWL_Widget\r
70 {\r
71 public:\r
72     static IFWL_DateTimePicker* Create();\r
73     FWL_ERR             Initialize(IFWL_Widget *pOuter = NULL);\r
74     FWL_ERR             Initialize(const CFWL_WidgetImpProperties &properties, IFWL_Widget *pOuter = NULL);\r
75     FWL_ERR             GetCurSel(FX_INT32 &iYear, FX_INT32 &iMonth, FX_INT32 &iDay);\r
76     FWL_ERR             SetCurSel(FX_INT32 iYear, FX_INT32 iMonth, FX_INT32 iDay);\r
77     FWL_ERR             SetEditText(const CFX_WideString &wsText);\r
78     FWL_ERR             GetEditText(CFX_WideString &wsText, FX_INT32 nStart = 0, FX_INT32 nCount = -1) const;\r
79     FX_INT32    CountSelRanges();\r
80     FX_INT32    GetSelRange(FX_INT32 nIndex, FX_INT32 &nStart);\r
81     FX_BOOL             CanUndo();\r
82     FX_BOOL             CanRedo();\r
83     FX_BOOL             Undo();\r
84     FX_BOOL             Redo();\r
85     FX_BOOL             CanCopy();\r
86     FX_BOOL             CanCut();\r
87     FX_BOOL             CanSelectAll();\r
88     FX_BOOL             Copy(CFX_WideString &wsCopy);\r
89     FX_BOOL             Cut(CFX_WideString &wsCut);\r
90     FX_BOOL             Paste(const CFX_WideString &wsPaste);\r
91     FX_BOOL             SelectAll();\r
92     FX_BOOL             Delete();\r
93     FX_BOOL             DeSelect();\r
94     FWL_ERR             GetBBox(CFX_RectF &rect);\r
95     FWL_ERR             SetEditLimit(FX_INT32 nLimit);\r
96     FWL_ERR             ModifyEditStylesEx(FX_DWORD dwStylesExAdded, FX_DWORD dwStylesExRemoved);\r
97 protected:\r
98     IFWL_DateTimePicker();\r
99     virtual ~IFWL_DateTimePicker();\r
100 };\r
101 #endif\r