• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 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_FXFA_CXFA_FFDATETIMEEDIT_H_
8 #define XFA_FXFA_CXFA_FFDATETIMEEDIT_H_
9 
10 #include "core/fxcrt/fx_coordinates.h"
11 #include "xfa/fxfa/cxfa_fftextedit.h"
12 
13 enum XFA_DATETIMETYPE {
14   XFA_DATETIMETYPE_Date = 0,
15   XFA_DATETIMETYPE_Time,
16   XFA_DATETIMETYPE_DateAndTime
17 };
18 
19 class CFWL_DateTimePicker;
20 class CFWL_Event;
21 class CFWL_Widget;
22 
23 class CXFA_FFDateTimeEdit final : public CXFA_FFTextEdit {
24  public:
25   explicit CXFA_FFDateTimeEdit(CXFA_Node* pNode);
26   ~CXFA_FFDateTimeEdit() override;
27 
28   // CXFA_FFTextEdit
29   CFX_RectF GetBBox(FocusOption focus) override;
30   bool LoadWidget() override;
31   void UpdateWidgetProperty() override;
32   void OnProcessEvent(CFWL_Event* pEvent) override;
33 
34   void OnSelectChanged(CFWL_Widget* pWidget,
35                        int32_t iYear,
36                        int32_t iMonth,
37                        int32_t iDay);
38 
39   // CXFA_FFWidget
40   bool CanUndo() override;
41   bool CanRedo() override;
42   bool Undo() override;
43   bool Redo() override;
44   bool CanCopy() override;
45   bool CanCut() override;
46   bool CanPaste() override;
47   bool CanSelectAll() override;
48   Optional<WideString> Copy() override;
49   Optional<WideString> Cut() override;
50   bool Paste(const WideString& wsPaste) override;
51   void SelectAll() override;
52   void Delete() override;
53   void DeSelect() override;
54   WideString GetText() override;
55 
56  private:
57   bool PtInActiveRect(const CFX_PointF& point) override;
58   bool CommitData() override;
59   bool UpdateFWLData() override;
60   bool IsDataChanged() override;
61 
62   CFWL_DateTimePicker* GetPickerWidget();
63 
64   uint32_t GetAlignment();
65 };
66 
67 #endif  // XFA_FXFA_CXFA_FFDATETIMEEDIT_H_
68