Synopsis

#include <adg-1/adg.h>

struct              AdgTextualIface;
void                adg_textual_set_font_dress          (AdgTextual *textual,
                                                         AdgDress dress);
AdgDress            adg_textual_get_font_dress          (AdgTextual *textual);
void                adg_textual_set_text                (AdgTextual *textual,
                                                         const gchar *text);
gchar *             adg_textual_dup_text                (AdgTextual *textual);
void                adg_textual_text_changed            (AdgTextual *textual,
                                                         const gchar *old_text);

Description

The AdgTextual interface should be implemented by entities that can be expressed by text. AdgToyText is a typical case but also more complex entities could implement it.

Details

struct AdgTextualIface

struct AdgTextualIface {
    /* Virtual table */
    void                (*set_font_dress)       (AdgTextual     *textual,
                                                 AdgDress        dress);
    AdgDress            (*get_font_dress)       (AdgTextual     *textual);
    void                (*set_text)             (AdgTextual     *textual,
                                                 const gchar    *text);
    gchar *             (*dup_text)             (AdgTextual     *textual);

    /* Signals */
    void                (*text_changed)         (AdgTextual     *textual,
                                                 const gchar    *old_text);
};

The virtual methods set_text and dup_text must be implemented by all the types which implement this interface.

set_font_dress ()

abstract virtual method to change the font dress.

get_font_dress ()

abstract virtual method to get the active font dress.

set_text ()

abstract virtual method to set a new text.

dup_text ()

abstract virtual method that returns a duplicate of the actual text.

text_changed ()

default signal handler for "text-changed".

Since 1.0


adg_textual_set_font_dress ()

void                adg_textual_set_font_dress          (AdgTextual *textual,
                                                         AdgDress dress);

Sets the font dress of textual to dress.

textual :

an object that implements AdgTextual

dress :

the new dress

Since 1.0


adg_textual_get_font_dress ()

AdgDress            adg_textual_get_font_dress          (AdgTextual *textual);

Gets the current font dress of textual, eventually resolved to an AdgFontStyle before the rendering.

textual :

an object that implements AdgTextual

Returns :

the current font dress of textual. [transfer none]

Since 1.0


adg_textual_set_text ()

void                adg_textual_set_text                (AdgTextual *textual,
                                                         const gchar *text);

Sets a new text on textual. If text is the same as the old text no actions are performed, otherwise the set_text() virtual method is called and the "text-changed" signal is emitted.

textual :

an object that implements AdgTextual

text :

the new text to be set

Since 1.0


adg_textual_dup_text ()

gchar *             adg_textual_dup_text                (AdgTextual *textual);

Gets a duplicate of the current text bound to textual.

textual :

an object that implements AdgTextual

Returns :

the current text of textual: free with g_free() when finished

Since 1.0


adg_textual_text_changed ()

void                adg_textual_text_changed            (AdgTextual *textual,
                                                         const gchar *old_text);

Emits the "text-changed" signal on textual.

Note

This function is only useful when creating a new class that implements the AdgTextual interface.

textual :

an object that implements AdgTextual

old_text :

the old text bound to textual

Since 1.0