Top | ![]() |
![]() |
![]() |
![]() |
GtkTextBuffer * | talkatu_buffer_new () |
TalkatuBufferStyle | talkatu_buffer_get_style () |
GSimpleActionGroup * | talkatu_buffer_get_action_group () |
void | talkatu_buffer_insert_markup () |
void | talkatu_buffer_insert_markup_with_tags_by_name () |
void | talkatu_buffer_insert_link () |
void | talkatu_buffer_clear () |
gchar * | talkatu_buffer_get_plain_text () |
gboolean | talkatu_buffer_get_is_empty () |
GActionGroup * | action-group | Read / Write / Construct Only |
TalkatuBufferStyle | style | Read / Write / Construct Only |
enum | TalkatuBufferStyle |
#define | TALKATU_BUFFER_LINK_TARGET_ATTRIBUTE |
#define | TALKATU_TYPE_BUFFER |
struct | TalkatuBufferClass |
TalkatuBuffer |
GObject ╰── GtkTextBuffer ╰── TalkatuBuffer ├── TalkatuHtmlBuffer ├── TalkatuMarkdownBuffer ╰── TalkatuWholeBuffer
Talkatu implements a couple of different types of text buffers. This API tries to abstract the commonalities between them and make it easier to create text buffers for additional markup types.
GtkTextBuffer *
talkatu_buffer_new (GSimpleActionGroup *action_group
);
This is a simple GtkTextBuffer subclass that contains the shared behavior for the other Talkatu text buffers.
TalkatuBufferStyle
talkatu_buffer_get_style (TalkatuBuffer *buffer
);
Get's format style of buffer
.
GSimpleActionGroup *
talkatu_buffer_get_action_group (TalkatuBuffer *buffer
);
A TalkatuBuffer can support multiple actions, whether it's formatting of text, or being able to insert images, code, etc. This function is called by TalkatuView to map them to keybindings as well as the format toolbar.
void talkatu_buffer_insert_markup (TalkatuBuffer *buffer
,GtkTextIter *pos
,const gchar *new_text
,gint new_text_length
);
Inserts text that will be or already is marked up. Calling this tells
buffer
to not apply the currently selected format to the newly inserted
text, which is what it does when text is normally inserted.
buffer |
The TalkatuBuffer instance. |
|
pos |
The GtkTextIter where the text should be inserted. |
|
new_text |
The new text to insert. |
|
new_text_length |
The len of |
void talkatu_buffer_insert_markup_with_tags_by_name (TalkatuBuffer *buffer
,GtkTextIter *pos
,const gchar *new_text
,gint new_text_length
,const gchar *first_tag_name
,...
);
Similiar to talkatu_buffer_insert_markup but allows you to specify tags to apply to the newly inserted text.
buffer |
The TalkatuBuffer instance. |
|
pos |
The GtkTextIter where the text should be inserted. |
|
new_text |
UTF-8 text. |
|
new_text_length |
The len of |
|
first_tag_name |
The name of the first tag to apply to |
|
... |
Additional tags to apply to |
void talkatu_buffer_insert_link (TalkatuBuffer *buffer
,GtkTextIter *pos
,const gchar *display_text
,const gchar *url
);
Inserts a link into buffer
with the given url
and display_text
. If
display_text
is not given, url
will be used.
buffer |
The TalkatuBuffer instance. |
|
pos |
The GtkTextIter where to insert the link. |
|
display_text |
The Text to display for the link. |
|
url |
The url to link to. |
void
talkatu_buffer_clear (TalkatuBuffer *buffer
);
Clears all text out of the buffer.
gchar *
talkatu_buffer_get_plain_text (TalkatuBuffer *buffer
);
Returns the text from the buffer without markup.
Returns (transfer full): A copy of the text from buffer
.
gboolean
talkatu_buffer_get_is_empty (TalkatuBuffer *buffer
);
Returns whether or not buffer
has any text in it.
#define TALKATU_BUFFER_LINK_TARGET_ATTRIBUTE "talkatu_link_target"
The name of the attribute set on GtkTextTags that contain the URL for links.
struct TalkatuBufferClass { GtkTextBufferClass parent; void (*insert_markup)(TalkatuBuffer *buffer, GtkTextIter *pos, const gchar *new_text, gint new_text_length); GSimpleActionGroup *(*create_action_group)(TalkatuBuffer *buffer); gpointer reserved[4]; };
“action-group”
property “action-group” GActionGroup *
The action group for this buffer.
Flags: Read / Write / Construct Only
“style”
property“style” TalkatuBufferStyle
The format style of the buffer.
Flags: Read / Write / Construct Only
Default value: TALKATU_BUFFER_STYLE_RICH