Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: xfa/fwl/core/cfwl_edit.h

Issue 2559173002: Move xfa/fwl/core to xfa/fwl. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/cfwl_datetimepicker.cpp ('k') | xfa/fwl/core/cfwl_edit.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 XFA_FWL_CORE_CFWL_EDIT_H_
8 #define XFA_FWL_CORE_CFWL_EDIT_H_
9
10 #include <deque>
11 #include <memory>
12 #include <vector>
13
14 #include "xfa/fde/cfde_txtedtengine.h"
15 #include "xfa/fde/ifde_txtedtdorecord.h"
16 #include "xfa/fwl/core/cfwl_event.h"
17 #include "xfa/fwl/core/cfwl_scrollbar.h"
18 #include "xfa/fwl/core/cfwl_widget.h"
19 #include "xfa/fxgraphics/cfx_path.h"
20
21 #define FWL_STYLEEXT_EDT_ReadOnly (1L << 0)
22 #define FWL_STYLEEXT_EDT_MultiLine (1L << 1)
23 #define FWL_STYLEEXT_EDT_WantReturn (1L << 2)
24 #define FWL_STYLEEXT_EDT_NoHideSel (1L << 3)
25 #define FWL_STYLEEXT_EDT_AutoHScroll (1L << 4)
26 #define FWL_STYLEEXT_EDT_AutoVScroll (1L << 5)
27 #define FWL_STYLEEXT_EDT_NoRedoUndo (1L << 6)
28 #define FWL_STYLEEXT_EDT_Validate (1L << 7)
29 #define FWL_STYLEEXT_EDT_Password (1L << 8)
30 #define FWL_STYLEEXT_EDT_Number (1L << 9)
31 #define FWL_STYLEEXT_EDT_VerticalLayout (1L << 12)
32 #define FWL_STYLEEXT_EDT_VerticalChars (1L << 13)
33 #define FWL_STYLEEXT_EDT_ReverseLine (1L << 14)
34 #define FWL_STYLEEXT_EDT_ArabicShapes (1L << 15)
35 #define FWL_STYLEEXT_EDT_ExpandTab (1L << 16)
36 #define FWL_STYLEEXT_EDT_CombText (1L << 17)
37 #define FWL_STYLEEXT_EDT_HNear (0L << 18)
38 #define FWL_STYLEEXT_EDT_HCenter (1L << 18)
39 #define FWL_STYLEEXT_EDT_HFar (2L << 18)
40 #define FWL_STYLEEXT_EDT_VNear (0L << 20)
41 #define FWL_STYLEEXT_EDT_VCenter (1L << 20)
42 #define FWL_STYLEEXT_EDT_VFar (2L << 20)
43 #define FWL_STYLEEXT_EDT_Justified (1L << 22)
44 #define FWL_STYLEEXT_EDT_Distributed (2L << 22)
45 #define FWL_STYLEEXT_EDT_HAlignMask (3L << 18)
46 #define FWL_STYLEEXT_EDT_VAlignMask (3L << 20)
47 #define FWL_STYLEEXT_EDT_HAlignModeMask (3L << 22)
48 #define FWL_STYLEEXT_EDT_InnerCaret (1L << 24)
49 #define FWL_STYLEEXT_EDT_ShowScrollbarFocus (1L << 25)
50 #define FWL_STYLEEXT_EDT_OuterScrollbar (1L << 26)
51 #define FWL_STYLEEXT_EDT_LastLineHeight (1L << 27)
52
53 class IFDE_TxtEdtDoRecord;
54 class CFWL_Edit;
55 class CFWL_MsgMouse;
56 class CFWL_WidgetProperties;
57 class CFWL_Caret;
58
59 class CFWL_Edit : public CFWL_Widget {
60 public:
61 CFWL_Edit(const CFWL_App* app,
62 std::unique_ptr<CFWL_WidgetProperties> properties,
63 CFWL_Widget* pOuter);
64 ~CFWL_Edit() override;
65
66 // CFWL_Widget:
67 FWL_Type GetClassID() const override;
68 CFX_RectF GetAutosizedWidgetRect() override;
69 CFX_RectF GetWidgetRect() override;
70 void Update() override;
71 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
72 void SetStates(uint32_t dwStates) override;
73 void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override;
74 void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override;
75 void OnProcessMessage(CFWL_Message* pMessage) override;
76 void OnProcessEvent(CFWL_Event* pEvent) override;
77 void OnDrawWidget(CFX_Graphics* pGraphics,
78 const CFX_Matrix* pMatrix) override;
79
80 virtual void SetText(const CFX_WideString& wsText);
81
82 int32_t GetTextLength() const;
83 CFX_WideString GetText() const;
84 void ClearText();
85
86 void AddSelRange(int32_t nStart);
87 int32_t CountSelRanges() const;
88 int32_t GetSelRange(int32_t nIndex, int32_t* nStart) const;
89 void ClearSelections();
90 int32_t GetLimit() const;
91 void SetLimit(int32_t nLimit);
92 void SetAliasChar(FX_WCHAR wAlias);
93 bool Copy(CFX_WideString& wsCopy);
94 bool Cut(CFX_WideString& wsCut);
95 bool Paste(const CFX_WideString& wsPaste);
96 bool Redo(const IFDE_TxtEdtDoRecord* pRecord);
97 bool Undo(const IFDE_TxtEdtDoRecord* pRecord);
98 bool Undo();
99 bool Redo();
100 bool CanUndo();
101 bool CanRedo();
102
103 void SetOuter(CFWL_Widget* pOuter);
104
105 void OnCaretChanged();
106 void OnTextChanged(const FDE_TXTEDT_TEXTCHANGE_INFO& ChangeInfo);
107 void OnSelChanged();
108 bool OnPageLoad(int32_t nPageIndex);
109 bool OnPageUnload(int32_t nPageIndex);
110 void OnAddDoRecord(std::unique_ptr<IFDE_TxtEdtDoRecord> pRecord);
111 bool OnValidate(const CFX_WideString& wsText);
112 void SetScrollOffset(FX_FLOAT fScrollOffset);
113
114 protected:
115 void ShowCaret(CFX_RectF* pRect);
116 void HideCaret(CFX_RectF* pRect);
117 const CFX_RectF& GetRTClient() const { return m_rtClient; }
118 CFDE_TxtEdtEngine* GetTxtEdtEngine() { return &m_EdtEngine; }
119
120 private:
121 void DrawTextBk(CFX_Graphics* pGraphics,
122 IFWL_ThemeProvider* pTheme,
123 const CFX_Matrix* pMatrix);
124 void DrawContent(CFX_Graphics* pGraphics,
125 IFWL_ThemeProvider* pTheme,
126 const CFX_Matrix* pMatrix);
127 void DrawSpellCheck(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix);
128
129 void UpdateEditEngine();
130 void UpdateEditParams();
131 void UpdateEditLayout();
132 bool UpdateOffset();
133 bool UpdateOffset(CFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged);
134 void UpdateVAlignment();
135 void UpdateCaret();
136 CFWL_ScrollBar* UpdateScroll();
137 void Layout();
138 void LayoutScrollBar();
139 void DeviceToEngine(CFX_PointF& pt);
140 void InitVerticalScrollBar();
141 void InitHorizontalScrollBar();
142 void InitEngine();
143 void InitCaret();
144 bool ValidateNumberChar(FX_WCHAR cNum);
145 void ClearRecord();
146 bool IsShowScrollBar(bool bVert);
147 bool IsContentHeightOverflow();
148 int32_t AddDoRecord(std::unique_ptr<IFDE_TxtEdtDoRecord> pRecord);
149 void ProcessInsertError(int32_t iError);
150 void AddSpellCheckObj(CFX_Path& PathData,
151 int32_t nStart,
152 int32_t nCount,
153 FX_FLOAT fOffSetX,
154 FX_FLOAT fOffSetY);
155
156 void DoButtonDown(CFWL_MsgMouse* pMsg);
157 void OnFocusChanged(CFWL_Message* pMsg, bool bSet);
158 void OnLButtonDown(CFWL_MsgMouse* pMsg);
159 void OnLButtonUp(CFWL_MsgMouse* pMsg);
160 void OnButtonDblClk(CFWL_MsgMouse* pMsg);
161 void OnMouseMove(CFWL_MsgMouse* pMsg);
162 void OnKeyDown(CFWL_MsgKey* pMsg);
163 void OnChar(CFWL_MsgKey* pMsg);
164 bool OnScroll(CFWL_ScrollBar* pScrollBar,
165 CFWL_EvtScroll::Code dwCode,
166 FX_FLOAT fPos);
167
168 CFX_RectF m_rtClient;
169 CFX_RectF m_rtEngine;
170 CFX_RectF m_rtStatic;
171 FX_FLOAT m_fVAlignOffset;
172 FX_FLOAT m_fScrollOffsetX;
173 FX_FLOAT m_fScrollOffsetY;
174 CFDE_TxtEdtEngine m_EdtEngine;
175 bool m_bLButtonDown;
176 int32_t m_nSelStart;
177 int32_t m_nLimit;
178 FX_FLOAT m_fFontSize;
179 bool m_bSetRange;
180 int32_t m_iMax;
181 std::unique_ptr<CFWL_ScrollBar> m_pVertScrollBar;
182 std::unique_ptr<CFWL_ScrollBar> m_pHorzScrollBar;
183 std::unique_ptr<CFWL_Caret> m_pCaret;
184 CFX_WideString m_wsCache;
185 CFX_WideString m_wsFont;
186 std::deque<std::unique_ptr<IFDE_TxtEdtDoRecord>> m_DoRecords;
187 int32_t m_iCurRecord;
188 int32_t m_iMaxRecord;
189 };
190
191 #endif // XFA_FWL_CORE_CFWL_EDIT_H_
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_datetimepicker.cpp ('k') | xfa/fwl/core/cfwl_edit.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698