dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 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 | |
dsinclair | 5b49309 | 2016-09-29 20:20:24 -0700 | [diff] [blame] | 7 | #ifndef XFA_FXFA_XFA_FFWIDGETHANDLER_H_ |
| 8 | #define XFA_FXFA_XFA_FFWIDGETHANDLER_H_ |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 9 | |
| 10 | #include <vector> |
| 11 | |
dsinclair | 5b49309 | 2016-09-29 20:20:24 -0700 | [diff] [blame] | 12 | #include "xfa/fxfa/cxfa_eventparam.h" |
| 13 | #include "xfa/fxfa/fxfa.h" |
dsinclair | 1628024 | 2016-07-21 12:03:47 -0700 | [diff] [blame] | 14 | #include "xfa/fxfa/parser/cxfa_document.h" |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 15 | |
| 16 | class CXFA_FFDocView; |
dsinclair | 89fcde8 | 2016-05-03 13:00:25 -0700 | [diff] [blame] | 17 | enum class FWL_WidgetHit; |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 18 | |
| 19 | class CXFA_FFWidgetHandler { |
| 20 | public: |
| 21 | CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView); |
| 22 | ~CXFA_FFWidgetHandler(); |
dsinclair | 221caf6 | 2016-04-04 12:08:40 -0700 | [diff] [blame] | 23 | |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 24 | CXFA_FFWidget* CreateWidget(CXFA_FFWidget* hParent, |
| 25 | XFA_WIDGETTYPE eType, |
dsinclair | 85d1f2c | 2016-06-23 12:40:16 -0700 | [diff] [blame] | 26 | CXFA_FFWidget* hBefore = nullptr); |
dsinclair | 221caf6 | 2016-04-04 12:08:40 -0700 | [diff] [blame] | 27 | |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 28 | bool OnMouseEnter(CXFA_FFWidget* hWidget); |
| 29 | bool OnMouseExit(CXFA_FFWidget* hWidget); |
| 30 | bool OnLButtonDown(CXFA_FFWidget* hWidget, |
| 31 | uint32_t dwFlags, |
| 32 | FX_FLOAT fx, |
| 33 | FX_FLOAT fy); |
| 34 | bool OnLButtonUp(CXFA_FFWidget* hWidget, |
| 35 | uint32_t dwFlags, |
| 36 | FX_FLOAT fx, |
| 37 | FX_FLOAT fy); |
| 38 | bool OnLButtonDblClk(CXFA_FFWidget* hWidget, |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 39 | uint32_t dwFlags, |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 40 | FX_FLOAT fx, |
| 41 | FX_FLOAT fy); |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 42 | bool OnMouseMove(CXFA_FFWidget* hWidget, |
| 43 | uint32_t dwFlags, |
| 44 | FX_FLOAT fx, |
| 45 | FX_FLOAT fy); |
| 46 | bool OnMouseWheel(CXFA_FFWidget* hWidget, |
| 47 | uint32_t dwFlags, |
| 48 | int16_t zDelta, |
| 49 | FX_FLOAT fx, |
| 50 | FX_FLOAT fy); |
| 51 | bool OnRButtonDown(CXFA_FFWidget* hWidget, |
| 52 | uint32_t dwFlags, |
| 53 | FX_FLOAT fx, |
| 54 | FX_FLOAT fy); |
| 55 | bool OnRButtonUp(CXFA_FFWidget* hWidget, |
| 56 | uint32_t dwFlags, |
| 57 | FX_FLOAT fx, |
| 58 | FX_FLOAT fy); |
| 59 | bool OnRButtonDblClk(CXFA_FFWidget* hWidget, |
| 60 | uint32_t dwFlags, |
| 61 | FX_FLOAT fx, |
| 62 | FX_FLOAT fy); |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 63 | |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 64 | bool OnKeyDown(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags); |
| 65 | bool OnKeyUp(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags); |
| 66 | bool OnChar(CXFA_FFWidget* hWidget, uint32_t dwChar, uint32_t dwFlags); |
dsinclair | 89fcde8 | 2016-05-03 13:00:25 -0700 | [diff] [blame] | 67 | FWL_WidgetHit OnHitTest(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy); |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 68 | bool OnSetCursor(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy); |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 69 | void RenderWidget(CXFA_FFWidget* hWidget, |
| 70 | CFX_Graphics* pGS, |
dsinclair | 9d6ca99 | 2016-06-16 10:51:56 -0700 | [diff] [blame] | 71 | CFX_Matrix* pMatrix, |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 72 | bool bHighlight); |
| 73 | bool HasEvent(CXFA_WidgetAcc* pWidgetAcc, XFA_EVENTTYPE eEventType); |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 74 | int32_t ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, CXFA_EventParam* pParam); |
| 75 | |
| 76 | protected: |
| 77 | CXFA_Node* CreateWidgetFormItem(XFA_WIDGETTYPE eType, |
| 78 | CXFA_Node* pParent, |
| 79 | CXFA_Node* pBefore) const; |
| 80 | |
| 81 | CXFA_Node* CreatePushButton(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 82 | CXFA_Node* CreateCheckButton(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 83 | CXFA_Node* CreateExclGroup(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 84 | CXFA_Node* CreateRadioButton(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 85 | CXFA_Node* CreateDatetimeEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 86 | CXFA_Node* CreateDecimalField(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 87 | CXFA_Node* CreateNumericField(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 88 | CXFA_Node* CreateSignature(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 89 | CXFA_Node* CreateTextEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 90 | CXFA_Node* CreateDropdownList(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 91 | CXFA_Node* CreateListBox(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 92 | CXFA_Node* CreateImageField(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 93 | CXFA_Node* CreatePasswordEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
dsinclair | 56a8b19 | 2016-06-21 14:15:25 -0700 | [diff] [blame] | 94 | CXFA_Node* CreateField(XFA_Element eElement, |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 95 | CXFA_Node* pParent, |
| 96 | CXFA_Node* pBefore) const; |
| 97 | CXFA_Node* CreateArc(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 98 | CXFA_Node* CreateRectangle(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 99 | CXFA_Node* CreateImage(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 100 | CXFA_Node* CreateLine(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 101 | CXFA_Node* CreateText(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
dsinclair | 56a8b19 | 2016-06-21 14:15:25 -0700 | [diff] [blame] | 102 | CXFA_Node* CreateDraw(XFA_Element eElement, |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 103 | CXFA_Node* pParent, |
| 104 | CXFA_Node* pBefore) const; |
| 105 | |
| 106 | CXFA_Node* CreateSubform(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
dsinclair | 56a8b19 | 2016-06-21 14:15:25 -0700 | [diff] [blame] | 107 | CXFA_Node* CreateFormItem(XFA_Element eElement, |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 108 | CXFA_Node* pParent, |
| 109 | CXFA_Node* pBefore) const; |
dsinclair | 56a8b19 | 2016-06-21 14:15:25 -0700 | [diff] [blame] | 110 | CXFA_Node* CreateCopyNode(XFA_Element eElement, |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 111 | CXFA_Node* pParent, |
dsinclair | 85d1f2c | 2016-06-23 12:40:16 -0700 | [diff] [blame] | 112 | CXFA_Node* pBefore = nullptr) const; |
dsinclair | 56a8b19 | 2016-06-21 14:15:25 -0700 | [diff] [blame] | 113 | CXFA_Node* CreateTemplateNode(XFA_Element eElement, |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 114 | CXFA_Node* pParent, |
| 115 | CXFA_Node* pBefore) const; |
| 116 | CXFA_Node* CreateFontNode(CXFA_Node* pParent) const; |
| 117 | CXFA_Node* CreateMarginNode(CXFA_Node* pParent, |
| 118 | uint32_t dwFlags, |
| 119 | FX_FLOAT fInsets[4]) const; |
dsinclair | 56a8b19 | 2016-06-21 14:15:25 -0700 | [diff] [blame] | 120 | CXFA_Node* CreateValueNode(XFA_Element eValue, CXFA_Node* pParent) const; |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 121 | CXFA_Document* GetObjFactory() const; |
| 122 | CXFA_Document* GetXFADoc() const; |
| 123 | |
| 124 | CXFA_FFDocView* m_pDocView; |
| 125 | }; |
| 126 | |
dsinclair | 5b49309 | 2016-09-29 20:20:24 -0700 | [diff] [blame] | 127 | #endif // XFA_FXFA_XFA_FFWIDGETHANDLER_H_ |