nyctergatis.com

Contact

Projects
Sysquake Remote Live
NME
PDF
Hike
Sudoku
GifBuilder
jpeglib for Palm OS
MySQL Client
Cross-GCC for Mac OS
NMEMFC.cpp File Reference

Support for MFC (Windows) . More...

#include "NMEMFC.h"
#include "NMEStyleCpp.h"

Go to the source code of this file.

Defines

#define isFirstUTF8Byte(c)   (((c) & 0x80) == 0 || ((c) & 0xe0) == 0xc0 || ((c) & 0xf0) == 0xe0)
 Test if a byte is the first byte of a UTF-8 character.

Functions

static CString utf8ToCString (char const *utf8, int len=-1)
 Convert unicode characters encoded as 16-bit UTF-8 to a CString.
static char * cStringToUtf8 (WCHAR const *wstr, int len=-1)
 Convert UCS-16 string to UTF-8.
void NMEMFCSetRichText (CRichEditCtrl &c, char const *input, int inputLength, bool replaceSel, CHARFORMAT const *plainTextCharFormat, bool links)
 Replace selection in a CRichEditCtrl with NME text converted to styled text.
void NMEMFCSetRichText (CRichEditCtrl &c, WCHAR const *input, int inputLength, bool replaceSel, CHARFORMAT const *plainTextCharFormat, bool links)
 Replace selection in a CRichEditCtrl with NME text converted to styled text.
void NMEMFCEnLink (NMHDR const *pNMHDR, LRESULT *pResult, NMEMFCLinkFun linkFun, void *linkFunData)
 Handle links (should be called when an EN_LINK notification is received).
void NMEMFCLinkFunURL (NMEConstText link, void *data)
 NMEMFCLinkFun callback to let Windows process URL (can be used as is or called from a user-written callback which recognizes other kinds of links).

Detailed Description

Support for MFC (Windows) .

Author:
Yves Piguet.

Definition in file NMEMFC.cpp.


Function Documentation

static char* cStringToUtf8 ( WCHAR const *  wstr,
int  len = -1 
) [static]

Convert UCS-16 string to UTF-8.

Parameters:
[in]wstrstring with 16-bit unicode char (UCS-16)
[in]lennumber of characters in wstr (-1 if null-terminated)
Returns:
newly allocated null-terminated string converted to UTF-8 (should be freed with delete [])

Definition at line 82 of file NMEMFC.cpp.

void NMEMFCEnLink ( NMHDR const *  pNMHDR,
LRESULT *  pResult,
NMEMFCLinkFun  linkFun,
void *  linkFunData = NULL 
)

Handle links (should be called when an EN_LINK notification is received).

Parameters:
[in]pNMHDRnotification message
[out]pResultresult code
[in]linkFuncallback which handles link clicks
[in]linkFunDatavalue passed to linkFun

Definition at line 293 of file NMEMFC.cpp.

void NMEMFCLinkFunURL ( NMEConstText  link,
void *  data = NULL 
)

NMEMFCLinkFun callback to let Windows process URL (can be used as is or called from a user-written callback which recognizes other kinds of links).

Parameters:
[in]linkraw URL, as in NME source text, without leading and trailing spaces (null-terminated string)
[in,out]datanot used

Definition at line 332 of file NMEMFC.cpp.

void NMEMFCSetRichText ( CRichEditCtrl &  c,
char const *  input,
int  inputLength = -1,
bool  replaceSel = FALSE,
CHARFORMAT const *  plainTextCharFormat = NULL,
bool  links = FALSE 
)

Replace selection in a CRichEditCtrl with NME text converted to styled text.

Parameters:
[in,out]cMFC rich text control
[in]inputtext with NME markup
[in]inputLengthlength of input, or negative if input is null-terminated
[in]replaceSelif TRUE, replace selection, else replace whole text
[in]plainTextCharFormatcharacter format of plain text (if NULL, use default character format of c)
[in]linksTRUE to enable links, else FALSE

Definition at line 123 of file NMEMFC.cpp.

void NMEMFCSetRichText ( CRichEditCtrl &  c,
WCHAR const *  input,
int  inputLength = -1,
bool  replaceSel = FALSE,
CHARFORMAT const *  plainTextCharFormat = NULL,
bool  links = FALSE 
)

Replace selection in a CRichEditCtrl with NME text converted to styled text.

Parameters:
[in,out]cMFC rich text control
[in]inputtext as UCS-16 with NME markup
[in]inputLengthlength of input, or negative if input is null-terminated
[in]replaceSelif TRUE, replace selection, else replace whole text
[in]plainTextCharFormatcharacter format of plain text (if NULL, use default character format of c)
[in]linksTRUE to enable links, else FALSE

Definition at line 282 of file NMEMFC.cpp.

static CString utf8ToCString ( char const *  utf8,
int  len = -1 
) [static]

Convert unicode characters encoded as 16-bit UTF-8 to a CString.

Parameters:
[in]utf8UTF-8 string
[in]lenlength of utf8 in bytes, or -1 if null-terminated

Definition at line 21 of file NMEMFC.cpp.

Generated by Doxygen.
Copyright 2007-2013, Yves Piguet.
All rights reserved.