219 lines
7.2 KiB
C
219 lines
7.2 KiB
C
|
#ifndef _EFL_CANVAS_TEXT_INTERNAL_H
|
||
|
#define _EFL_CANVAS_TEXT_INTERNAL_H
|
||
|
|
||
|
#include <Evas.h>
|
||
|
|
||
|
#define _REPLACEMENT_CHAR_UTF8 "\xEF\xBF\xBC"
|
||
|
#define _PARAGRAPH_SEPARATOR_UTF8 "\xE2\x80\xA9"
|
||
|
#define _NEWLINE_UTF8 "\n"
|
||
|
#define _TAB_UTF8 "\t"
|
||
|
|
||
|
/* private struct for textblock object internal data */
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Efl_Canvas_Text_Data
|
||
|
* The actual textblock object.
|
||
|
*/
|
||
|
typedef struct _Evas_Object_Textblock Efl_Canvas_Text_Data;
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Evas_Object_Style_Tag
|
||
|
* The structure used for finding style tags.
|
||
|
*/
|
||
|
typedef struct _Evas_Object_Style_Tag Evas_Object_Style_Tag;
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Evas_Object_Style_Tag
|
||
|
* The structure used for finding style tags.
|
||
|
*/
|
||
|
typedef struct _Evas_Object_Style_Tag_Base Evas_Object_Style_Tag_Base;
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Evas_Object_Textblock_Node_Text
|
||
|
* A text node.
|
||
|
*/
|
||
|
typedef struct _Evas_Object_Textblock_Node_Text Evas_Object_Textblock_Node_Text;
|
||
|
/*
|
||
|
* Defined in Evas.h
|
||
|
typedef struct _Evas_Object_Textblock_Node_Format Evas_Object_Textblock_Node_Format;
|
||
|
*/
|
||
|
typedef struct _Evas_Textblock_Node_Format Evas_Textblock_Node_Format;
|
||
|
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Evas_Object_Textblock_Paragraph
|
||
|
* A layouting paragraph.
|
||
|
*/
|
||
|
typedef struct _Evas_Object_Textblock_Paragraph Evas_Object_Textblock_Paragraph;
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Evas_Object_Textblock_Line
|
||
|
* A layouting line.
|
||
|
*/
|
||
|
typedef struct _Evas_Object_Textblock_Line Evas_Object_Textblock_Line;
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Evas_Object_Textblock_Item
|
||
|
* A layouting item.
|
||
|
*/
|
||
|
typedef struct _Evas_Object_Textblock_Item Evas_Object_Textblock_Item;
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Evas_Object_Textblock_Item
|
||
|
* A layouting text item.
|
||
|
*/
|
||
|
typedef struct _Evas_Object_Textblock_Text_Item Evas_Object_Textblock_Text_Item;
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Evas_Object_Textblock_Format_Item
|
||
|
* A layouting format item.
|
||
|
*/
|
||
|
typedef struct _Evas_Object_Textblock_Format_Item Evas_Object_Textblock_Format_Item;
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Evas_Object_Textblock_Format
|
||
|
* A textblock format.
|
||
|
*/
|
||
|
typedef struct _Evas_Object_Textblock_Format Evas_Object_Textblock_Format;
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Evas_Textblock_Selection_Iterator
|
||
|
* A textblock selection iterator.
|
||
|
*/
|
||
|
typedef struct _Evas_Textblock_Selection_Iterator Evas_Textblock_Selection_Iterator;
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Efl_Text_Annotate_Annotation_Iterator
|
||
|
* A textblock annotation iterator.
|
||
|
*/
|
||
|
typedef struct _Efl_Text_Annotate_Annotation_Iterator Efl_Text_Annotate_Annotation_Iterator;
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Efl_Canvas_Text_Filter
|
||
|
* A structure holding gfx filter information for a text item
|
||
|
*/
|
||
|
typedef struct _Efl_Canvas_Text_Filter Efl_Canvas_Text_Filter;
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Efl_Canvas_Text_Filter_Post_Render
|
||
|
* Post-render data for async rendering of gfx filters
|
||
|
*/
|
||
|
typedef struct _Efl_Canvas_Text_Filter_Post_Render Efl_Canvas_Text_Filter_Post_Render;
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Efl_Canvas_Text_Filter_Program
|
||
|
* Filter name - code database
|
||
|
*/
|
||
|
typedef struct _Efl_Canvas_Text_Filter_Program Efl_Canvas_Text_Filter_Program;
|
||
|
/**
|
||
|
* @internal
|
||
|
* @typedef Text_Item_Filter
|
||
|
* Text item filter properties (run context, output buffer, ...)
|
||
|
*/
|
||
|
typedef struct _Text_Item_Filter Text_Item_Filter;
|
||
|
|
||
|
|
||
|
struct _Evas_Object_Style_Tag_Base
|
||
|
{
|
||
|
const char *tag; /**< Format Identifier: b=Bold, i=Italic etc. */
|
||
|
const char *replace; /**< Replacement string. "font_weight=Bold", "font_style=Italic" etc. */
|
||
|
size_t tag_len; /**< Strlen of tag. */
|
||
|
};
|
||
|
|
||
|
struct _Evas_Object_Style_Tag
|
||
|
{
|
||
|
EINA_INLIST;
|
||
|
Evas_Object_Style_Tag_Base tag; /**< Base style object for holding style information. */
|
||
|
};
|
||
|
|
||
|
struct _Evas_Object_Textblock_Node_Text
|
||
|
{
|
||
|
EINA_INLIST;
|
||
|
Eina_UStrbuf *unicode; /**< Actual paragraph text. */
|
||
|
char *utf8; /**< Text in utf8 format. */
|
||
|
Evas_Object_Textblock_Node_Format *format_node; /**< Points to the last format node before the paragraph, or if there is none, to the first format node within the paragraph.*/
|
||
|
Evas_Object_Textblock_Paragraph *par; /**< Points to the paragraph node of which this node is a part. */
|
||
|
Eina_Bool dirty : 1; /**< EINA_TRUE if already handled/format changed, else EINA_FALSE. */
|
||
|
Eina_Bool is_new : 1; /**< EINA_TRUE if its a new paragraph, else EINA_FALSE. */
|
||
|
};
|
||
|
|
||
|
struct _Evas_Textblock_Node_Format
|
||
|
{
|
||
|
EINA_INLIST;
|
||
|
const char *format; /**< Cached, parsed and translated version of orig_format. */
|
||
|
const char *orig_format; /**< Original format information. */
|
||
|
Evas_Object_Textblock_Node_Text *text_node; /**< The text node it's pointing to. */
|
||
|
Efl_Text_Annotate_Annotation *annotation; /**< Pointer to this node's annotation handle (if exists). */
|
||
|
size_t offset; /**< Offset from the last format node of the same text. */
|
||
|
struct {
|
||
|
unsigned char l, r, t, b;
|
||
|
} pad; /**< Amount of padding required. */
|
||
|
unsigned char anchor : 2; /**< ANCHOR_NONE, ANCHOR_A or ANCHOR_ITEM. */
|
||
|
Eina_Bool opener : 1; /**< EINA_TRUE if opener, else EINA_FALSE. */
|
||
|
Eina_Bool own_closer : 1; /**< EINA_TRUE if own_closer, else EINA_FALSE. */
|
||
|
Eina_Bool visible : 1; /**< EINA_TRUE if format is visible format, else EINA_FALSE. */
|
||
|
Eina_Bool format_change : 1; /**< EINA_TRUE if the format of the textblock has changed, else EINA_FALSE. */
|
||
|
Eina_Bool is_new : 1; /**< EINA_TRUE if its a new format node, else EINA_FALSE */
|
||
|
};
|
||
|
|
||
|
struct _Efl_Text_Cursor_Handle
|
||
|
{
|
||
|
Evas_Object *obj;
|
||
|
Eina_List *cur_objs;
|
||
|
size_t pos;
|
||
|
Evas_Object_Textblock_Node_Text *node;
|
||
|
unsigned int ref_count;
|
||
|
Eina_Bool changed : 1;
|
||
|
};
|
||
|
|
||
|
void evas_textblock_cursor_line_jump_by(Efl_Text_Cursor_Handle *cur, int by);
|
||
|
int _cursor_text_append(Efl_Text_Cursor_Handle *cur, const char *text);
|
||
|
|
||
|
|
||
|
// Used in Efl.Text.Cursor, where multible objects can have same handle.
|
||
|
Efl_Text_Cursor_Handle *
|
||
|
evas_textblock_cursor_ref(Efl_Text_Cursor_Handle *cursor, Eo * cursor_obj);
|
||
|
|
||
|
// Used in Efl.Text.Cursor, where multible objects can have same handle.
|
||
|
void
|
||
|
evas_textblock_cursor_unref(Efl_Text_Cursor_Handle *cursor, Eo * cursor_obj);
|
||
|
|
||
|
#ifdef EAPI
|
||
|
# undef EAPI
|
||
|
#endif
|
||
|
|
||
|
#ifdef _WIN32
|
||
|
# ifdef EFL_BUILD
|
||
|
# ifdef DLL_EXPORT
|
||
|
# define EAPI __declspec(dllexport)
|
||
|
# else
|
||
|
# define EAPI
|
||
|
# endif
|
||
|
# else
|
||
|
# define EAPI __declspec(dllimport)
|
||
|
# endif
|
||
|
#else
|
||
|
# ifdef __GNUC__
|
||
|
# if __GNUC__ >= 4
|
||
|
# define EAPI __attribute__ ((visibility("default")))
|
||
|
# else
|
||
|
# define EAPI
|
||
|
# endif
|
||
|
# else
|
||
|
# define EAPI
|
||
|
# endif
|
||
|
#endif
|
||
|
|
||
|
/**
|
||
|
* Internally sets given text_object into cursor object.
|
||
|
*
|
||
|
* @param canvas_text_obj the cursor object.
|
||
|
* @param canvas_text_obj the canvas text object, where cursor methods will take effect.
|
||
|
* @param text_obj the text_object that user can get using cursor text_object property.
|
||
|
*/
|
||
|
EAPI void efl_text_cursor_text_object_set(Eo *cursor, Eo *canvas_text_obj, Eo *text_obj);
|
||
|
|
||
|
#undef EAPI
|
||
|
#define EAPI
|
||
|
|
||
|
#endif
|