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


Detailed Description

Support for MFC (Windows) .

Author:
Yves Piguet. Copyright 2007-2008, 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.

#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).

Typedef Documentation

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

Callback to handle link clicks.

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

Definition at line 50 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] pNMHDR notification message
[out] pResult result code
[in] linkFun callback which handles link clicks
[in] linkFunData value passed to linkFun

Definition at line 284 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] link raw URL, as in NME source text, without leading and trailing spaces (null-terminated string)
[in,out] data not used

Definition at line 315 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] c MFC rich text control
[in] input text as UCS-16 with NME markup
[in] inputLength length of input, or negative if input is null-terminated
[in] replaceSel if TRUE, replace selection, else replace whole text
[in] plainTextCharFormat character format of plain text (if NULL, use default character format of c)
[in] links TRUE to enable links, else FALSE

Definition at line 273 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] c MFC rich text control
[in] input text with NME markup
[in] inputLength length of input, or negative if input is null-terminated
[in] replaceSel if TRUE, replace selection, else replace whole text
[in] plainTextCharFormat character format of plain text (if NULL, use default character format of c)
[in] links TRUE to enable links, else FALSE

Definition at line 122 of file NMEMFC.cpp.

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