## GdictDefbox GdictDefbox — Display the list of definitions for a word |

## Synopsis

    struct              GdictDefbox;
    struct              GdictDefboxClass;
    GtkWidget *         gdict_defbox_new                    (void);
    GtkWidget *         gdict_defbox_new_with_context       (GdictContext *context);
    void                gdict_defbox_set_context            (GdictDefbox *defbox,
                                                             GdictContext *context);
    GdictContext *      gdict_defbox_get_context            (GdictDefbox *defbox);
    void                gdict_defbox_set_database           (GdictDefbox *defbox,
                                                             const gchar *database);
    const gchar *       gdict_defbox_get_database           (GdictDefbox *defbox);
    gchar *             gdict_defbox_get_text               (GdictDefbox *defbox,
                                                             gsize *length);
    void                gdict_defbox_select_all             (GdictDefbox *defbox);
    void                gdict_defbox_copy_to_clipboard      (GdictDefbox *defbox,
                                                             GtkClipboard *clipboard);
    void                gdict_defbox_clear                  (GdictDefbox *defbox);
    void                gdict_defbox_lookup                 (GdictDefbox *defbox,
                                                             const gchar *word);
    const gchar *       gdict_defbox_get_word               (GdictDefbox *defbox);
    gint                gdict_defbox_count_definitions      (GdictDefbox *defbox);
    void                gdict_defbox_jump_to_definition     (GdictDefbox *defbox,
                                                             gint number);
    void                gdict_defbox_set_show_find          (GdictDefbox *defbox,
                                                             gboolean show_find);
    gboolean            gdict_defbox_get_show_find          (GdictDefbox *defbox);
    void                gdict_defbox_find_next              (GdictDefbox *defbox);
    void                gdict_defbox_find_previous          (GdictDefbox *defbox);
    void                gdict_defbox_set_font_name          (GdictDefbox *defbox,
                                                             const gchar *font_name);
    const gchar *       gdict_defbox_get_font_name          (GdictDefbox *defbox);
    gchar *             gdict_defbox_get_selected_word      (GdictDefbox *defbox);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkWidget
                   +----GtkContainer
                         +----GtkBox
                               +----GtkVBox
                                     +----GdictDefbox

## Implemented Interfaces

GdictDefbox implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Properties

      "context"                  GdictContext*         : Read / Write / Construct
      "database"                 gchar*                : Read / Write
      "font-name"                gchar*                : Read / Write
      "word"                     gchar*                : Read / Write

## Signals

      "find-next"                                      : Action
      "find-previous"                                  : Action
      "hide-find"                                      : Action
      "link-clicked"                                   : Run Last
      "show-find"                                      : Action

## Description

The GdictDefbox widget is a composite widget showing the list of definitions for a word. It queries the passed GdictContext and displays the list of GdictDefinitions obtained.

It provides syntax highlighting, clickable links and an embedded find bar.

## Details

### struct GdictDefbox

    struct GdictDefbox;

### struct GdictDefboxClass

    struct GdictDefboxClass {
      GtkVBoxClass parent_class;

      /* these are all RUN_ACTION signals for key bindings */
      void (*show_find)     (GdictDefbox *defbox);
      void (*hide_find)     (GdictDefbox *defbox);
      void (*find_previous) (GdictDefbox *defbox);
      void (*find_next)     (GdictDefbox *defbox);

      /* signals */
      void (*link_clicked)  (GdictDefbox *defbox,
                             const gchar *link);

      /* padding for future expansion */
      void (*_gdict_defbox_1) (void);
      void (*_gdict_defbox_2) (void);
      void (*_gdict_defbox_3) (void);
      void (*_gdict_defbox_4) (void);
    };

### gdict_defbox_new ()

    GtkWidget *         gdict_defbox_new                    (void);

Creates a new GdictDefbox widget. Use this widget to search for a word using a GdictContext, and to show the resulting definition(s). You must set a GdictContext for this widget using `gdict_defbox_set_context()`.

Returns : | a new GdictDefbox widget.

Since 0.1

### gdict_defbox_new_with_context ()

    GtkWidget *         gdict_defbox_new_with_context       (GdictContext *context);

Creates a new GdictDefbox widget. Use this widget to search for a word using `context`, and to show the resulting definition.

`context` : | a GdictContext
Returns : | a new GdictDefbox widget.

Since 0.1

### gdict_defbox_set_context ()

    void                gdict_defbox_set_context            (GdictDefbox *defbox,
                                                             GdictContext *context);

Sets `context` as the GdictContext to be used by `defbox` in order to retrieve the definitions of a word.

`defbox` : | a GdictDefbox
`context` : | a GdictContext

Since 0.1

### gdict_defbox_get_context ()

    GdictContext *      gdict_defbox_get_context            (GdictDefbox *defbox);

Gets the GdictContext used by `defbox`.

`defbox` : | a GdictDefbox
Returns : | a GdictContext.

Since 0.1

### gdict_defbox_set_database ()

    void                gdict_defbox_set_database           (GdictDefbox *defbox,
                                                             const gchar *database);

Sets `database` as the database used by the GdictContext bound to `defbox` to query for word definitions.

`defbox` : | a GdictDefbox
`database` : | a database

Since 0.1

### gdict_defbox_get_database ()

    const gchar *       gdict_defbox_get_database           (GdictDefbox *defbox);

Gets the database used by `defbox`. See `gdict_defbox_set_database()`.

`defbox` : | a GdictDefbox
Returns : | the name of a database. The return string is owned by the GdictDefbox widget and should not be modified or freed.

Since 0.1

### gdict_defbox_get_text ()

    gchar *             gdict_defbox_get_text               (GdictDefbox *defbox,
                                                             gsize *length);

Gets the full contents of `defbox`.

`defbox` : | a GdictDefbox
`length` : | return location for the text length or `NULL`
Returns : | a newly allocated string containing the text displayed by `defbox`.

Since 0.1

### gdict_defbox_select_all ()

    void                gdict_defbox_select_all             (GdictDefbox *defbox);

Selects all the text displayed by `defbox`

`defbox` : | a GdictDefbox

Since 0.1

### gdict_defbox_copy_to_clipboard ()

    void                gdict_defbox_copy_to_clipboard      (GdictDefbox *defbox,
                                                             GtkClipboard *clipboard);

Copies the selected text inside `defbox` into `clipboard`.

`defbox` : | a GdictDefbox
`clipboard` : | a GtkClipboard

Since 0.1

### gdict_defbox_clear ()

    void                gdict_defbox_clear                  (GdictDefbox *defbox);

Clears the buffer of `defbox`

`defbox` : | a `GdictDefbox`

Since 0.1

### gdict_defbox_lookup ()

    void                gdict_defbox_lookup                 (GdictDefbox *defbox,
                                                             const gchar *word);

Searches `word` inside the dictionary sources using the GdictContext provided when creating `defbox` or set using `gdict_defbox_set_context()`.

`defbox` : | a GdictDefbox
`word` : | the word to look up

Since 0.1

### gdict_defbox_get_word ()

    const gchar *       gdict_defbox_get_word               (GdictDefbox *defbox);

Retrieves the word being looked up.

`defbox` : | a GdictDefbox
Returns : | the word looked up, or `NULL`. The returned string is owned by the GdictDefbox widget and should never be modified or freed.

Since 0.12

### gdict_defbox_count_definitions ()

    gint                gdict_defbox_count_definitions      (GdictDefbox *defbox);

Gets the number of definitions displayed by `defbox`

`defbox` : | a GdictDefbox
Returns : | the number of definitions.

Since 0.1

### gdict_defbox_jump_to_definition ()

    void                gdict_defbox_jump_to_definition     (GdictDefbox *defbox,
                                                             gint number);

Scrolls to the definition identified by `number`. If `number` is -1, jumps to the last definition.

`defbox` : | a GdictDefbox
`number` : | the definition to jump to

Since 0.1

### gdict_defbox_set_show_find ()

    void                gdict_defbox_set_show_find          (GdictDefbox *defbox,
                                                             gboolean show_find);

Whether `defbox` should show the find pane.

`defbox` : | a GdictDefbox
`show_find` : | `TRUE` to show the find pane

Since 0.1

### gdict_defbox_get_show_find ()

    gboolean            gdict_defbox_get_show_find          (GdictDefbox *defbox);

Gets whether the find pane should be visible or not.

`defbox` : | a GdictDefbox
Returns : | `TRUE` if the find pane is visible.

Since 0.1

### gdict_defbox_find_next ()

    void                gdict_defbox_find_next              (GdictDefbox *defbox);

Emits the "find-next" signal.

`defbox` : | a GdictDefbox

Since 0.1

### gdict_defbox_find_previous ()

    void                gdict_defbox_find_previous          (GdictDefbox *defbox);

Emits the "find-previous" signal.

`defbox` : | a GdictDefbox

Since 0.1

### gdict_defbox_set_font_name ()

    void                gdict_defbox_set_font_name          (GdictDefbox *defbox,
                                                             const gchar *font_name);

Sets `font_name` as the font for `defbox`. It calls internally `pango_font_description_from_string()` and `gtk_widget_modify_font()`.

Passing `NULL` for `font_name` will reset any previously set font.

`defbox` : | a GdictDefbox
`font_name` : | a font description, or `NULL`

Since 0.3.0

### gdict_defbox_get_font_name ()

    const gchar *       gdict_defbox_get_font_name          (GdictDefbox *defbox);

Retrieves the font currently used by `defbox`.

`defbox` : | a GdictDefbox
Returns : | a font name. The returned string is owned by `defbox` and should not be modified or freed.

Since 0.3

### gdict_defbox_get_selected_word ()

    gchar *             gdict_defbox_get_selected_word      (GdictDefbox *defbox);

Retrieves the selected word from the defbox widget

`defbox` : | a GdictDefbox
Returns : | a newly allocated string containing the selected word. Use `g_free()` when done using it.

Since 0.12

## Property Details

### The `"context"` property

      "context"                  GdictContext*         : Read / Write / Construct

The GdictContext object used to get the word definition.

Since 0.1

### The `"database"` property

      "database"                 gchar*                : Read / Write

The database used by the GdictDefbox bound to this object to get the word definition.

Default value: "*"

Since 0.1

### The `"font-name"` property

      "font-name"                gchar*                : Read / Write

The name of the font used by the GdictDefbox to display the definitions. use the same string you use for `pango_font_description_from_string()`.

Default value: "Sans 10"

Since 0.3

### The `"word"` property

      "word"                     gchar*                : Read / Write

The word to look up.

Default value: NULL

Since 0.10

## Signal Details

### The `"find-next"` signal

    void                user_function                      (GdictDefbox *gdictdefbox,
                                                            gpointer     user_data)        : Action

### The `"find-previous"` signal

    void                user_function                      (GdictDefbox *gdictdefbox,
                                                            gpointer     user_data)        : Action

### The `"hide-find"` signal

    void                user_function                      (GdictDefbox *gdictdefbox,
                                                            gpointer     user_data)        : Action

### The `"link-clicked"` signal

    void                user_function                      (GdictDefbox *gdictdefbox,
                                                            gchar       *arg1,
                                                            gpointer     user_data)        : Run Last

### The `"show-find"` signal

    void                user_function                      (GdictDefbox *gdictdefbox,
                                                            gpointer     user_data)        : Action