Next: , Previous: GtkItem, Up: Top


131 GtkMisc

Base class for widgets with alignments and padding

131.1 Overview

The <gtk-misc> 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.

131.2 Usage

— Class: <gtk-misc>

Derives from <gtk-widget>.

This class defines the following slots:

xalign
The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts.
yalign
The vertical alignment, from 0 (top) to 1 (bottom)
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
— Function: gtk-misc-set-alignment (self <gtk-misc>) (xalign float) (yalign float)
— Method: set-alignment

Sets the alignment of the widget.

misc
a <gtk-misc>.
xalign
the horizontal alignment, from 0 (left) to 1 (right).
yalign
the vertical alignment, from 0 (top) to 1 (bottom).
— Function: gtk-misc-set-padding (self <gtk-misc>) (xpad int) (ypad int)
— Method: set-padding

Sets the amount of space to add around the widget.

misc
a <gtk-misc>.
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.
— Function: gtk-misc-get-alignment (self <gtk-misc>) ⇒  (xalign float) (yalign float)
— Method: get-alignment

Gets the X and Y alignment of the widget within its allocation. See gtk-misc-set-alignment.

misc
a <gtk-misc>
xalign
location to store X alignment of misc, or ‘#f
yalign
location to store Y alignment of misc, or ‘#f
— Function: gtk-misc-get-padding (self <gtk-misc>) ⇒  (xpad int) (ypad int)
— Method: get-padding

Gets the padding in the X and Y directions of the widget. See gtk-misc-set-padding.

misc
a <gtk-misc>
xpad
location to store padding in the X direction, or ‘#f
ypad
location to store padding in the Y direction, or ‘#f