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 _FWL_EDIT_LIGHT_H
8 #define _FWL_EDIT_LIGHT_H
9 class CFWL_Widget;
10 class CFWL_WidgetProperties;
11 class CFWL_Edit;
12 class CFWL_Edit : public CFWL_Widget {
13  public:
14   static CFWL_Edit* Create();
15   FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL);
16   FWL_ERR SetText(const CFX_WideString& wsText);
17   int32_t GetTextLength() const;
18   FWL_ERR GetText(CFX_WideString& wsText,
19                   int32_t nStart = 0,
20                   int32_t nCount = -1) const;
21   FWL_ERR ClearText();
22   int32_t GetCaretPos() const;
23   int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE);
24   FWL_ERR AddSelRange(int32_t nStart, int32_t nCount = -1);
25   int32_t CountSelRanges();
26   int32_t GetSelRange(int32_t nIndex, int32_t& nStart);
27   FWL_ERR ClearSelections();
28   int32_t GetLimit();
29   FWL_ERR SetLimit(int32_t nLimit);
30   FWL_ERR SetAliasChar(FX_WCHAR wAlias);
31   FWL_ERR SetFormatString(const CFX_WideString& wsFormat);
32   FWL_ERR Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLen);
33   FWL_ERR DeleteSelections();
34   FWL_ERR DeleteRange(int32_t nStart, int32_t nCount = -1);
35   FWL_ERR ReplaceSelections(const CFX_WideStringC& wsReplace);
36   FWL_ERR Replace(int32_t nStart,
37                   int32_t nLen,
38                   const CFX_WideStringC& wsReplace);
39   FWL_ERR DoClipboard(int32_t iCmd);
40   FX_BOOL Redo(const CFX_ByteStringC& bsRecord);
41   FX_BOOL Undo(const CFX_ByteStringC& bsRecord);
42   FWL_ERR SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant);
43   FWL_ERR SetNumberRange(int32_t iMin, int32_t iMax);
44   FWL_ERR SetBackColor(FX_DWORD dwColor);
45   FWL_ERR SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize);
46   FX_BOOL CanUndo();
47   FX_BOOL CanRedo();
48   FX_BOOL Undo();
49   FX_BOOL Redo();
50   FX_BOOL Copy(CFX_WideString& wsCopy);
51   FX_BOOL Cut(CFX_WideString& wsCut);
52   FX_BOOL Paste(const CFX_WideString& wsPaste);
53   FX_BOOL Delete();
54   void SetScrollOffset(FX_FLOAT fScrollOffset);
55   FX_BOOL GetSuggestWords(CFX_PointF pointf, CFX_ByteStringArray& sSuggest);
56   FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf,
57                                 const CFX_ByteStringC& bsReplace);
58   CFWL_Edit();
59   virtual ~CFWL_Edit();
60 };
61 #endif
62