AlpSmartText
[UI Attachments]


Detailed Description

ALP Smart Text Engine.

The Smart Text Engine is an object is used in conjection with a GtkTextView to highlight phone numbers,URLs and email addresses. When the user activates these highlighted strings, the information is sent to the exchange manager, which may activate the dialer, web browser, or email program depending on the type of link the user has activated.

To use the ALP smart text engine, you need to link with the libalp_max.so shared library and include <alp/smarttext.h>. Create a GtkTextView and then create a smart text engine using alp_smart_text_new.


Data Structures

struct  _AlpSmartText
struct  _AlpSmartTextClass

Defines

#define ALP_IS_SMART_TEXT(obj)   (G_TYPE_CHECK_INSTANCE_TYPE((obj), ALP_TYPE_SMART_TEXT))
#define ALP_IS_SMART_TEXT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass), ALP_TYPE_SMART_TEXT))
#define ALP_SMART_TEXT(obj)   (G_TYPE_CHECK_INSTANCE_CAST((obj), ALP_TYPE_SMART_TEXT, AlpSmartText))
#define ALP_SMART_TEXT_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST((klass), ALP_TYPE_SMART_TEXT, AlpSmartTextClass))
#define ALP_SMART_TEXT_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj), ALP_TYPE_SMART_TEXT, AlpSmartTextClass))
#define ALP_SMART_TEXT_TAG_NAME_EMAIL   "AlpSmartTextEmail"
#define ALP_SMART_TEXT_TAG_NAME_INTLNUM   "AlpSmartTextIntl"
#define ALP_SMART_TEXT_TAG_NAME_LOCALNUM   "AlpSmartTextLocal"
#define ALP_SMART_TEXT_TAG_NAME_RTSP   "AlpSmartTextRtsp"
#define ALP_SMART_TEXT_TAG_NAME_URL   "AlpSmartTextUrl"
#define ALP_SMART_TEXT_TAG_NAME_USSDREQ   "AlpSmartTextUssdReq"
#define ALP_TYPE_SMART_TEXT   (alp_smart_text_get_type())

Typedefs

typedef _AlpSmartText AlpSmartText
typedef _AlpSmartTextClass AlpSmartTextClass
typedef void(* AlpSmartTextHandlerCallback )(GtkTextTag *tag, char *text, GtkWidget *widget, void *userdata)
 Callback function that performs an action when the user activates a smart text tag.

Functions

GtkTextTag * alp_smart_text_create_tag (AlpSmartText *self, char *name)
 Create a tag that looks like a Smart Text Engine tag. Adds the tag to the text buffer.
void alp_smart_text_enable_tag (AlpSmartText *self, GtkTextTag *tag, bool enable)
 Enables or disables the recognizer and handler associated with a particular tag.
GtkTextTag * alp_smart_text_get_tag_with_name (AlpSmartText *self, char *name)
 Convenience function that returns a pointer to the text tag with the specified name.
GType alp_smart_text_get_type (void) G_GNUC_CONST
 This is the function behind the GTK ALP_TYPE_SMART_TEXT macro that is used in macros like ALP_SMART_TEXT and ALP_IS_SMART_TEXT - you will probably never have any reason to call this method directly.
AlpSmartTextalp_smart_text_new (GtkTextView *textView)
 Creates a new AlpSmartText engine and attaches it to the specified text view.
void alp_smart_text_set_handler_for_tag (AlpSmartText *self, GtkTextTag *tag, AlpSmartTextHandlerCallback handlerCallback, void *handlerUserdata)
 Sets the event handler callback for the specified tag.


Define Documentation

#define ALP_IS_SMART_TEXT obj   )     (G_TYPE_CHECK_INSTANCE_TYPE((obj), ALP_TYPE_SMART_TEXT))
 

#define ALP_IS_SMART_TEXT_CLASS klass   )     (G_TYPE_CHECK_CLASS_TYPE((klass), ALP_TYPE_SMART_TEXT))
 

#define ALP_SMART_TEXT obj   )     (G_TYPE_CHECK_INSTANCE_CAST((obj), ALP_TYPE_SMART_TEXT, AlpSmartText))
 

#define ALP_SMART_TEXT_CLASS klass   )     (G_TYPE_CHECK_CLASS_CAST((klass), ALP_TYPE_SMART_TEXT, AlpSmartTextClass))
 

#define ALP_SMART_TEXT_GET_CLASS obj   )     (G_TYPE_INSTANCE_GET_CLASS((obj), ALP_TYPE_SMART_TEXT, AlpSmartTextClass))
 

#define ALP_SMART_TEXT_TAG_NAME_EMAIL   "AlpSmartTextEmail"
 

Name of email text tag. Used with alp_smart_text_get_tag_with_name.

#define ALP_SMART_TEXT_TAG_NAME_INTLNUM   "AlpSmartTextIntl"
 

Name of international phone number text tag. Used with alp_smart_text_get_tag_with_name.

#define ALP_SMART_TEXT_TAG_NAME_LOCALNUM   "AlpSmartTextLocal"
 

Name of local phone number text tag. Used with alp_smart_text_get_tag_with_name.

#define ALP_SMART_TEXT_TAG_NAME_RTSP   "AlpSmartTextRtsp"
 

Name of rstp URL text tag. Used with alp_smart_text_get_tag_with_name.

#define ALP_SMART_TEXT_TAG_NAME_URL   "AlpSmartTextUrl"
 

Name of URL text tag. Used with alp_smart_text_get_tag_with_name.

#define ALP_SMART_TEXT_TAG_NAME_USSDREQ   "AlpSmartTextUssdReq"
 

Name of USSD request text tag. Used with alp_smart_text_get_tag_with_name.

#define ALP_TYPE_SMART_TEXT   (alp_smart_text_get_type())
 


Typedef Documentation

typedef struct _AlpSmartText AlpSmartText
 

typedef struct _AlpSmartTextClass AlpSmartTextClass
 

typedef void(* AlpSmartTextHandlerCallback)(GtkTextTag *tag, char *text, GtkWidget *widget, void *userdata)
 

Callback function that performs an action when the user activates a smart text tag.

Parameters:
[in] tag the GtkTextTag that the user has activated
[in] text the text within the tag, for example, the phone number, URL, or email address
[in] widget a widget that can be used to position a menu on the screen
[in] pointer to user data associated with the callback


Function Documentation

GtkTextTag* alp_smart_text_create_tag AlpSmartText self,
char *  name
 

Create a tag that looks like a Smart Text Engine tag. Adds the tag to the text buffer.

Parameters:
[in] self the smart text engine
[in] name the tag name. Specify NULL for an anonymous tag.
Returns:
pointer to the new tag or NULL if an error occurs
Remarks:
This is a replacement for the gtk_text_buffer_create_tag function except that it uses the default tag creator function defined by the licensee.

void alp_smart_text_enable_tag AlpSmartText self,
GtkTextTag *  tag,
bool  enable
 

Enables or disables the recognizer and handler associated with a particular tag.

Parameters:
[in] self the smart text engine
[in] tag GtkTextTag or NULL to enable/disable all tags
[in] enable whether to enable or disable the parser for the tag
Returns:
pointer to the text tag or NULL if an error occurs

GtkTextTag* alp_smart_text_get_tag_with_name AlpSmartText self,
char *  name
 

Convenience function that returns a pointer to the text tag with the specified name.

Parameters:
[in] self the smart text engine
[in] name name of the tag to retrieve
Returns:
pointer to the text tag or NULL if an error occurs

GType alp_smart_text_get_type void   ) 
 

This is the function behind the GTK ALP_TYPE_SMART_TEXT macro that is used in macros like ALP_SMART_TEXT and ALP_IS_SMART_TEXT - you will probably never have any reason to call this method directly.

AlpSmartText* alp_smart_text_new GtkTextView *  textView  ) 
 

Creates a new AlpSmartText engine and attaches it to the specified text view.

Parameters:
[in] textView The text view that the engine will work with.
Returns:
a new AlpSmartText engine.

void alp_smart_text_set_handler_for_tag AlpSmartText self,
GtkTextTag *  tag,
AlpSmartTextHandlerCallback  handlerCallback,
void *  handlerUserdata
 

Sets the event handler callback for the specified tag.

Parameters:
[in] self the smart text engine
[in] tag the tag that can be activated
[in] handlerCallback the callback that is called when the tag is activated
[in] handlerUserdata user data associated with the callback
Returns:
nothing
Remarks:
This function can be used with tags that you created with alp_smart_text_create_tag or with AlpSmartText predefined tags. You can use the alp_smart_text_get_tag_with_name to get a predefined tag.


Generated on Wed Jul 30 07:06:42 2008 by Doxygen 1.4.6 for ALP SDK + Hiker Documentation

Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.