OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FXFA_APP_XFA_FFFIELD_H_ | 7 #ifndef XFA_FXFA_APP_XFA_FFFIELD_H_ |
8 #define XFA_FXFA_APP_XFA_FFFIELD_H_ | 8 #define XFA_FXFA_APP_XFA_FFFIELD_H_ |
9 | 9 |
10 #include "xfa/fwl/core/cfwl_widget.h" | 10 #include "xfa/fwl/core/cfwl_widget.h" |
11 #include "xfa/fwl/core/ifwl_widgetdelegate.h" | 11 #include "xfa/fwl/core/ifwl_widgetdelegate.h" |
12 #include "xfa/fxfa/xfa_ffpageview.h" | 12 #include "xfa/fxfa/xfa_ffpageview.h" |
13 #include "xfa/fxfa/xfa_ffwidget.h" | 13 #include "xfa/fxfa/xfa_ffwidget.h" |
14 | 14 |
15 #define XFA_MINUI_HEIGHT 4.32f | 15 #define XFA_MINUI_HEIGHT 4.32f |
16 #define XFA_DEFAULTUI_HEIGHT 2.0f | 16 #define XFA_DEFAULTUI_HEIGHT 2.0f |
17 | 17 |
18 class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { | 18 class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { |
19 public: | 19 public: |
20 CXFA_FFField(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); | 20 CXFA_FFField(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); |
21 ~CXFA_FFField() override; | 21 ~CXFA_FFField() override; |
22 | 22 |
23 // CXFA_FFWidget | 23 // CXFA_FFWidget |
24 FX_BOOL GetBBox(CFX_RectF& rtBox, | 24 bool GetBBox(CFX_RectF& rtBox, |
25 uint32_t dwStatus, | 25 uint32_t dwStatus, |
26 FX_BOOL bDrawFocus = FALSE) override; | 26 bool bDrawFocus = false) override; |
27 void RenderWidget(CFX_Graphics* pGS, | 27 void RenderWidget(CFX_Graphics* pGS, |
28 CFX_Matrix* pMatrix, | 28 CFX_Matrix* pMatrix, |
29 uint32_t dwStatus) override; | 29 uint32_t dwStatus) override; |
30 FX_BOOL IsLoaded() override; | 30 bool IsLoaded() override; |
31 FX_BOOL LoadWidget() override; | 31 bool LoadWidget() override; |
32 void UnloadWidget() override; | 32 void UnloadWidget() override; |
33 FX_BOOL PerformLayout() override; | 33 bool PerformLayout() override; |
34 FX_BOOL OnMouseEnter() override; | 34 bool OnMouseEnter() override; |
35 FX_BOOL OnMouseExit() override; | 35 bool OnMouseExit() override; |
36 FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; | 36 bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; |
37 FX_BOOL OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; | 37 bool OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; |
38 FX_BOOL OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; | 38 bool OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; |
39 FX_BOOL OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; | 39 bool OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; |
40 FX_BOOL OnMouseWheel(uint32_t dwFlags, | 40 bool OnMouseWheel(uint32_t dwFlags, |
41 int16_t zDelta, | 41 int16_t zDelta, |
42 FX_FLOAT fx, | 42 FX_FLOAT fx, |
43 FX_FLOAT fy) override; | 43 FX_FLOAT fy) override; |
44 FX_BOOL OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; | 44 bool OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; |
45 FX_BOOL OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; | 45 bool OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; |
46 FX_BOOL OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; | 46 bool OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; |
47 | 47 |
48 FX_BOOL OnSetFocus(CXFA_FFWidget* pOldWidget) override; | 48 bool OnSetFocus(CXFA_FFWidget* pOldWidget) override; |
49 FX_BOOL OnKillFocus(CXFA_FFWidget* pNewWidget) override; | 49 bool OnKillFocus(CXFA_FFWidget* pNewWidget) override; |
50 FX_BOOL OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) override; | 50 bool OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) override; |
51 FX_BOOL OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) override; | 51 bool OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) override; |
52 FX_BOOL OnChar(uint32_t dwChar, uint32_t dwFlags) override; | 52 bool OnChar(uint32_t dwChar, uint32_t dwFlags) override; |
53 FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy) override; | 53 FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy) override; |
54 FX_BOOL OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) override; | 54 bool OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) override; |
55 | 55 |
56 // IFWL_WidgetDelegate | 56 // IFWL_WidgetDelegate |
57 void OnProcessMessage(CFWL_Message* pMessage) override; | 57 void OnProcessMessage(CFWL_Message* pMessage) override; |
58 void OnProcessEvent(CFWL_Event* pEvent) override; | 58 void OnProcessEvent(CFWL_Event* pEvent) override; |
59 void OnDrawWidget(CFX_Graphics* pGraphics, | 59 void OnDrawWidget(CFX_Graphics* pGraphics, |
60 const CFX_Matrix* pMatrix = nullptr) override; | 60 const CFX_Matrix* pMatrix = nullptr) override; |
61 | 61 |
62 void UpdateFWL(); | 62 void UpdateFWL(); |
63 uint32_t UpdateUIProperty(); | 63 uint32_t UpdateUIProperty(); |
64 | 64 |
65 protected: | 65 protected: |
66 FX_BOOL PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) override; | 66 bool PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) override; |
67 | 67 |
68 virtual void SetFWLRect(); | 68 virtual void SetFWLRect(); |
69 void SetFWLThemeProvider(); | 69 void SetFWLThemeProvider(); |
70 CFWL_Widget* GetNormalWidget() { return m_pNormalWidget; } | 70 CFWL_Widget* GetNormalWidget() { return m_pNormalWidget; } |
71 void FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy); | 71 void FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy); |
72 void LayoutCaption(); | 72 void LayoutCaption(); |
73 void RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix = nullptr); | 73 void RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix = nullptr); |
74 | 74 |
75 int32_t CalculateOverride(); | 75 int32_t CalculateOverride(); |
76 int32_t CalculateWidgetAcc(CXFA_WidgetAcc* pAcc); | 76 int32_t CalculateWidgetAcc(CXFA_WidgetAcc* pAcc); |
77 FX_BOOL ProcessCommittedData(); | 77 bool ProcessCommittedData(); |
78 virtual FX_BOOL CommitData(); | 78 virtual bool CommitData(); |
79 virtual FX_BOOL IsDataChanged(); | 79 virtual bool IsDataChanged(); |
80 void DrawHighlight(CFX_Graphics* pGS, | 80 void DrawHighlight(CFX_Graphics* pGS, |
81 CFX_Matrix* pMatrix, | 81 CFX_Matrix* pMatrix, |
82 uint32_t dwStatus, | 82 uint32_t dwStatus, |
83 FX_BOOL bEllipse = FALSE); | 83 bool bEllipse = false); |
84 void DrawFocus(CFX_Graphics* pGS, CFX_Matrix* pMatrix); | 84 void DrawFocus(CFX_Graphics* pGS, CFX_Matrix* pMatrix); |
85 void TranslateFWLMessage(CFWL_Message* pMessage); | 85 void TranslateFWLMessage(CFWL_Message* pMessage); |
86 void CapPlacement(); | 86 void CapPlacement(); |
87 void CapTopBottomPlacement(CXFA_Caption caption, | 87 void CapTopBottomPlacement(CXFA_Caption caption, |
88 const CFX_RectF& rtWidget, | 88 const CFX_RectF& rtWidget, |
89 int32_t iCapPlacement); | 89 int32_t iCapPlacement); |
90 void CapLeftRightPlacement(CXFA_Caption caption, | 90 void CapLeftRightPlacement(CXFA_Caption caption, |
91 const CFX_RectF& rtWidget, | 91 const CFX_RectF& rtWidget, |
92 int32_t iCapPlacement); | 92 int32_t iCapPlacement); |
93 void SetEditScrollOffset(); | 93 void SetEditScrollOffset(); |
94 | 94 |
95 CFWL_Widget* m_pNormalWidget; | 95 CFWL_Widget* m_pNormalWidget; |
96 CFX_RectF m_rtUI; | 96 CFX_RectF m_rtUI; |
97 CFX_RectF m_rtCaption; | 97 CFX_RectF m_rtCaption; |
98 }; | 98 }; |
99 | 99 |
100 #endif // XFA_FXFA_APP_XFA_FFFIELD_H_ | 100 #endif // XFA_FXFA_APP_XFA_FFFIELD_H_ |
OLD | NEW |