nyctergatis.com

Contact

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

Support for MFC (Windows) . More...

#include "NME.h"
#include "NMEStyle.h"
#include <afxrich.h>

Go to the source code of this file.

Typedefs

typedef void(* NMEMFCLinkFun )(NMEConstText link, void *data)
 Callback to handle link clicks.

Functions

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.
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.
void NMEMFCEnLink (NMHDR const *pNMHDR, LRESULT *pResult, NMEMFCLinkFun linkFun, void *linkFunData=NULL)
 Handle links (should be called when an EN_LINK notification is received).
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).

Detailed Description

Support for MFC (Windows) .

Author:
Yves Piguet.

Links

Here is how to support links in a CRichEditView (assuming the subclass name is S and the control id is ID):

  • Enable links in method S::OnCreate, e.g. with
        GetRichEditCtrl().SetEventMask(GetRichEditCtrl().GetEventMask() | ENM_LINK);
    
  • Add the following protected method prototype in the header file:
        afx_msg void OnEnLink(NMHDR* pNMHDR, LRESULT* pResult);
    
  • Add the following method definition to CRichEditView's subclass (you can write your own NMEMFCLinkFun function if you want to process links in a special way):
        void S::OnEnLink(NMHDR* pNMHDR, LRESULT* pResult)
        {
          NMEMFCEnLink(pNMHDR, pResult, NMEMFCLinkFunURL);
        }
    
  • Add the following line between BEGIN_MESSAGE_MAP and END_MESSAGE_MAP:
        ON_NOTIFY(EN_LINK, ID, OnEnLink)
    
  • call NMEMFCSetRichText with argument link set to TRUE

You should replace ON_NOTIFY with ON_NOTIFY_RANGE and define S::OnEnLinkRange(UINT id, NMHDR* pNMHDR, LRESULT* pResult) if you have to handle multiple CRichEditView controls with one method.

Definition in file NMEMFC.h.


Typedef Documentation

typedef void(* NMEMFCLinkFun)(NMEConstText link, void *data)

Callback to handle link clicks.

Parameters:
[in]linkraw link, as in NME source text, without leading and trailing spaces (null-terminated string)
[in,out]datadata value specific to the callback

Definition at line 53 of file NMEMFC.h.


Function Documentation

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.

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