get_preferred_width.html) [ get_preferred_width_for_height
](vfunc.Widget.get_preferred_width_for_height.html) [ get_request_mode
](vfunc.Widget.get_request_mode.html) [ grab_broken_event
](vfunc.Widget.grab_broken_event.html) [ grab_focus
](vfunc.Widget.grab_focus.html) [ grab_notify ](vfunc.Widget.grab_notify.html)
[ hide ](vfunc.Widget.hide.html) [ hierarchy_changed
](vfunc.Widget.hierarchy_changed.html) [ key_press_event
](vfunc.Widget.key_press_event.html) [ key_release_event
](vfunc.Widget.key_release_event.html) [ keynav_failed
](vfunc.Widget.keynav_failed.html) [ leave_notify_event
](vfunc.Widget.leave_notify_event.html) [ map ](vfunc.Widget.map.html) [
map_event ](vfunc.Widget.map_event.html) [ mnemonic_activate
](vfunc.Widget.mnemonic_activate.html) [ motion_notify_event
](vfunc.Widget.motion_notify_event.html) [ move_focus
](vfunc.Widget.move_focus.html) [ parent_set ](vfunc.Widget.parent_set.html) [
popup_menu ](vfunc.Widget.popup_menu.html) [ property_notify_event
](vfunc.Widget.property_notify_event.html) [ proximity_in_event
](vfunc.Widget.proximity_in_event.html) [ proximity_out_event
](vfunc.Widget.proximity_out_event.html) [ query_tooltip
](vfunc.Widget.query_tooltip.html) [ queue_draw_region
](vfunc.Widget.queue_draw_region.html) [ realize ](vfunc.Widget.realize.html)
[ screen_changed ](vfunc.Widget.screen_changed.html) [ scroll_event
](vfunc.Widget.scroll_event.html) [ selection_clear_event
](vfunc.Widget.selection_clear_event.html) [ selection_get
](vfunc.Widget.selection_get.html) [ selection_notify_event
](vfunc.Widget.selection_notify_event.html) [ selection_received
](vfunc.Widget.selection_received.html) [ selection_request_event
](vfunc.Widget.selection_request_event.html) [ show ](vfunc.Widget.show.html)
[ show_all ](vfunc.Widget.show_all.html) [ show_help
](vfunc.Widget.show_help.html) [ size_allocate
](vfunc.Widget.size_allocate.html) [ state_changed
](vfunc.Widget.state_changed.html) [ state_flags_changed
](vfunc.Widget.state_flags_changed.html) [ style_set
](vfunc.Widget.style_set.html) [ style_updated
](vfunc.Widget.style_updated.html) [ touch_event
](vfunc.Widget.touch_event.html) [ unmap ](vfunc.Widget.unmap.html) [
unmap_event ](vfunc.Widget.unmap_event.html) [ unrealize
](vfunc.Widget.unrealize.html) [ visibility_notify_event
](vfunc.Widget.visibility_notify_event.html) [ window_state_event
](vfunc.Widget.window_state_event.html)

Generated by [ gi-docgen ](https://gitlab.gnome.org/GNOME/gi-docgen) 2023.4

###  Class

#  [ Gtk ](index.html) Widget

####  Description  [ [src]
](https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkwidget.c#L76 "go
to source location")

    
    
    abstract class Gtk.Widget : GObject.InitiallyUnowned
      implements Atk.ImplementorIface, Gtk.Buildable {
      /* No available fields */
    }

GtkWidget is the base class all widgets in  GTK  \+ derive from. It manages
the widget lifecycle, states and style.

#  Height-for-width Geometry Management # {#geometry-management}

GTK  \+ uses a height-for-width (and width-for-height) geometry management
system. Height-for-width means that a widget can change how much vertical
space it needs, depending on the amount of horizontal space that it is given
(and similar for width-for-height). The most common example is a label that
reflows to fill up the available width, wraps to fewer lines, and therefore
needs less height.

Height-for-width geometry management is implemented in  GTK  \+ by way of five
virtual methods:

  * ` GtkWidgetClass ` .get_request_mode() 
  * ` GtkWidgetClass ` .get_preferred_width() 
  * ` GtkWidgetClass ` .get_preferred_height() 
  * ` GtkWidgetClass ` .get_preferred_height_for_width() 
  * ` GtkWidgetClass ` .get_preferred_width_for_height() 
  * ` GtkWidgetClass ` .get_preferred_height_and_baseline_for_width() 

There are some important things to keep in mind when implementing height-for-
width and when using it in container implementations.

The geometry management system will query a w