nyctergatis.com

Contact

Projects
Sysquake Remote Live
NME
PDF
Hike
Sudoku
GifBuilder
jpeglib for Palm OS
MySQL Client
Cross-GCC for Mac OS

NMEGtk.c File Reference


Detailed Description

Support for GTK+ .

Author:
Yves Piguet. Copyright 2007-2008, Yves Piguet.

Definition in file NMEGtk.c.

#include "NMEGtk.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.


Functions

void NMEGtkInit (NMEGtk *nmegtk, GtkTextBuffer *textBuffer, int charSize)
 Initialize NMEGtk data structure.
void NMEGtkSetLinkFun (NMEGtk *nmegtk, NMEGtkLinkFun linkFun, void *linkFunData)
 Set the callback which processes clicks on links.
static gboolean linkEvent (GtkTextTag *tag, GtkWidget *w, GdkEventButton *event, GtkTextIter *iter, gpointer d)
 Signal handler for GTK+ link events.
void NMEGtkApplyStyle (NMEGtk const *nmegtk, NMEStyleTable const *spanTable, NMEInt offset, NMEInt length, NMEConstText nmeTextForLinks)
 Apply styles collected by NMEStyle to a GTK+ text buffer.
NMEErr NMEGtkInsert (GtkTextBuffer *textBuffer, NMEGtk const *nmegtk, NMEConstText str, NMEInt len, NMEBoolean replaceSel, NMEBoolean links)
 Insert text with NME markup in a GtkTextBuffer, calling NMEGtkApplyStyle.

Variables

static GdkCursor * textCursor = NULL
 cursor over nonlink text
static GdkCursor * linkCursor = NULL
 cursor over links

Function Documentation

static gboolean linkEvent ( GtkTextTag *  tag,
GtkWidget *  w,
GdkEventButton *  event,
GtkTextIter *  iter,
gpointer  d 
) [static]

Signal handler for GTK+ link events.

Parameters:
[in] tag GTK+ tag of the link
[in] w GTK+ textview widget
[in] event event description
[in] iter location of the event in the textbuffer
[in] d adress of a NMEGtkLinkCB structure

Definition at line 99 of file NMEGtk.c.

void NMEGtkApplyStyle ( NMEGtk const *  nmegtk,
NMEStyleTable const *  spanTable,
NMEInt  offset,
NMEInt  length,
NMEConstText  nmeTextForLinks 
)

Apply styles collected by NMEStyle to a GTK+ text buffer.

Parameters:
[in] nmegtk data structure initialized by NMEGtkInit
[in] spanTable table of style spans created by NMEProcess with NMEStyle
[in] offset offset of NME output in textBuffer, in unicode characters
[in] length length of NME output in unicode characters
[in] nmeTextForLinks set hypertext links if source NME text, don't if NULL

Definition at line 129 of file NMEGtk.c.

void NMEGtkInit ( NMEGtk nmegtk,
GtkTextBuffer *  textBuffer,
int  charSize 
)

Initialize NMEGtk data structure.

Parameters:
[out] nmegtk data structure used by NMEGtkApplyStyle
[in] textBuffer text buffer style is applied to
[in] charSize standard text character size, used as the basis for heading sizes and superscript/subscript offsets

Definition at line 17 of file NMEGtk.c.

NMEErr NMEGtkInsert ( GtkTextBuffer *  textBuffer,
NMEGtk const *  nmegtk,
NMEConstText  str,
NMEInt  len,
NMEBoolean  replaceSel,
NMEBoolean  links 
)

Insert text with NME markup in a GtkTextBuffer, calling NMEGtkApplyStyle.

Parameters:
[in,out] textBuffer GTK+ text buffer
[in] nmegtk NMEGtk structure for textBuffer, initialized with NMEGtkInit
[in] str text with NME markup
[in] len length of str in bytes, or -1 if str is null-terminated
[in] replaceSel if TRUE, replace selection, else replace whole text
[in] links set hypertext links if TRUE

Definition at line 220 of file NMEGtk.c.

void NMEGtkSetLinkFun ( NMEGtk nmegtk,
NMEGtkLinkFun  linkFun,
void *  linkFunData 
)

Set the callback which processes clicks on links.

Parameters:
[in,out] nmegtk data structure used by NMEGtkApplyStyle
[in] linkFun callback which handles link clicks
[in] linkFunData value passed to linkFun

Definition at line 83 of file NMEGtk.c.

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