## GntWidget

GntWidget — A general widget

## Functions

#define | GNTSEAL()
#define | GNT_WIDGET_FLAGS()
#define | GNT_WIDGET_SET_FLAGS()
#define | GNT_WIDGET_UNSET_FLAGS()
GType | gnt_widget_get_gtype ()
void | gnt_widget_destroy ()
void | gnt_widget_show ()
void | gnt_widget_draw ()
void | gnt_widget_expose ()
void | gnt_widget_hide ()
GntWidget * | gnt_widget_get_parent ()
GntWidget * | gnt_widget_get_toplevel ()
void | gnt_widget_get_position ()
void | gnt_widget_set_position ()
void | gnt_widget_size_request ()
void | gnt_widget_get_size ()
gboolean | gnt_widget_set_size ()
gboolean | gnt_widget_confirm_size ()
gboolean | gnt_widget_key_pressed ()
gboolean | gnt_widget_clicked ()
gboolean | gnt_widget_set_focus ()
void | gnt_widget_activate ()
void | gnt_widget_set_name ()
const char * | gnt_widget_get_name ()
void | gnt_widget_queue_update ()
void | gnt_widget_set_take_focus ()
gboolean | gnt_widget_get_take_focus ()
void | gnt_widget_set_visible ()
gboolean | gnt_widget_get_visible ()
gboolean | gnt_widget_has_shadow ()
gboolean | gnt_widget_in_destruction ()
void | gnt_widget_set_drawing ()
gboolean | gnt_widget_get_drawing ()
void | gnt_widget_set_mapped ()
gboolean | gnt_widget_get_mapped ()
void | gnt_widget_set_has_border ()
gboolean | gnt_widget_get_has_border ()
void | gnt_widget_set_has_shadow ()
gboolean | gnt_widget_get_has_shadow ()
void | gnt_widget_set_has_focus ()
gboolean | gnt_widget_get_has_focus ()
void | gnt_widget_set_is_urgent ()
gboolean | gnt_widget_get_is_urgent ()
void | gnt_widget_set_grow_x ()
gboolean | gnt_widget_get_grow_x ()
void | gnt_widget_set_grow_y ()
gboolean | gnt_widget_get_grow_y ()
void | gnt_widget_set_transient ()
gboolean | gnt_widget_get_transient ()
void | gnt_widget_set_disable_actions ()
gboolean | gnt_widget_get_disable_actions ()

## Types and Values

enum | GntWidgetFlags
enum | GntMouseEvent
enum | GntParamFlags
struct | GntWidgetPriv
struct | GntWidget

## Object Hierarchy

        GObject
        ╰── GntBindable
            ╰── GntWidget
                ╰── GntProgressBar

## Description

## Functions

### GNTSEAL()

    #define             GNTSEAL(ident)

### GNT_WIDGET_FLAGS()

    #define             GNT_WIDGET_FLAGS(obj)

`GNT_WIDGET_FLAGS` has been deprecated since version 2.14.0 and should not be used in newly-written code.

See GntWidgetFlags for individual accessors instead.

### GNT_WIDGET_SET_FLAGS()

    #define             GNT_WIDGET_SET_FLAGS(obj, flags)

`GNT_WIDGET_SET_FLAGS` has been deprecated since version 2.14.0 and should not be used in newly-written code.

See GntWidgetFlags for individual accessors instead.

### GNT_WIDGET_UNSET_FLAGS()

    #define             GNT_WIDGET_UNSET_FLAGS(obj, flags)

`GNT_WIDGET_UNSET_FLAGS` has been deprecated since version 2.14.0 and should not be used in newly-written code.

See GntWidgetFlags for individual accessors instead.

### gnt_widget_get_gtype ()

    GType
    gnt_widget_get_gtype (void);

#### Returns

GType for GntWidget.

### gnt_widget_destroy ()

    void
    gnt_widget_destroy (GntWidget *widget);

Destroy a widget.

Emits the "destroy" signal notifying all reference holders that they should release `widget` .

#### Parameters

widget | The widget to destroy. |

### gnt_widget_show ()

    void
    gnt_widget_show (GntWidget *widget);

Show a widget. This should only be used for toplevel widgets. For the rest of the widgets, use gnt_widget_draw instead.

#### Parameters

widget | The widget to show. |

### gnt_widget_draw ()

    void
    gnt_widget_draw (GntWidget *widget);

Draw a widget.

#### Parameters

widget | The widget to draw. |

### gnt_widget_expose ()

    void
    gnt_widget_expose (GntWidget *widget,
                       int x,
                       int y,
                       int width,
                       int height);

`gnt_widget_expose` has been deprecated since version 2.14.0 and should not be used in newly-written code.

Expose part of a widget.

Internal function -- do not use.

### gnt_widget_hide ()

    void
    gnt_widget_hide (GntWidget *widget);

Hide a widget.

#### Parameters

widget | The widget to hide. |

### gnt_widget_get_parent ()

    GntWidget *
    gnt_widget_get_parent (GntWidget *widget);

Get the parent of a widget.

#### Parameters

widget | The widget. |

#### Returns

The parent widget.

[transfer none][nullable]

Since: 2.14.0

### gnt_widget_get_toplevel ()

    GntWidget *
    gnt_widget_get_toplevel (GntWidget *widget);

Get the toplevel parent of a widget in the container hierarchy. If widget has no parent widgets, it will be returned as the topmost widget.

#### Parameters

widget | The widget. |

#### Returns

The toplevel parent widget.

[transfer none][nullable]

Since: 2.14.0

### gnt_widget_get_position ()

    void
    gnt_widget_get_position (GntWidget *widget,
                             int *x,
                             int *y);

Get the position of a widget.

#### Parameters

widget | The widget. |
x | Location to store the x-coordinate of the widget. |
y | Location to store the y-coordinate of the widget. |

### gnt_widget_set_position ()

    void
    gnt_widget_set_position (GntWidget *widget,
                             int x,
                             int y);

Set the position of a widget.

#### Parameters

widget | The widget to reposition. |
x | The x-coordinate of the widget. |
y | The x-coordinate of the widget. |

### gnt_widget_size_request ()

    void
    gnt_widget_size_request (GntWidget *widget);

Request a widget to calculate its desired size.

#### Parameters

widget | The widget. |

### gnt_widget_get_size ()

    void
    gnt_widget_get_size (GntWidget *widget,
                         int *width,
                         int *height);

Get the size of a widget.

#### Parameters

widget | The widget. |
width | Location to store the width of the widget. |
height | Location to store the height of the widget. |

### gnt_widget_set_size ()

    gboolean
    gnt_widget_set_size (GntWidget *widget,
                         int width,
                         int height);

Set the size of a widget.

#### Parameters

widget | The widget to resize. |
width | The width of the widget. |
height | The height of the widget. |

#### Returns

If the widget was resized to the new size.

### gnt_widget_confirm_size ()

    gboolean
    gnt_widget_confirm_size (GntWidget *widget,
                             int width,
                             int height);

Confirm a requested a size for a widget.

#### Parameters

widget | The widget. |
width | The requested width. |
height | The requested height. |

#### Returns

`TRUE` if the new size was confirmed, `FALSE` otherwise.

### gnt_widget_key_pressed ()

    gboolean
    gnt_widget_key_pressed (GntWidget *widget,
                            const char *keys);

Trigger the key-press callbacks for a widget.

#### Parameters

widget | The widget. |
keys | The keypress on the widget. |

#### Returns

`TRUE` if the key-press was handled, `FALSE` otherwise.

### gnt_widget_clicked ()

    gboolean
    gnt_widget_clicked (GntWidget *widget,
                        GntMouseEvent event,
                        int x,
                        int y);

Trigger the 'click' callback of a widget.

#### Parameters

widget | The widget. |
event | The mouseevent. |
x | The x-coordinate of the mouse. |
y | The y-coordinate of the mouse. |

#### Returns

`TRUE` if the event was handled, `FALSE` otherwise.

### gnt_widget_set_focus ()

    gboolean
    gnt_widget_set_focus (GntWidget *widget,
                          gboolean set);

Give or remove focus to a widget.

#### Parameters

widget | The widget. |
set | `TRUE` of focus should be given to the widget, `FALSE` if focus should be removed. |

#### Returns

`TRUE` if the focus has been changed, `FALSE` otherwise.

### gnt_widget_activate ()

    void
    gnt_widget_activate (GntWidget *widget);

Activate a widget. This only applies to widgets that can be activated (eg. GntButton)

#### Parameters

widget | The widget to activate. |

### gnt_widget_set_name ()

    void
    gnt_widget_set_name (GntWidget *widget,
                         const char *name);

Set the name of a widget.

#### Parameters

widget | The widget. |
name | A new name for the widget. |

### gnt_widget_get_name ()

    const char *
    gnt_widget_get_name (GntWidget *widget);

Get the name of a widget.

#### Parameters

widget | The widget. |

#### Returns

The name of the widget.

### gnt_widget_queue_update ()

    void
    gnt_widget_queue_update (GntWidget *widget);

`gnt_widget_queue_update` has been deprecated since version 2.14.0 and should not be used in newly-written code.

Use `gnt_widget_draw()` instead.

Internal function -- do not use. Use `gnt_widget_draw()` instead.

### gnt_widget_set_take_focus ()

    void
    gnt_widget_set_take_focus (GntWidget *widget,
                               gboolean set);

Set whether a widget can take focus or not.

#### Parameters

widget | The widget. |
set | `TRUE` if the widget can take focus. |

### gnt_widget_get_take_focus ()

    gboolean
    gnt_widget_get_take_focus (GntWidget *widget);

Get whether a widget can take focus or not.

#### Parameters

widget | The widget. |

#### Returns

`TRUE` if the widget can take focus.

Since: 2.14.0

### gnt_widget_set_visible ()

    void
    gnt_widget_set_visible (GntWidget *widget,
                            gboolean set);

Set the visibility of a widget.

#### Parameters

widget | The widget. |
set | Whether the widget is visible or not. |

### gnt_widget_get_visible ()

    gboolean
    gnt_widget_get_visible (GntWidget *widget);

Get the visibility of a widget.

#### Parameters

widget | The widget. |

#### Returns

Whether the widget is visible or not.

Since: 2.14.0

### gnt_widget_has_shadow ()

    gboolean
    gnt_widget_has_shadow (GntWidget *widget);

Check whether the widget has shadows.

#### Parameters

widget | The widget. |

#### Returns

`TRUE` if the widget has shadows. This checks both the user-setting and whether the widget can have shadows at all.

### gnt_widget_in_destruction ()

    gboolean
    gnt_widget_in_destruction (GntWidget *widget);

Returns whether the widget is currently being destroyed.

This information can sometimes be used to avoid doing unnecessary work.

#### Parameters

widget | The widget |

#### Returns

`TRUE` if the widget is being destroyed.

Since: 2.14.0

### gnt_widget_set_drawing ()

    void
    gnt_widget_set_drawing (GntWidget *widget,
                            gboolean drawing);

Marks the widget as being drawn (or not).

#### Parameters

widget | The widget |
drawing | Whether or not the widget is being drawn |

Since: 2.14.0

### gnt_widget_get_drawing ()

    gboolean
    gnt_widget_get_drawing (GntWidget *widget);

Returns whether the widget is currently being drawn.

This information can sometimes be used to avoid doing unnecessary work.

#### Parameters

widget | The widget |

#### Returns

`TRUE` if the widget is being drawn.

Since: 2.14.0

### gnt_widget_set_mapped ()

    void
    gnt_widget_set_mapped (GntWidget *widget,
                           gboolean mapped);

Marks the widget as being mapped (or not).

This should generally only be called from the widget's "map" or "unmap" implementation.

#### Parameters

widget | The widget |
mapped | Whether or not the widget is mapped |

Since: 2.14.0

### gnt_widget_get_mapped ()

    gboolean
    gnt_widget_get_mapped (GntWidget *widget);

Whether widget is mapped or not.

#### Parameters

widget | The widget |

#### Returns

Whether the widget is mapped or not.

Since: 2.14.0

### gnt_widget_set_has_border ()

    void
    gnt_widget_set_has_border (GntWidget *widget,
                               gboolean has_border);

Sets the has-border property on widget to `has_border` .

#### Parameters

widget | The widget |
has_border | Whether or not the widget has a border |

Since: 2.14.0

### gnt_widget_get_has_border ()

    gboolean
    gnt_widget_get_has_border (GntWidget *widget);

Returns the has-border property on widget.

#### Parameters

widget | The widget |

#### Returns

Whether the widget has a border or not.

Since: 2.14.0

### gnt_widget_set_has_shadow ()

    void
    gnt_widget_set_has_shadow (GntWidget *widget,
                               gboolean has_shadow);

Sets the has-shadow property on widget to has_shadow. Note, setting this property does not necessarily mean the widget will have a shadow, depending on its styling.

#### Parameters

widget | The widget |
has_shadow | Whether or not the widget has a shadow |

Since: 2.14.0

### gnt_widget_get_has_shadow ()

    gboolean
    gnt_widget_get_has_shadow (GntWidget *widget);

Returns the has-shadow property on widget. Note, this is a property of the widget, but does not necessarily mean the widget will have a shadow as that depends on its styling. Use `gnt_widget_has_shadow()` to determine whether the widget will actually have a shadow.

#### Parameters

widget | The widget |

#### Returns

Whether the widget has a shadow set or not.

Since: 2.14.0

### gnt_widget_set_has_focus ()

    void
    gnt_widget_set_has_focus (GntWidget *widget,
                              gboolean has_focus);

Sets the has-focus flag on a widget. Note, setting this flag does not necessarily mean the widget will have focus.

This is mostly for internal use; you probably want to use `gnt_widget_set_focus()` instead.

#### Parameters

widget | The widget |
has_focus | Whether or not the widget has focus |

Since: 2.14.0

### gnt_widget_get_has_focus ()

    gboolean
    gnt_widget_get_has_focus (GntWidget *widget);

Check whether a widget has the focus flag.

This is mostly for internal use; you probably want to use `gnt_widget_has_focus()` instead.

#### Parameters

widget | The widget |

#### Returns

`TRUE` if the widget's focus flag is set, `FALSE` otherwise.

### gnt_widget_set_is_urgent ()

    void
    gnt_widget_set_is_urgent (GntWidget *widget,
                              gboolean urgent);

Set the URGENT hint for a widget.

#### Parameters

widget | The widget to set the URGENT hint for |
urgent | Whether the URGENT hint should be set or not |

Since: 2.14.0

### gnt_widget_get_is_urgent ()

    gboolean
    gnt_widget_get_is_urgent (GntWidget *widget);

### gnt_widget_set_grow_x ()

    void
    gnt_widget_set_grow_x (GntWidget *widget,
                           gboolean grow_x);

Whether widget should grow in the x direction.

#### Parameters

widget | The widget |
grow_x | Whether the widget should grow or not |

Since: 2.14.0

### gnt_widget_get_grow_x ()

    gboolean
    gnt_widget_get_grow_x (GntWidget *widget);

Returns whether the widget should grow in the x direction.

#### Parameters

widget | The widget |

#### Returns

Whether widget should grow in the x direction.

Since: 2.14.0

### gnt_widget_set_grow_y ()

    void
    gnt_widget_set_grow_y (GntWidget *widget,
                           gboolean grow_y);

Whether widget should grow in the y direction.

#### Parameters

widget | The widget |
grow_y | Whether the widget should grow or not |

Since: 2.14.0

### gnt_widget_get_grow_y ()

    gboolean
    gnt_widget_get_grow_y (GntWidget *widget);

Returns whether the widget should grow in the y direction.

#### Parameters

widget | The widget |

#### Returns

Whether widget should grow in the y direction.

Since: 2.14.0

### gnt_widget_set_transient ()

    void
    gnt_widget_set_transient (GntWidget *widget,
                              gboolean transient);

Whether the widget should be transient.

#### Parameters

widget | The widget |
transient | Whether the widget is transient or not |

Since: 2.14.0

### gnt_widget_get_transient ()

    gboolean
    gnt_widget_get_transient (GntWidget *widget);

Returns whether the widget is transient.

#### Parameters

widget | The widget |

#### Returns

Whether the widget should be transient.

Since: 2.14.0

### gnt_widget_set_disable_actions ()

    void
    gnt_widget_set_disable_actions (GntWidget *widget,
                                    gboolean disable_actions);

Whether widget actions should be disabled.

#### Parameters

widget | The widget |
disable_actions | Whether the widget actions should be disabled or not |

Since: 2.14.0

### gnt_widget_get_disable_actions ()

    gboolean
    gnt_widget_get_disable_actions (GntWidget *widget);

Returns whether the widget actions are disabled.

#### Parameters

widget | The widget |

#### Returns

Whether the widget actions are disabled.

Since: 2.14.0

## Types and Values

### enum GntWidgetFlags

`GntWidgetFlags` has been deprecated since version 2.14.0 and should not be used in newly-written code.

Use the individual accessor functions documented below instead.

#### Members

GNT_WIDGET_DESTROYING |  |
GNT_WIDGET_CAN_TAKE_FOCUS |  |
GNT_WIDGET_MAPPED |  |
GNT_WIDGET_NO_BORDER |  |
GNT_WIDGET_NO_SHADOW |  |
GNT_WIDGET_HAS_FOCUS |  |
GNT_WIDGET_DRAWING |  |
GNT_WIDGET_URGENT |  |
GNT_WIDGET_GROW_X |  |
GNT_WIDGET_GROW_Y |  |
GNT_WIDGET_INVISIBLE |  |
GNT_WIDGET_TRANSIENT |  |
GNT_WIDGET_DISABLE_ACTIONS |  |

### enum GntMouseEvent

#### Members

GNT_LEFT_MOUSE_DOWN |  |
GNT_RIGHT_MOUSE_DOWN |  |
GNT_MIDDLE_MOUSE_DOWN |  |
GNT_MOUSE_UP |  |
GNT_MOUSE_SCROLL_UP |  |
GNT_MOUSE_SCROLL_DOWN |  |

### enum GntParamFlags

#### Members

GNT_PARAM_SERIALIZABLE |  |

### struct GntWidgetPriv

    struct GntWidgetPriv {
    	int GNTSEAL(x), GNTSEAL(y);
    	int GNTSEAL(width), GNTSEAL(height);
    	GntWidgetFlags GNTSEAL(flags);
    	char *GNTSEAL(name);

    	int GNTSEAL(minw), GNTSEAL(minh);    /* Minimum size for the widget */
    };

Access to any fields is deprecated. See inline comments for replacements.

### struct GntWidget

    struct GntWidget;

Access to any fields is deprecated. See inline comments for replacements.