00001
00007 #ifndef __NMEGtk__
00008 #define __NMEGtk__
00009
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013
00014 #include "NME.h"
00015 #include "NMEStyle.h"
00016
00017 #include <gtk/gtk.h>
00018
00019 #define kMaxHeadingLevel 4
00020 #define kMaxListLevel 4
00021
00027 typedef void (*NMEGtkLinkFun)(NMEConstText link, void *data);
00028
00030 typedef struct
00031 {
00032 NMEGtkLinkFun fun;
00033 void *data;
00034 } NMEGtkLinkCB;
00035
00037 typedef struct
00038 {
00039 GtkTextBuffer *textBuffer;
00040 NMEGtkLinkCB *linkCB;
00041 GtkTextTag *plainTag;
00042 GtkTextTag *boldTag;
00043 GtkTextTag *italicTag;
00044 GtkTextTag *underlineTag;
00045 GtkTextTag *superTag;
00046 GtkTextTag *subTag;
00047 GtkTextTag *monoTag;
00048 GtkTextTag *headingTag[kMaxHeadingLevel];
00049 GtkTextTag *parTag;
00050 GtkTextTag *indentTag[kMaxListLevel];
00051 } NMEGtk;
00052
00059 void NMEGtkInit(NMEGtk *nmegtk, GtkTextBuffer *textBuffer, int charSize);
00060
00066 void NMEGtkSetLinkFun(NMEGtk *nmegtk, NMEGtkLinkFun linkFun, void *linkFunData);
00067
00075 void NMEGtkApplyStyle(NMEGtk const *nmegtk,
00076 NMEStyleTable const *spanTable,
00077 NMEInt offset, NMEInt length,
00078 NMEConstText nmeTextForLinks);
00079
00089 NMEErr NMEGtkInsert(GtkTextBuffer *textBuffer,
00090 NMEGtk const *nmegtk,
00091 NMEConstText str, NMEInt len,
00092 NMEBoolean replaceSel,
00093 NMEBoolean links);
00094
00095 #ifdef __cplusplus
00096 }
00097 #endif
00098
00099 #endif