ReactOS  0.4.14-dev-52-g6116262
CRichEdit Class Reference

#include <crichedit.h>

Inheritance diagram for CRichEdit:
Collaboration diagram for CRichEdit:

Public Member Functions

 CRichEdit ()
 
VOID SetRangeFormatting (SIZE_T Start, SIZE_T End, DWORD dwEffects)
 
LONG GetTextLen ()
 
VOID InsertText (LPCWSTR lpszText, DWORD dwEffects)
 
VOID InsertText (const ATL::CStringW &szText, DWORD dwEffects)
 
VOID SetText (LPCWSTR lpszText, DWORD dwEffects)
 
VOID SetText (const ATL::CStringW &szText, DWORD dwEffects)
 
HWND Create (HWND hwndParent)
 
virtual VOID OnLink (ENLINK *Link)
 
 ~CRichEdit ()
 

Private Member Functions

VOID GenericInsertText (LPCWSTR lpszText, SIZE_T InsertedTextLen, DWORD dwEffects)
 

Private Attributes

HMODULE m_LoadedLibrary
 

Detailed Description

Definition at line 4 of file crichedit.h.

Constructor & Destructor Documentation

◆ CRichEdit()

CRichEdit::CRichEdit ( )
inline

Definition at line 35 of file crichedit.h.

35 : CWindow(), m_LoadedLibrary(NULL) {}
smooth NULL
Definition: ftsmooth.c:416
HMODULE m_LoadedLibrary
Definition: crichedit.h:7

◆ ~CRichEdit()

CRichEdit::~CRichEdit ( )
inline

Definition at line 125 of file crichedit.h.

126  {
127  if (m_LoadedLibrary)
128  {
130  }
131  }
#define FreeLibrary(x)
Definition: compat.h:405
HMODULE m_LoadedLibrary
Definition: crichedit.h:7

Member Function Documentation

◆ Create()

HWND CRichEdit::Create ( HWND  hwndParent)
inline

Definition at line 95 of file crichedit.h.

96  {
97  m_LoadedLibrary = LoadLibraryW(L"riched20.dll");
98 
99  m_hWnd = CreateWindowExW(0,
100  L"RichEdit20W",
101  NULL,
104  205, 28, 465, 100,
105  hwndParent,
106  NULL,
107  _AtlBaseModule.GetModuleInstance(),
108  NULL);
109 
110  if (m_hWnd)
111  {
116  }
117 
118  return m_hWnd;
119  }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define TRUE
Definition: types.h:120
#define SB_VERT
Definition: winuser.h:553
#define ENM_MOUSEEVENTS
Definition: richedit.h:476
#define ES_MULTILINE
Definition: pedump.c:667
UINT_PTR WPARAM
Definition: windef.h:207
#define ES_READONLY
Definition: pedump.c:675
#define WS_CHILD
Definition: pedump.c:617
DWORD WINAPI GetSysColor(_In_ int)
#define ENM_LINK
Definition: richedit.h:485
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
#define EM_SETBKGNDCOLOR
Definition: richedit.h:100
#define EM_SETEVENTMASK
Definition: richedit.h:102
#define DEFAULT_GUI_FONT
Definition: wingdi.h:908
static const WCHAR L[]
Definition: oid.c:1250
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define COLOR_BTNFACE
Definition: winuser.h:918
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define EM_SHOWSCROLLBAR
Definition: richedit.h:130
#define WM_SETFONT
Definition: winuser.h:1632
HMODULE m_LoadedLibrary
Definition: crichedit.h:7
#define ES_LEFT
Definition: pedump.c:664
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by CMainWindow::CreateRichEdit().

◆ GenericInsertText()

VOID CRichEdit::GenericInsertText ( LPCWSTR  lpszText,
SIZE_T  InsertedTextLen,
DWORD  dwEffects 
)
inlineprivate

Definition at line 9 of file crichedit.h.

10  {
12  SIZE_T Len = GetTextLen();
13 
14  if (InsertedTextLen)
15  {
16  /* Insert new text */
17  SetText.flags = ST_SELECTION;
18  SetText.codepage = 1200;
19 
21 
22  if ((dwEffects == CFM_LINK) && !PathIsURLW(lpszText))
23  {
24  // if text is not an URL, no styling is used
25  SetRangeFormatting(Len, Len + InsertedTextLen, 0);
26  }
27  else
28  {
29  SetRangeFormatting(Len, Len + InsertedTextLen, dwEffects);
30  }
31  }
32  }
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath)
Definition: url.c:2432
VOID SetRangeFormatting(SIZE_T Start, SIZE_T End, DWORD dwEffects)
Definition: crichedit.h:37
LONG_PTR LPARAM
Definition: windef.h:208
#define Len
Definition: deflate.h:82
#define EM_SETTEXTEX
Definition: richedit.h:131
#define CFM_LINK
Definition: richedit.h:337
#define ST_SELECTION
Definition: richedit.h:1072
ULONG_PTR SIZE_T
Definition: typedefs.h:78
LONG GetTextLen()
Definition: crichedit.h:54
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
VOID SetText(LPCWSTR lpszText, DWORD dwEffects)
Definition: crichedit.h:84

Referenced by InsertText().

◆ GetTextLen()

LONG CRichEdit::GetTextLen ( )
inline

Definition at line 54 of file crichedit.h.

55  {
56  GETTEXTLENGTHEX TxtLenStruct;
57 
58  TxtLenStruct.flags = GTL_NUMCHARS;
59  TxtLenStruct.codepage = 1200;
60 
61  return (LONG) SendMessageW(EM_GETTEXTLENGTHEX, (WPARAM) &TxtLenStruct, 0);
62  }
UINT_PTR WPARAM
Definition: windef.h:207
long LONG
Definition: pedump.c:60
#define GTL_NUMCHARS
Definition: richedit.h:1058
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define EM_GETTEXTLENGTHEX
Definition: richedit.h:129

Referenced by GenericInsertText().

◆ InsertText() [1/2]

VOID CRichEdit::InsertText ( LPCWSTR  lpszText,
DWORD  dwEffects 
)
inline

Definition at line 72 of file crichedit.h.

73  {
74  GenericInsertText(lpszText, wcslen(lpszText), dwEffects);
75  }
VOID GenericInsertText(LPCWSTR lpszText, SIZE_T InsertedTextLen, DWORD dwEffects)
Definition: crichedit.h:9
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by CAppRichEdit::InsertLanguageInfo(), CAppRichEdit::LoadAndInsertText(), SetText(), CAppRichEdit::SetWelcomeText(), and CAppRichEdit::ShowInstalledAppInfo().

◆ InsertText() [2/2]

VOID CRichEdit::InsertText ( const ATL::CStringW szText,
DWORD  dwEffects 
)
inline

Definition at line 77 of file crichedit.h.

78  {
79  GenericInsertText(szText.GetString(), szText.GetLength(), dwEffects);
80  }
static const WCHAR szText[]
Definition: dialog.c:139
VOID GenericInsertText(LPCWSTR lpszText, SIZE_T InsertedTextLen, DWORD dwEffects)
Definition: crichedit.h:9

◆ OnLink()

virtual VOID CRichEdit::OnLink ( ENLINK Link)
inlinevirtual

Definition at line 121 of file crichedit.h.

122  {
123  }

◆ SetRangeFormatting()

VOID CRichEdit::SetRangeFormatting ( SIZE_T  Start,
SIZE_T  End,
DWORD  dwEffects 
)
inline

Definition at line 37 of file crichedit.h.

38  {
39  CHARFORMAT2W CharFormat;
40 
42 
43  ZeroMemory(&CharFormat, sizeof(CharFormat));
44 
45  CharFormat.cbSize = sizeof(CharFormat);
46  CharFormat.dwMask = dwEffects;
47  CharFormat.dwEffects = dwEffects;
48 
50 
51  SendMessageW(EM_SETSEL, End, End + 1);
52  }
#define ZeroMemory
Definition: winbase.h:1635
#define EM_SETCHARFORMAT
Definition: richedit.h:101
DWORD dwEffects
Definition: richedit.h:307
LONG_PTR LPARAM
Definition: windef.h:208
#define EM_SETSEL
Definition: winuser.h:2000
Definition: partlist.h:33
#define SCF_WORD
Definition: richedit.h:236
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
DWORD dwMask
Definition: richedit.h:306
#define SCF_SELECTION
Definition: richedit.h:235

Referenced by GenericInsertText().

◆ SetText() [1/2]

VOID CRichEdit::SetText ( LPCWSTR  lpszText,
DWORD  dwEffects 
)
inline

Definition at line 84 of file crichedit.h.

85  {
86  SetWindowTextW(L"");
87  InsertText(lpszText, dwEffects);
88  }
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
static const WCHAR L[]
Definition: oid.c:1250
VOID InsertText(LPCWSTR lpszText, DWORD dwEffects)
Definition: crichedit.h:72

Referenced by GenericInsertText(), SetText(), CAppRichEdit::SetWelcomeText(), CAppRichEdit::ShowAvailableAppInfo(), and CAppRichEdit::ShowInstalledAppInfo().

◆ SetText() [2/2]

VOID CRichEdit::SetText ( const ATL::CStringW szText,
DWORD  dwEffects 
)
inline

Definition at line 90 of file crichedit.h.

91  {
92  SetText(szText.GetString(), dwEffects);
93  }
static const WCHAR szText[]
Definition: dialog.c:139
VOID SetText(LPCWSTR lpszText, DWORD dwEffects)
Definition: crichedit.h:84

Member Data Documentation

◆ m_LoadedLibrary

HMODULE CRichEdit::m_LoadedLibrary
private

Definition at line 7 of file crichedit.h.

Referenced by Create(), and ~CRichEdit().


The documentation for this class was generated from the following file: