Package: gtk

Function gtk-label-layout-offsets

Lambda List

gtk-label-layout-offsets (label)

Arguments

label -- a gtk-label widget

Return Value

x -- an integer with the x offset
y -- an integer with the y offset

Details

Obtains the coordinates where the label will draw the pango-layout object representing the text in the label. This is useful to convert mouse events into coordinates inside the pango-layout object, e.g. to take some action if some part of the label is clicked.

Of course you will need to create a gtk-event-box widget to receive the events, and pack the label inside it, since labels are windowless. Labels return false from the gtk-widget-has-window function. Remember when using the pango-layout functions you need to convert to and from pixels using the pango-pixels function or the +pango-scale+ constant.

Example

(gtk-label-layout-offsets (make-instance 'gtk-label))
=> 0
=> -9
(gtk-label-layout-offsets (make-instance 'gtk-label :label "text"))
=> -14
=> -9    
 

See also

2021-10-31