7#ifndef XFA_FWL_CFWL_EDIT_H_
8#define XFA_FWL_CFWL_EDIT_H_
13#include "xfa/fde/cfde_texteditengine.h"
14#include "xfa/fgas/graphics/cfgas_gepath.h"
15#include "xfa/fwl/cfwl_event.h"
16#include "xfa/fwl/cfwl_scrollbar.h"
17#include "xfa/fwl/cfwl_widget.h"
19#define FWL_STYLEEXT_EDT_ReadOnly (1L
<< 0
)
20#define FWL_STYLEEXT_EDT_MultiLine (1L
<< 1
)
21#define FWL_STYLEEXT_EDT_WantReturn (1L
<< 2
)
22#define FWL_STYLEEXT_EDT_AutoHScroll (1L
<< 4
)
23#define FWL_STYLEEXT_EDT_AutoVScroll (1L
<< 5
)
24#define FWL_STYLEEXT_EDT_Validate (1L
<< 7
)
25#define FWL_STYLEEXT_EDT_Password (1L
<< 8
)
26#define FWL_STYLEEXT_EDT_Number (1L
<< 9
)
27#define FWL_STYLEEXT_EDT_CombText (1L
<< 17
)
28#define FWL_STYLEEXT_EDT_HNear 0
29#define FWL_STYLEEXT_EDT_HCenter (1L
<< 18
)
30#define FWL_STYLEEXT_EDT_HFar (2L
<< 18
)
31#define FWL_STYLEEXT_EDT_VNear 0
32#define FWL_STYLEEXT_EDT_VCenter (1L
<< 20
)
33#define FWL_STYLEEXT_EDT_VFar (2L
<< 20
)
34#define FWL_STYLEEXT_EDT_Justified (1L
<< 22
)
35#define FWL_STYLEEXT_EDT_HAlignMask (3L
<< 18
)
36#define FWL_STYLEEXT_EDT_VAlignMask (3L
<< 20
)
37#define FWL_STYLEEXT_EDT_HAlignModeMask (3L
<< 22
)
38#define FWL_STYLEEXT_EDT_ShowScrollbarFocus (1L
<< 25
)
39#define FWL_STYLEEXT_EDT_OuterScrollbar (1L
<< 26
)
42class CFWL_MessageMouse;
53 void Trace(cppgc::Visitor* visitor)
const override;
59 void SetStates(uint32_t dwStates)
override;
67 virtual void SetText(
const WideString& wsText);
85 bool Paste(
const WideString& wsPaste);
97 bool OnValidate(
const WideString& wsText)
override;
116 void UpdateEditEngine();
117 void UpdateEditParams();
118 void UpdateEditLayout();
120 bool UpdateOffset(CFWL_ScrollBar* pScrollBar,
float fPosChanged);
121 void UpdateVAlignment();
123 CFWL_ScrollBar* UpdateScroll();
125 void LayoutScrollBar();
126 CFX_PointF DeviceToEngine(
const CFX_PointF& pt);
127 void InitVerticalScrollBar();
130 bool IsShowVertScrollBar()
const;
131 bool IsContentHeightOverflow()
const;
132 void SetCursorPosition(size_t position);
133 void UpdateCursorRect();
135 void DoRButtonDown(CFWL_MessageMouse* pMsg);
136 void OnFocusGained();
138 void OnLButtonDown(CFWL_MessageMouse* pMsg);
139 void OnLButtonUp(CFWL_MessageMouse* pMsg);
140 void OnButtonDoubleClick(CFWL_MessageMouse* pMsg);
141 void OnMouseMove(CFWL_MessageMouse* pMsg);
142 void OnKeyDown(CFWL_MessageKey* pMsg);
143 void OnChar(CFWL_MessageKey* pMsg);
144 bool OnScroll(CFWL_ScrollBar* pScrollBar,
145 CFWL_EventScroll::
Code dwCode,
152 bool m_bLButtonDown =
false;
153 int32_t m_nLimit = -1;
154 float m_fVAlignOffset = 0.0f;
155 float m_fScrollOffsetX = 0.0f;
156 float m_fScrollOffsetY = 0.0f;
157 float m_fFontSize = 0.0f;
158 size_t m_CursorPosition = 0;
159 std::unique_ptr<CFDE_TextEditEngine>
const m_pEditEngine;
160 cppgc::Member<CFWL_ScrollBar> m_pVertScrollBar;
161 cppgc::Member<CFWL_Caret> m_pCaret;
162 WideString m_wsCache;
void SetDataLength(int32_t dataLength)
FWL_Type GetClassID() const override
void SetType(BC_TYPE type)
void SetCalChecksum(bool calChecksum)
void SetWideNarrowRatio(int8_t ratio)
void OnProcessEvent(CFWL_Event *pEvent) override
void DrawWidget(CFGAS_GEGraphics *pGraphics, const CFX_Matrix &matrix) override
void SetPrintChecksum(bool printChecksum)
void SetTextLocation(BC_TEXT_LOC location)
void SetStartChar(char startChar)
void SetText(const WideString &wsText) override
void SetEndChar(char endChar)
void SetModuleHeight(int32_t height)
void SetErrorCorrectionLevel(int32_t ecLevel)
void SetTextSkipNotify(const WideString &wsText) override
void SetModuleWidth(int32_t width)
bool IsProtectedType() const
void SetCharEncoding(BC_CHAR_ENCODING encoding)
CFX_RectF GetAutosizedWidgetRect() override
void OnTextChanged() override
CFX_RectF GetWidgetRect() override
virtual void SetText(const WideString &wsText)
void SetLimit(int32_t nLimit)
const CFX_RectF & GetRTClient() const
void OnProcessMessage(CFWL_Message *pMessage) override
void OnCaretChanged() override
void DrawWidget(CFGAS_GEGraphics *pGraphics, const CFX_Matrix &matrix) override
size_t GetTextLength() const
CFDE_TextEditEngine * GetTxtEdtEngine()
void Trace(cppgc::Visitor *visitor) const override
void SetScrollOffset(float fScrollOffset) override
CFWL_Edit(CFWL_App *app, const Properties &properties, CFWL_Widget *pOuter)
FWL_WidgetHit HitTest(const CFX_PointF &point) override
bool OnValidate(const WideString &wsText) override
void SetAliasChar(wchar_t wAlias)
bool Paste(const WideString &wsPaste)
void OnTextWillChange(CFDE_TextEditEngine::TextChange *change) override
absl::optional< WideString > Cut()
WideString GetText() const
FWL_Type GetClassID() const override
void PreFinalize() override
void ShowCaret(CFX_RectF *pRect)
void OnProcessEvent(CFWL_Event *pEvent) override
absl::optional< WideString > Copy()
void OnDrawWidget(CFGAS_GEGraphics *pGraphics, const CFX_Matrix &matrix) override
void SetStates(uint32_t dwStates) override
void HideCaret(CFX_RectF *pRect)
bool HasSelection() const
void OnSelChanged() override
void NotifyTextFull() override
std::pair< size_t, size_t > GetSelection() const
virtual void SetTextSkipNotify(const WideString &wsText)
void Concat(const CFX_Matrix &right)
#define CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED