ReactOS 0.4.15-dev-7136-g77ab709
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 CStringW &szText, DWORD dwEffects)
 
VOID SetText (LPCWSTR lpszText, DWORD dwEffects)
 
VOID SetText (const 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)
36 {
37 }
HMODULE m_LoadedLibrary
Definition: crichedit.h:6
#define NULL
Definition: types.h:112

◆ ~CRichEdit()

CRichEdit::~CRichEdit ( )
inline

Definition at line 128 of file crichedit.h.

129 {
130 if (m_LoadedLibrary)
131 {
133 }
134 }
#define FreeLibrary(x)
Definition: compat.h:748

Member Function Documentation

◆ Create()

HWND CRichEdit::Create ( HWND  hwndParent)
inline

Definition at line 104 of file crichedit.h.

105 {
106 m_LoadedLibrary = LoadLibraryW(L"riched20.dll");
107
108 m_hWnd = CreateWindowExW(
109 0, L"RichEdit20W", NULL, WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_LEFT | ES_READONLY, 205, 28, 465, 100,
110 hwndParent, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
111
112 if (m_hWnd)
113 {
118 }
119
120 return m_hWnd;
121 }
static HWND hwndParent
Definition: cryptui.c:300
#define TRUE
Definition: types.h:120
#define LoadLibraryW(x)
Definition: compat.h:747
#define L(x)
Definition: ntvdm.h:50
#define WS_CHILD
Definition: pedump.c:617
#define ES_READONLY
Definition: pedump.c:675
#define WS_VISIBLE
Definition: pedump.c:620
#define ES_LEFT
Definition: pedump.c:664
#define ES_MULTILINE
Definition: pedump.c:667
#define ENM_LINK
Definition: richedit.h:485
#define EM_SETEVENTMASK
Definition: richedit.h:102
#define EM_SETBKGNDCOLOR
Definition: richedit.h:100
#define EM_SHOWSCROLLBAR
Definition: richedit.h:130
#define ENM_MOUSEEVENTS
Definition: richedit.h:476
UINT_PTR WPARAM
Definition: windef.h:207
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
DWORD WINAPI GetSysColor(_In_ int)
#define SB_VERT
Definition: winuser.h:553
#define WM_SETFONT
Definition: winuser.h:1649
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)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define COLOR_BTNFACE
Definition: winuser.h:927

Referenced by CAppInfoDisplay::ProcessWindowMessage().

◆ GenericInsertText()

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

Definition at line 9 of file crichedit.h.

10 {
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 }
LONG GetTextLen()
Definition: crichedit.h:58
VOID SetText(LPCWSTR lpszText, DWORD dwEffects)
Definition: crichedit.h:91
VOID SetRangeFormatting(SIZE_T Start, SIZE_T End, DWORD dwEffects)
Definition: crichedit.h:40
#define Len
Definition: deflate.h:82
BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath)
Definition: url.c:2432
#define ST_SELECTION
Definition: richedit.h:1072
#define EM_SETTEXTEX
Definition: richedit.h:131
#define CFM_LINK
Definition: richedit.h:337
ULONG_PTR SIZE_T
Definition: typedefs.h:80
LONG_PTR LPARAM
Definition: windef.h:208

Referenced by InsertText().

◆ GetTextLen()

LONG CRichEdit::GetTextLen ( )
inline

Definition at line 58 of file crichedit.h.

59 {
60 GETTEXTLENGTHEX TxtLenStruct;
61
62 TxtLenStruct.flags = GTL_NUMCHARS;
63 TxtLenStruct.codepage = 1200;
64
65 return (LONG)SendMessageW(EM_GETTEXTLENGTHEX, (WPARAM)&TxtLenStruct, 0);
66 }
long LONG
Definition: pedump.c:60
#define GTL_NUMCHARS
Definition: richedit.h:1058
#define EM_GETTEXTLENGTHEX
Definition: richedit.h:129

Referenced by GenericInsertText().

◆ InsertText() [1/2]

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

Definition at line 83 of file crichedit.h.

84 {
85 GenericInsertText(szText.GetString(), szText.GetLength(), dwEffects);
86 }
VOID GenericInsertText(LPCWSTR lpszText, SIZE_T InsertedTextLen, DWORD dwEffects)
Definition: crichedit.h:9

◆ InsertText() [2/2]

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

Definition at line 77 of file crichedit.h.

78 {
79 GenericInsertText(lpszText, wcslen(lpszText), dwEffects);
80 }
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by CAvailableApplicationInfo::InsertLanguageInfo(), CAppRichEdit::LoadAndInsertText(), SetText(), CAppRichEdit::SetWelcomeText(), and CInstalledApplicationInfo::ShowAppInfo().

◆ OnLink()

virtual VOID CRichEdit::OnLink ( ENLINK Link)
inlinevirtual

Definition at line 124 of file crichedit.h.

125 {
126 }

◆ SetRangeFormatting()

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

Definition at line 40 of file crichedit.h.

41 {
42 CHARFORMAT2W CharFormat;
43
45
46 ZeroMemory(&CharFormat, sizeof(CharFormat));
47
48 CharFormat.cbSize = sizeof(CharFormat);
49 CharFormat.dwMask = dwEffects;
50 CharFormat.dwEffects = dwEffects;
51
53
54 SendMessageW(EM_SETSEL, End, End + 1);
55 }
#define SCF_WORD
Definition: richedit.h:236
#define SCF_SELECTION
Definition: richedit.h:235
#define EM_SETCHARFORMAT
Definition: richedit.h:101
DWORD dwMask
Definition: richedit.h:306
DWORD dwEffects
Definition: richedit.h:307
@ Start
Definition: partlist.h:33
#define ZeroMemory
Definition: winbase.h:1712
#define EM_SETSEL
Definition: winuser.h:2017

Referenced by GenericInsertText().

◆ SetText() [1/2]

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

Definition at line 98 of file crichedit.h.

99 {
100 SetText(szText.GetString(), dwEffects);
101 }

◆ SetText() [2/2]

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

Definition at line 91 of file crichedit.h.

92 {
94 InsertText(lpszText, dwEffects);
95 }
VOID InsertText(LPCWSTR lpszText, DWORD dwEffects)
Definition: crichedit.h:77
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)

Referenced by GenericInsertText(), SetText(), CAppRichEdit::SetWelcomeText(), CAvailableApplicationInfo::ShowAppInfo(), and CInstalledApplicationInfo::ShowAppInfo().

Member Data Documentation

◆ m_LoadedLibrary

HMODULE CRichEdit::m_LoadedLibrary
private

Definition at line 6 of file crichedit.h.

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


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