[994dbc]: RichEditCtrlExtn.h Maximize Restore History

Download this file

RichEditCtrlExtn.h    94 lines (74 with data), 2.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* Copyright (c) 2003-2007 Rony Shapiro <ronys@users.sourceforge.net>.
* All rights reserved. Use of the code is allowed under the
* Artistic License 2.0 terms, as specified in the LICENSE file
* distributed with this code, or available from
* http://www.opensource.org/licenses/artistic-license-2.0.php
*/
#pragma once
// CRichEditControlExtn.h : header file
// Extensions to standard CRichEditCtrl Control
#include <algorithm>
#include <vector>
#include <string>
#include <bitset>
class CRichEditCtrlExtn : public CRichEditCtrl
{
// Construction
public:
CRichEditCtrlExtn();
void SetWindowText(LPCTSTR lpszString);
// (Un)Register to be notified if the link clicked
bool RegisterOnLink(bool (*pfcn) (const CString &, const CString &, LPARAM), LPARAM);
void UnRegisterOnLink();
void NotifyListModified();
// URL for friendly name in text
struct ALink {
int iStart;
int iEnd;
TCHAR tcszURL[_MAX_PATH];
};
private:
// HTML formatting functions
CString GetTextFormatting(CString csHTML, int &iError);
COLORREF ConvertColourToColorRef(CString &csValue);
int ConvertSizeToPoints(CString &csValue, int &iCurrentSize);
int ConvertPointsToSize(const int iCurrentPoints);
enum {FACENAMECHANGED = 0, SIZECHANGED, COLOURCHANGED};
enum EntryType {Bold, Italic, Underline, Font, Colour, Size, Name, Link};
// Formating for Bold, Italic, Underline, Colour, Font Size & Font Name
struct st_format {
int iStart;
int iEnd;
enum EntryType entrytype;
COLORREF cr; // Only valid if entrytype = Colour
int iSize; // Only valid if entrytype = Size
TCHAR tcszFACENAME[LF_FACESIZE]; // Only valid if entrytype = Name
};
// Vectors of format changes to be applied to the text string
std::vector<st_format> m_vFormat;
std::vector<ALink> m_vALink;
static bool iStartCompare(st_format elem1, st_format elem2);
// Callback if link has been clicked
// parameters = link text clicked, instance that registered for callback
// Callback returns "true" if it processed the link
bool (*m_pfcnNotifyLinkClicked) (const CString &, const CString &, LPARAM);
LPARAM m_NotifyInstance;
// Attributes
private:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRichEditCtrlExtn)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CRichEditCtrlExtn();
// Generated message map functions
protected:
//{{AFX_MSG(CRichEditCtrlExtn)
afx_msg void OnLink(NMHDR *pNotifyStruct, LRESULT *pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};