📄 richedit.h
字号:
#define IMF_CLOSESTATUSWINDOW 0x0008
#define IMF_VERTICAL 0x0020
#define IMF_FORCEACTIVE 0x0040
#define IMF_FORCEINACTIVE 0x0080
#define IMF_FORCEREMEMBER 0x0100
#define IMF_MULTIPLEEDIT 0x0400
/* Word break flags (used with WB_CLASSIFY) */
#define WBF_CLASS ((BYTE) 0x0F)
#define WBF_ISWHITE ((BYTE) 0x10)
#define WBF_BREAKLINE ((BYTE) 0x20)
#define WBF_BREAKAFTER ((BYTE) 0x40)
/* new data types */
#ifdef _WIN32
/* extended edit word break proc (character set aware) */
typedef LONG (*EDITWORDBREAKPROCEX)(char *pchText, LONG cchText, BYTE bCharSet, INT action);
#endif
/* all character format measurements are in twips */
typedef struct _charformat
{
UINT cbSize;
_WPAD _wPad1;
DWORD dwMask;
DWORD dwEffects;
LONG yHeight;
LONG yOffset;
COLORREF crTextColor;
BYTE bCharSet;
BYTE bPitchAndFamily;
char szFaceName[LF_FACESIZE];
_WPAD _wPad2;
} CHARFORMATA;
typedef struct _charformatw
{
UINT cbSize;
_WPAD _wPad1;
DWORD dwMask;
DWORD dwEffects;
LONG yHeight;
LONG yOffset;
COLORREF crTextColor;
BYTE bCharSet;
BYTE bPitchAndFamily;
WCHAR szFaceName[LF_FACESIZE];
_WPAD _wPad2;
} CHARFORMATW;
#if (_RICHEDIT_VER >= 0x0200)
#ifdef UNICODE
#define CHARFORMAT CHARFORMATW
#else
#define CHARFORMAT CHARFORMATA
#endif /* UNICODE */
#else
#define CHARFORMAT CHARFORMATA
#endif /* _RICHEDIT_VER >= 0x0200 */
/* CHARFORMAT masks */
#define CFM_BOLD 0x00000001
#define CFM_ITALIC 0x00000002
#define CFM_UNDERLINE 0x00000004
#define CFM_STRIKEOUT 0x00000008
#define CFM_PROTECTED 0x00000010
#define CFM_LINK 0x00000020 /* Exchange hyperlink extension */
#define CFM_SIZE 0x80000000
#define CFM_COLOR 0x40000000
#define CFM_FACE 0x20000000
#define CFM_OFFSET 0x10000000
#define CFM_CHARSET 0x08000000
/* CHARFORMAT effects */
#define CFE_BOLD 0x0001
#define CFE_ITALIC 0x0002
#define CFE_UNDERLINE 0x0004
#define CFE_STRIKEOUT 0x0008
#define CFE_PROTECTED 0x0010
#define CFE_LINK 0x0020
#define CFE_AUTOCOLOR 0x40000000 /* NOTE: this corresponds to */
/* CFM_COLOR, which controls it */
#define yHeightCharPtsMost 1638
/* EM_SETCHARFORMAT wParam masks */
#define SCF_SELECTION 0x0001
#define SCF_WORD 0x0002
#define SCF_DEFAULT 0x0000 // set the default charformat or paraformat
#define SCF_ALL 0x0004 // not valid with SCF_SELECTION or SCF_WORD
#define SCF_USEUIRULES 0x0008 // modifier for SCF_SELECTION; says that
// the format came from a toolbar, etc. and
// therefore UI formatting rules should be
// used instead of strictly formatting the
// selection.
typedef struct _charrange
{
LONG cpMin;
LONG cpMax;
} CHARRANGE;
typedef struct _textrange
{
CHARRANGE chrg;
LPSTR lpstrText; /* allocated by caller, zero terminated by RichEdit */
} TEXTRANGEA;
typedef struct _textrangew
{
CHARRANGE chrg;
LPWSTR lpstrText; /* allocated by caller, zero terminated by RichEdit */
} TEXTRANGEW;
#if (_RICHEDIT_VER >= 0x0200)
#ifdef UNICODE
#define TEXTRANGE TEXTRANGEW
#else
#define TEXTRANGE TEXTRANGEA
#endif /* UNICODE */
#else
#define TEXTRANGE TEXTRANGEA
#endif /* _RICHEDIT_VER >= 0x0200 */
typedef DWORD (CALLBACK *EDITSTREAMCALLBACK)(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb);
typedef struct _editstream
{
DWORD dwCookie; /* user value passed to callback as first parameter */
DWORD dwError; /* last error */
EDITSTREAMCALLBACK pfnCallback;
} EDITSTREAM;
/* stream formats */
#define SF_TEXT 0x0001
#define SF_RTF 0x0002
#define SF_RTFNOOBJS 0x0003 /* outbound only */
#define SF_TEXTIZED 0x0004 /* outbound only */
#define SF_UNICODE 0x0010 /* Unicode file of some kind */
/* Flag telling stream operations to operate on the selection only */
/* EM_STREAMIN will replace the current selection */
/* EM_STREAMOUT will stream out the current selection */
#define SFF_SELECTION 0x8000
/* Flag telling stream operations to ignore some FE control words */
/* having to do with FE word breaking and horiz vs vertical text. */
/* Not used in RichEdit 2.0 and later */
#define SFF_PLAINRTF 0x4000
/* Flag telling file stream output (SFF_SELECTION flag not set) to persist */
/* \viewscaleN control word */
#define SFF_PERSISTVIEWSCALE 0x2000
/* Flag telling stream operations to represent Unicode with UTF-8 instead */
/* of code pages */
#define SFF_UTF8 0x1000
/* Flag telling stream operations to output in WordPad format */
#define SFF_PWD 0x0800
/* 3-bit field specifying the value of N - 1 to use for \rtfN or \pwdN */
#define SFF_RTFVAL 0x70000
typedef struct _findtext
{
CHARRANGE chrg;
LPCSTR lpstrText;
} FINDTEXTA;
typedef struct _findtextw
{
CHARRANGE chrg;
LPCWSTR lpstrText;
} FINDTEXTW;
#if (_RICHEDIT_VER >= 0x0200)
#ifdef UNICODE
#define FINDTEXT FINDTEXTW
#else
#define FINDTEXT FINDTEXTA
#endif /* UNICODE */
#else
#define FINDTEXT FINDTEXTA
#endif /* _RICHEDIT_VER >= 0x0200 */
typedef struct _findtextexa
{
CHARRANGE chrg;
LPSTR lpstrText;
CHARRANGE chrgText;
} FINDTEXTEXA;
typedef struct _findtextexw
{
CHARRANGE chrg;
LPWSTR lpstrText;
CHARRANGE chrgText;
} FINDTEXTEXW;
#if (_RICHEDIT_VER >= 0x0200)
#ifdef UNICODE
#define FINDTEXTEX FINDTEXTEXW
#else
#define FINDTEXTEX FINDTEXTEXA
#endif /* UNICODE */
#else
#define FINDTEXTEX FINDTEXTEXA
#endif /* _RICHEDIT_VER >= 0x0200 */
typedef struct _formatrange
{
HDC hdc;
HDC hdcTarget;
RECT rc;
RECT rcPage;
CHARRANGE chrg;
} FORMATRANGE;
/* all paragraph measurements are in twips */
#define MAX_TAB_STOPS 32
#define lDefaultTab 720
/* this is a hack to make PARAFORMAT compatible with RE 1.0 */
#define wReserved wEffects
typedef struct _paraformat
{
UINT cbSize;
_WPAD _wPad1;
DWORD dwMask;
WORD wNumbering;
WORD wEffects;
LONG dxStartIndent;
LONG dxRightIndent;
LONG dxOffset;
WORD wAlignment;
SHORT cTabCount;
LONG rgxTabs[MAX_TAB_STOPS];
} PARAFORMAT;
/* PARAFORMAT mask values */
#define PFM_STARTINDENT 0x00000001
#define PFM_RIGHTINDENT 0x00000002
#define PFM_OFFSET 0x00000004
#define PFM_ALIGNMENT 0x00000008
#define PFM_TABSTOPS 0x00000010
#define PFM_NUMBERING 0x00000020
#define PFM_OFFSETINDENT 0x80000000
/* PARAFORMAT numbering options */
#define PFN_BULLET 0x0001
/* PARAFORMAT alignment options */
#define PFA_LEFT 0x0001
#define PFA_RIGHT 0x0002
#define PFA_CENTER 0x0003
/* CHARFORMAT2 and PARAFORMAT2 structures */
#ifdef __cplusplus
struct CHARFORMAT2W : _charformatw
{
WORD wWeight; /* Font weight (LOGFONT value) */
SHORT sSpacing; /* Amount to space between letters */
COLORREF crBackColor; /* Background color */
LCID lcid; /* Locale ID */
DWORD dwReserved; /* Reserved. Must be 0 */
SHORT sStyle; /* Style handle */
WORD wKerning; /* Twip size above which to kern char pair*/
BYTE bUnderlineType; /* Underline type */
BYTE bAnimation; /* Animated text like marching ants */
BYTE bRevAuthor; /* Revision author index */
};
struct CHARFORMAT2A : _charformat
{
WORD wWeight; /* Font weight (LOGFONT value) */
SHORT sSpacing; /* Amount to space between letters */
COLORREF crBackColor; /* Background color */
LCID lcid; /* Locale ID */
DWORD dwReserved; /* Reserved. Must be 0 */
SHORT sStyle; /* Style handle */
WORD wKerning; /* Twip size above which to kern char pair*/
BYTE bUnderlineType; /* Underline type */
BYTE bAnimation; /* Animated text like marching ants */
BYTE bRevAuthor; /* Revision author index */
};
#else /* regular C-style */
typedef struct _charformat2w
{
UINT cbSize;
_WPAD _wPad1;
DWORD dwMask;
DWORD dwEffects;
LONG yHeight;
LONG yOffset; /* > 0 for superscript, < 0 for subscript */
COLORREF crTextColor;
BYTE bCharSet;
BYTE bPitchAndFamily;
WCHAR szFaceName[LF_FACESIZE];
_WPAD _wPad2;
WORD wWeight; /* Font weight (LOGFONT value) */
SHORT sSpacing; /* Amount to space between letters */
COLORREF crBackColor; /* Background color */
LCID lcid; /* Locale ID */
DWORD dwReserved; /* Reserved. Must be 0 */
SHORT sStyle; /* Style handle */
WORD wKerning; /* Twip size above which to kern char pair*/
BYTE bUnderlineType; /* Underline type */
BYTE bAnimation; /* Animated text like marching ants */
BYTE bRevAuthor; /* Revision author index */
BYTE bReserved1;
} CHARFORMAT2W;
typedef struct _charformat2a
{
UINT cbSize;
_WPAD _wPad1;
DWORD dwMask;
DWORD dwEffects;
LONG yHeight;
LONG yOffset; /* > 0 for superscript, < 0 for subscript */
COLORREF crTextColor;
BYTE bCharSet;
BYTE bPitchAndFamily;
char szFaceName[LF_FACESIZE];
_WPAD _wPad2;
WORD wWeight; /* Font weight (LOGFONT value) */
SHORT sSpacing; /* Amount to space between letters */
COLORREF crBackColor; /* Background color */
LCID lcid; /* Locale ID */
DWORD dwReserved; /* Reserved. Must be 0 */
SHORT sStyle; /* Style handle */
WORD wKerning; /* Twip size above which to kern char pair*/
BYTE bUnderlineType; /* Underline type */
BYTE bAnimation; /* Animated text like marching ants */
BYTE bRevAuthor; /* Revision author index */
} CHARFORMAT2A;
#endif /* C++ */
#ifdef UNICODE
#define CHARFORMAT2 CHARFORMAT2W
#else
#define CHARFORMAT2 CHARFORMAT2A
#endif
#define CHARFORMATDELTA (sizeof(CHARFORMAT2) - sizeof(CHARFORMAT))
/* CHARFORMAT and PARAFORMAT "ALL" masks
CFM_COLOR mirrors CFE_AUTOCOLOR, a little hack to easily deal with autocolor*/
#define CFM_EFFECTS (CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_COLOR | \
CFM_STRIKEOUT | CFE_PROTECTED | CFM_LINK)
#define CFM_ALL (CFM_EFFECTS | CFM_SIZE | CFM_FACE | CFM_OFFSET | CFM_CHARSET)
#define PFM_ALL (PFM_STARTINDENT | PFM_RIGHTINDENT | PFM_OFFSET | \
PFM_ALIGNMENT | PFM_TABSTOPS | PFM_NUMBERING | \
PFM_OFFSETINDENT| PFM_RTLPARA)
/* New masks and effects -- a parenthesized asterisk indicates that
the data is stored by RichEdit2.0, but not displayed */
#define CFM_SMALLCAPS 0x0040 /* (*) */
#define CFM_ALLCAPS 0x0080 /* (*) */
#define CFM_HIDDEN 0x0100 /* (*) */
#define CFM_OUTLINE 0x0200 /* (*) */
#define CFM_SHADOW 0x0400 /* (*) */
#define CFM_EMBOSS 0x0800 /* (*) */
#define CFM_IMPRINT 0x1000 /* (*) */
#define CFM_DISABLED 0x2000
#define CFM_REVISED 0x4000
#define CFM_BACKCOLOR 0x04000000
#define CFM_LCID 0x02000000
#define CFM_UNDERLINETYPE 0x00800000 /* (*) */
#define CFM_WEIGHT 0x00400000
#define CFM_SPACING 0x00200000 /* (*) */
#define CFM_KERNING 0x00100000 /* (*) */
#define CFM_STYLE 0x00080000 /* (*) */
#define CFM_ANIMATION 0x00040000 /* (*) */
#define CFM_REVAUTHOR 0x00008000
#define CFE_SUBSCRIPT 0x00010000 /* Superscript and subscript are */
#define CFE_SUPERSCRIPT 0x00020000 /* mutually exclusive */
#define CFM_SUBSCRIPT CFE_SUBSCRIPT | CFE_SUPERSCRIPT
#define CFM_SUPERSCRIPT CFM_SUBSCRIPT
#define CFM_EFFECTS2 (CFM_EFFECTS | CFM_DISABLED | CFM_SMALLCAPS | CFM_ALLCAPS \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -