GtkMisc: GTK+ 2 Reference Manual

## GtkMisc GtkMisc — Base class for widgets with alignments and padding |

## Functions

void | gtk_misc_set_alignment ()
void | gtk_misc_set_padding ()
void | gtk_misc_get_alignment ()
void | gtk_misc_get_padding ()

## Properties

gfloat | xalign | Read / Write
gint | xpad | Read / Write
gfloat | yalign | Read / Write
gint | ypad | Read / Write

## Types and Values

struct | GtkMisc

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkObject
                ╰── GtkWidget
                    ╰── GtkMisc
                        ├── GtkLabel
                        ├── GtkArrow
                        ├── GtkImage
                        ╰── GtkPixmap

## Implemented Interfaces

GtkMisc implements AtkImplementorIface and GtkBuildable.

## Includes

    #include <gtk/gtk.h>

## Description

The GtkMisc widget is an abstract widget which is not useful itself, but is used to derive subclasses which have alignment and padding attributes.

The horizontal and vertical padding attributes allows extra space to be added around the widget.

The horizontal and vertical alignment attributes enable the widget to be positioned within its allocated area. Note that if the widget is added to a container in such a way that it expands automatically to fill its allocated area, the alignment settings will not alter the widgets position.

## Functions

### gtk_misc_set_alignment ()

    void
    gtk_misc_set_alignment (GtkMisc *misc,
                            gfloat xalign,
                            gfloat yalign);

Sets the alignment of the widget.

#### Parameters

misc | a GtkMisc. |
xalign | the horizontal alignment, from 0 (left) to 1 (right). |
yalign | the vertical alignment, from 0 (top) to 1 (bottom). |

### gtk_misc_set_padding ()

    void
    gtk_misc_set_padding (GtkMisc *misc,
                          gint xpad,
                          gint ypad);

Sets the amount of space to add around the widget.

#### Parameters

misc | a GtkMisc. |
xpad | the amount of space to add on the left and right of the widget, in pixels. |
ypad | the amount of space to add on the top and bottom of the widget, in pixels. |

### gtk_misc_get_alignment ()

    void
    gtk_misc_get_alignment (GtkMisc *misc,
                            gfloat *xalign,
                            gfloat *yalign);

Gets the X and Y alignment of the widget within its allocation. See `gtk_misc_set_alignment()`.

#### Parameters

misc | a GtkMisc |
xalign | location to store X alignment of `misc` , or `NULL`. | [out][allow-none]
yalign | location to store Y alignment of `misc` , or `NULL`. | [out][allow-none]

### gtk_misc_get_padding ()

    void
    gtk_misc_get_padding (GtkMisc *misc,
                          gint *xpad,
                          gint *ypad);

Gets the padding in the X and Y directions of the widget. See `gtk_misc_set_padding()`.

#### Parameters

misc | a GtkMisc |
xpad | location to store padding in the X direction, or `NULL`. | [out][allow-none]
ypad | location to store padding in the Y direction, or `NULL`. | [out][allow-none]

## Types and Values

### struct GtkMisc

    struct GtkMisc;

The GtkMisc struct contains the following fields. (These fields should be considered read-only. They should never be set by an application.)

gfloat `xalign`; | the horizontal alignment, from 0 (left) to 1 (right).
gfloat `yalign`; | the vertical alignment, from 0 (top) to 1 (bottom).
guint16 `xpad`; | the amount of space to add on the left and right of the widget, in pixels.
guint16 `ypad`; | the amount of space to add on the top and bottom of the widget, in pixels.

## Property Details

### The `“xalign”` property

      “xalign”                   gfloat

The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts.

Flags: Read / Write

Allowed values: [0,1]

Default value: 0.5

### The `“xpad”` property

      “xpad”                     gint

The amount of space to add on the left and right of the widget, in pixels.

Flags: Read / Write

Allowed values: >= 0

Default value: 0

### The `“yalign”` property

      “yalign”                   gfloat

The vertical alignment, from 0 (top) to 1 (bottom).

Flags: Read / Write

Allowed values: [0,1]

Default value: 0.5

### The `“ypad”` property

      “ypad”                     gint

The amount of space to add on the top and bottom of the widget, in pixels.

Flags: Read / Write

Allowed values: >= 0

Default value: 0