gtkmm: Gtk::Widget Class Reference

gtkmm 3.24.3

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Related Functions | List of all members
Gtk::Widget Class Reference

Abstract Widget (Base class for all widgets) More...

`#include <gtkmm/widget.h>`

Inheritance diagram for Gtk::Widget:
[legend]

## Public Types
using | SlotTick = sigc::slot< bool(const Glib::RefPtr< Gdk::FrameClock >&)>
| Callback type for adding a function to update animations. More...
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Public Member Functions
| Widget (Widget&& src) noexcept
Widget& | operator= (Widget&& src) noexcept
| Widget (const Widget&)=delete
Widget& | operator= (const Widget&)=delete
| ~Widget () noexcept override
| Destroys the widget. More...
GtkWidget* | gobj ()
| Provides access to the underlying C GObject. More...
const GtkWidget* | gobj () const
| Provides access to the underlying C GObject. More...
void | show ()
| Flags a widget to be displayed. More...
void | show_now ()
| Shows a widget. More...
void | hide ()
| Reverses the effects of show(), causing the widget to be hidden (invisible to the user). More...
void | show_all ()
| Recursively shows a widget, and any child widgets (if the widget is a container). More...
void | queue_draw ()
| Equivalent to calling queue_draw_area() for the entire area of a widget. More...
void | queue_draw_area (int x, int y, int width, int height)
| Convenience function that calls queue_draw_region() on the region created from the given coordinates. More...
void | queue_draw_region (const ::Cairo::RefPtr< const ::Cairo::Region >& region)
| Invalidates the area of widget defined by region by calling gdk_window_invalidate_region() on the widget’s window and all its child windows. More...
void | queue_resize ()
| This function is only for use in widget implementations. More...
void | queue_allocate ()
| This function is only for use in widget implementations. More...
void | size_allocate (const Allocation& allocation)
| This function is only used by Gtk::Container subclasses, to assign a size and position to their child widgets. More...
void | size_allocate (const Allocation& allocation, int baseline)
| This function is only used by Gtk::Container subclasses, to assign a size, position and (optionally) baseline to their child widgets. More...
SizeRequestMode | get_request_mode () const
| Gets whether the widget prefers a height-for-width layout or a width-for-height layout. More...
void | get_preferred_width (int& minimum_width, int& natural_width) const
| Retrieves a widget’s initial minimum and natural width. More...
void | get_preferred_height_for_width (int width, int& minimum_height, int& natural_height) const
| Retrieves a widget’s minimum and natural height if it would be given the specified width. More...
void | get_preferred_height_for_width (int width, int& minimum_height, int& natural_height, int& minimum_baseline, int& natural_baseline) const
| Retrieves a widget’s minimum and natural height and the corresponding baselines if it would be given the specified width, or the default height if width is -1. More...
void | get_preferred_height (int& minimum_height, int& natural_height) const
| Retrieves a widget’s initial minimum and natural height. More...
void | get_preferred_width_for_height (int height, int& minimum_width, int& natural_width) const
| Retrieves a widget’s minimum and natural width if it would be given the specified height. More...
void | get_preferred_size (Requisition& minimum_size, Requisition& natural_size) const
| Retrieves the minimum and natural size of a widget, taking into account the widget’s preference for height-for-width management. More...
void | add_accelerator (const Glib::ustring& accel_signal, const Glib::RefPtr< AccelGroup >& accel_group, guint accel_key, Gdk::ModifierType accel_mods, AccelFlags accel_flags)
| Installs an accelerator for this widget in accel_group that causes accel_signal to be emitted if the accelerator is activated. More...
bool | remove_accelerator (const Glib::RefPtr< AccelGroup >& accel_group, guint accel_key, Gdk::ModifierType accel_mods)
| Removes an accelerator from widget, previously installed with add_accelerator(). More...
void | set_accel_path (const Glib::ustring& accel_path, const Glib::RefPtr< AccelGroup >& accel_group)
| Given an accelerator group, accel_group, and an accelerator path, accel_path, sets up an accelerator in accel_group so whenever the key binding that is defined for accel_path is pressed, widget will be activated. More...
bool | mnemonic_activate (bool group_cycling)
| Emits the Gtk::Widget::signal_mnemonic_activate() signal. More...
bool | event (GdkEvent* gdk_event)
| Rarely-used function. More...
int | send_expose (GdkEvent* gdk_event)
| Very rarely-used function. More...
bool | send_focus_change (GdkEvent* gdk_event)
| Sends the focus change gdk_event to widget. More...
bool | activate ()
| For widgets that can be “activated” (buttons, menu items, etc.) this function activates them. More...
void | reparent (Widget& new_parent)
| Moves a widget from one Gtk::Container to another, handling reference count issues to avoid destroying the widget. More...
bool | intersect (const Gdk::Rectangle& area) const
bool | intersect (const Gdk::Rectangle& area, Gdk::Rectangle& intersection) const
| Computes the intersection of a widget’s area and area, storing the intersection in intersection, and returns `true` if there was an intersection. More...
::Cairo::RefPtr< ::Cairo::Region > | region_intersect (const ::Cairo::RefPtr< ::Cairo::Region >& region) const
| Computes the intersection of a widget’s area and region, returning the intersection. More...
void | freeze_child_notify ()
| Stops emission of Gtk::Widget::signal_child_notify() signals on widget. More...
void | child_notify (const Glib::ustring& child_property)
| Emits a Gtk::Widget::signal_child_notify() signal for the [child property][child-properties] child_property on widget. More...
void | thaw_child_notify ()
| Reverts the effect of a previous call to freeze_child_notify(). More...
void | set_can_focus (bool can_focus=true)
| Specifies whether widget can own the input focus. More...
bool | get_can_focus () const
| Determines whether widget can own the input focus. More...
bool | has_focus () const
| Determines if the widget has the global input focus. More...
bool | is_focus () const
| Determines if the widget is the focus widget within its toplevel. More...
bool | has_visible_focus () const
| Determines if the widget should show a visible indication that it has the global input focus. More...
void | grab_focus ()
| Causes widget to have the keyboard focus for the Gtk::Window it's inside. More...
void | set_focus_on_click (bool focus_on_click=true)
| Sets whether the widget should grab focus when it is clicked with the mouse. More...
bool | get_focus_on_click () const
| Returns whether the widget should grab focus when it is clicked with the mouse. More...
void | set_can_default (bool can_default=true)
| Specifies whether widget can be a default widget. More...
bool | get_can_default () const
| Determines whether widget can be a default widget. More...
bool | has_default () const
| Determines whether widget is the current default widget within its toplevel. More...
void | grab_default ()
| Causes widget to become the default widget. More...
void | set_receives_default (bool receives_default=true)
| Specifies whether widget will be treated as the default widget within its toplevel when it has the focus, even if another widget is the default. More...
bool | get_receives_default () const
| Determines whether widget is always treated as the default widget within its toplevel when it has the focus, even if another widget is the default. More...
bool | has_grab () const
| Determines whether the widget is currently grabbing events, so it is the only widget receiving input events (keyboard and mouse). More...
bool | device_is_shadowed (const Glib::RefPtr< const Gdk::Device >& device)
| Returns `true` if device has been shadowed by a GTK+ device grab on another widget, so it would stop sending events to widget. More...
void | add_modal_grab ()
| Block events to everything else than this widget and its children. More...
void | remove_modal_grab ()
| Remove the modal grab of the widget in case it was previously grabbed. More...
void | set_name (const Glib::ustring& name)
| Widgets can be named, which allows you to refer to them from a CSS file. More...
void | unset_name ()
Glib::ustring | get_name () const
| Retrieves the name of a widget. More...
void | set_state (StateType state)
| This function is for use in widget implementations. More...
StateType | get_state () const
| Returns the widget’s state. More...
void | set_state_flags (StateFlags flags, bool clear=true)
| This function is for use in widget implementations. More...
void | unset_state_flags (StateFlags flags)
| This function is for use in widget implementations. More...
StateFlags | get_state_flags () const
| Returns the widget state as a flag set. More...
void | set_sensitive (bool sensitive=true)
| Sets the sensitivity of a widget. More...
bool | get_sensitive () const
| Returns the widget’s sensitivity (in the sense of returning the value that has been set using set_sensitive()). More...
bool | is_sensitive () const
| Returns the widget’s effective sensitivity, which means it is sensitive itself and also its parent widget is sensitive. More...
void | set_visible (bool visible=true)
| Sets the visibility state of widget. More...
bool | get_visible () const
| Determines whether the widget is visible. More...
bool | is_visible () const
| Determines whether the widget and all its parents are marked as visible. More...
bool | get_has_window () const
| Determines whether widget has a Gdk::Window of its own. More...
bool | get_is_toplevel () const
| Determines whether widget is a toplevel widget. More...
bool | get_is_drawable () const
| Determines whether widget can be drawn to. More...
bool | get_realized () const
| Determines whether widget is realized. More...
bool | get_mapped () const
| Whether the widget is mapped. More...
void | set_app_paintable (bool app_paintable=true)
| Sets whether the application intends to draw on the widget in an Gtk::Widget::signal_draw() handler. More...
bool | get_app_paintable () const
| Determines whether the application intends to draw on the widget in an Gtk::Widget::signal_draw() handler. More...
void | set_double_buffered (bool double_buffered=true)
| Widgets are double buffered by default; you can use this function to turn off the buffering. More...
bool | get_double_buffered () const
| Determines whether the widget is double buffered. More...
void | set_redraw_on_allocate (bool redraw_on_allocate=true)
| Sets whether the entire widget is queued for drawing when its size allocation changes. More...
void | set_child_visible (bool visible=true)
| Sets whether widget should be mapped along with its when its parent is mapped and widget has been shown with show(). More...
bool | get_child_visible () const
| Gets the value set with set_child_visible(). More...
Glib::RefPtr< Gdk::Window > | get_window ()
| Returns the widget’s window if it is realized, `nullptr` otherwise. More...
Glib::RefPtr< const Gdk::Window > | get_window () const
| Returns the widget’s window if it is realized, `nullptr` otherwise. More...
void | register_window (const Glib::RefPtr< Gdk::Window >& window)
| Registers a Gdk::Window with the widget and sets it up so that the widget receives events for it. More...
void | unregister_window (const Glib::RefPtr< Gdk::Window >& window)
| Unregisters a Gdk::Window from the widget that was previously set up with register_window(). More...
int | get_allocated_width () const
| Returns the width that has currently been allocated to widget. More...
int | get_allocated_height () const
| Returns the height that has currently been allocated to widget. More...
int | get_allocated_baseline () const
| Returns the baseline that has currently been allocated to widget. More...
void | get_allocated_size (Allocation& allocation, int& baseline) const
| Retrieves the widget’s allocated size. More...
Allocation | get_allocation () const
| Retrieves the widget's location. More...
void | set_allocation (const Allocation& allocation)
| Sets the widget’s allocation. More...
void | set_clip (const Allocation& clip)
| Sets the widget’s clip. More...
Allocation | get_clip () const
| Retrieves the widget’s clip area. More...
Container* | get_parent ()
| Returns the parent container of widget. More...
const Container* | get_parent () const
| Returns the parent container of widget. More...
Glib::RefPtr< Gdk::Window > | get_parent_window ()
| Gets widget’s parent window, or `nullptr` if it does not have one. More...
Glib::RefPtr< const Gdk::Window > | get_parent_window () const
| Gets widget’s parent window, or `nullptr` if it does not have one. More...
void | set_parent_window (const Glib::RefPtr< const Gdk::Window >& parent_window)
| Sets a non default parent window for widget. More...
bool | child_focus (DirectionType direction)
| This function is used by custom widget implementations; if you're writing an app, you’d use grab_focus() to move the focus to a particular widget, and Gtk::Container::set_focus_chain() to change the focus tab order. More...
bool | keynav_failed (DirectionType direction)
| This function should be called whenever keyboard navigation within a single widget hits a boundary. More...
void | error_bell ()
| Notifies the user about an input-related error on this widget. More...
void | set_size_request (int width=-1, int height=-1)
| Sets the minimum size of a widget; that is, the widget’s size request will be at least width by height. More...
void | get_size_request (int& width, int& height) const
| Gets the size request that was explicitly set for the widget using set_size_request(). More...
void | set_events (Gdk::EventMask events)
| Sets the event mask (see Gdk::EventMask) for a widget. More...
void | add_events (Gdk::EventMask events)
| Adds the events in the bitfield events to the event mask for widget. More...
void | set_device_events (const Glib::RefPtr< const Gdk::Device >& device, Gdk::EventMask events)
| Sets the device event mask (see Gdk::EventMask) for a widget. More...
void | add_device_events (const Glib::RefPtr< const Gdk::Device >& device, Gdk::EventMask events)
| Adds the device events in the bitfield events to the event mask for widget. More...
void | set_opacity (double opacity)
| Request the widget to be rendered partially transparent, with opacity 0 being fully transparent and 1 fully opaque. More...
double | get_opacity () const
| Fetches the requested opacity for this widget. More...
void | set_device_enabled (const Glib::RefPtr< Gdk::Device >& device, bool enabled=true)
| Enables or disables a Gdk::Device to interact with widget and all its children. More...
bool | get_device_enabled (const Glib::RefPtr< const Gdk::Device >& device) const
| Returns whether device can interact with widget and its children. More...
Container* | get_toplevel ()
| This function returns the topmost widget in the container hierarchy widget is a part of. More...
const Container* | get_toplevel () const
| This function returns the topmost widget in the container hierarchy widget is a part of. More...
Widget* | get_ancestor (GType widget_type)
| Gets the first ancestor of widget with type widget_type. More...
const Widget* | get_ancestor (GType widget_type) const
| Gets the first ancestor of widget with type widget_type. More...
Glib::RefPtr< Gdk::Visual > | get_visual ()
| Gets the visual that will be used to render widget. More...
Glib::RefPtr< Gdk::Screen > | get_screen ()
| Get the Gdk::Screen from the toplevel window associated with this widget. More...
Glib::RefPtr< const Gdk::Screen > | get_screen () const
| Get the Gdk::Screen from the toplevel window associated with this widget. More...
bool | has_screen () const
| Checks whether there is a Gdk::Screen is associated with this widget. More...
int | get_scale_factor () const
| Retrieves the internal scale factor that maps from window coordinates to the actual device pixels. More...
Glib::RefPtr< Gdk::Display > | get_display ()
| Get the Gdk::Display for the toplevel window associated with this widget. More...
Glib::RefPtr< const Gdk::Display > | get_display () const
| Get the Gdk::Display for the toplevel window associated with this widget. More...
Glib::RefPtr< Gdk::Window > | get_root_window ()
| Get the root window where this widget is located. More...
Glib::RefPtr< const Gdk::Window > | get_root_window () const
| Get the root window where this widget is located. More...
Glib::RefPtr< Settings > | get_settings ()
| Gets the settings object holding the settings used for this widget. More...
Glib::RefPtr< Clipboard > | get_clipboard (const Glib::ustring& selection)
| Returns the clipboard object for the given selection to be used with widget. More...
Glib::RefPtr< const Clipboard > | get_clipboard (const Glib::ustring& selection) const
| Returns the clipboard object for the given selection to be used with widget. More...
bool | get_hexpand () const
| Gets whether the widget would like any available extra horizontal space. More...
void | set_hexpand (bool expand=true)
| Sets whether the widget would like any available extra horizontal space. More...
bool | get_hexpand_set () const
| Gets whether set_hexpand() has been used to explicitly set the expand flag on this widget. More...
void | set_hexpand_set (bool set=true)
| Sets whether the hexpand flag (see get_hexpand()) will be used. More...
bool | get_vexpand () const
| Gets whether the widget would like any available extra vertical space. More...
void | set_vexpand (bool expand=true)
| Sets whether the widget would like any available extra vertical space. More...
bool | get_vexpand_set () const
| Gets whether set_vexpand() has been used to explicitly set the expand flag on this widget. More...
void | set_vexpand_set (bool set=true)
| Sets whether the vexpand flag (see get_vexpand()) will be used. More...
void | queue_compute_expand ()
| Mark widget as needing to recompute its expand flags. More...
bool | compute_expand (Orientation orientation)
| Computes whether a container should give this widget extra space when possible. More...
bool | get_support_multidevice () const
| Returns `true` if widget is multiple pointer aware. More...
void | set_support_multidevice (bool support_multidevice=true)
| Enables or disables multiple pointer awareness. More...
Glib::RefPtr< Atk::Object > | get_accessible ()
| Returns the accessible object that describes the widget to an assistive technology. More...
Glib::RefPtr< const Atk::Object > | get_accessible () const
| Returns the accessible object that describes the widget to an assistive technology. More...
Align | get_halign () const
| Gets the value of the Gtk::Widget::property_halign() property. More...
void | set_halign (Align align)
| Sets the horizontal alignment of widget. More...
Align | get_valign () const
| Gets the value of the Gtk::Widget::property_valign() property. More...
Align | get_valign_with_baseline () const
| Gets the value of the Gtk::Widget::property_valign() property, including Gtk::ALIGN_BASELINE. More...
void | set_valign (Align align)
| Sets the vertical alignment of widget. More...
int | get_margin_left () const
| Gets the value of the Gtk::Widget::property_margin_left() property. More...
void | set_margin_left (int margin)
| Sets the left margin of widget. More...
int | get_margin_right () const
| Gets the value of the Gtk::Widget::property_margin_right() property. More...
void | set_margin_right (int margin)
| Sets the right margin of widget. More...
int | get_margin_start () const
| Gets the value of the Gtk::Widget::property_margin_start() property. More...
void | set_margin_start (int margin)
| Sets the start margin of widget. More...
int | get_margin_end () const
| Gets the value of the Gtk::Widget::property_margin_end() property. More...
void | set_margin_end (int margin)
| Sets the end margin of widget. More...
int | get_margin_top () const
| Gets the value of the Gtk::Widget::property_margin_top() property. More...
void | set_margin_top (int margin)
| Sets the top margin of widget. More...
int | get_margin_bottom () const
| Gets the value of the Gtk::Widget::property_margin_bottom() property. More...
void | set_margin_bottom (int margin)
| Sets the bottom margin of widget. More...
Gdk::EventMask | get_events () const
| Returns the event mask (see Gdk::EventMask) for the widget. More...
Gdk::EventMask | get_device_events (const Glib::RefPtr< const Gdk::Device >& device) const
| Returns the events mask for the widget corresponding to an specific device. More...
void | get_pointer (int& x, int& y) const
| Obtains the location of the mouse pointer in widget coordinates. More...
bool | is_ancestor (Widget& ancestor) const
| Determines whether widget is somewhere inside ancestor, possibly with intermediate containers. More...
bool | translate_coordinates (Widget& dest_widget, int src_x, int src_y, int& dest_x, int& dest_y)
| Translate coordinates relative to src_widget’s allocation to coordinates relative to dest_widget’s allocations. More...
void | override_color (const Gdk::RGBA& color, StateFlags state=STATE_FLAG_NORMAL)
| Sets the color to use for a widget. More...
void | unset_color (StateFlags state=STATE_FLAG_NORMAL)
| Undoes the effect of previous calls to override_color(). More...
void | override_background_color (const Gdk::RGBA& color, StateFlags state=STATE_FLAG_NORMAL)
| Sets the background color to use for a widget. More...
void | unset_background_color (StateFlags state=STATE_FLAG_NORMAL)
| Undoes the effect of previous calls to override_background_color(). More...
void | override_font (const Pango::FontDescription& font_desc)
| Sets the font to use for a widget. More...
void | unset_font ()
| Undoes the effect of previous calls to override_font(). More...
void | override_symbolic_color (const Glib::ustring& name, const Gdk::RGBA& color)
| Sets a symbolic color for a widget. More...
void | unset_symbolic_color (const Glib::ustring& name)
| Undoes the effect of previous calls to override_symbolic_color(). More...
void | override_cursor (const Gdk::RGBA& cursor, const Gdk::RGBA& secondary_cursor)
| Sets the cursor color to use in a widget, overriding the cursor-color and secondary-cursor-color style properties. More...
void | unset_cursor ()
| Undoes the effect of previous calls to override_cursor(). More...
void | reset_style ()
| Updates the style context of widget and all descendants by updating its widget path. More...
template<class PropertyType >
void | get_style_property (const Glib::ustring& the_property_name, PropertyType& value) const
| Gets the value of a style property of widget. More...
Glib::RefPtr< Pango::Context > | create_pango_context ()
| Creates a new Pango::Context with the appropriate font map, font options, font description, and base direction for drawing text for this widget. More...
Glib::RefPtr< Pango::Context > | get_pango_context ()
| Gets a Pango::Context with the appropriate font map, font description, and base direction for this widget. More...
void | set_font_options (const ::Cairo::FontOptions& options)
| Sets the #cairo_font_options_t used for Pango rendering in this widget. More...
void | unset_font_options ()
| Undoes the effect of previous calls to set_font_options(). More...
::Cairo::FontOptions | get_font_options () const
| Returns the #cairo_font_options_t used for Pango rendering. More...
Glib::RefPtr< Pango::Layout > | create_pango_layout (const Glib::ustring& text)
| Creates a new Pango::Layout with the appropriate font map, font description, and base direction for drawing text for this widget. More...
Glib::RefPtr< Gdk::Pixbuf > | render_icon_pixbuf (const StockID& stock_id, IconSize size)
| A convenience function that uses the theme engine and style settings for widget to look up stock_id and render it to a pixbuf. More...
void | set_composite_name (const Glib::ustring& name)
| Sets a widgets composite name. More...
void | unset_composite_name ()
Glib::ustring | get_composite_name () const
| Obtains the composite name of a widget. More...
void | set_direction (TextDirection dir)
| Sets the reading direction on a particular widget. More...
TextDirection | get_direction () const
| Gets the reading direction for a particular widget. More...
void | shape_combine_region (const ::Cairo::RefPtr< const ::Cairo::Region >& region)
| Sets a shape for this widget’s GDK window. More...
void | input_shape_combine_region (const ::Cairo::RefPtr< const ::Cairo::Region >& region)
| Sets an input shape for this widget’s GDK window. More...
WidgetPath | get_path () const
| Returns the Gtk::WidgetPath representing widget, if the widget is not connected to a toplevel widget, a partial path will be created. More...
std::vector< Widget* > | list_mnemonic_labels ()
| Returns a newly allocated list of the widgets, normally labels, for which this widget is the target of a mnemonic (see for example, Gtk::Label::set_mnemonic_widget()). More...
std::vector< const Widget* > | list_mnemonic_labels () const
| Returns a newly allocated list of the widgets, normally labels, for which this widget is the target of a mnemonic (see for example, Gtk::Label::set_mnemonic_widget()). More...
void | add_mnemonic_label (Widget& label)
| Adds a widget to the list of mnemonic labels for this widget. More...
void | remove_mnemonic_label (Widget& label)
| Removes a widget from the list of mnemonic labels for this widget. More...
void | drag_get_data (const Glib::RefPtr< Gdk::DragContext >& context, const Glib::ustring& target, guint32 time)
void | drag_highlight ()
void | drag_unhighlight ()
void | drag_dest_set (DestDefaults flags=DestDefaults(0), Gdk::DragAction actions=Gdk::DragAction(0))
void | drag_dest_set (const std::vector< TargetEntry >& targets, DestDefaults flags=DEST_DEFAULT_ALL, Gdk::DragAction actions=Gdk::ACTION_COPY)
void | drag_dest_set_proxy (const Glib::RefPtr< Gdk::Window >& proxy_window, Gdk::DragProtocol protocol, bool use_coordinates)
| Sets this widget as a proxy for drops to another window. More...
void | drag_dest_unset ()
| Clears information about a drop destination set with gtk_drag_dest_set(). More...
Glib::ustring | drag_dest_find_target (const Glib::RefPtr< Gdk::DragContext >& context, const Glib::RefPtr< TargetList >& target_list) const
| Looks for a match between context->targets and the dest_target_list, returning the first matching target, otherwise returning GDK_NONE. More...
Glib::ustring | drag_dest_find_target (const Glib::RefPtr< Gdk::DragContext >& context) const
Glib::RefPtr< TargetList > | drag_dest_get_target_list ()
| Returns the list of targets this widget can accept from drag-and-drop. More...
Glib::RefPtr< const TargetList > | drag_dest_get_target_list () const
| Returns the list of targets this widget can accept from drag-and-drop. More...
void | drag_dest_set_target_list (const Glib::RefPtr< TargetList >& target_list)
| Sets the target types that this widget can accept from drag-and-drop. More...
void | drag_dest_add_text_targets ()
| Add the text targets supported by Gtk::SelectionData to the target list of the drag destination. More...
void | drag_dest_add_image_targets ()
| Add the image targets supported by Gtk::SelectionData to the target list of the drag destination. More...
void | drag_dest_add_uri_targets ()
| Add the URI targets supported by Gtk::SelectionData to the target list of the drag destination. More...
void | drag_source_set (const std::vector< TargetEntry >& targets, Gdk::ModifierType start_button_mask=Gdk::MODIFIER_MASK, Gdk::DragAction actions=Gdk::ACTION_COPY)
void | drag_source_unset ()
| Undoes the effects of gtk_drag_source_set(). More...
void | drag_source_set_icon (const Glib::RefPtr< Gdk::Pixbuf >& pixbuf)
| Sets the icon that will be used for drags from a particular widget from a Gdk::Pixbuf. More...
void | drag_source_set_icon (const StockID& stock_id)
| Sets the icon that will be used for drags from a particular source to a stock icon. More...
void | drag_source_set_icon (const Glib::ustring& icon_name)
| Sets the icon that will be used for drags from a particular source to a themed icon. More...
void | drag_source_add_text_targets ()
| Add the text targets supported by Gtk::SelectionData to the target list of the drag source. More...
void | drag_source_add_uri_targets ()
| Add the URI targets supported by Gtk::SelectionData to the target list of the drag source. More...
void | drag_source_add_image_targets ()
| Add the writable image targets supported by Gtk::SelectionData to the target list of the drag source. More...
Glib::RefPtr< Gdk::DragContext > | drag_begin (const Glib::RefPtr< TargetList >& targets, Gdk::DragAction actions, int button, GdkEvent* gdk_event)
Glib::RefPtr< Gdk::DragContext > | drag_begin (const Glib::RefPtr< TargetList >& targets, Gdk::DragAction actions, int button, GdkEvent* gdk_event, int x, int y)
bool | drag_check_threshold (int start_x, int start_y, int current_x, int current_y)
void | drag_set_as_icon (const Glib::RefPtr< Gdk::DragContext >& context, int hot_x, int hot_y)
void | queue_resize_no_redraw ()
| This function works like queue_resize(), except that the widget is not invalidated. More...
Glib::RefPtr< Gdk::FrameClock > | get_frame_clock ()
| Obtains the frame clock for a widget. More...
Glib::RefPtr< const Gdk::FrameClock > | get_frame_clock () const
| Obtains the frame clock for a widget. More...
bool | get_no_show_all () const
| Returns the current value of the Gtk::Widget::property_no_show_all() property, which determines whether calls to show_all() will affect this widget. More...
void | set_no_show_all (bool no_show_all=true)
| Sets the Gtk::Widget::property_no_show_all() property, which determines whether calls to show_all() will affect this widget. More...
void | set_parent (Widget& parent)
| This function is useful only when implementing subclasses of Gtk::Container. More...
void | unparent ()
| This function is only for use in widget implementations. More...
void | map ()
| This function is only for use in widget implementations. More...
void | unmap ()
| This function is only for use in widget implementations. More...
void | draw_insertion_cursor (const ::Cairo::RefPtr< ::Cairo::Context >& cr, const Gdk::Rectangle& location, bool is_primary, TextDirection direction, bool draw_arrow=true)
| Draws a text caret on cr at location. More...
void | set_tooltip_window (Window& custom_window)
| Replaces the default window used for displaying tooltips with custom_window. More...
Window* | get_tooltip_window ()
| Returns the Gtk::Window of the current tooltip. More...
void | trigger_tooltip_query ()
| Triggers a tooltip query on the display where the toplevel of widget is located. More...
void | set_tooltip_text (const Glib::ustring& text)
| Sets text as the contents of the tooltip. More...
Glib::ustring | get_tooltip_text () const
| Gets the contents of the tooltip for widget. More...
void | set_tooltip_markup (const Glib::ustring& markup)
| Sets markup as the contents of the tooltip, which is marked up with the Pango text markup language. More...
Glib::ustring | get_tooltip_markup () const
| Gets the contents of the tooltip for widget. More...
void | set_has_tooltip (bool has_tooltip=TRUE)
| Sets the has-tooltip property on widget to has_tooltip. More...
bool | get_has_tooltip () const
| Returns the current value of the has-tooltip property. More...
int | get_width () const
int | get_height () const
bool | is_composited () const
| Whether widget can rely on having its alpha channel drawn correctly. More...
bool | in_destruction () const
| Returns whether the widget is currently being destroyed. More...
Glib::RefPtr< StyleContext > | get_style_context ()
| Returns the style context associated to widget. More...
Glib::RefPtr< Gtk::StyleContext > | get_style_context () const
| Returns the style context associated to widget. More...
Gdk::ModifierType | get_modifier_mask (Gdk::ModifierIntent intent)
| Returns the modifier mask the widget’s windowing system backend uses for a particular purpose. More...
guint | add_tick_callback (const SlotTick& slot)
| Queues an animation frame update and adds a callback to be called before each frame. More...
void | remove_tick_callback (guint id)
| Removes a tick callback previously registered with add_tick_callback(). More...
void | insert_action_group (const Glib::ustring& name, const Glib::RefPtr< Gio::ActionGroup >& group)
| Inserts group into widget. More...
void | remove_action_group (const Glib::ustring& name)
| Removes a group from the widget. More...
Glib::RefPtr< Gio::ActionGroup > | get_action_group (const Glib::ustring& prefix)
| Retrieves the Gio::ActionGroup that was registered using prefix. More...
Glib::RefPtr< const Gio::ActionGroup > | get_action_group (const Glib::ustring& prefix) const
| Retrieves the Gio::ActionGroup that was registered using prefix. More...
std::vector< Glib::ustring > | list_action_prefixes () const
| Retrieves a `nullptr`-terminated array of strings containing the prefixes of Gio::ActionGroup's available to widget. More...
void | set_font_map (const Glib::RefPtr< Pango::FontMap >& font_map)
| Sets the font map to use for Pango rendering. More...
Glib::RefPtr< Pango::FontMap > | get_font_map ()
| Gets the font map that has been set with set_font_map(). More...
Glib::RefPtr< const Pango::FontMap > | get_font_map () const
| Gets the font map that has been set with set_font_map(). More...
Glib::SignalProxy< void > | signal_show ()
Glib::SignalProxy< void > | signal_hide ()
Glib::SignalProxy< void > | signal_map ()
| Emitted on mapping of a widget to the screen. More...
Glib::SignalProxy< void > | signal_unmap ()
Glib::SignalProxy< void > | signal_realize ()
| Emitted on realization of a widget. More...
Glib::SignalProxy< void > | signal_unrealize ()
Glib::SignalProxy< void, Allocation& > | signal_size_allocate ()
Glib::SignalProxy< void, Gtk::StateType > | signal_state_changed ()
Glib::SignalProxy< void, Gtk::StateFlags > | signal_state_flags_changed ()
Glib::SignalProxy< void, Widget* > | signal_parent_changed ()
| Informs objects that their parent changed. More...
Glib::SignalProxy< void, Widget* > | signal_hierarchy_changed ()
Glib::SignalProxy< void > | signal_style_updated ()
Glib::SignalProxy< void, TextDirection > | signal_direction_changed ()
Glib::SignalProxy< void, bool > | signal_grab_notify ()
Glib::SignalProxy< void, GParamSpec* > | signal_child_notify ()
Glib::SignalProxyDetailedAnyType< void, GParamSpec* > | signal_child_notify (const Glib::ustring& child_property_name)
Glib::SignalProxy< bool, bool > | signal_mnemonic_activate ()
Glib::SignalProxy< void > | signal_grab_focus ()
Glib::SignalProxy< bool, DirectionType > | signal_focus ()
Glib::SignalProxy< bool, GdkEvent* > | signal_event ()
Glib::SignalProxy< void, GdkEvent* > | signal_event_after ()
Glib::SignalProxy< bool, GdkEventButton* > | signal_button_press_event ()
| Event triggered by user pressing button. More...
Glib::SignalProxy< bool, GdkEventButton* > | signal_button_release_event ()
| Event triggered by user releasing button. More...
Glib::SignalProxy< bool, GdkEventScroll* > | signal_scroll_event ()
Glib::SignalProxy< bool, GdkEventMotion* > | signal_motion_notify_event ()
| Event triggered by user moving pointer. More...
Glib::SignalProxy< bool, GdkEventAny* > | signal_delete_event ()
Glib::SignalProxy< bool, const ::Cairo::RefPtr< ::Cairo::Context >& > | signal_draw ()
Glib::SignalProxy< bool, GdkEventKey* > | signal_key_press_event ()
| Event triggered by a key press will widget has focus. More...
Glib::SignalProxy< bool, GdkEventKey* > | signal_key_release_event ()
| Event triggered by a key release will widget has focus. More...
Glib::SignalProxy< bool, GdkEventCrossing* > | signal_enter_notify_event ()
| Event triggered by pointer entering widget area. More...
Glib::SignalProxy< bool, GdkEventCrossing* > | signal_leave_notify_event ()
| Event triggered by pointer leaving widget area. More...
Glib::SignalProxy< bool, GdkEventConfigure* > | signal_configure_event ()
| Event triggered by a window resizing. More...
Glib::SignalProxy< bool, GdkEventFocus* > | signal_focus_in_event ()
Glib::SignalProxy< bool, GdkEventFocus* > | signal_focus_out_event ()
Glib::SignalProxy< bool, GdkEventAny* > | signal_map_event ()
Glib::SignalProxy< bool, GdkEventAny* > | signal_unmap_event ()
Glib::SignalProxy< bool, GdkEventProperty* > | signal_property_notify_event ()
Glib::SignalProxy< bool, GdkEventSelection* > | signal_selection_clear_event ()
Glib::SignalProxy< bool, GdkEventSelection* > | signal_selection_request_event ()
Glib::SignalProxy< bool, GdkEventSelection* > | signal_selection_notify_event ()
Glib::SignalProxy< bool, GdkEventProximity* > | signal_proximity_in_event ()
Glib::SignalProxy< bool, GdkEventProximity* > | signal_proximity_out_event ()
Glib::SignalProxy< bool, GdkEventVisibility* > | signal_visibility_notify_event ()
Glib::SignalProxy< bool, GdkEventWindowState* > | signal_window_state_event ()
Glib::SignalProxy< void, SelectionData&, guint, guint > | signal_selection_get ()
Glib::SignalProxy< void, const SelectionData&, guint > | signal_selection_received ()
Glib::SignalProxy< void, const Glib::RefPtr< Gdk::DragContext >& > | signal_drag_begin ()
Glib::SignalProxy< void, const Glib::RefPtr< Gdk::DragContext >& > | signal_drag_end ()
Glib::SignalProxy< void, const Glib::RefPtr< Gdk::DragContext >&, SelectionData&, guint, guint > | signal_drag_data_get ()
Glib::SignalProxy< void, const Glib::RefPtr< Gdk::DragContext >& > | signal_drag_data_delete ()
Glib::SignalProxy< bool, const Glib::RefPtr< Gdk::DragContext >&, DragResult > | signal_drag_failed ()
Glib::SignalProxy< void, const Glib::RefPtr< Gdk::DragContext >&, guint > | signal_drag_leave ()
Glib::SignalProxy< bool, const Glib::RefPtr< Gdk::DragContext >&, int, int, guint > | signal_drag_motion ()
Glib::SignalProxy< bool, const Glib::RefPtr< Gdk::DragContext >&, int, int, guint > | signal_drag_drop ()
Glib::SignalProxy< void, const Glib::RefPtr< Gdk::DragContext >&, int, int, const SelectionData&, guint, guint > | signal_drag_data_received ()
Glib::SignalProxy< void, const Glib::RefPtr< Gdk::Screen >& > | signal_screen_changed ()
Glib::SignalProxy< void > | signal_composited_changed ()
Glib::SignalProxy< bool > | signal_popup_menu ()
Glib::SignalProxy< bool, int, int, bool, const Glib::RefPtr< Tooltip >& > | signal_query_tooltip ()
Glib::SignalProxy< bool, GdkEventGrabBroken* > | signal_grab_broken_event ()
Glib::SignalProxy< bool, GdkEventExpose* > | signal_damage_event ()
Glib::SignalProxy< bool, GdkEventTouch* > | signal_touch_event ()
Glib::PropertyProxy< Glib::ustring > | property_name ()
| The name of the widget. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_name () const
| The name of the widget. More...
Glib::PropertyProxy< Container* > | property_parent ()
| The parent widget of this widget. More...
Glib::PropertyProxy_ReadOnly< Container* > | property_parent () const
| The parent widget of this widget. More...
Glib::PropertyProxy< int > | property_width_request ()
| Override for width request of the widget, or -1 if natural request should be used. More...
Glib::PropertyProxy_ReadOnly< int > | property_width_request () const
| Override for width request of the widget, or -1 if natural request should be used. More...
Glib::PropertyProxy< int > | property_height_request ()
| Override for height request of the widget, or -1 if natural request should be used. More...
Glib::PropertyProxy_ReadOnly< int > | property_height_request () const
| Override for height request of the widget, or -1 if natural request should be used. More...
Glib::PropertyProxy< bool > | property_visible ()
| Whether the widget is visible. More...
Glib::PropertyProxy_ReadOnly< bool > | property_visible () const
| Whether the widget is visible. More...
Glib::PropertyProxy< bool > | property_sensitive ()
| Whether the widget responds to input. More...
Glib::PropertyProxy_ReadOnly< bool > | property_sensitive () const
| Whether the widget responds to input. More...
Glib::PropertyProxy< bool > | property_app_paintable ()
| Whether the application will paint directly on the widget. More...
Glib::PropertyProxy_ReadOnly< bool > | property_app_paintable () const
| Whether the application will paint directly on the widget. More...
Glib::PropertyProxy< bool > | property_can_focus ()
| Whether the widget can accept the input focus. More...
Glib::PropertyProxy_ReadOnly< bool > | property_can_focus () const
| Whether the widget can accept the input focus. More...
Glib::PropertyProxy< bool > | property_has_focus ()
| Whether the widget has the input focus. More...
Glib::PropertyProxy_ReadOnly< bool > | property_has_focus () const
| Whether the widget has the input focus. More...
Glib::PropertyProxy< bool > | property_is_focus ()
| Whether the widget is the focus widget within the toplevel. More...
Glib::PropertyProxy_ReadOnly< bool > | property_is_focus () const
| Whether the widget is the focus widget within the toplevel. More...
Glib::PropertyProxy< bool > | property_focus_on_click ()
| Whether the widget should grab focus when it is clicked with the mouse. More...
Glib::PropertyProxy_ReadOnly< bool > | property_focus_on_click () const
| Whether the widget should grab focus when it is clicked with the mouse. More...
Glib::PropertyProxy< bool > | property_can_default ()
| Whether the widget can be the default widget. More...
Glib::PropertyProxy_ReadOnly< bool > | property_can_default () const
| Whether the widget can be the default widget. More...
Glib::PropertyProxy< bool > | property_has_default ()
| Whether the widget is the default widget. More...
Glib::PropertyProxy_ReadOnly< bool > | property_has_default () const
| Whether the widget is the default widget. More...
Glib::PropertyProxy< bool > | property_receives_default ()
| If `true`, the widget will receive the default action when it is focused. More...
Glib::PropertyProxy_ReadOnly< bool > | property_receives_default () const
| If `true`, the widget will receive the default action when it is focused. More...
Glib::PropertyProxy_ReadOnly< bool > | property_composite_child () const
| Whether the widget is part of a composite widget. More...
Glib::PropertyProxy< Glib::RefPtr< Style > > | property_style ()
| The style of the widget, which contains information about how it will look (colors, etc). More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Style > > | property_style () const
| The style of the widget, which contains information about how it will look (colors, etc). More...
Glib::PropertyProxy< Gdk::EventMask > | property_events ()
| The event mask that decides what kind of GdkEvents this widget gets. More...
Glib::PropertyProxy_ReadOnly< Gdk::EventMask > | property_events () const
| The event mask that decides what kind of GdkEvents this widget gets. More...
Glib::PropertyProxy< bool > | property_has_tooltip ()
| Enables or disables the emission of Gtk::Widget::signal_query_tooltip() on widget. More...
Glib::PropertyProxy_ReadOnly< bool > | property_has_tooltip () const
| Enables or disables the emission of Gtk::Widget::signal_query_tooltip() on widget. More...
Glib::PropertyProxy< Glib::ustring > | property_tooltip_markup ()
| Sets the text of tooltip to be the given string, which is marked up with the [Pango text markup language][PangoMarkupFormat]. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_tooltip_markup () const
| Sets the text of tooltip to be the given string, which is marked up with the [Pango text markup language][PangoMarkupFormat]. More...
Glib::PropertyProxy< Glib::ustring > | property_tooltip_text ()
| Sets the text of tooltip to be the given string. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_tooltip_text () const
| Sets the text of tooltip to be the given string. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gdk::Window > > | property_window () const
| The widget's window if it is realized, `nullptr` otherwise. More...
Glib::PropertyProxy< bool > | property_no_show_all ()
| Whether Gtk::Widget::show_all() should not affect this widget. More...
Glib::PropertyProxy_ReadOnly< bool > | property_no_show_all () const
| Whether Gtk::Widget::show_all() should not affect this widget. More...
Glib::PropertyProxy< bool > | property_double_buffered ()
| Whether the widget is double buffered. More...
Glib::PropertyProxy_ReadOnly< bool > | property_double_buffered () const
| Whether the widget is double buffered. More...
Glib::PropertyProxy< Align > | property_halign ()
| How to distribute horizontal space if widget gets extra space, see Gtk::Align. More...
Glib::PropertyProxy_ReadOnly< Align > | property_halign () const
| How to distribute horizontal space if widget gets extra space, see Gtk::Align. More...
Glib::PropertyProxy< Align > | property_valign ()
| How to distribute vertical space if widget gets extra space, see Gtk::Align. More...
Glib::PropertyProxy_ReadOnly< Align > | property_valign () const
| How to distribute vertical space if widget gets extra space, see Gtk::Align. More...
Glib::PropertyProxy< int > | property_margin_left ()
| Margin on left side of widget. More...
Glib::PropertyProxy_ReadOnly< int > | property_margin_left () const
| Margin on left side of widget. More...
Glib::PropertyProxy< int > | property_margin_right ()
| Margin on right side of widget. More...
Glib::PropertyProxy_ReadOnly< int > | property_margin_right () const
| Margin on right side of widget. More...
Glib::PropertyProxy< int > | property_margin_start ()
| Margin on start of widget, horizontally. More...
Glib::PropertyProxy_ReadOnly< int > | property_margin_start () const
| Margin on start of widget, horizontally. More...
Glib::PropertyProxy< int > | property_margin_end ()
| Margin on end of widget, horizontally. More...
Glib::PropertyProxy_ReadOnly< int > | property_margin_end () const
| Margin on end of widget, horizontally. More...
Glib::PropertyProxy< int > | property_margin_top ()
| Margin on top side of widget. More...
Glib::PropertyProxy_ReadOnly< int > | property_margin_top () const
| Margin on top side of widget. More...
Glib::PropertyProxy< int > | property_margin_bottom ()
| Margin on bottom side of widget. More...
Glib::PropertyProxy_ReadOnly< int > | property_margin_bottom () const
| Margin on bottom side of widget. More...
Glib::PropertyProxy< int > | property_margin ()
| Sets all four sides' margin at once. More...
Glib::PropertyProxy_ReadOnly< int > | property_margin () const
| Sets all four sides' margin at once. More...
Glib::PropertyProxy< bool > | property_hexpand ()
| Whether to expand horizontally. More...
Glib::PropertyProxy_ReadOnly< bool > | property_hexpand () const
| Whether to expand horizontally. More...
Glib::PropertyProxy< bool > | property_hexpand_set ()
| Whether to use the Gtk::Widget::property_hexpand() property. More...
Glib::PropertyProxy_ReadOnly< bool > | property_hexpand_set () const
| Whether to use the Gtk::Widget::property_hexpand() property. More...
Glib::PropertyProxy< bool > | property_vexpand ()
| Whether to expand vertically. More...
Glib::PropertyProxy_ReadOnly< bool > | property_vexpand () const
| Whether to expand vertically. More...
Glib::PropertyProxy< bool > | property_vexpand_set ()
| Whether to use the Gtk::Widget::property_vexpand() property. More...
Glib::PropertyProxy_ReadOnly< bool > | property_vexpand_set () const
| Whether to use the Gtk::Widget::property_vexpand() property. More...
Glib::PropertyProxy< bool > | property_expand ()
| Whether to expand in both directions. More...
Glib::PropertyProxy_ReadOnly< bool > | property_expand () const
| Whether to expand in both directions. More...
Glib::PropertyProxy< double > | property_opacity ()
| The requested opacity of the widget. More...
Glib::PropertyProxy_ReadOnly< double > | property_opacity () const
| The requested opacity of the widget. More...
Glib::PropertyProxy_ReadOnly< int > | property_scale_factor () const
| The scale factor of the widget. More...
Public Member Functions inherited from Gtk::Object
| Object (Object&& src) noexcept
Object& | operator= (Object&& src) noexcept
| ~Object () noexcept override
GObject* | gobj ()
| Provides access to the underlying C GObject. More...
const GObject* | gobj () const
| Provides access to the underlying C GObject. More...
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void > &&slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, sigc::slot< void > &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const
Public Member Functions inherited from Gtk::Buildable
| Buildable (Buildable&& src) noexcept
Buildable& | operator= (Buildable&& src) noexcept
| ~Buildable () noexcept override
GtkBuildable* | gobj ()
| Provides access to the underlying C GObject. More...
const GtkBuildable* | gobj () const
| Provides access to the underlying C GObject. More...
void | set_name (const Glib::ustring& name)
| Sets the name of the buildable object. More...
Glib::ustring | get_name () const
| Gets the name of the buildable object. More...
Public Member Functions inherited from Glib::Interface
| Interface ()
| Interface (Interface &&src) noexcept
Interface & | operator= (Interface &&src) noexcept
| Interface (const Glib::Interface_Class &interface_class)
| Interface (GObject *castitem)
| ~Interface () noexcept override
| Interface (const Interface &)=delete
Interface & | operator= (const Interface &)=delete
GObject * | gobj ()
const GObject * | gobj () const
Public Member Functions inherited from Atk::Implementor
| Implementor (Implementor &&src) noexcept
Implementor & | operator= (Implementor &&src) noexcept
| ~Implementor () noexcept override
AtkImplementor * | gobj ()
const AtkImplementor * | gobj () const
Glib::RefPtr< Atk::Implementor > | wrap (AtkImplementor *object, bool take_copy=false)

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Widget* | get_current_modal_grab ()
| Retrieve the widget which is currently grabbing all events. More...
static void | push_composite_child ()
| Makes all newly-created widgets as composite children until the corresponding pop_composite_child() call. More...
static void | pop_composite_child ()
| Cancels the effect of a previous call to push_composite_child(). More...
static void | set_default_direction (TextDirection dir)
| Sets the default reading direction for widgets where the direction has not been explicitly set by set_direction(). More...
static TextDirection | get_default_direction ()
| Obtains the current default reading direction. More...
static Widget* | drag_get_source_widget (const Glib::RefPtr< Gdk::DragContext >& context)
Static Public Member Functions inherited from Gtk::Buildable
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
Static Public Member Functions inherited from Atk::Implementor
static void | add_interface (GType gtype_implementer)
static GType | get_type ()

## Protected Member Functions
virtual void | on_show ()
| This is a default handler for the signal signal_show(). More...
virtual void | on_hide ()
| This is a default handler for the signal signal_hide(). More...
virtual void | on_map ()
| This is a default handler for the signal signal_map(). More...
virtual void | on_unmap ()
| This is a default handler for the signal signal_unmap(). More...
virtual void | on_realize ()
| This is a default handler for the signal signal_realize(). More...
virtual void | on_unrealize ()
| This is a default handler for the signal signal_unrealize(). More...
virtual void | on_size_allocate (Allocation& allocation)
| This is a default handler for the signal signal_size_allocate(). More...
virtual void | on_state_changed (Gtk::StateType previous_state)
| This is a default handler for the signal signal_state_changed(). More...
virtual void | on_parent_changed (Widget* previous_parent)
| This is a default handler for the signal signal_parent_changed(). More...
virtual void | on_hierarchy_changed (Widget* previous_toplevel)
| This is a default handler for the signal signal_hierarchy_changed(). More...
virtual void | on_style_updated ()
| This is a default handler for the signal signal_style_updated(). More...
virtual void | on_direction_changed (TextDirection direction)
| This is a default handler for the signal signal_direction_changed(). More...
virtual void | on_grab_notify (bool was_grabbed)
| This is a default handler for the signal signal_grab_notify(). More...
virtual void | on_child_notify (GParamSpec* pspec)
| This is a default handler for the signal signal_child_notify(). More...
virtual bool | on_mnemonic_activate (bool group_cycling)
| This is a default handler for the signal signal_mnemonic_activate(). More...
virtual void | on_grab_focus ()
| This is a default handler for the signal signal_grab_focus(). More...
virtual bool | on_focus (DirectionType direction)
| This is a default handler for the signal signal_focus(). More...
virtual bool | on_event (GdkEvent* gdk_event)
| This is a default handler for the signal signal_event(). More...
virtual bool | on_button_press_event (GdkEventButton* button_event)
| This is a default handler for the signal signal_button_press_event(). More...
virtual bool | on_button_release_event (GdkEventButton* release_event)
| This is a default handler for the signal signal_button_release_event(). More...
virtual bool | on_scroll_event (GdkEventScroll* scroll_event)
| This is a default handler for the signal signal_scroll_event(). More...
virtual bool | on_motion_notify_event (GdkEventMotion* motion_event)
| This is a default handler for the signal signal_motion_notify_event(). More...
virtual bool | on_delete_event (GdkEventAny* any_event)
| This is a default handler for the signal signal_delete_event(). More...
virtual bool | on_draw (const ::Cairo::RefPtr< ::Cairo::Context >& cr)
| This is a default handler for the signal signal_draw(). More...
virtual bool | on_key_press_event (GdkEventKey* key_event)
| This is a default handler for the signal signal_key_press_event(). More...
virtual bool | on_key_release_event (GdkEventKey* key_event)
| This is a default handler for the signal signal_key_release_event(). More...
virtual bool | on_enter_notify_event (GdkEventCrossing* crossing_event)
| This is a default handler for the signal signal_enter_notify_event(). More...
virtual bool | on_leave_notify_event (GdkEventCrossing* crossing_event)
| This is a default handler for the signal signal_leave_notify_event(). More...
virtual bool | on_configure_event (GdkEventConfigure* configure_event)
| This is a default handler for the signal signal_configure_event(). More...
virtual bool | on_focus_in_event (GdkEventFocus* focus_event)
| This is a default handler for the signal signal_focus_in_event(). More...
virtual bool | on_focus_out_event (GdkEventFocus* gdk_event)
| This is a default handler for the signal signal_focus_out_event(). More...
virtual bool | on_map_event (GdkEventAny* any_event)
| This is a default handler for the signal signal_map_event(). More...
virtual bool | on_unmap_event (GdkEventAny* any_event)
| This is a default handler for the signal signal_unmap_event(). More...
virtual bool | on_property_notify_event (GdkEventProperty* property_event)
| This is a default handler for the signal signal_property_notify_event(). More...
virtual bool | on_selection_clear_event (GdkEventSelection* selection_event)
| This is a default handler for the signal signal_selection_clear_event(). More...
virtual bool | on_selection_request_event (GdkEventSelection* selection_event)
| This is a default handler for the signal signal_selection_request_event(). More...
virtual bool | on_selection_notify_event (GdkEventSelection* selection_event)
| This is a default handler for the signal signal_selection_notify_event(). More...
virtual bool | on_proximity_in_event (GdkEventProximity* proximity_event)
| This is a default handler for the signal signal_proximity_in_event(). More...
virtual bool | on_proximity_out_event (GdkEventProximity* proximity_event)
| This is a default handler for the signal signal_proximity_out_event(). More...
virtual bool | on_visibility_notify_event (GdkEventVisibility* visibility_event)
| This is a default handler for the signal signal_visibility_notify_event(). More...
virtual bool | on_window_state_event (GdkEventWindowState* window_state_event)
| This is a default handler for the signal signal_window_state_event(). More...
virtual void | on_selection_get (SelectionData& selection_data, guint info, guint time)
| This is a default handler for the signal signal_selection_get(). More...
virtual void | on_selection_received (const SelectionData& selection_data, guint time)
| This is a default handler for the signal signal_selection_received(). More...
virtual void | on_drag_begin (const Glib::RefPtr< Gdk::DragContext >& context)
| This is a default handler for the signal signal_drag_begin(). More...
virtual void | on_drag_end (const Glib::RefPtr< Gdk::DragContext >& context)
| This is a default handler for the signal signal_drag_end(). More...
virtual void | on_drag_data_get (const Glib::RefPtr< Gdk::DragContext >& context, SelectionData& selection_data, guint info, guint time)
| This is a default handler for the signal signal_drag_data_get(). More...
virtual void | on_drag_data_delete (const Glib::RefPtr< Gdk::DragContext >& context)
| This is a default handler for the signal signal_drag_data_delete(). More...
virtual void | on_drag_leave (const Glib::RefPtr< Gdk::DragContext >& context, guint time)
| This is a default handler for the signal signal_drag_leave(). More...
virtual bool | on_drag_motion (const Glib::RefPtr< Gdk::DragContext >& context, int x, int y, guint time)
| This is a default handler for the signal signal_drag_motion(). More...
virtual bool | on_drag_drop (const Glib::RefPtr< Gdk::DragContext >& context, int x, int y, guint time)
| This is a default handler for the signal signal_drag_drop(). More...
virtual void | on_drag_data_received (const Glib::RefPtr< Gdk::DragContext >& context, int x, int y, const SelectionData& selection_data, guint info, guint time)
| This is a default handler for the signal signal_drag_data_received(). More...
virtual void | on_screen_changed (const Glib::RefPtr< Gdk::Screen >& previous_screen)
| This is a default handler for the signal signal_screen_changed(). More...
virtual void | dispatch_child_properties_changed_vfunc (guint p1, GParamSpec** p2)
virtual void | show_all_vfunc ()
virtual Glib::RefPtr< Atk::Object > | get_accessible_vfunc ()
virtual SizeRequestMode | get_request_mode_vfunc () const
virtual void | get_preferred_width_vfunc (int& minimum_width, int& natural_width) const
virtual void | get_preferred_height_for_width_vfunc (int width, int& minimum_height, int& natural_height) const
virtual void | get_preferred_height_vfunc (int& minimum_height, int& natural_height) const
virtual void | get_preferred_width_for_height_vfunc (int height, int& minimum_width, int& natural_width) const
| Widget ()
void | realize ()
| Creates the GDK (windowing system) resources associated with a widget. More...
void | unrealize ()
| This function is only useful in widget implementations. More...
void | draw (const ::Cairo::RefPtr< ::Cairo::Context >& cr)
| Draws widget to cr. More...
void | set_mapped (bool mapped=true)
| Marks the widget as being mapped. More...
void | set_realized (bool realized=true)
| Marks the widget as being realized. More...
void | set_has_window (bool has_window=true)
| Specifies whether widget has a Gdk::Window of its own. More...
void | set_window (const Glib::RefPtr< Gdk::Window >& window)
| Sets a widget's window. More...
void | transform_cairo_context_to_window (const ::Cairo::RefPtr< ::Cairo::Context >& cr, const Glib::RefPtr< const Gdk::Window >& window)
| Transforms the given cairo context cr from widget-relative coordinates to window-relative coordinates. More...
Requisition | get_requisition () const
| Retrieves the widget's requisition. More...
void | get_style_property_value (const Glib::ustring& the_property_name, Glib::ValueBase& value) const
| Gets the value of a style property of widget. More...
void | realize_if_needed ()
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
Protected Member Functions inherited from Gtk::Buildable
| Buildable ()
| You should derive from this class to use it. More...
Protected Member Functions inherited from Atk::Implementor
| Implementor ()
virtual Glib::RefPtr< Object > | ref_accessibile_vfunc ()

## Static Protected Member Functions
static bool | should_draw_window (const ::Cairo::RefPtr< const ::Cairo::Context >& cr, const Glib::RefPtr< const Gdk::Window >& window)
| This function is supposed to be called in Gtk::Widget::signal_draw() implementations for widgets that support multiple windows. More...

## Related Functions
(Note that these are not member functions.)
Gtk::Widget* | wrap (GtkWidget* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Gtk::Buildable
Glib::RefPtr< Gtk::Buildable > | wrap (GtkBuildable* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Detailed Description

Abstract Widget (Base class for all widgets)

As the base class of all widgets this contains all of the properties and methods common to all widgets. It is an abstract class that can not be instantiated.

Important part of widgets are the *_event signals and virtual methods that every widget have. Those are events coming directly from gdk and thus also from XLib. By overriding those virtual methods you can trap everything a widget can ever do. In order to capture events from a widget, the event mask must first be set with ().

Only widgets with a Gdk::Window on the server side are allowed to capture events. Widgets in the Gtk::Misc group for example lack a Gdk::Window.

Key values are the codes which are sent whenever a key is pressed or released. The complete list of key values can be found in the gdk/gdkkeysyms.h header file. They are prefixed with `GDK_KEY_`.

## Member Typedef Documentation

## ◆ SlotTick

using Gtk::Widget::SlotTick = sigc::slot<bool(const Glib::RefPtr<Gdk::FrameClock>&)>

Callback type for adding a function to update animations.

See add_tick_callback().

For instance:

bool on_tick(const Glib::RefPtr<Gdk::FrameClock>& frame_clock);

Parameters

  frame_clock | The frame clock for the widget (same as calling get_frame_clock()).

Returns
  `true` if the tick callback should continue to be called, `false` if the tick callback should be removed.

Since gtkmm 3.24:

## Constructor & Destructor Documentation

## ◆ Widget() [1/3]

Gtk::Widget::Widget | ( | Widget&& | src | ) |
| noexcept

## ◆ Widget() [2/3]

Gtk::Widget::Widget | ( | const Widget& |  | ) |
| delete

## ◆ ~Widget()

Gtk::Widget::~Widget | ( |  | ) |
| overridenoexcept

Destroys the widget.

The widget will be automatically removed from the parent container.

## ◆ Widget() [3/3]

Gtk::Widget::Widget | ( |  | ) |
| protected

## Member Function Documentation

## ◆ activate()

bool Gtk::Widget::activate | ( |  | ) |

For widgets that can be “activated” (buttons, menu items, etc.) this function activates them.

Activation is what happens when you press Enter on a widget during key navigation. If widget isn't activatable, the function returns `false`.

Returns
  `true` if the widget was activatable.

## ◆ add_accelerator()

void Gtk::Widget::add_accelerator | ( | const Glib::ustring & | accel_signal,
|  | const Glib::RefPtr< AccelGroup >& | accel_group,
|  | guint | accel_key,
|  | Gdk::ModifierType | accel_mods,
|  | AccelFlags | accel_flags
| ) |  |

Installs an accelerator for this widget in accel_group that causes accel_signal to be emitted if the accelerator is activated.

The accel_group needs to be added to the widget’s toplevel via Gtk::Window::add_accel_group(), and the signal must be of type G_SIGNAL_ACTION. Accelerators added through this function are not user changeable during runtime. If you want to support accelerators that can be changed by the user, use Gtk::AccelMap::add_entry() and set_accel_path() or Gtk::MenuItem::set_accel_path() instead.

Parameters

  accel_signal | Widget signal to emit on accelerator activation.
  accel_group | Accel group for this widget, added to its toplevel.
  accel_key | GDK keyval of the accelerator.
  accel_mods | Modifier key combination of the accelerator.
  accel_flags | Flag accelerators, e.g. Gtk::ACCEL_VISIBLE.

## ◆ add_device_events()

void Gtk::Widget::add_device_events | ( | const Glib::RefPtr< const Gdk::Device >& | device,
|  | Gdk::EventMask | events
| ) |  |

Adds the device events in the bitfield events to the event mask for widget.

See set_device_events() for details.

Since gtkmm 3.0:

Parameters

  device | A Gdk::Device.
  events | An event mask, see Gdk::EventMask.

## ◆ add_events()

void Gtk::Widget::add_events | ( | Gdk::EventMask | events | ) |

Adds the events in the bitfield events to the event mask for widget.

See set_events() and the [input handling overview][event-masks] for details.

Parameters

  events | An event mask, see Gdk::EventMask.

## ◆ add_mnemonic_label()

void Gtk::Widget::add_mnemonic_label | ( | Widget& | label | ) |

Adds a widget to the list of mnemonic labels for this widget.

(See list_mnemonic_labels()). Note the list of mnemonic labels for the widget is cleared when the widget is destroyed, so the caller must make sure to update its internal state at this point as well.

Since gtkmm 2.4:

Parameters

  label | A Gtk::Widget that acts as a mnemonic label for widget.

## ◆ add_modal_grab()

void Gtk::Widget::add_modal_grab | ( |  | ) |

Block events to everything else than this widget and its children.

This way you can get modal behaviour (usually not recommended). One practical example could be when implementing a key-binding widget that needs exclusive access to the key combination that the user presses next.

Calls to add_modal_grab should be paired with calls to remove_modal_grab.

## ◆ add_tick_callback()

guint Gtk::Widget::add_tick_callback | ( | const SlotTick& | slot | ) |

Queues an animation frame update and adds a callback to be called before each frame.

Until the tick callback is removed, it will be called frequently (usually at the frame rate of the output device or as quickly as the application can be repainted, whichever is slower). For this reason, is most suitable for handling graphics that change every frame or every few frames. The tick callback does not automatically imply a relayout or repaint. If you want a repaint or relayout, and aren’t changing widget properties that would trigger that (for example, changing the text of a Gtk::Label), then you will have to call queue_resize() or queue_draw_area() yourself.

Gdk::FrameClock::get_frame_time() should generally be used for timing continuous animations and Gdk::FrameTimings::get_predicted_presentation_time() if you are trying to display isolated frames at particular times.

This is a more convenient alternative to connecting directly to the Gdk::FrameClock::signal_update() signal of Gdk::FrameClock, since you don't have to worry about when a Gdk::FrameClock is assigned to a widget.

Since gtkmm 3.24:

Parameters

  slot | Slot to call for updating animations.

Returns
  An id for the connection of this callback. Remove the callback by passing it to remove_tick_callback().

## ◆ child_focus()

bool Gtk::Widget::child_focus | ( | DirectionType | direction | ) |

This function is used by custom widget implementations; if you're writing an app, you’d use grab_focus() to move the focus to a particular widget, and Gtk::Container::set_focus_chain() to change the focus tab order.

So you may want to investigate those functions instead.

child_focus() is called by containers as the user moves around the window using keyboard shortcuts. direction indicates what kind of motion is taking place (up, down, left, right, tab forward, tab backward). child_focus() emits the Gtk::Widget::signal_focus() signal; widgets override the default handler for this signal in order to implement appropriate focus behavior.

The default signal_focus() handler for a widget should return `true` if moving in direction left the focus on a focusable location inside that widget, and `false` if moving in direction moved the focus outside the widget. If returning `true`, widgets normally call grab_focus() to place the focus accordingly; if returning `false`, they don’t modify the current focus location.

Parameters

  direction | Direction of focus movement.

Returns
  `true` if focus ended up inside widget.

## ◆ child_notify()

void Gtk::Widget::child_notify | ( | const Glib::ustring & | child_property | ) |

Emits a Gtk::Widget::signal_child_notify() signal for the [child property][child-properties] child_property on widget.

This is the analogue of Glib::object_notify() for child properties.

Also see Gtk::Container::child_notify().

Parameters

  child_property | The name of a child property installed on the class of widget’s parent.

## ◆ compute_expand()

bool Gtk::Widget::compute_expand | ( | Orientation | orientation | ) |

Computes whether a container should give this widget extra space when possible.

Containers should check this, rather than looking at get_hexpand() or get_vexpand().

This function already checks whether the widget is visible, so visibility does not need to be checked separately. Non-visible widgets are not expanded.

The computed expand value uses either the expand setting explicitly set on the widget itself, or, if none has been explicitly set, the widget may expand if some of its children do.

Parameters

  orientation | Expand direction.

Returns
  Whether widget tree rooted here should be expanded.

## ◆ create_pango_context()

Glib::RefPtr<Pango::Context> Gtk::Widget::create_pango_context | ( |  | ) |

Creates a new Pango::Context with the appropriate font map, font options, font description, and base direction for drawing text for this widget.

See also get_pango_context().

Returns
  The new Pango::Context.

## ◆ create_pango_layout()

Glib::RefPtr<Pango::Layout> Gtk::Widget::create_pango_layout | ( | const Glib::ustring & | text | ) |

Creates a new Pango::Layout with the appropriate font map, font description, and base direction for drawing text for this widget.

If you keep a Pango::Layout created in this way around, you need to re-create it when the widget Pango::Context is replaced. This can be tracked by using the Gtk::Widget::signal_screen_changed() signal on the widget.

Parameters

  text | Text to set on the layout (can be `nullptr`).

Returns
  The new Pango::Layout.

## ◆ device_is_shadowed()

bool Gtk::Widget::device_is_shadowed | ( | const Glib::RefPtr< const Gdk::Device >& | device | ) |

Returns `true` if device has been shadowed by a GTK+ device grab on another widget, so it would stop sending events to widget.

This may be used in the Gtk::Widget::signal_grab_notify() signal to check for specific devices. See gtk_device_grab_add().

Since gtkmm 3.0:

Parameters

  device | A Gdk::Device.

Returns
  `true` if there is an ongoing grab on device by another Gtk::Widget than widget.

## ◆ dispatch_child_properties_changed_vfunc()

virtual void Gtk::Widget::dispatch_child_properties_changed_vfunc | ( | guint | p1,
|  | GParamSpec ** | p2
| ) |  |
| protectedvirtual

## ◆ drag_begin() [1/2]

Glib::RefPtr<Gdk::DragContext> Gtk::Widget::drag_begin | ( | const Glib::RefPtr< TargetList >& | targets,
|  | Gdk::DragAction | actions,
|  | int | button,
|  | GdkEvent * | gdk_event
| ) |  |

Deprecated:
  Use the drag_begin() that takes x,y coordinates.

Parameters

  targets | The targets (data formats) in which the source can provide the data.
  actions | A bitmask of the allowed drag actions for this drag.
  button | The button the user clicked to start the drag.
  gdk_event | The event that triggered the start of the drag.

## ◆ drag_begin() [2/2]

Glib::RefPtr<Gdk::DragContext> Gtk::Widget::drag_begin | ( | const Glib::RefPtr< TargetList >& | targets,
|  | Gdk::DragAction | actions,
|  | int | button,
|  | GdkEvent * | gdk_event,
|  | int | x,
|  | int | y
| ) |  |

## ◆ drag_check_threshold()

bool Gtk::Widget::drag_check_threshold | ( | int | start_x,
|  | int | start_y,
|  | int | current_x,
|  | int | current_y
| ) |  |

Parameters

  start_x | X coordinate of start of drag.
  start_y | Y coordinate of start of drag.
  current_x | Current X coordinate.
  current_y | Current Y coordinate.

## ◆ drag_dest_add_image_targets()

void Gtk::Widget::drag_dest_add_image_targets | ( |  | ) |

Add the image targets supported by Gtk::SelectionData to the target list of the drag destination.

The targets are added with info = 0. If you need another value, use Gtk::TargetList::add_image_targets() and gtk_drag_dest_set_target_list().

Since gtkmm 2.6:

## ◆ drag_dest_add_text_targets()

void Gtk::Widget::drag_dest_add_text_targets | ( |  | ) |

Add the text targets supported by Gtk::SelectionData to the target list of the drag destination.

The targets are added with info = 0. If you need another value, use Gtk::TargetList::add_text_targets() and gtk_drag_dest_set_target_list().

Since gtkmm 2.6:

## ◆ drag_dest_add_uri_targets()

void Gtk::Widget::drag_dest_add_uri_targets | ( |  | ) |

Add the URI targets supported by Gtk::SelectionData to the target list of the drag destination.

The targets are added with info = 0. If you need another value, use Gtk::TargetList::add_uri_targets() and gtk_drag_dest_set_target_list().

Since gtkmm 2.6:

## ◆ drag_dest_find_target() [1/2]

Glib::ustring Gtk::Widget::drag_dest_find_target | ( | const Glib::RefPtr< Gdk::DragContext >& | context | ) | const

## ◆ drag_dest_find_target() [2/2]

Glib::ustring Gtk::Widget::drag_dest_find_target | ( | const Glib::RefPtr< Gdk::DragContext >& | context,
|  | const Glib::RefPtr< TargetList >& | target_list
| ) |  | const

Looks for a match between context->targets and the dest_target_list, returning the first matching target, otherwise returning GDK_NONE.

dest_target_list should usually be the return value from gtk_drag_dest_get_target_list(), but some widgets may have different valid targets for different parts of the widget; in that case, they will have to implement a drag_motion handler that passes the correct target list to this function.

Parameters

  context | Drag context.
  target_list | List of droppable targets.

Returns
  First target that the source offers and the dest can accept, or GDK_NONE.

## ◆ drag_dest_get_target_list() [1/2]

Glib::RefPtr<TargetList> Gtk::Widget::drag_dest_get_target_list | ( |  | ) |

Returns the list of targets this widget can accept from drag-and-drop.

Returns
  The Gtk::TargetList, or `nullptr` if none.

## ◆ drag_dest_get_target_list() [2/2]

Glib::RefPtr<const TargetList> Gtk::Widget::drag_dest_get_target_list | ( |  | ) | const

Returns the list of targets this widget can accept from drag-and-drop.

Returns
  The Gtk::TargetList, or `nullptr` if none.

## ◆ drag_dest_set() [1/2]

void Gtk::Widget::drag_dest_set | ( | const std::vector< TargetEntry >& | targets,
|  | DestDefaults | flags = `DEST_DEFAULT_ALL`,
|  | Gdk::DragAction | actions = `Gdk::ACTION_COPY`
| ) |  |

## ◆ drag_dest_set() [2/2]

void Gtk::Widget::drag_dest_set | ( | DestDefaults | flags = `DestDefaults(0)`,
|  | Gdk::DragAction | actions = `Gdk::DragAction(0)`
| ) |  |

## ◆ drag_dest_set_proxy()

void Gtk::Widget::drag_dest_set_proxy | ( | const Glib::RefPtr< Gdk::Window >& | proxy_window,
|  | Gdk::DragProtocol | protocol,
|  | bool | use_coordinates
| ) |  |

Sets this widget as a proxy for drops to another window.

Deprecated: 3.22

Deprecated:
  No replacement available.

Parameters

  proxy_window | The window to which to forward drag events.
  protocol | The drag protocol which the proxy_window accepts (You can use gdk_drag_get_protocol() to determine this).
  use_coordinates | If `true`, send the same coordinates to the destination, because it is an embedded subwindow.

## ◆ drag_dest_set_target_list()

void Gtk::Widget::drag_dest_set_target_list | ( | const Glib::RefPtr< TargetList >& | target_list | ) |

Sets the target types that this widget can accept from drag-and-drop.

The widget must first be made into a drag destination with gtk_drag_dest_set().

Parameters

  target_list | List of droppable targets, or `nullptr` for none.

## ◆ drag_dest_unset()

void Gtk::Widget::drag_dest_unset | ( |  | ) |

Clears information about a drop destination set with gtk_drag_dest_set().

The widget will no longer receive notification of drags.

## ◆ drag_get_data()

void Gtk::Widget::drag_get_data | ( | const Glib::RefPtr< Gdk::DragContext >& | context,
|  | const Glib::ustring & | target,
|  | guint32 | time
| ) |  |

Parameters

  context | The drag context.
  target | The target (form of the data) to retrieve.
  time | A timestamp for retrieving the data. This will generally be the time received in a Gtk::Widget::signal_drag_motion()" or Gtk::Widget::signal_drag_drop()" signal.

## ◆ drag_get_source_widget()

static Widget* Gtk::Widget::drag_get_source_widget | ( | const Glib::RefPtr< Gdk::DragContext >& | context | ) |
| static

## ◆ drag_highlight()

void Gtk::Widget::drag_highlight | ( |  | ) |

## ◆ drag_set_as_icon()

void Gtk::Widget::drag_set_as_icon | ( | const Glib::RefPtr< Gdk::DragContext >& | context,
|  | int | hot_x,
|  | int | hot_y
| ) |  |

## ◆ drag_source_add_image_targets()

void Gtk::Widget::drag_source_add_image_targets | ( |  | ) |

Add the writable image targets supported by Gtk::SelectionData to the target list of the drag source.

The targets are added with info = 0. If you need another value, use Gtk::TargetList::add_image_targets() and gtk_drag_source_set_target_list().

Since gtkmm 2.6:

## ◆ drag_source_add_text_targets()

void Gtk::Widget::drag_source_add_text_targets | ( |  | ) |

Add the text targets supported by Gtk::SelectionData to the target list of the drag source.

The targets are added with info = 0. If you need another value, use Gtk::TargetList::add_text_targets() and gtk_drag_source_set_target_list().

Since gtkmm 2.6:

## ◆ drag_source_add_uri_targets()

void Gtk::Widget::drag_source_add_uri_targets | ( |  | ) |

Add the URI targets supported by Gtk::SelectionData to the target list of the drag source.

The targets are added with info = 0. If you need another value, use Gtk::TargetList::add_uri_targets() and gtk_drag_source_set_target_list().

Since gtkmm 2.6:

## ◆ drag_source_set()

void Gtk::Widget::drag_source_set | ( | const std::vector< TargetEntry >& | targets,
|  | Gdk::ModifierType | start_button_mask = `Gdk::MODIFIER_MASK`,
|  | Gdk::DragAction | actions = `Gdk::ACTION_COPY`
| ) |  |

## ◆ drag_source_set_icon() [1/3]

void Gtk::Widget::drag_source_set_icon | ( | const Glib::RefPtr< Gdk::Pixbuf >& | pixbuf | ) |

Sets the icon that will be used for drags from a particular widget from a Gdk::Pixbuf.

GTK+ retains a reference for pixbuf and will release it when it is no longer needed.

Parameters

  pixbuf | The Gdk::Pixbuf for the drag icon.

## ◆ drag_source_set_icon() [2/3]

void Gtk::Widget::drag_source_set_icon | ( | const Glib::ustring & | icon_name | ) |

Sets the icon that will be used for drags from a particular source to a themed icon.

See the docs for Gtk::IconTheme for more details.

Since gtkmm 2.8:

Parameters

  icon_name | Name of icon to use.

## ◆ drag_source_set_icon() [3/3]

void Gtk::Widget::drag_source_set_icon | ( | const StockID& | stock_id | ) |

Sets the icon that will be used for drags from a particular source to a stock icon.

Deprecated: 3.10: Use gtk_drag_source_set_icon_name() instead.

Deprecated:
  Use the drag_source_set_icon() that takes a Glib::ustring instead.

Parameters

  stock_id | The ID of the stock icon to use.

## ◆ drag_source_unset()

void Gtk::Widget::drag_source_unset | ( |  | ) |

Undoes the effects of gtk_drag_source_set().

## ◆ drag_unhighlight()

void Gtk::Widget::drag_unhighlight | ( |  | ) |

## ◆ draw()

void Gtk::Widget::draw | ( | const ::Cairo::RefPtr< ::Cairo::Context > & | cr | ) |
| protected

Draws widget to cr.

The top left corner of the widget will be drawn to the currently set origin point of cr.

You should pass a cairo context as cr argument that is in an original state. Otherwise the resulting drawing is undefined. For example changing the operator using cairo_set_operator() or the line width using cairo_set_line_width() might have unwanted side effects. You may however change the context’s transform matrix - like with cairo_scale(), cairo_translate() or cairo_set_matrix() and clip region with cairo_clip() prior to calling this function. Also, it is fine to modify the context with cairo_save() and cairo_push_group() prior to calling this function.

Note that special-purpose widgets may contain special code for rendering to the screen and might appear differently on screen and when rendered using draw().

Since gtkmm 3.0:

Parameters

  cr | A cairo context to draw to.

## ◆ draw_insertion_cursor()

void Gtk::Widget::draw_insertion_cursor | ( | const ::Cairo::RefPtr< ::Cairo::Context > & | cr,
|  | const Gdk::Rectangle& | location,
|  | bool | is_primary,
|  | TextDirection | direction,
|  | bool | draw_arrow = `true`
| ) |  |

Draws a text caret on cr at location.

This is not a style function but merely a convenience function for drawing the standard cursor shape.

Deprecated:
  Use StyleContext::render_insertion_cursor() instead.

## ◆ error_bell()

void Gtk::Widget::error_bell | ( |  | ) |

Notifies the user about an input-related error on this widget.

If the Gtk::Settings gtk-error-bell property is true, it calls Gdk::Window::beep(), otherwise it does nothing.

Note that the effect of Gdk::Window::beep() can be configured in many ways, depending on the windowing backend and the desktop environment or window manager that is used.

Since gtkmm 2.12:

## ◆ event()

bool Gtk::Widget::event | ( | GdkEvent * | gdk_event | ) |

Rarely-used function.

This function is used to emit the event signals on a widget (those signals should never be emitted without using this function to do so). If you want to synthesize an event though, don’t use this function; instead, use gtk_main_do_event() so the event will behave as if it were in the event queue. Don’t synthesize expose events; instead, use gdk_window_invalidate_rect() to invalidate a region of the window.

Parameters

  gdk_event | A Gdk::Event.

Returns
  Return from the event signal emission (`true` if the event was handled).

## ◆ freeze_child_notify()

void Gtk::Widget::freeze_child_notify | ( |  | ) |

Stops emission of Gtk::Widget::signal_child_notify() signals on widget.

The signals are queued until thaw_child_notify() is called on widget.

This is the analogue of Glib::object_freeze_notify() for child properties.

## ◆ get_accessible() [1/2]

Glib::RefPtr<Atk::Object> Gtk::Widget::get_accessible | ( |  | ) |

Returns the accessible object that describes the widget to an assistive technology.

If accessibility support is not available, this Atk::Object instance may be a no-op. Likewise, if no class-specific Atk::Object implementation is available for the widget instance in question, it will inherit an Atk::Object implementation from the first ancestor class for which such an implementation is defined.

The documentation of the ATK library contains more information about accessible objects and their uses.

Returns
  The Atk::Object associated with widget.

## ◆ get_accessible() [2/2]

Glib::RefPtr<const Atk::Object> Gtk::Widget::get_accessible | ( |  | ) | const

Returns the accessible object that describes the widget to an assistive technology.

If accessibility support is not available, this Atk::Object instance may be a no-op. Likewise, if no class-specific Atk::Object implementation is available for the widget instance in question, it will inherit an Atk::Object implementation from the first ancestor class for which such an implementation is defined.

The documentation of the ATK library contains more information about accessible objects and their uses.

Returns
  The Atk::Object associated with widget.

## ◆ get_accessible_vfunc()

virtual Glib::RefPtr<Atk::Object> Gtk::Widget::get_accessible_vfunc | ( |  | ) |
| protectedvirtual

## ◆ get_action_group() [1/2]

Glib::RefPtr<Gio::ActionGroup> Gtk::Widget::get_action_group | ( | const Glib::ustring & | prefix | ) |

Retrieves the Gio::ActionGroup that was registered using prefix.

The resulting Gio::ActionGroup may have been registered to widget or any Gtk::Widget in its ancestry.

If no action group was found matching prefix, then `nullptr` is returned.

Since gtkmm 3.16:

Parameters

  prefix | The “prefix” of the action group.

Returns
  A Gio::ActionGroup or `nullptr`.

## ◆ get_action_group() [2/2]

Glib::RefPtr<const Gio::ActionGroup> Gtk::Widget::get_action_group | ( | const Glib::ustring & | prefix | ) | const

Retrieves the Gio::ActionGroup that was registered using prefix.

The resulting Gio::ActionGroup may have been registered to widget or any Gtk::Widget in its ancestry.

If no action group was found matching prefix, then `nullptr` is returned.

Since gtkmm 3.16:

Parameters

  prefix | The “prefix” of the action group.

Returns
  A Gio::ActionGroup or `nullptr`.

## ◆ get_allocated_baseline()

int Gtk::Widget::get_allocated_baseline | ( |  | ) | const

Returns the baseline that has currently been allocated to widget.

This function is intended to be used when implementing handlers for the Gtk::Widget::signal_draw() function, and when allocating child widgets in Gtk::Widget::size_allocate.

Since gtkmm 3.10:

Returns
  The baseline of the widget, or -1 if none.

## ◆ get_allocated_height()

int Gtk::Widget::get_allocated_height | ( |  | ) | const

Returns the height that has currently been allocated to widget.

This function is intended to be used when implementing handlers for the Gtk::Widget::signal_draw() function.

Returns
  The height of the widget.

## ◆ get_allocated_size()

void Gtk::Widget::get_allocated_size | ( | Allocation& | allocation,
|  | int & | baseline
| ) |  | const

Retrieves the widget’s allocated size.

This function returns the last values passed to size_allocate_with_baseline(). The value differs from the size returned in get_allocation() in that functions like set_halign() can adjust the allocation, but not the value returned by this function.

If a widget is not visible, its allocated size is 0.

Since gtkmm 3.20:

Parameters

  allocation | A pointer to a Gtk::Allocation to copy to.
  baseline | A pointer to an integer to copy to.

## ◆ get_allocated_width()

int Gtk::Widget::get_allocated_width | ( |  | ) | const

Returns the width that has currently been allocated to widget.

This function is intended to be used when implementing handlers for the Gtk::Widget::signal_draw() function.

Returns
  The width of the widget.

## ◆ get_allocation()

Allocation Gtk::Widget::get_allocation | ( |  | ) | const

Retrieves the widget's location.

Note, when implementing a Container: a widget's allocation will be its "adjusted" allocation, that is, the widget's parent container typically calls size_allocate() with an allocation, and that allocation is then adjusted (to handle margin and alignment for example) before assignment to the widget. get_allocation() returns the adjusted allocation that was actually assigned to the widget. The adjusted allocation is guaranteed to be completely contained within the size_allocate() allocation, however. So a Container is guaranteed that its children stay inside the assigned bounds, but not that they have exactly the bounds the container assigned. There is no way to get the original allocation assigned by size_allocate(), since it isn't stored. If a container implementation needs that information it will have to track it itself.

Returns
  The widget's allocated area.

## ◆ get_ancestor() [1/2]

Widget* Gtk::Widget::get_ancestor | ( | GType | widget_type | ) |

Gets the first ancestor of widget with type widget_type.

For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)` gets the first Gtk::Box that’s an ancestor of widget. No reference will be added to the returned widget; it should not be unreferenced. See note about checking for a toplevel Gtk::Window in the docs for get_toplevel().

Note that unlike is_ancestor(), get_ancestor() considers widget to be an ancestor of itself.

Parameters

  widget_type | Ancestor type.

Returns
  The ancestor widget, or `nullptr` if not found.

## ◆ get_ancestor() [2/2]

const Widget* Gtk::Widget::get_ancestor | ( | GType | widget_type | ) | const

Gets the first ancestor of widget with type widget_type.

For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)` gets the first Gtk::Box that’s an ancestor of widget. No reference will be added to the returned widget; it should not be unreferenced. See note about checking for a toplevel Gtk::Window in the docs for get_toplevel().

Note that unlike is_ancestor(), get_ancestor() considers widget to be an ancestor of itself.

Parameters

  widget_type | Ancestor type.

Returns
  The ancestor widget, or `nullptr` if not found.

## ◆ get_app_paintable()

bool Gtk::Widget::get_app_paintable | ( |  | ) | const

Determines whether the application intends to draw on the widget in an Gtk::Widget::signal_draw() handler.

See set_app_paintable()

Since gtkmm 2.18:

Returns
  `true` if the widget is app paintable.

## ◆ get_can_default()

bool Gtk::Widget::get_can_default | ( |  | ) | const

Determines whether widget can be a default widget.

See set_can_default().

Since gtkmm 2.18:

Returns
  `true` if widget can be a default widget, `false` otherwise.

## ◆ get_can_focus()

bool Gtk::Widget::get_can_focus | ( |  | ) | const

Determines whether widget can own the input focus.

See set_can_focus().

Since gtkmm 2.18:

Returns
  `true` if widget can own the input focus, `false` otherwise.

## ◆ get_child_visible()

bool Gtk::Widget::get_child_visible | ( |  | ) | const

Gets the value set with set_child_visible().

If you feel a need to use this function, your code probably needs reorganization.

This function is only useful for container implementations and never should be called by an application.

Returns
  `true` if the widget is mapped with the parent.

## ◆ get_clip()

Allocation Gtk::Widget::get_clip | ( |  | ) | const

Retrieves the widget’s clip area.

The clip area is the area in which all of the widget's drawing will happen. Other toolkits call it the bounding box.

Historically, in GTK+ the clip area has been equal to the allocation retrieved via get_allocation().

Since gtkmm 3.14:

## ◆ get_clipboard() [1/2]

Glib::RefPtr<Clipboard> Gtk::Widget::get_clipboard | ( | const Glib::ustring & | selection | ) |

Returns the clipboard object for the given selection to be used with widget.

widget must have a Gdk::Display associated with it, so must be attached to a toplevel window.

Since gtkmm 2.2:

Parameters

  selection | A Gdk::Atom which identifies the clipboard to use. GDK_SELECTION_CLIPBOARD gives the default clipboard. Another common value is GDK_SELECTION_PRIMARY, which gives the primary X selection.

Returns
  The appropriate clipboard object. If no clipboard already exists, a new one will be created. Once a clipboard object has been created, it is persistent for all time.

## ◆ get_clipboard() [2/2]

Glib::RefPtr<const Clipboard> Gtk::Widget::get_clipboard | ( | const Glib::ustring & | selection | ) | const

Returns the clipboard object for the given selection to be used with widget.

widget must have a Gdk::Display associated with it, so must be attached to a toplevel window.

Since gtkmm 2.2:

Parameters

  selection | A Gdk::Atom which identifies the clipboard to use. GDK_SELECTION_CLIPBOARD gives the default clipboard. Another common value is GDK_SELECTION_PRIMARY, which gives the primary X selection.

Returns
  The appropriate clipboard object. If no clipboard already exists, a new one will be created. Once a clipboard object has been created, it is persistent for all time.

## ◆ get_composite_name()

Glib::ustring Gtk::Widget::get_composite_name | ( |  | ) | const

Obtains the composite name of a widget.

Deprecated: 3.10: Use class_set_template(), or don’t use this API at all.

Deprecated:
  Use gtk_widget_class_set_template(), or don't use this API at all.

Returns
  The composite name of widget, or an empty string if widget is not a composite child.

## ◆ get_current_modal_grab()

static Widget* Gtk::Widget::get_current_modal_grab | ( |  | ) |
| static

Retrieve the widget which is currently grabbing all events.

## ◆ get_default_direction()

static TextDirection Gtk::Widget::get_default_direction | ( |  | ) |
| static

Obtains the current default reading direction.

See set_default_direction().

Returns
  The current default direction.

## ◆ get_device_enabled()

bool Gtk::Widget::get_device_enabled | ( | const Glib::RefPtr< const Gdk::Device >& | device | ) | const

Returns whether device can interact with widget and its children.

See set_device_enabled().

Since gtkmm 3.0:

Parameters

  device | A Gdk::Device.

Returns
  `true` is device is enabled for widget.

## ◆ get_device_events()

Gdk::EventMask Gtk::Widget::get_device_events | ( | const Glib::RefPtr< const Gdk::Device >& | device | ) | const

Returns the events mask for the widget corresponding to an specific device.

These are the events that the widget will receive when device operates on it.

Since gtkmm 3.0:

Parameters

  device | A Gdk::Device.

Returns
  Device event mask for widget.

## ◆ get_direction()

TextDirection Gtk::Widget::get_direction | ( |  | ) | const

Gets the reading direction for a particular widget.

See set_direction().

Returns
  The reading direction for the widget.

## ◆ get_display() [1/2]

Glib::RefPtr<Gdk::Display> Gtk::Widget::get_display | ( |  | ) |

Get the Gdk::Display for the toplevel window associated with this widget.

This function can only be called after the widget has been added to a widget hierarchy with a Gtk::Window at the top.

In general, you should only create display specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.

Since gtkmm 2.2:

Returns
  The Gdk::Display for the toplevel for this widget.

## ◆ get_display() [2/2]

Glib::RefPtr<const Gdk::Display> Gtk::Widget::get_display | ( |  | ) | const

Get the Gdk::Display for the toplevel window associated with this widget.

This function can only be called after the widget has been added to a widget hierarchy with a Gtk::Window at the top.

In general, you should only create display specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.

Since gtkmm 2.2:

Returns
  The Gdk::Display for the toplevel for this widget.

## ◆ get_double_buffered()

bool Gtk::Widget::get_double_buffered | ( |  | ) | const

Determines whether the widget is double buffered.

See set_double_buffered()

Since gtkmm 2.18:

Deprecated:
  This should not be used in newly written code.

Returns
  `true` if the widget is double buffered.

## ◆ get_events()

Gdk::EventMask Gtk::Widget::get_events | ( |  | ) | const

Returns the event mask (see Gdk::EventMask) for the widget.

These are the events that the widget will receive.

Note
  Internally, the widget event mask will be the logical OR of the event mask set through set_events() or add_events(), and the event mask necessary to cater for every Gtk::EventController created for the widget.

Returns
  Event mask for widget.

## ◆ get_focus_on_click()

bool Gtk::Widget::get_focus_on_click | ( |  | ) | const

Returns whether the widget should grab focus when it is clicked with the mouse.

See set_focus_on_click().

Since gtkmm 3.20:

Returns
  `true` if the widget should grab focus when it is clicked with the mouse.

## ◆ get_font_map() [1/2]

Glib::RefPtr<Pango::FontMap> Gtk::Widget::get_font_map | ( |  | ) |

Gets the font map that has been set with set_font_map().

Since gtkmm 3.18:

Returns
  A Pango::FontMap, or `nullptr`.

## ◆ get_font_map() [2/2]

Glib::RefPtr<const Pango::FontMap> Gtk::Widget::get_font_map | ( |  | ) | const

Gets the font map that has been set with set_font_map().

Since gtkmm 3.18:

Returns
  A Pango::FontMap, or `nullptr`.

## ◆ get_font_options()

::Cairo::FontOptions Gtk::Widget::get_font_options | ( |  | ) | const

Returns the #cairo_font_options_t used for Pango rendering.

When not set, the defaults font options for the Gdk::Screen will be used.

Since gtkmm 3.18:

Returns
  The #cairo_font_options_t or `nullptr` if not set.

## ◆ get_frame_clock() [1/2]

Glib::RefPtr<Gdk::FrameClock> Gtk::Widget::get_frame_clock | ( |  | ) |

Obtains the frame clock for a widget.

The frame clock is a global “ticker” that can be used to drive animations and repaints. The most common reason to get the frame clock is to call gdk_frame_clock_get_frame_time(), in order to get a time to use for animating. For example you might record the start of the animation with an initial value from gdk_frame_clock_get_frame_time(), and then update the animation by calling gdk_frame_clock_get_frame_time() again during each repaint.

gdk_frame_clock_request_phase() will result in a new frame on the clock, but won’t necessarily repaint any widgets. To repaint a widget, you have to use queue_draw() which invalidates the widget (thus scheduling it to receive a draw on the next frame). queue_draw() will also end up requesting a frame on the appropriate frame clock.

A widget’s frame clock will not change while the widget is mapped. Reparenting a widget (which implies a temporary unmap) can change the widget’s frame clock.

Unrealized widgets do not have a frame clock.

Since gtkmm 3.24:

Returns
  A Gdk::FrameClock, or `nullptr` if widget is unrealized.

## ◆ get_frame_clock() [2/2]

Glib::RefPtr<const Gdk::FrameClock> Gtk::Widget::get_frame_clock | ( |  | ) | const

Obtains the frame clock for a widget.

The frame clock is a global “ticker” that can be used to drive animations and repaints. The most common reason to get the frame clock is to call gdk_frame_clock_get_frame_time(), in order to get a time to use for animating. For example you might record the start of the animation with an initial value from gdk_frame_clock_get_frame_time(), and then update the animation by calling gdk_frame_clock_get_frame_time() again during each repaint.

gdk_frame_clock_request_phase() will result in a new frame on the clock, but won’t necessarily repaint any widgets. To repaint a widget, you have to use queue_draw() which invalidates the widget (thus scheduling it to receive a draw on the next frame). queue_draw() will also end up requesting a frame on the appropriate frame clock.

A widget’s frame clock will not change while the widget is mapped. Reparenting a widget (which implies a temporary unmap) can change the widget’s frame clock.

Unrealized widgets do not have a frame clock.

Since gtkmm 3.24:

Returns
  A Gdk::FrameClock, or `nullptr` if widget is unrealized.

## ◆ get_halign()

Align Gtk::Widget::get_halign | ( |  | ) | const

Gets the value of the Gtk::Widget::property_halign() property.

For backwards compatibility reasons this method will never return Gtk::ALIGN_BASELINE, but instead it will convert it to Gtk::ALIGN_FILL. Baselines are not supported for horizontal alignment.

Returns
  The horizontal alignment of widget.

## ◆ get_has_tooltip()

bool Gtk::Widget::get_has_tooltip | ( |  | ) | const

Returns the current value of the has-tooltip property.

See Gtk::Widget::property_has_tooltip() for more information.

Since gtkmm 2.12:

Returns
  Current value of has-tooltip on widget.

## ◆ get_has_window()

bool Gtk::Widget::get_has_window | ( |  | ) | const

Determines whether widget has a Gdk::Window of its own.

See set_has_window().

Since gtkmm 2.18:

Returns
  `true` if widget has a window, `false` otherwise.

## ◆ get_height()

int Gtk::Widget::get_height | ( |  | ) | const

## ◆ get_hexpand()

bool Gtk::Widget::get_hexpand | ( |  | ) | const

Gets whether the widget would like any available extra horizontal space.

When a user resizes a Gtk::Window, widgets with expand=`true` generally receive the extra space. For example, a list or scrollable area or document in your window would often be set to expand.

Containers should use compute_expand() rather than this function, to see whether a widget, or any of its children, has the expand flag set. If any child of a widget wants to expand, the parent may ask to expand also.

This function only looks at the widget’s own hexpand flag, rather than computing whether the entire widget tree rooted at this widget wants to expand.

Returns
  Whether hexpand flag is set.

## ◆ get_hexpand_set()

bool Gtk::Widget::get_hexpand_set | ( |  | ) | const

Gets whether set_hexpand() has been used to explicitly set the expand flag on this widget.

If hexpand is set, then it overrides any computed expand value based on child widgets. If hexpand is not set, then the expand value depends on whether any children of the widget would like to expand.

There are few reasons to use this function, but it’s here for completeness and consistency.

Returns
  Whether hexpand has been explicitly set.

## ◆ get_is_drawable()

bool Gtk::Widget::get_is_drawable | ( |  | ) | const

Determines whether widget can be drawn to.

A widget can be drawn to if it is mapped and visible.

Since gtkmm 2.18:

Returns
  `true` if widget is drawable, `false` otherwise.

## ◆ get_is_toplevel()

bool Gtk::Widget::get_is_toplevel | ( |  | ) | const

Determines whether widget is a toplevel widget.

Currently only Gtk::Window and Gtk::Invisible (and out-of-process Gtk::Plugs) are toplevel widgets. Toplevel widgets have no parent widget.

Since gtkmm 2.18:

Returns
  `true` if widget is a toplevel, `false` otherwise.

## ◆ get_mapped()

bool Gtk::Widget::get_mapped | ( |  | ) | const

Whether the widget is mapped.

Since gtkmm 2.20:

Returns
  `true` if the widget is mapped, `false` otherwise.

## ◆ get_margin_bottom()

int Gtk::Widget::get_margin_bottom | ( |  | ) | const

Gets the value of the Gtk::Widget::property_margin_bottom() property.

Since gtkmm 3.0:

Returns
  The bottom margin of widget.

## ◆ get_margin_end()

int Gtk::Widget::get_margin_end | ( |  | ) | const

Gets the value of the Gtk::Widget::property_margin_end() property.

Since gtkmm 3.12:

Returns
  The end margin of widget.

## ◆ get_margin_left()

int Gtk::Widget::get_margin_left | ( |  | ) | const

Gets the value of the Gtk::Widget::property_margin_left() property.

Deprecated: 3.12: Use get_margin_start() instead.

Since gtkmm 3.0:

Deprecated:
  Use get_margin_start() instead.

Returns
  The left margin of widget.

## ◆ get_margin_right()

int Gtk::Widget::get_margin_right | ( |  | ) | const

Gets the value of the Gtk::Widget::property_margin_right() property.

Deprecated: 3.12: Use get_margin_end() instead.

Since gtkmm 3.0:

Deprecated:
  Use get_margin_end() instead.

Returns
  The right margin of widget.

## ◆ get_margin_start()

int Gtk::Widget::get_margin_start | ( |  | ) | const

Gets the value of the Gtk::Widget::property_margin_start() property.

Since gtkmm 3.12:

Returns
  The start margin of widget.

## ◆ get_margin_top()

int Gtk::Widget::get_margin_top | ( |  | ) | const

Gets the value of the Gtk::Widget::property_margin_top() property.

Since gtkmm 3.0:

Returns
  The top margin of widget.

## ◆ get_modifier_mask()

Gdk::ModifierType Gtk::Widget::get_modifier_mask | ( | Gdk::ModifierIntent | intent | ) |

Returns the modifier mask the widget’s windowing system backend uses for a particular purpose.

See gdk_keymap_get_modifier_mask().

Since gtkmm 3.4:

Parameters

  intent | The use case for the modifier mask.

Returns
  The modifier mask used for intent.

## ◆ get_name()

Glib::ustring Gtk::Widget::get_name | ( |  | ) | const

Retrieves the name of a widget.

See set_name() for the significance of widget names.

Returns
  Name of the widget. This string is owned by GTK+ and should not be modified or freed.

## ◆ get_no_show_all()

bool Gtk::Widget::get_no_show_all | ( |  | ) | const

Returns the current value of the Gtk::Widget::property_no_show_all() property, which determines whether calls to show_all() will affect this widget.

Since gtkmm 2.4:

Returns
  The current value of the “no-show-all” property.

## ◆ get_opacity()

double Gtk::Widget::get_opacity | ( |  | ) | const

Fetches the requested opacity for this widget.

See set_opacity().

Since gtkmm 3.8:

Returns
  The requested opacity for this widget.

## ◆ get_pango_context()

Glib::RefPtr<Pango::Context> Gtk::Widget::get_pango_context | ( |  | ) |

Gets a Pango::Context with the appropriate font map, font description, and base direction for this widget.

Unlike the context returned by create_pango_context(), this context is owned by the widget (it can be used until the screen for the widget changes or the widget is removed from its toplevel), and will be updated to match any changes to the widget’s attributes. This can be tracked by using the Gtk::Widget::signal_screen_changed() signal on the widget.

Returns
  The Pango::Context for the widget.

## ◆ get_parent() [1/2]

Container* Gtk::Widget::get_parent | ( |  | ) |

Returns the parent container of widget.

Returns
  The parent container of widget, or `nullptr`.

## ◆ get_parent() [2/2]

const Container* Gtk::Widget::get_parent | ( |  | ) | const

Returns the parent container of widget.

Returns
  The parent container of widget, or `nullptr`.

## ◆ get_parent_window() [1/2]

Glib::RefPtr<Gdk::Window> Gtk::Widget::get_parent_window | ( |  | ) |

Gets widget’s parent window, or `nullptr` if it does not have one.

Returns
  The parent window of widget, or `nullptr` if it does not have a parent window.

## ◆ get_parent_window() [2/2]

Glib::RefPtr<const Gdk::Window> Gtk::Widget::get_parent_window | ( |  | ) | const

Gets widget’s parent window, or `nullptr` if it does not have one.

Returns
  The parent window of widget, or `nullptr` if it does not have a parent window.

## ◆ get_path()

WidgetPath Gtk::Widget::get_path | ( |  | ) | const

Returns the Gtk::WidgetPath representing widget, if the widget is not connected to a toplevel widget, a partial path will be created.

Returns
  The Gtk::WidgetPath representing widget.

## ◆ get_pointer()

void Gtk::Widget::get_pointer | ( | int & | x,
|  | int & | y
| ) |  | const

Obtains the location of the mouse pointer in widget coordinates.

Widget coordinates are a bit odd; for historical reasons, they are defined as widget->window coordinates for widgets that return `true` for get_has_window(); and are relative to widget->allocation.x, widget->allocation.y otherwise.

Deprecated: 3.4: Use gdk_window_get_device_position() instead.

Deprecated:
  Use Gdk::Window::get_device_position instead.

Parameters

  x | Return location for the X coordinate, or `nullptr`.
  y | Return location for the Y coordinate, or `nullptr`.

## ◆ get_preferred_height()

void Gtk::Widget::get_preferred_height | ( | int & | minimum_height,
|  | int & | natural_height
| ) |  | const

Retrieves a widget’s initial minimum and natural height.

This call is specific to width-for-height requests.

The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any Gtk::SizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

Since gtkmm 3.0:

Parameters

  minimum_height | Location to store the minimum height, or `nullptr`.
  natural_height | Location to store the natural height, or `nullptr`.

## ◆ get_preferred_height_for_width() [1/2]

void Gtk::Widget::get_preferred_height_for_width | ( | int | width,
|  | int & | minimum_height,
|  | int & | natural_height
| ) |  | const

Retrieves a widget’s minimum and natural height if it would be given the specified width.

The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any Gtk::SizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

Since gtkmm 3.0:

Parameters

  width | The width which is available for allocation.
  minimum_height | Location for storing the minimum height, or `nullptr`.
  natural_height | Location for storing the natural height, or `nullptr`.

## ◆ get_preferred_height_for_width() [2/2]

void Gtk::Widget::get_preferred_height_for_width | ( | int | width,
|  | int & | minimum_height,
|  | int & | natural_height,
|  | int & | minimum_baseline,
|  | int & | natural_baseline
| ) |  | const

Retrieves a widget’s minimum and natural height and the corresponding baselines if it would be given the specified width, or the default height if width is -1.

The baselines may be -1 which means that no baseline is requested for this widget.

The returned request will be modified by the GtkWidgetClass::adjust_size_request and GtkWidgetClass::adjust_baseline_request virtual methods and by any Gtk::SizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

Since gtkmm 3.10:

Parameters

  width | The width which is available for allocation, or -1 if none.
  minimum_height | Location for storing the minimum height, or `nullptr`.
  natural_height | Location for storing the natural height, or `nullptr`.
  minimum_baseline | Location for storing the baseline for the minimum height, or `nullptr`.
  natural_baseline | Location for storing the baseline for the natural height, or `nullptr`.

## ◆ get_preferred_height_for_width_vfunc()

virtual void Gtk::Widget::get_preferred_height_for_width_vfunc | ( | int | width,
|  | int & | minimum_height,
|  | int & | natural_height
| ) |  | const
| protectedvirtual

## ◆ get_preferred_height_vfunc()

virtual void Gtk::Widget::get_preferred_height_vfunc | ( | int & | minimum_height,
|  | int & | natural_height
| ) |  | const
| protectedvirtual

## ◆ get_preferred_size()

void Gtk::Widget::get_preferred_size | ( | Requisition& | minimum_size,
|  | Requisition& | natural_size
| ) |  | const

Retrieves the minimum and natural size of a widget, taking into account the widget’s preference for height-for-width management.

This is used to retrieve a suitable size by container widgets which do not impose any restrictions on the child placement. It can be used to deduce toplevel window and menu sizes as well as child widgets in free-form containers such as GtkLayout.

Handle with care. Note that the natural height of a height-for-width widget will generally be a smaller size than the minimum height, since the required height for the natural width is generally smaller than the required height for the minimum width.

Use get_preferred_height_and_baseline_for_width() if you want to support baseline alignment.

Since gtkmm 3.0:

Parameters

  minimum_size | Location for storing the minimum size, or `nullptr`.
  natural_size | Location for storing the natural size, or `nullptr`.

## ◆ get_preferred_width()

void Gtk::Widget::get_preferred_width | ( | int & | minimum_width,
|  | int & | natural_width
| ) |  | const

Retrieves a widget’s initial minimum and natural width.

This call is specific to height-for-width requests.

The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any Gtk::SizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

Since gtkmm 3.0:

Parameters

  minimum_width | Location to store the minimum width, or `nullptr`.
  natural_width | Location to store the natural width, or `nullptr`.

## ◆ get_preferred_width_for_height()

void Gtk::Widget::get_preferred_width_for_height | ( | int | height,
|  | int & | minimum_width,
|  | int & | natural_width
| ) |  | const

Retrieves a widget’s minimum and natural width if it would be given the specified height.

The returned request will be modified by the GtkWidgetClass::adjust_size_request virtual method and by any Gtk::SizeGroups that have been applied. That is, the returned request is the one that should be used for layout, not necessarily the one returned by the widget itself.

Since gtkmm 3.0:

Parameters

  height | The height which is available for allocation.
  minimum_width | Location for storing the minimum width, or `nullptr`.
  natural_width | Location for storing the natural width, or `nullptr`.

## ◆ get_preferred_width_for_height_vfunc()

virtual void Gtk::Widget::get_preferred_width_for_height_vfunc | ( | int | height,
|  | int & | minimum_width,
|  | int & | natural_width
| ) |  | const
| protectedvirtual

## ◆ get_preferred_width_vfunc()

virtual void Gtk::Widget::get_preferred_width_vfunc | ( | int & | minimum_width,
|  | int & | natural_width
| ) |  | const
| protectedvirtual

## ◆ get_realized()

bool Gtk::Widget::get_realized | ( |  | ) | const

Determines whether widget is realized.

Since gtkmm 2.20:

Returns
  `true` if widget is realized, `false` otherwise.

## ◆ get_receives_default()

bool Gtk::Widget::get_receives_default | ( |  | ) | const

Determines whether widget is always treated as the default widget within its toplevel when it has the focus, even if another widget is the default.

See set_receives_default().

Since gtkmm 2.18:

Returns
  `true` if widget acts as the default widget when focused, `false` otherwise.

## ◆ get_request_mode()

SizeRequestMode Gtk::Widget::get_request_mode | ( |  | ) | const

Gets whether the widget prefers a height-for-width layout or a width-for-height layout.

Gtk::Bin widgets generally propagate the preference of their child, container widgets need to request something either in context of their children or in context of their allocation capabilities.

Since gtkmm 3.0:

Returns
  The Gtk::SizeRequestMode preferred by widget.

## ◆ get_request_mode_vfunc()

virtual SizeRequestMode Gtk::Widget::get_request_mode_vfunc | ( |  | ) | const
| protectedvirtual

## ◆ get_requisition()

Requisition Gtk::Widget::get_requisition | ( |  | ) | const
| protected

Retrieves the widget's requisition.

This method should only be used by widget implementations in order to discover whether the widget's requisition has actually changed after some internal state change (so that they can call queue_resize() instead of queue_draw()).

Normally, size_request() should be used.

Returns
  The widget's requisition.

Since gtkmm 2.20:

Deprecated:
  Use get_preferred_size() instead.

## ◆ get_root_window() [1/2]

Glib::RefPtr<Gdk::Window> Gtk::Widget::get_root_window | ( |  | ) |

Get the root window where this widget is located.

This function can only be called after the widget has been added to a widget hierarchy with Gtk::Window at the top.

The root window is useful for such purposes as creating a popup Gdk::Window associated with the window. In general, you should only create display specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.

Since gtkmm 2.2:

Deprecated: 3.12: Use gdk_screen_get_root_window() instead

Deprecated:
  Use Gdk::Screen::get_root_window() instead.

Returns
  The Gdk::Window root window for the toplevel for this widget.

## ◆ get_root_window() [2/2]

Glib::RefPtr<const Gdk::Window> Gtk::Widget::get_root_window | ( |  | ) | const

Get the root window where this widget is located.

This function can only be called after the widget has been added to a widget hierarchy with Gtk::Window at the top.

The root window is useful for such purposes as creating a popup Gdk::Window associated with the window. In general, you should only create display specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.

Since gtkmm 2.2:

Deprecated: 3.12: Use gdk_screen_get_root_window() instead

Deprecated:
  Use Gdk::Screen::get_root_window() instead.

Returns
  The Gdk::Window root window for the toplevel for this widget.

## ◆ get_scale_factor()

int Gtk::Widget::get_scale_factor | ( |  | ) | const

Retrieves the internal scale factor that maps from window coordinates to the actual device pixels.

On traditional systems this is 1, on high density outputs, it can be a higher value (typically 2).

See gdk_window_get_scale_factor().

Since gtkmm 3.10:

Returns
  The scale factor for widget.

## ◆ get_screen() [1/2]

Glib::RefPtr<Gdk::Screen> Gtk::Widget::get_screen | ( |  | ) |

Get the Gdk::Screen from the toplevel window associated with this widget.

This function can only be called after the widget has been added to a widget hierarchy with a Gtk::Window at the top.

In general, you should only create screen specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.

Since gtkmm 2.2:

Returns
  The Gdk::Screen for the toplevel for this widget.

## ◆ get_screen() [2/2]

Glib::RefPtr<const Gdk::Screen> Gtk::Widget::get_screen | ( |  | ) | const

Get the Gdk::Screen from the toplevel window associated with this widget.

This function can only be called after the widget has been added to a widget hierarchy with a Gtk::Window at the top.

In general, you should only create screen specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.

Since gtkmm 2.2:

Returns
  The Gdk::Screen for the toplevel for this widget.

## ◆ get_sensitive()

bool Gtk::Widget::get_sensitive | ( |  | ) | const

Returns the widget’s sensitivity (in the sense of returning the value that has been set using set_sensitive()).

The effective sensitivity of a widget is however determined by both its own and its parent widget’s sensitivity. See is_sensitive().

Since gtkmm 2.18:

Returns
  `true` if the widget is sensitive.

## ◆ get_settings()

Glib::RefPtr<Settings> Gtk::Widget::get_settings | ( |  | ) |

Gets the settings object holding the settings used for this widget.

Note that this function can only be called when the Gtk::Widget is attached to a toplevel, since the settings object is specific to a particular Gdk::Screen.

Returns
  The relevant Gtk::Settings object.

## ◆ get_size_request()

void Gtk::Widget::get_size_request | ( | int & | width,
|  | int & | height
| ) |  | const

Gets the size request that was explicitly set for the widget using set_size_request().

A value of -1 stored in width or height indicates that that dimension has not been set explicitly and the natural requisition of the widget will be used instead. See set_size_request(). To get the size a widget will actually request, call get_preferred_size() instead of this function.

Parameters

  width | Return location for width, or `nullptr`.
  height | Return location for height, or `nullptr`.

## ◆ get_state()

StateType Gtk::Widget::get_state | ( |  | ) | const

Returns the widget’s state.

See set_state().

Since gtkmm 2.18:

Deprecated: 3.0: Use get_state_flags() instead.

Deprecated:
  Use get_state_flags() instead.

Returns
  The state of widget.

## ◆ get_state_flags()

StateFlags Gtk::Widget::get_state_flags | ( |  | ) | const

Returns the widget state as a flag set.

It is worth mentioning that the effective Gtk::STATE_FLAG_INSENSITIVE state will be returned, that is, also based on parent insensitivity, even if widget itself is sensitive.

Also note that if you are looking for a way to obtain the Gtk::StateFlags to pass to a Gtk::StyleContext method, you should look at Gtk::StyleContext::get_state().

Since gtkmm 3.0:

Returns
  The state flags for widget.

## ◆ get_style_context() [1/2]

Glib::RefPtr<StyleContext> Gtk::Widget::get_style_context | ( |  | ) |

Returns the style context associated to widget.

The returned object is guaranteed to be the same for the lifetime of widget.

Returns
  A Gtk::StyleContext. This memory is owned by widget and must not be freed.

## ◆ get_style_context() [2/2]

Glib::RefPtr<Gtk::StyleContext> Gtk::Widget::get_style_context | ( |  | ) | const

Returns the style context associated to widget.

The returned object is guaranteed to be the same for the lifetime of widget.

Returns
  A Gtk::StyleContext. This memory is owned by widget and must not be freed.

## ◆ get_style_property()

template <class PropertyType >

void Gtk::Widget::get_style_property | ( | const Glib::ustring & | the_property_name,
|  | PropertyType & | value
| ) |  | const

Gets the value of a style property of widget.

Parameters

  the_property_name | The name of a style property.
  value | Location to return the property value.

## ◆ get_style_property_value()

void Gtk::Widget::get_style_property_value | ( | const Glib::ustring & | the_property_name,
|  | Glib::ValueBase & | value
| ) |  | const
| protected

Gets the value of a style property of widget.

It is usually easier to use get_style_property(), to avoid the use of Glib::Value.

Parameters

  the_property_name | The name of a style property.
  value | Location to return the property value.

## ◆ get_support_multidevice()

bool Gtk::Widget::get_support_multidevice | ( |  | ) | const

Returns `true` if widget is multiple pointer aware.

See set_support_multidevice() for more information.

Returns
  `true` if widget is multidevice aware.

## ◆ get_tooltip_markup()

Glib::ustring Gtk::Widget::get_tooltip_markup | ( |  | ) | const

Gets the contents of the tooltip for widget.

Since gtkmm 2.12:

Returns
  The tooltip text.

## ◆ get_tooltip_text()

Glib::ustring Gtk::Widget::get_tooltip_text | ( |  | ) | const

Gets the contents of the tooltip for widget.

Since gtkmm 2.12:

Returns
  The tooltip text.

## ◆ get_tooltip_window()

Window* Gtk::Widget::get_tooltip_window | ( |  | ) |

Returns the Gtk::Window of the current tooltip.

This can be the GtkWindow created by default, or the custom tooltip window set using set_tooltip_window().

Since gtkmm 2.12:

Returns
  The Gtk::Window of the current tooltip.

## ◆ get_toplevel() [1/2]

Container* Gtk::Widget::get_toplevel | ( |  | ) |

This function returns the topmost widget in the container hierarchy widget is a part of.

If widget has no parent widgets, it will be returned as the topmost widget. No reference will be added to the returned widget; it should not be unreferenced.

Note the difference in behavior vs. get_ancestor(); `gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW)` would return `nullptr` if widget wasn’t inside a toplevel window, and if the window was inside a Gtk::Window-derived widget which was in turn inside the toplevel Gtk::Window. While the second case may seem unlikely, it actually happens when a Gtk::Plug is embedded inside a Gtk::Socket within the same application.

To reliably find the toplevel Gtk::Window, use get_toplevel() and call GTK_IS_WINDOW() on the result. For instance, to get the title of a widget's toplevel window, one might use:

[C example ellipted]

Returns
  The topmost ancestor of widget, or widget itself if there’s no ancestor.

## ◆ get_toplevel() [2/2]

const Container* Gtk::Widget::get_toplevel | ( |  | ) | const

This function returns the topmost widget in the container hierarchy widget is a part of.

If widget has no parent widgets, it will be returned as the topmost widget. No reference will be added to the returned widget; it should not be unreferenced.

Note the difference in behavior vs. get_ancestor(); `gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW)` would return `nullptr` if widget wasn’t inside a toplevel window, and if the window was inside a Gtk::Window-derived widget which was in turn inside the toplevel Gtk::Window. While the second case may seem unlikely, it actually happens when a Gtk::Plug is embedded inside a Gtk::Socket within the same application.

To reliably find the toplevel Gtk::Window, use get_toplevel() and call GTK_IS_WINDOW() on the result. For instance, to get the title of a widget's toplevel window, one might use:

[C example ellipted]

Returns
  The topmost ancestor of widget, or widget itself if there’s no ancestor.

## ◆ get_type()

static GType Gtk::Widget::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ get_valign()

Align Gtk::Widget::get_valign | ( |  | ) | const

Gets the value of the Gtk::Widget::property_valign() property.

For backwards compatibility reasons this method will never return Gtk::ALIGN_BASELINE, but instead it will convert it to Gtk::ALIGN_FILL. If your widget want to support baseline aligned children it must use get_valign_with_baseline(), or `g_object_get (widget, "valign",& value, <tt>nullptr</tt>)`, which will also report the true value.

Returns
  The vertical alignment of widget, ignoring baseline alignment.

## ◆ get_valign_with_baseline()

Align Gtk::Widget::get_valign_with_baseline | ( |  | ) | const

Gets the value of the Gtk::Widget::property_valign() property, including Gtk::ALIGN_BASELINE.

Since gtkmm 3.10:

Returns
  The vertical alignment of widget.

## ◆ get_vexpand()

bool Gtk::Widget::get_vexpand | ( |  | ) | const

Gets whether the widget would like any available extra vertical space.

See get_hexpand() for more detail.

Returns
  Whether vexpand flag is set.

## ◆ get_vexpand_set()

bool Gtk::Widget::get_vexpand_set | ( |  | ) | const

Gets whether set_vexpand() has been used to explicitly set the expand flag on this widget.

See get_hexpand_set() for more detail.

Returns
  Whether vexpand has been explicitly set.

## ◆ get_visible()

bool Gtk::Widget::get_visible | ( |  | ) | const

Determines whether the widget is visible.

If you want to take into account whether the widget’s parent is also marked as visible, use is_visible() instead.

This function does not check if the widget is obscured in any way.

See set_visible().

Since gtkmm 2.18:

Returns
  `true` if the widget is visible.

## ◆ get_visual()

Glib::RefPtr<Gdk::Visual> Gtk::Widget::get_visual | ( |  | ) |

Gets the visual that will be used to render widget.

Returns
  The visual for widget.

## ◆ get_width()

int Gtk::Widget::get_width | ( |  | ) | const

## ◆ get_window() [1/2]

Glib::RefPtr<Gdk::Window> Gtk::Widget::get_window | ( |  | ) |

Returns the widget’s window if it is realized, `nullptr` otherwise.

Since gtkmm 2.14:

Returns
  widget’s window.

## ◆ get_window() [2/2]

Glib::RefPtr<const Gdk::Window> Gtk::Widget::get_window | ( |  | ) | const

Returns the widget’s window if it is realized, `nullptr` otherwise.

Since gtkmm 2.14:

Returns
  widget’s window.

## ◆ gobj() [1/2]

GtkWidget* Gtk::Widget::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkWidget* Gtk::Widget::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ grab_default()

void Gtk::Widget::grab_default | ( |  | ) |

Causes widget to become the default widget.

widget must be able to be a default widget; typically you would ensure this yourself by calling set_can_default() with a `true` value. The default widget is activated when the user presses Enter in a window. Default widgets must be activatable, that is, activate() should affect them. Note that Gtk::Entry widgets require the “activates-default” property set to `true` before they activate the default widget when Enter is pressed and the Gtk::Entry is focused.

## ◆ grab_focus()

void Gtk::Widget::grab_focus | ( |  | ) |

Causes widget to have the keyboard focus for the Gtk::Window it's inside.

widget must be a focusable widget, such as a Gtk::Entry; something like Gtk::Frame won’t work.

More precisely, it must have the GTK_CAN_FOCUS flag set. Use set_can_focus() to modify that flag.

The widget also needs to be realized and mapped. This is indicated by the related signals. Grabbing the focus immediately after creating the widget will likely fail and cause critical warnings.

## ◆ has_default()

bool Gtk::Widget::has_default | ( |  | ) | const

Determines whether widget is the current default widget within its toplevel.

See set_can_default().

Since gtkmm 2.18:

Returns
  `true` if widget is the current default widget within its toplevel, `false` otherwise.

## ◆ has_focus()

bool Gtk::Widget::has_focus | ( |  | ) | const

Determines if the widget has the global input focus.

See is_focus() for the difference between having the global input focus, and only having the focus within a toplevel.

Since gtkmm 2.18:

Returns
  `true` if the widget has the global input focus.

## ◆ has_grab()

bool Gtk::Widget::has_grab | ( |  | ) | const

Determines whether the widget is currently grabbing events, so it is the only widget receiving input events (keyboard and mouse).

See also gtk_grab_add().

Since gtkmm 2.18:

Returns
  `true` if the widget is in the grab_widgets stack.

## ◆ has_screen()

bool Gtk::Widget::has_screen | ( |  | ) | const

Checks whether there is a Gdk::Screen is associated with this widget.

All toplevel widgets have an associated screen, and all widgets added into a hierarchy with a toplevel window at the top.

Since gtkmm 2.2:

Returns
  `true` if there is a Gdk::Screen associated with the widget.

## ◆ has_visible_focus()

bool Gtk::Widget::has_visible_focus | ( |  | ) | const

Determines if the widget should show a visible indication that it has the global input focus.

This is a convenience function for use in signal_draw() handlers that takes into account whether focus indication should currently be shown in the toplevel window of widget. See Gtk::Window::get_focus_visible() for more information about focus indication.

To find out if the widget has the global input focus, use has_focus().

Since gtkmm 3.2:

Returns
  `true` if the widget should display a “focus rectangle”.

## ◆ hide()

void Gtk::Widget::hide | ( |  | ) |

Reverses the effects of show(), causing the widget to be hidden (invisible to the user).

## ◆ in_destruction()

bool Gtk::Widget::in_destruction | ( |  | ) | const

Returns whether the widget is currently being destroyed.

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

Returns
  `true` if widget is being destroyed.

## ◆ input_shape_combine_region()

void Gtk::Widget::input_shape_combine_region | ( | const ::Cairo::RefPtr< const ::Cairo::Region > & | region | ) |

Sets an input shape for this widget’s GDK window.

This allows for windows which react to mouse click in a nonrectangular region, see gdk_window_input_shape_combine_region() for more information.

Since gtkmm 3.0:

Parameters

  region | Shape to be added, or `nullptr` to remove an existing shape.

## ◆ insert_action_group()

void Gtk::Widget::insert_action_group | ( | const Glib::ustring & | name,
|  | const Glib::RefPtr< Gio::ActionGroup > & | group
| ) |  |

Inserts group into widget.

Children of widget that implement Gtk::Actionable can then be associated with actions in group by setting their “action-name” to prefix.`action-name`.

If group is `nullptr`, a previously inserted group for name is removed from widget.

Since gtkmm 3.6:

Parameters

  name | The prefix for actions in group.
  group | A Gio::ActionGroup, or `nullptr`.

## ◆ intersect() [1/2]

bool Gtk::Widget::intersect | ( | const Gdk::Rectangle& | area | ) | const

## ◆ intersect() [2/2]

bool Gtk::Widget::intersect | ( | const Gdk::Rectangle& | area,
|  | Gdk::Rectangle& | intersection
| ) |  | const

Computes the intersection of a widget’s area and area, storing the intersection in intersection, and returns `true` if there was an intersection.

intersection may be `nullptr` if you’re only interested in whether there was an intersection.

Parameters

  area | A rectangle.
  intersection | Rectangle to store intersection of widget and area.

Returns
  `true` if there was an intersection.

## ◆ is_ancestor()

bool Gtk::Widget::is_ancestor | ( | Widget& | ancestor | ) | const

Determines whether widget is somewhere inside ancestor, possibly with intermediate containers.

Parameters

  ancestor | Another Gtk::Widget.

Returns
  `true` if ancestor contains widget as a child, grandchild, great grandchild, etc.

## ◆ is_composited()

bool Gtk::Widget::is_composited | ( |  | ) | const

Whether widget can rely on having its alpha channel drawn correctly.

On X11 this function returns whether a compositing manager is running for widget’s screen.

Please note that the semantics of this call will change in the future if used on a widget that has a composited window in its hierarchy (as set by gdk_window_set_composited()).

Since gtkmm 2.10:

Deprecated: 3.22: Use gdk_screen_is_composited() instead.

Deprecated:
  Use Gdk::Screen::is_composited() instead.

Returns
  `true` if the widget can rely on its alpha channel being drawn correctly.

## ◆ is_focus()

bool Gtk::Widget::is_focus | ( |  | ) | const

Determines if the widget is the focus widget within its toplevel.

(This does not mean that the Gtk::Widget::property_has_focus() property is necessarily set; Gtk::Widget::property_has_focus() will only be set if the toplevel widget additionally has the global input focus.)

Returns
  `true` if the widget is the focus widget.

## ◆ is_sensitive()

bool Gtk::Widget::is_sensitive | ( |  | ) | const

Returns the widget’s effective sensitivity, which means it is sensitive itself and also its parent widget is sensitive.

Since gtkmm 2.18:

Returns
  `true` if the widget is effectively sensitive.

## ◆ is_visible()

bool Gtk::Widget::is_visible | ( |  | ) | const

Determines whether the widget and all its parents are marked as visible.

This function does not check if the widget is obscured in any way.

See also get_visible() and set_visible()

Since gtkmm 3.8:

Returns
  `true` if the widget and all its parents are visible.

## ◆ keynav_failed()

bool Gtk::Widget::keynav_failed | ( | DirectionType | direction | ) |

This function should be called whenever keyboard navigation within a single widget hits a boundary.

The function emits the Gtk::Widget::signal_keynav_failed() signal on the widget and its return value should be interpreted in a way similar to the return value of child_focus():

When `true` is returned, stay in the widget, the failed keyboard navigation is OK and/or there is nowhere we can/should move the focus to.

When `false` is returned, the caller should continue with keyboard navigation outside the widget, e.g. by calling child_focus() on the widget’s toplevel.

The default signal_keynav_failed() handler returns `false` for Gtk::DIR_TAB_FORWARD and Gtk::DIR_TAB_BACKWARD. For the other values of Gtk::DirectionType it returns `true`.

Whenever the default handler returns `true`, it also calls error_bell() to notify the user of the failed keyboard navigation.

A use case for providing an own implementation of signal_keynav_failed() (either by connecting to it or by overriding it) would be a row of Gtk::Entry widgets where the user should be able to navigate the entire row with the cursor keys, as e.g. known from user interfaces that require entering license keys.

Since gtkmm 2.12:

Parameters

  direction | Direction of focus movement.

Returns
  `true` if stopping keyboard navigation is fine, `false` if the emitting widget should try to handle the keyboard navigation attempt in its parent container(s).

## ◆ list_action_prefixes()

std::vector<Glib::ustring> Gtk::Widget::list_action_prefixes | ( |  | ) | const

Retrieves a `nullptr`-terminated array of strings containing the prefixes of Gio::ActionGroup's available to widget.

Since gtkmm 3.16:

Returns
  A `nullptr`-terminated array of strings.

## ◆ list_mnemonic_labels() [1/2]

std::vector<Widget*> Gtk::Widget::list_mnemonic_labels | ( |  | ) |

Returns a newly allocated list of the widgets, normally labels, for which this widget is the target of a mnemonic (see for example, Gtk::Label::set_mnemonic_widget()).

The widgets in the list are not individually referenced. If you want to iterate through the list and perform actions involving callbacks that might destroy the widgets, you must call `g_list_foreach (result, (GFunc)g_object_ref, <tt>nullptr</tt>)` first, and then unref all the widgets afterwards.

Since gtkmm 2.4:

Returns
  The list of mnemonic labels; free this list with Glib::list_free() when you are done with it.

## ◆ list_mnemonic_labels() [2/2]

std::vector<const Widget*> Gtk::Widget::list_mnemonic_labels | ( |  | ) | const

Returns a newly allocated list of the widgets, normally labels, for which this widget is the target of a mnemonic (see for example, Gtk::Label::set_mnemonic_widget()).

The widgets in the list are not individually referenced. If you want to iterate through the list and perform actions involving callbacks that might destroy the widgets, you must call `g_list_foreach (result, (GFunc)g_object_ref, <tt>nullptr</tt>)` first, and then unref all the widgets afterwards.

Since gtkmm 2.4:

Returns
  The list of mnemonic labels; free this list with Glib::list_free() when you are done with it.

## ◆ map()

void Gtk::Widget::map | ( |  | ) |

This function is only for use in widget implementations.

Causes a widget to be mapped if it isn’t already.

## ◆ mnemonic_activate()

bool Gtk::Widget::mnemonic_activate | ( | bool | group_cycling | ) |

Emits the Gtk::Widget::signal_mnemonic_activate() signal.

Parameters

  group_cycling | `true` if there are other widgets with the same mnemonic.

Returns
  `true` if the signal has been handled.

## ◆ on_button_press_event()

virtual bool Gtk::Widget::on_button_press_event | ( | GdkEventButton * | button_event | ) |
| protectedvirtual

This is a default handler for the signal signal_button_press_event().

## ◆ on_button_release_event()

virtual bool Gtk::Widget::on_button_release_event | ( | GdkEventButton * | release_event | ) |
| protectedvirtual

This is a default handler for the signal signal_button_release_event().

## ◆ on_child_notify()

virtual void Gtk::Widget::on_child_notify | ( | GParamSpec * | pspec | ) |
| protectedvirtual

This is a default handler for the signal signal_child_notify().

## ◆ on_configure_event()

virtual bool Gtk::Widget::on_configure_event | ( | GdkEventConfigure * | configure_event | ) |
| protectedvirtual

This is a default handler for the signal signal_configure_event().

## ◆ on_delete_event()

virtual bool Gtk::Widget::on_delete_event | ( | GdkEventAny * | any_event | ) |
| protectedvirtual

This is a default handler for the signal signal_delete_event().

## ◆ on_direction_changed()

virtual void Gtk::Widget::on_direction_changed | ( | TextDirection | direction | ) |
| protectedvirtual

This is a default handler for the signal signal_direction_changed().

## ◆ on_drag_begin()

virtual void Gtk::Widget::on_drag_begin | ( | const Glib::RefPtr< Gdk::DragContext >& | context | ) |
| protectedvirtual

This is a default handler for the signal signal_drag_begin().

## ◆ on_drag_data_delete()

virtual void Gtk::Widget::on_drag_data_delete | ( | const Glib::RefPtr< Gdk::DragContext >& | context | ) |
| protectedvirtual

This is a default handler for the signal signal_drag_data_delete().

## ◆ on_drag_data_get()

virtual void Gtk::Widget::on_drag_data_get | ( | const Glib::RefPtr< Gdk::DragContext >& | context,
|  | SelectionData& | selection_data,
|  | guint | info,
|  | guint | time
| ) |  |
| protectedvirtual

This is a default handler for the signal signal_drag_data_get().

## ◆ on_drag_data_received()

virtual void Gtk::Widget::on_drag_data_received | ( | const Glib::RefPtr< Gdk::DragContext >& | context,
|  | int | x,
|  | int | y,
|  | const SelectionData& | selection_data,
|  | guint | info,
|  | guint | time
| ) |  |
| protectedvirtual

This is a default handler for the signal signal_drag_data_received().

## ◆ on_drag_drop()

virtual bool Gtk::Widget::on_drag_drop | ( | const Glib::RefPtr< Gdk::DragContext >& | context,
|  | int | x,
|  | int | y,
|  | guint | time
| ) |  |
| protectedvirtual

This is a default handler for the signal signal_drag_drop().

## ◆ on_drag_end()

virtual void Gtk::Widget::on_drag_end | ( | const Glib::RefPtr< Gdk::DragContext >& | context | ) |
| protectedvirtual

This is a default handler for the signal signal_drag_end().

## ◆ on_drag_leave()

virtual void Gtk::Widget::on_drag_leave | ( | const Glib::RefPtr< Gdk::DragContext >& | context,
|  | guint | time
| ) |  |
| protectedvirtual

This is a default handler for the signal signal_drag_leave().

## ◆ on_drag_motion()

virtual bool Gtk::Widget::on_drag_motion | ( | const Glib::RefPtr< Gdk::DragContext >& | context,
|  | int | x,
|  | int | y,
|  | guint | time
| ) |  |
| protectedvirtual

This is a default handler for the signal signal_drag_motion().

## ◆ on_draw()

virtual bool Gtk::Widget::on_draw | ( | const ::Cairo::RefPtr< ::Cairo::Context > & | cr | ) |
| protectedvirtual

This is a default handler for the signal signal_draw().

## ◆ on_enter_notify_event()

virtual bool Gtk::Widget::on_enter_notify_event | ( | GdkEventCrossing * | crossing_event | ) |
| protectedvirtual

This is a default handler for the signal signal_enter_notify_event().

## ◆ on_event()

virtual bool Gtk::Widget::on_event | ( | GdkEvent * | gdk_event | ) |
| protectedvirtual

This is a default handler for the signal signal_event().

## ◆ on_focus()

virtual bool Gtk::Widget::on_focus | ( | DirectionType | direction | ) |
| protectedvirtual

This is a default handler for the signal signal_focus().

## ◆ on_focus_in_event()

virtual bool Gtk::Widget::on_focus_in_event | ( | GdkEventFocus * | focus_event | ) |
| protectedvirtual

This is a default handler for the signal signal_focus_in_event().

## ◆ on_focus_out_event()

virtual bool Gtk::Widget::on_focus_out_event | ( | GdkEventFocus * | gdk_event | ) |
| protectedvirtual

This is a default handler for the signal signal_focus_out_event().

## ◆ on_grab_focus()

virtual void Gtk::Widget::on_grab_focus | ( |  | ) |
| protectedvirtual

This is a default handler for the signal signal_grab_focus().

## ◆ on_grab_notify()

virtual void Gtk::Widget::on_grab_notify | ( | bool | was_grabbed | ) |
| protectedvirtual

This is a default handler for the signal signal_grab_notify().

## ◆ on_hide()

virtual void Gtk::Widget::on_hide | ( |  | ) |
| protectedvirtual

This is a default handler for the signal signal_hide().

## ◆ on_hierarchy_changed()

virtual void Gtk::Widget::on_hierarchy_changed | ( | Widget* | previous_toplevel | ) |
| protectedvirtual

This is a default handler for the signal signal_hierarchy_changed().

## ◆ on_key_press_event()

virtual bool Gtk::Widget::on_key_press_event | ( | GdkEventKey * | key_event | ) |
| protectedvirtual

This is a default handler for the signal signal_key_press_event().

## ◆ on_key_release_event()

virtual bool Gtk::Widget::on_key_release_event | ( | GdkEventKey * | key_event | ) |
| protectedvirtual

This is a default handler for the signal signal_key_release_event().

## ◆ on_leave_notify_event()

virtual bool Gtk::Widget::on_leave_notify_event | ( | GdkEventCrossing * | crossing_event | ) |
| protectedvirtual

This is a default handler for the signal signal_leave_notify_event().

## ◆ on_map()

virtual void Gtk::Widget::on_map | ( |  | ) |
| protectedvirtual

This is a default handler for the signal signal_map().

## ◆ on_map_event()

virtual bool Gtk::Widget::on_map_event | ( | GdkEventAny * | any_event | ) |
| protectedvirtual

This is a default handler for the signal signal_map_event().

## ◆ on_mnemonic_activate()

virtual bool Gtk::Widget::on_mnemonic_activate | ( | bool | group_cycling | ) |
| protectedvirtual

This is a default handler for the signal signal_mnemonic_activate().

## ◆ on_motion_notify_event()

virtual bool Gtk::Widget::on_motion_notify_event | ( | GdkEventMotion * | motion_event | ) |
| protectedvirtual

This is a default handler for the signal signal_motion_notify_event().

## ◆ on_parent_changed()

virtual void Gtk::Widget::on_parent_changed | ( | Widget* | previous_parent | ) |
| protectedvirtual

This is a default handler for the signal signal_parent_changed().

## ◆ on_property_notify_event()

virtual bool Gtk::Widget::on_property_notify_event | ( | GdkEventProperty * | property_event | ) |
| protectedvirtual

This is a default handler for the signal signal_property_notify_event().

## ◆ on_proximity_in_event()

virtual bool Gtk::Widget::on_proximity_in_event | ( | GdkEventProximity * | proximity_event | ) |
| protectedvirtual

This is a default handler for the signal signal_proximity_in_event().

## ◆ on_proximity_out_event()

virtual bool Gtk::Widget::on_proximity_out_event | ( | GdkEventProximity * | proximity_event | ) |
| protectedvirtual

This is a default handler for the signal signal_proximity_out_event().

## ◆ on_realize()

virtual void Gtk::Widget::on_realize | ( |  | ) |
| protectedvirtual

This is a default handler for the signal signal_realize().

## ◆ on_screen_changed()

virtual void Gtk::Widget::on_screen_changed | ( | const Glib::RefPtr< Gdk::Screen >& | previous_screen | ) |
| protectedvirtual

This is a default handler for the signal signal_screen_changed().

## ◆ on_scroll_event()

virtual bool Gtk::Widget::on_scroll_event | ( | GdkEventScroll * | scroll_event | ) |
| protectedvirtual

This is a default handler for the signal signal_scroll_event().

## ◆ on_selection_clear_event()

virtual bool Gtk::Widget::on_selection_clear_event | ( | GdkEventSelection * | selection_event | ) |
| protectedvirtual

This is a default handler for the signal signal_selection_clear_event().

## ◆ on_selection_get()

virtual void Gtk::Widget::on_selection_get | ( | SelectionData& | selection_data,
|  | guint | info,
|  | guint | time
| ) |  |
| protectedvirtual

This is a default handler for the signal signal_selection_get().

## ◆ on_selection_notify_event()

virtual bool Gtk::Widget::on_selection_notify_event | ( | GdkEventSelection * | selection_event | ) |
| protectedvirtual

This is a default handler for the signal signal_selection_notify_event().

## ◆ on_selection_received()

virtual void Gtk::Widget::on_selection_received | ( | const SelectionData& | selection_data,
|  | guint | time
| ) |  |
| protectedvirtual

This is a default handler for the signal signal_selection_received().

## ◆ on_selection_request_event()

virtual bool Gtk::Widget::on_selection_request_event | ( | GdkEventSelection * | selection_event | ) |
| protectedvirtual

This is a default handler for the signal signal_selection_request_event().

## ◆ on_show()

virtual void Gtk::Widget::on_show | ( |  | ) |
| protectedvirtual

This is a default handler for the signal signal_show().

## ◆ on_size_allocate()

virtual void Gtk::Widget::on_size_allocate | ( | Allocation& | allocation | ) |
| protectedvirtual

This is a default handler for the signal signal_size_allocate().

## ◆ on_state_changed()

virtual void Gtk::Widget::on_state_changed | ( | Gtk::StateType | previous_state | ) |
| protectedvirtual

This is a default handler for the signal signal_state_changed().

## ◆ on_style_updated()

virtual void Gtk::Widget::on_style_updated | ( |  | ) |
| protectedvirtual

This is a default handler for the signal signal_style_updated().

## ◆ on_unmap()

virtual void Gtk::Widget::on_unmap | ( |  | ) |
| protectedvirtual

This is a default handler for the signal signal_unmap().

## ◆ on_unmap_event()

virtual bool Gtk::Widget::on_unmap_event | ( | GdkEventAny * | any_event | ) |
| protectedvirtual

This is a default handler for the signal signal_unmap_event().

## ◆ on_unrealize()

virtual void Gtk::Widget::on_unrealize | ( |  | ) |
| protectedvirtual

This is a default handler for the signal signal_unrealize().

## ◆ on_visibility_notify_event()

virtual bool Gtk::Widget::on_visibility_notify_event | ( | GdkEventVisibility * | visibility_event | ) |
| protectedvirtual

This is a default handler for the signal signal_visibility_notify_event().

## ◆ on_window_state_event()

virtual bool Gtk::Widget::on_window_state_event | ( | GdkEventWindowState * | window_state_event | ) |
| protectedvirtual

This is a default handler for the signal signal_window_state_event().

## ◆ operator=() [1/2]

Widget& Gtk::Widget::operator= | ( | const Widget& |  | ) |
| delete

## ◆ operator=() [2/2]

Widget& Gtk::Widget::operator= | ( | Widget&& | src | ) |
| noexcept

## ◆ override_background_color()

void Gtk::Widget::override_background_color | ( | const Gdk::RGBA& | color,
|  | StateFlags | state = `STATE_FLAG_NORMAL`
| ) |  |

Sets the background color to use for a widget.

All other style values are left untouched. See override_color().

Since gtkmm 3.0:

Deprecated: 3.16: This function is not useful in the context of CSS-based rendering. If you wish to change the way a widget renders its background you should use a custom CSS style, through an application-specific Gtk::StyleProvider and a CSS style class. You can also override the default drawing of a widget through the Gtk::Widget::signal_draw() signal, and use Cairo to draw a specific color, regardless of the CSS style.

Deprecated:
  Use a custom style provider and style classes instead.

Parameters

  state | The state for which to set the background color.
  color | The color to assign, or `nullptr` to undo the effect of previous calls to override_background_color().

## ◆ override_color()

void Gtk::Widget::override_color | ( | const Gdk::RGBA& | color,
|  | StateFlags | state = `STATE_FLAG_NORMAL`
| ) |  |

Sets the color to use for a widget.

All other style values are left untouched.

This function does not act recursively. Setting the color of a container does not affect its children. Note that some widgets that you may not think of as containers, for instance Gtk::Buttons, are actually containers.

This API is mostly meant as a quick way for applications to change a widget appearance. If you are developing a widgets library and intend this change to be themeable, it is better done by setting meaningful CSS classes in your widget/container implementation through Gtk::StyleContext::add_class().

This way, your widget library can install a Gtk::CssProvider with the GTK_STYLE_PROVIDER_PRIORITY_FALLBACK priority in order to provide a default styling for those widgets that need so, and this theming may fully overridden by the user’s theme.

Note that for complex widgets this may bring in undesired results (such as uniform background color everywhere), in these cases it is better to fully style such widgets through a Gtk::CssProvider with the GTK_STYLE_PROVIDER_PRIORITY_APPLICATION priority.

Since gtkmm 3.0:

Deprecated:3.16: Use a custom style provider and style classes instead

Deprecated:
  Use a custom style provider and style classes instead.

Parameters

  state | The state for which to set the color.
  color | The color to assign, or `nullptr` to undo the effect of previous calls to override_color().

## ◆ override_cursor()

void Gtk::Widget::override_cursor | ( | const Gdk::RGBA& | cursor,
|  | const Gdk::RGBA& | secondary_cursor
| ) |  |

Sets the cursor color to use in a widget, overriding the cursor-color and secondary-cursor-color style properties.

All other style values are left untouched. See also modify_style().

Note that the underlying properties have the Gdk::Color type, so the alpha value in primary and secondary will be ignored.

Since gtkmm 3.0:

Deprecated: 3.16: This function is not useful in the context of CSS-based rendering. If you wish to change the color used to render the primary and secondary cursors you should use a custom CSS style, through an application-specific Gtk::StyleProvider and a CSS style class.

Deprecated:
  Use a custom style provider and style classes instead.

Parameters

  cursor | The color to use for primary cursor (does not need to be allocated), or `nullptr` to undo the effect of previous calls to of override_cursor().
  secondary_cursor | The color to use for secondary cursor (does not need to be allocated), or `nullptr` to undo the effect of previous calls to of override_cursor().

## ◆ override_font()

void Gtk::Widget::override_font | ( | const Pango::FontDescription & | font_desc | ) |

Sets the font to use for a widget.

All other style values are left untouched. See override_color().

Since gtkmm 3.0:

Deprecated: 3.16: This function is not useful in the context of CSS-based rendering. If you wish to change the font a widget uses to render its text you should use a custom CSS style, through an application-specific Gtk::StyleProvider and a CSS style class.

Deprecated:
  Use a custom style provider and style classes instead.

Parameters

  font_desc | The font description to use, or `nullptr` to undo the effect of previous calls to override_font().

## ◆ override_symbolic_color()

void Gtk::Widget::override_symbolic_color | ( | const Glib::ustring & | name,
|  | const Gdk::RGBA& | color
| ) |  |

Sets a symbolic color for a widget.

All other style values are left untouched. See override_color() for overriding the foreground or background color.

Since gtkmm 3.0:

Deprecated: 3.16: This function is not useful in the context of CSS-based rendering. If you wish to change the color used to render symbolic icons you should use a custom CSS style, through an application-specific Gtk::StyleProvider and a CSS style class.

Deprecated:
  Use a custom style provider and style classes instead.

Parameters

  name | The name of the symbolic color to modify.
  color | The color to assign (does not need to be allocated), or `nullptr` to undo the effect of previous calls to override_symbolic_color().

## ◆ pop_composite_child()

static void Gtk::Widget::pop_composite_child | ( |  | ) |
| static

Cancels the effect of a previous call to push_composite_child().

Deprecated: 3.10: Use class_set_template(), or don’t use this API at all.

Deprecated:
  Use gtk_widget_class_set_template(), or don't use this API at all.

## ◆ property_app_paintable() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_app_paintable | ( |  | ) |

Whether the application will paint directly on the widget.

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_app_paintable() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_app_paintable | ( |  | ) | const

Whether the application will paint directly on the widget.

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_can_default() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_can_default | ( |  | ) |

Whether the widget can be the default widget.

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_can_default() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_can_default | ( |  | ) | const

Whether the widget can be the default widget.

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_can_focus() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_can_focus | ( |  | ) |

Whether the widget can accept the input focus.

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_can_focus() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_can_focus | ( |  | ) | const

Whether the widget can accept the input focus.

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_composite_child()

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_composite_child | ( |  | ) | const

Whether the widget is part of a composite widget.

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_double_buffered() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_double_buffered | ( |  | ) |

Whether the widget is double buffered.

Since gtkmm 2.18:

Deprecated: 3.14: Widgets should not use this property.

Deprecated:
  Widgets should not use this property.

Default value: `true`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_double_buffered() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_double_buffered | ( |  | ) | const

Whether the widget is double buffered.

Since gtkmm 2.18:

Deprecated: 3.14: Widgets should not use this property.

Deprecated:
  Widgets should not use this property.

Default value: `true`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_events() [1/2]

Glib::PropertyProxy< Gdk::EventMask > Gtk::Widget::property_events | ( |  | ) |

The event mask that decides what kind of GdkEvents this widget gets.

Default value: Gdk::STRUCTURE_MASK

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_events() [2/2]

Glib::PropertyProxy_ReadOnly< Gdk::EventMask > Gtk::Widget::property_events | ( |  | ) | const

The event mask that decides what kind of GdkEvents this widget gets.

Default value: Gdk::STRUCTURE_MASK

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_expand() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_expand | ( |  | ) |

Whether to expand in both directions.

Setting this sets both Gtk::Widget::property_hexpand() and Gtk::Widget::property_vexpand()

Since gtkmm 3.0:

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_expand() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_expand | ( |  | ) | const

Whether to expand in both directions.

Setting this sets both Gtk::Widget::property_hexpand() and Gtk::Widget::property_vexpand()

Since gtkmm 3.0:

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_focus_on_click() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_focus_on_click | ( |  | ) |

Whether the widget should grab focus when it is clicked with the mouse.

This property is only relevant for widgets that can take focus.

Before 3.20, several widgets (GtkButton, GtkFileChooserButton, GtkComboBox) implemented this property individually.

Since gtkmm 3.20:

Default value: `true`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_focus_on_click() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_focus_on_click | ( |  | ) | const

Whether the widget should grab focus when it is clicked with the mouse.

This property is only relevant for widgets that can take focus.

Before 3.20, several widgets (GtkButton, GtkFileChooserButton, GtkComboBox) implemented this property individually.

Since gtkmm 3.20:

Default value: `true`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_halign() [1/2]

Glib::PropertyProxy< Align > Gtk::Widget::property_halign | ( |  | ) |

How to distribute horizontal space if widget gets extra space, see Gtk::Align.

Since gtkmm 3.0:

Default value: Gtk::ALIGN_FILL

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_halign() [2/2]

Glib::PropertyProxy_ReadOnly< Align > Gtk::Widget::property_halign | ( |  | ) | const

How to distribute horizontal space if widget gets extra space, see Gtk::Align.

Since gtkmm 3.0:

Default value: Gtk::ALIGN_FILL

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_has_default() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_has_default | ( |  | ) |

Whether the widget is the default widget.

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_has_default() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_has_default | ( |  | ) | const

Whether the widget is the default widget.

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_has_focus() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_has_focus | ( |  | ) |

Whether the widget has the input focus.

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_has_focus() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_has_focus | ( |  | ) | const

Whether the widget has the input focus.

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_has_tooltip() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_has_tooltip | ( |  | ) |

Enables or disables the emission of Gtk::Widget::signal_query_tooltip() on widget.

A value of `true` indicates that widget can have a tooltip, in this case the widget will be queried using Gtk::Widget::signal_query_tooltip() to determine whether it will provide a tooltip or not.

Note that setting this property to `true` for the first time will change the event masks of the GdkWindows of this widget to include leave-notify and motion-notify events. This cannot and will not be undone when the property is set to `false` again.

Since gtkmm 2.12:

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_has_tooltip() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_has_tooltip | ( |  | ) | const

Enables or disables the emission of Gtk::Widget::signal_query_tooltip() on widget.

A value of `true` indicates that widget can have a tooltip, in this case the widget will be queried using Gtk::Widget::signal_query_tooltip() to determine whether it will provide a tooltip or not.

Note that setting this property to `true` for the first time will change the event masks of the GdkWindows of this widget to include leave-notify and motion-notify events. This cannot and will not be undone when the property is set to `false` again.

Since gtkmm 2.12:

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_height_request() [1/2]

Glib::PropertyProxy< int > Gtk::Widget::property_height_request | ( |  | ) |

Override for height request of the widget, or -1 if natural request should be used.

Default value: -1

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_height_request() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::Widget::property_height_request | ( |  | ) | const

Override for height request of the widget, or -1 if natural request should be used.

Default value: -1

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_hexpand() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_hexpand | ( |  | ) |

Whether to expand horizontally.

See Gtk::Widget::set_hexpand().

Since gtkmm 3.0:

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_hexpand() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_hexpand | ( |  | ) | const

Whether to expand horizontally.

See Gtk::Widget::set_hexpand().

Since gtkmm 3.0:

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_hexpand_set() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_hexpand_set | ( |  | ) |

Whether to use the Gtk::Widget::property_hexpand() property.

See Gtk::Widget::get_hexpand_set().

Since gtkmm 3.0:

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_hexpand_set() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_hexpand_set | ( |  | ) | const

Whether to use the Gtk::Widget::property_hexpand() property.

See Gtk::Widget::get_hexpand_set().

Since gtkmm 3.0:

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_is_focus() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_is_focus | ( |  | ) |

Whether the widget is the focus widget within the toplevel.

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_is_focus() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_is_focus | ( |  | ) | const

Whether the widget is the focus widget within the toplevel.

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_margin() [1/2]

Glib::PropertyProxy< int > Gtk::Widget::property_margin | ( |  | ) |

Sets all four sides' margin at once.

If read, returns max margin on any side.

Since gtkmm 3.0:

Default value: 0

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_margin() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::Widget::property_margin | ( |  | ) | const

Sets all four sides' margin at once.

If read, returns max margin on any side.

Since gtkmm 3.0:

Default value: 0

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_margin_bottom() [1/2]

Glib::PropertyProxy< int > Gtk::Widget::property_margin_bottom | ( |  | ) |

Margin on bottom side of widget.

This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from Gtk::Widget::set_size_request() for example.

Since gtkmm 3.0:

Default value: 0

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_margin_bottom() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::Widget::property_margin_bottom | ( |  | ) | const

Margin on bottom side of widget.

This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from Gtk::Widget::set_size_request() for example.

Since gtkmm 3.0:

Default value: 0

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_margin_end() [1/2]

Glib::PropertyProxy< int > Gtk::Widget::property_margin_end | ( |  | ) |

Margin on end of widget, horizontally.

This property supports left-to-right and right-to-left text directions.

This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from Gtk::Widget::set_size_request() for example.

Since gtkmm 3.12:

Default value: 0

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_margin_end() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::Widget::property_margin_end | ( |  | ) | const

Margin on end of widget, horizontally.

This property supports left-to-right and right-to-left text directions.

This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from Gtk::Widget::set_size_request() for example.

Since gtkmm 3.12:

Default value: 0

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_margin_left() [1/2]

Glib::PropertyProxy< int > Gtk::Widget::property_margin_left | ( |  | ) |

Margin on left side of widget.

This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from Gtk::Widget::set_size_request() for example.

Deprecated: 3.12: Use Gtk::Widget::property_margin_start() instead.

Since gtkmm 3.0:

Deprecated:
  Use property_margin_start() instead.

Default value: 0

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_margin_left() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::Widget::property_margin_left | ( |  | ) | const

Margin on left side of widget.

This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from Gtk::Widget::set_size_request() for example.

Deprecated: 3.12: Use Gtk::Widget::property_margin_start() instead.

Since gtkmm 3.0:

Deprecated:
  Use property_margin_start() instead.

Default value: 0

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_margin_right() [1/2]

Glib::PropertyProxy< int > Gtk::Widget::property_margin_right | ( |  | ) |

Margin on right side of widget.

This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from Gtk::Widget::set_size_request() for example.

Deprecated: 3.12: Use Gtk::Widget::property_margin_end() instead.

Since gtkmm 3.0:

Deprecated:
  Use property_margin_end() instead.

Default value: 0

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_margin_right() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::Widget::property_margin_right | ( |  | ) | const

Margin on right side of widget.

This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from Gtk::Widget::set_size_request() for example.

Deprecated: 3.12: Use Gtk::Widget::property_margin_end() instead.

Since gtkmm 3.0:

Deprecated:
  Use property_margin_end() instead.

Default value: 0

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_margin_start() [1/2]

Glib::PropertyProxy< int > Gtk::Widget::property_margin_start | ( |  | ) |

Margin on start of widget, horizontally.

This property supports left-to-right and right-to-left text directions.

This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from Gtk::Widget::set_size_request() for example.

Since gtkmm 3.12:

Default value: 0

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_margin_start() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::Widget::property_margin_start | ( |  | ) | const

Margin on start of widget, horizontally.

This property supports left-to-right and right-to-left text directions.

This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from Gtk::Widget::set_size_request() for example.

Since gtkmm 3.12:

Default value: 0

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_margin_top() [1/2]

Glib::PropertyProxy< int > Gtk::Widget::property_margin_top | ( |  | ) |

Margin on top side of widget.

This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from Gtk::Widget::set_size_request() for example.

Since gtkmm 3.0:

Default value: 0

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_margin_top() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::Widget::property_margin_top | ( |  | ) | const

Margin on top side of widget.

This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from Gtk::Widget::set_size_request() for example.

Since gtkmm 3.0:

Default value: 0

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_name() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::Widget::property_name | ( |  | ) |

The name of the widget.

Default value: ""

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_name() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::Widget::property_name | ( |  | ) | const

The name of the widget.

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_no_show_all() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_no_show_all | ( |  | ) |

Whether Gtk::Widget::show_all() should not affect this widget.

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_no_show_all() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_no_show_all | ( |  | ) | const

Whether Gtk::Widget::show_all() should not affect this widget.

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_opacity() [1/2]

Glib::PropertyProxy< double > Gtk::Widget::property_opacity | ( |  | ) |

The requested opacity of the widget.

See Gtk::Widget::set_opacity() for more details about window opacity.

Before 3.8 this was only available in GtkWindow

Since gtkmm 3.8:

Default value: 1

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_opacity() [2/2]

Glib::PropertyProxy_ReadOnly< double > Gtk::Widget::property_opacity | ( |  | ) | const

The requested opacity of the widget.

See Gtk::Widget::set_opacity() for more details about window opacity.

Before 3.8 this was only available in GtkWindow

Since gtkmm 3.8:

Default value: 1

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_parent() [1/2]

Glib::PropertyProxy< Container* > Gtk::Widget::property_parent | ( |  | ) |

The parent widget of this widget.

Must be a Container widget.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_parent() [2/2]

Glib::PropertyProxy_ReadOnly< Container* > Gtk::Widget::property_parent | ( |  | ) | const

The parent widget of this widget.

Must be a Container widget.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_receives_default() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_receives_default | ( |  | ) |

If `true`, the widget will receive the default action when it is focused.

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_receives_default() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_receives_default | ( |  | ) | const

If `true`, the widget will receive the default action when it is focused.

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_scale_factor()

Glib::PropertyProxy_ReadOnly< int > Gtk::Widget::property_scale_factor | ( |  | ) | const

The scale factor of the widget.

See Gtk::Widget::get_scale_factor() for more details about widget scaling.

Since gtkmm 3.10:

Default value: 1

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_sensitive() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_sensitive | ( |  | ) |

Whether the widget responds to input.

Default value: `true`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_sensitive() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_sensitive | ( |  | ) | const

Whether the widget responds to input.

Default value: `true`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_style() [1/2]

Glib::PropertyProxy< Glib::RefPtr<Style> > Gtk::Widget::property_style | ( |  | ) |

The style of the widget, which contains information about how it will look (colors, etc).

Deprecated: Use Gtk::StyleContext instead

Deprecated:
  Don't use this API. There is no Style class in gtkmm 3.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_style() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Style> > Gtk::Widget::property_style | ( |  | ) | const

The style of the widget, which contains information about how it will look (colors, etc).

Deprecated: Use Gtk::StyleContext instead

Deprecated:
  Don't use this API. There is no Style class in gtkmm 3.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_tooltip_markup() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::Widget::property_tooltip_markup | ( |  | ) |

Sets the text of tooltip to be the given string, which is marked up with the [Pango text markup language][PangoMarkupFormat].

Also see Gtk::Tooltip::set_markup().

This is a convenience property which will take care of getting the tooltip shown if the given string is not `nullptr`: Gtk::Widget::property_has_tooltip() will automatically be set to `true` and there will be taken care of Gtk::Widget::signal_query_tooltip() in the default signal handler.

Note that if both Gtk::Widget::property_tooltip_text() and Gtk::Widget::property_tooltip_markup() are set, the last one wins.

Since gtkmm 2.12:

Default value: ""

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_tooltip_markup() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::Widget::property_tooltip_markup | ( |  | ) | const

Sets the text of tooltip to be the given string, which is marked up with the [Pango text markup language][PangoMarkupFormat].

Also see Gtk::Tooltip::set_markup().

This is a convenience property which will take care of getting the tooltip shown if the given string is not `nullptr`: Gtk::Widget::property_has_tooltip() will automatically be set to `true` and there will be taken care of Gtk::Widget::signal_query_tooltip() in the default signal handler.

Note that if both Gtk::Widget::property_tooltip_text() and Gtk::Widget::property_tooltip_markup() are set, the last one wins.

Since gtkmm 2.12:

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_tooltip_text() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::Widget::property_tooltip_text | ( |  | ) |

Sets the text of tooltip to be the given string.

Also see Gtk::Tooltip::set_text().

This is a convenience property which will take care of getting the tooltip shown if the given string is not `nullptr`: Gtk::Widget::property_has_tooltip() will automatically be set to `true` and there will be taken care of Gtk::Widget::signal_query_tooltip() in the default signal handler.

Note that if both Gtk::Widget::property_tooltip_text() and Gtk::Widget::property_tooltip_markup() are set, the last one wins.

Since gtkmm 2.12:

Default value: ""

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_tooltip_text() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::Widget::property_tooltip_text | ( |  | ) | const

Sets the text of tooltip to be the given string.

Also see Gtk::Tooltip::set_text().

This is a convenience property which will take care of getting the tooltip shown if the given string is not `nullptr`: Gtk::Widget::property_has_tooltip() will automatically be set to `true` and there will be taken care of Gtk::Widget::signal_query_tooltip() in the default signal handler.

Note that if both Gtk::Widget::property_tooltip_text() and Gtk::Widget::property_tooltip_markup() are set, the last one wins.

Since gtkmm 2.12:

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_valign() [1/2]

Glib::PropertyProxy< Align > Gtk::Widget::property_valign | ( |  | ) |

How to distribute vertical space if widget gets extra space, see Gtk::Align.

Since gtkmm 3.0:

Default value: Gtk::ALIGN_FILL

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_valign() [2/2]

Glib::PropertyProxy_ReadOnly< Align > Gtk::Widget::property_valign | ( |  | ) | const

How to distribute vertical space if widget gets extra space, see Gtk::Align.

Since gtkmm 3.0:

Default value: Gtk::ALIGN_FILL

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_vexpand() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_vexpand | ( |  | ) |

Whether to expand vertically.

See Gtk::Widget::set_vexpand().

Since gtkmm 3.0:

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_vexpand() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_vexpand | ( |  | ) | const

Whether to expand vertically.

See Gtk::Widget::set_vexpand().

Since gtkmm 3.0:

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_vexpand_set() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_vexpand_set | ( |  | ) |

Whether to use the Gtk::Widget::property_vexpand() property.

See Gtk::Widget::get_vexpand_set().

Since gtkmm 3.0:

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_vexpand_set() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_vexpand_set | ( |  | ) | const

Whether to use the Gtk::Widget::property_vexpand() property.

See Gtk::Widget::get_vexpand_set().

Since gtkmm 3.0:

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_visible() [1/2]

Glib::PropertyProxy< bool > Gtk::Widget::property_visible | ( |  | ) |

Whether the widget is visible.

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_visible() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_visible | ( |  | ) | const

Whether the widget is visible.

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_width_request() [1/2]

Glib::PropertyProxy< int > Gtk::Widget::property_width_request | ( |  | ) |

Override for width request of the widget, or -1 if natural request should be used.

Default value: -1

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_width_request() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::Widget::property_width_request | ( |  | ) | const

Override for width request of the widget, or -1 if natural request should be used.

Default value: -1

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_window()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Window> > Gtk::Widget::property_window | ( |  | ) | const

The widget's window if it is realized, `nullptr` otherwise.

Since gtkmm 2.14:

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ push_composite_child()

static void Gtk::Widget::push_composite_child | ( |  | ) |
| static

Makes all newly-created widgets as composite children until the corresponding pop_composite_child() call.

A composite child is a child that’s an implementation detail of the container it’s inside and should not be visible to people using the container. Composite children aren’t treated differently by GTK+ (but see Gtk::Container::foreach() vs. Gtk::Container::forall()), but e.g. GUI builders might want to treat them in a different way.

Deprecated: 3.10: This API never really worked well and was mostly unused, now we have a more complete mechanism for composite children, see class_set_template().

Deprecated:
  This API never really worked well and was mostly unused, now we have a more complete mechanism for composite children, see gtk_widget_class_set_template().

## ◆ queue_allocate()

void Gtk::Widget::queue_allocate | ( |  | ) |

This function is only for use in widget implementations.

Flags the widget for a rerun of the GtkWidgetClass::size_allocate function. Use this function instead of queue_resize() when the widget's size request didn't change but it wants to reposition its contents.

An example user of this function is set_halign().

Since gtkmm 3.20:

## ◆ queue_compute_expand()

void Gtk::Widget::queue_compute_expand | ( |  | ) |

Mark widget as needing to recompute its expand flags.

Call this function when setting legacy expand child properties on the child of a container.

See compute_expand().

## ◆ queue_draw()

void Gtk::Widget::queue_draw | ( |  | ) |

Equivalent to calling queue_draw_area() for the entire area of a widget.

## ◆ queue_draw_area()

void Gtk::Widget::queue_draw_area | ( | int | x,
|  | int | y,
|  | int | width,
|  | int | height
| ) |  |

Convenience function that calls queue_draw_region() on the region created from the given coordinates.

The region here is specified in widget coordinates. Widget coordinates are a bit odd; for historical reasons, they are defined as widget->window coordinates for widgets that return `true` for get_has_window(), and are relative to widget->allocation.x, widget->allocation.y otherwise.

width or height may be 0, in this case this function does nothing. Negative values for width and height are not allowed.

Parameters

  x | X coordinate of upper-left corner of rectangle to redraw.
  y | Y coordinate of upper-left corner of rectangle to redraw.
  width | Width of region to draw.
  height | Height of region to draw.

## ◆ queue_draw_region()

void Gtk::Widget::queue_draw_region | ( | const ::Cairo::RefPtr< const ::Cairo::Region > & | region | ) |

Invalidates the area of widget defined by region by calling gdk_window_invalidate_region() on the widget’s window and all its child windows.

Once the main loop becomes idle (after the current batch of events has been processed, roughly), the window will receive expose events for the union of all regions that have been invalidated.

Normally you would only use this function in widget implementations. You might also use it to schedule a redraw of a Gtk::DrawingArea or some portion thereof.

Since gtkmm 3.0:

Parameters

  region | Region to draw.

## ◆ queue_resize()

void Gtk::Widget::queue_resize | ( |  | ) |

This function is only for use in widget implementations.

Flags a widget to have its size renegotiated; should be called when a widget for some reason has a new size request. For example, when you change the text in a Gtk::Label, Gtk::Label queues a resize to ensure there’s enough space for the new text.

Note that you cannot call queue_resize() on a widget from inside its implementation of the GtkWidgetClass::size_allocate virtual method. Calls to queue_resize() from inside GtkWidgetClass::size_allocate will be silently ignored.

## ◆ queue_resize_no_redraw()

void Gtk::Widget::queue_resize_no_redraw | ( |  | ) |

This function works like queue_resize(), except that the widget is not invalidated.

Since gtkmm 2.4:

## ◆ realize()

void Gtk::Widget::realize | ( |  | ) |
| protected

Creates the GDK (windowing system) resources associated with a widget.

For example, widget->window will be created when a widget is realized. Normally realization happens implicitly; if you show a widget and all its parent containers, then the widget will be realized and mapped automatically.

Realizing a widget requires all the widget’s parent widgets to be realized; calling realize() realizes the widget’s parents in addition to widget itself. If a widget is not yet inside a toplevel window when you realize it, bad things will happen.

This function is primarily used in widget implementations, and isn’t very useful otherwise. Many times when you think you might need it, a better approach is to connect to a signal that will be called after the widget is realized automatically, such as Gtk::Widget::signal_draw(). Or simply Glib::signal_connect() to the Gtk::Widget::signal_realize() signal.

## ◆ realize_if_needed()

void Gtk::Widget::realize_if_needed | ( |  | ) |
| protected

## ◆ region_intersect()

::Cairo::RefPtr< ::Cairo::Region> Gtk::Widget::region_intersect | ( | const ::Cairo::RefPtr< ::Cairo::Region > & | region | ) | const

Computes the intersection of a widget’s area and region, returning the intersection.

The result may be empty, use cairo_region_is_empty() to check.

Deprecated: 3.14: Use get_allocation() and cairo_region_intersect_rectangle() to get the same behavior.

Deprecated:
  Use get_allocation() and Cairo::Region::intersect(const Cairo::RectangleInt&) to get the same behavior.

Parameters

  region | A #cairo_region_t, in the same coordinate system as widget->allocation. That is, relative to widget->window for widgets which return `false` from get_has_window(); relative to the parent window of widget->window otherwise.

Returns
  A newly allocated region holding the intersection of widget and region.

## ◆ register_window()

void Gtk::Widget::register_window | ( | const Glib::RefPtr< Gdk::Window >& | window | ) |

Registers a Gdk::Window with the widget and sets it up so that the widget receives events for it.

Call unregister_window() when destroying the window.

Before 3.8 you needed to call gdk_window_set_user_data() directly to set this up. This is now deprecated and you should use register_window() instead. Old code will keep working as is, although some new features like transparency might not work perfectly.

Since gtkmm 3.8:

Parameters

  window | A Gdk::Window.

## ◆ remove_accelerator()

bool Gtk::Widget::remove_accelerator | ( | const Glib::RefPtr< AccelGroup >& | accel_group,
|  | guint | accel_key,
|  | Gdk::ModifierType | accel_mods
| ) |  |

Removes an accelerator from widget, previously installed with add_accelerator().

Parameters

  accel_group | Accel group for this widget.
  accel_key | GDK keyval of the accelerator.
  accel_mods | Modifier key combination of the accelerator.

Returns
  Whether an accelerator was installed and could be removed.

## ◆ remove_action_group()

void Gtk::Widget::remove_action_group | ( | const Glib::ustring & | name | ) |

Removes a group from the widget.

See insert_action_group().

Parameters

  name | The prefix for actions.

Since gtkmm 3.10:

## ◆ remove_mnemonic_label()

void Gtk::Widget::remove_mnemonic_label | ( | Widget& | label | ) |

Removes a widget from the list of mnemonic labels for this widget.

(See list_mnemonic_labels()). The widget must have previously been added to the list with add_mnemonic_label().

Since gtkmm 2.4:

Parameters

  label | A Gtk::Widget that was previously set as a mnemonic label for widget with add_mnemonic_label().

## ◆ remove_modal_grab()

void Gtk::Widget::remove_modal_grab | ( |  | ) |

Remove the modal grab of the widget in case it was previously grabbed.

## ◆ remove_tick_callback()

void Gtk::Widget::remove_tick_callback | ( | guint | id | ) |

Removes a tick callback previously registered with add_tick_callback().

Since gtkmm 3.24:

Parameters

  id | An id returned by add_tick_callback().

## ◆ render_icon_pixbuf()

Glib::RefPtr<Gdk::Pixbuf> Gtk::Widget::render_icon_pixbuf | ( | const StockID& | stock_id,
|  | IconSize | size
| ) |  |

A convenience function that uses the theme engine and style settings for widget to look up stock_id and render it to a pixbuf.

stock_id should be a stock icon ID such as Gtk::STOCK_OPEN or Gtk::STOCK_OK. size should be a size such as Gtk::ICON_SIZE_MENU.

The pixels in the returned Gdk::Pixbuf are shared with the rest of the application and should not be modified. The pixbuf should be freed after use with Glib::object_unref().

Since gtkmm 3.0:

Deprecated: 3.10: Use Gtk::IconTheme::load_icon() instead.

Deprecated:
  Use IconTheme::load_icon() instead.

Parameters

  stock_id | A stock ID.
  size | A stock size (Gtk::IconSize). A size of `(GtkIconSize)-1` means render at the size of the source and don’t scale (if there are multiple source sizes, GTK+ picks one of the available sizes).

Returns
  A new pixbuf, or `nullptr` if the stock ID wasn’t known.

## ◆ reparent()

void Gtk::Widget::reparent | ( | Widget& | new_parent | ) |

Moves a widget from one Gtk::Container to another, handling reference count issues to avoid destroying the widget.

Parameters

  new_parent | A Gtk::Container to move the widget into.

## ◆ reset_style()

void Gtk::Widget::reset_style | ( |  | ) |

Updates the style context of widget and all descendants by updating its widget path.

Gtk::Containers may want to use this on a child when reordering it in a way that a different style might apply to it. See also Gtk::Container::get_path_for_child().

Since gtkmm 3.0:

## ◆ send_expose()

int Gtk::Widget::send_expose | ( | GdkEvent * | gdk_event | ) |

Very rarely-used function.

This function is used to emit an expose event on a widget. This function is not normally used directly. The only time it is used is when propagating an expose event to a windowless child widget (get_has_window() is `false`), and that is normally done using Gtk::Container::propagate_draw().

If you want to force an area of a window to be redrawn, use gdk_window_invalidate_rect() or gdk_window_invalidate_region(). To cause the redraw to be done immediately, follow that call with a call to gdk_window_process_updates().

Deprecated: 3.22: Application and widget code should not handle expose events directly; invalidation should use the Gtk::Widget API, and drawing should only happen inside Gtk::Widget::signal_draw() implementations

Deprecated:
  Application and widget code should not handle expose events directly; invalidation should use the Gtk::Widget API, and drawing should only happen inside signal_draw() implementations.

Parameters

  gdk_event | A expose Gdk::Event.

Returns
  Return from the event signal emission (`true` if the event was handled).

## ◆ send_focus_change()

bool Gtk::Widget::send_focus_change | ( | GdkEvent * | gdk_event | ) |

Sends the focus change gdk_event to widget.

This function is not meant to be used by applications. The only time it should be used is when it is necessary for a Gtk::Widget to assign focus to a widget that is semantically owned by the first widget even though it’s not a direct child - for instance, a search entry in a floating window similar to the quick search in Gtk::TreeView.

An example of its usage is:

[C example ellipted]

Since gtkmm 2.20:

Parameters

  gdk_event | A Gdk::Event of type GDK_FOCUS_CHANGE.

Returns
  The return value from the event signal emission: `true` if the event was handled, and `false` otherwise.

## ◆ set_accel_path()

void Gtk::Widget::set_accel_path | ( | const Glib::ustring & | accel_path,
|  | const Glib::RefPtr< AccelGroup >& | accel_group
| ) |  |

Given an accelerator group, accel_group, and an accelerator path, accel_path, sets up an accelerator in accel_group so whenever the key binding that is defined for accel_path is pressed, widget will be activated.

This removes any accelerators (for any accelerator group) installed by previous calls to set_accel_path(). Associating accelerators with paths allows them to be modified by the user and the modifications to be saved for future use. (See Gtk::AccelMap::save().)

This function is a low level function that would most likely be used by a menu creation system like Gtk::UIManager. If you use Gtk::UIManager, setting up accelerator paths will be done automatically.

Even when you you aren’t using Gtk::UIManager, if you only want to set up accelerators on menu items Gtk::MenuItem::set_accel_path() provides a somewhat more convenient interface.

Note that accel_path string will be stored in a Quark. Therefore, if you pass a static string, you can save some memory by interning it first with Glib::intern_static_string().

Parameters

  accel_path | Path used to look up the accelerator.
  accel_group | A Gtk::AccelGroup.

## ◆ set_allocation()

void Gtk::Widget::set_allocation | ( | const Allocation& | allocation | ) |

Sets the widget’s allocation.

This should not be used directly, but from within a widget’s size_allocate method.

The allocation set should be the “adjusted” or actual allocation. If you’re implementing a Gtk::Container, you want to use size_allocate() instead of set_allocation(). The GtkWidgetClass::adjust_size_allocation virtual method adjusts the allocation inside size_allocate() to create an adjusted allocation.

Since gtkmm 2.18:

Parameters

  allocation | A pointer to a Gtk::Allocation to copy from.

## ◆ set_app_paintable()

void Gtk::Widget::set_app_paintable | ( | bool | app_paintable = `true` | ) |

Sets whether the application intends to draw on the widget in an Gtk::Widget::signal_draw() handler.

This is a hint to the widget and does not affect the behavior of the GTK+ core; many widgets ignore this flag entirely. For widgets that do pay attention to the flag, such as Gtk::EventBox and Gtk::Window, the effect is to suppress default themed drawing of the widget's background. (Children of the widget will still be drawn.) The application is then entirely responsible for drawing the widget background.

Note that the background is still drawn when the widget is mapped.

Parameters

  app_paintable | `true` if the application will paint on the widget.

## ◆ set_can_default()

void Gtk::Widget::set_can_default | ( | bool | can_default = `true` | ) |

Specifies whether widget can be a default widget.

See grab_default() for details about the meaning of “default”.

Since gtkmm 2.18:

Parameters

  can_default | Whether or not widget can be a default widget.

## ◆ set_can_focus()

void Gtk::Widget::set_can_focus | ( | bool | can_focus = `true` | ) |

Specifies whether widget can own the input focus.

See grab_focus() for actually setting the input focus on a widget.

Since gtkmm 2.18:

Parameters

  can_focus | Whether or not widget can own the input focus.

## ◆ set_child_visible()

void Gtk::Widget::set_child_visible | ( | bool | visible = `true` | ) |

Sets whether widget should be mapped along with its when its parent is mapped and widget has been shown with show().

The child visibility can be set for widget before it is added to a container with set_parent(), to avoid mapping children unnecessary before immediately unmapping them. However it will be reset to its default state of `true` when the widget is removed from a container.

Note that changing the child visibility of a widget does not queue a resize on the widget. Most of the time, the size of a widget is computed from all visible children, whether or not they are mapped. If this is not the case, the container can queue a resize itself.

This function is only useful for container implementations and never should be called by an application.

Parameters

  visible | If `true`, widget should be mapped along with its parent.

## ◆ set_clip()

void Gtk::Widget::set_clip | ( | const Allocation& | clip | ) |

Sets the widget’s clip.

This must not be used directly, but from within a widget’s size_allocate method. It must be called after set_allocation() (or after chaining up to the parent class), because that function resets the clip.

The clip set should be the area that widget draws on. If widget is a Gtk::Container, the area must contain all children's clips.

If this function is not called by widget during a signal_size_allocate() handler, the clip will be set to widget's allocation.

Since gtkmm 3.14:

Parameters

  clip | A pointer to a Gtk::Allocation to copy from.

## ◆ set_composite_name()

void Gtk::Widget::set_composite_name | ( | const Glib::ustring & | name | ) |

Sets a widgets composite name.

The widget must be a composite child of its parent; see push_composite_child().

Deprecated: 3.10: Use class_set_template(), or don’t use this API at all.

Deprecated:
  Use gtk_widget_class_set_template(), or don't use this API at all.

Parameters

  name | The name to set.

## ◆ set_default_direction()

static void Gtk::Widget::set_default_direction | ( | TextDirection | dir | ) |
| static

Sets the default reading direction for widgets where the direction has not been explicitly set by set_direction().

Parameters

  dir | The new default direction. This cannot be Gtk::TEXT_DIR_NONE.

## ◆ set_device_enabled()

void Gtk::Widget::set_device_enabled | ( | const Glib::RefPtr< Gdk::Device >& | device,
|  | bool | enabled = `true`
| ) |  |

Enables or disables a Gdk::Device to interact with widget and all its children.

It does so by descending through the Gdk::Window hierarchy and enabling the same mask that is has for core events (i.e. the one that gdk_window_get_events() returns).

Since gtkmm 3.0:

Parameters

  device | A Gdk::Device.
  enabled | Whether to enable the device.

## ◆ set_device_events()

void Gtk::Widget::set_device_events | ( | const Glib::RefPtr< const Gdk::Device >& | device,
|  | Gdk::EventMask | events
| ) |  |

Sets the device event mask (see Gdk::EventMask) for a widget.

The event mask determines which events a widget will receive from device. Keep in mind that different widgets have different default event masks, and by changing the event mask you may disrupt a widget’s functionality, so be careful. This function must be called while a widget is unrealized. Consider add_device_events() for widgets that are already realized, or if you want to preserve the existing event mask. This function can’t be used with windowless widgets (which return `false` from get_has_window()); to get events on those widgets, place them inside a Gtk::EventBox and receive events on the event box.

Since gtkmm 3.0:

Parameters

  device | A Gdk::Device.
  events | Event mask.

## ◆ set_direction()

void Gtk::Widget::set_direction | ( | TextDirection | dir | ) |

Sets the reading direction on a particular widget.

This direction controls the primary direction for widgets containing text, and also the direction in which the children of a container are packed. The ability to set the direction is present in order so that correct localization into languages with right-to-left reading directions can be done. Generally, applications will let the default reading direction present, except for containers where the containers are arranged in an order that is explicitly visual rather than logical (such as buttons for text justification).

If the direction is set to Gtk::TEXT_DIR_NONE, then the value set by set_default_direction() will be used.

Parameters

  dir | The new direction.

## ◆ set_double_buffered()

void Gtk::Widget::set_double_buffered | ( | bool | double_buffered = `true` | ) |

Widgets are double buffered by default; you can use this function to turn off the buffering.

“Double buffered” simply means that gdk_window_begin_draw_frame() and gdk_window_end_draw_frame() are called automatically around expose events sent to the widget. gdk_window_begin_draw_frame() diverts all drawing to a widget's window to an offscreen buffer, and gdk_window_end_draw_frame() draws the buffer to the screen. The result is that users see the window update in one smooth step, and don’t see individual graphics primitives being rendered.

In very simple terms, double buffered widgets don’t flicker, so you would only use this function to turn off double buffering if you had special needs and really knew what you were doing.

Note
  if you turn off double-buffering, you have to handle expose events, since even the clearing to the background color or pixmap will not happen automatically (as it is done in gdk_window_begin_draw_frame()).

In 3.10 GTK and GDK have been restructured for translucent drawing. Since then expose events for double-buffered widgets are culled into a single event to the toplevel GDK window. If you now unset double buffering, you will cause a separate rendering pass for every widget. This will likely cause rendering problems - in particular related to stacking - and usually increases rendering times significantly.

Deprecated: 3.14: This function does not work under non-X11 backends or with non-native windows. It should not be used in newly written code.

Deprecated:
  This does not work under non-X11 backends, and it should not be used in newly written code.

Parameters

  double_buffered | `true` to double-buffer a widget.

## ◆ set_events()

void Gtk::Widget::set_events | ( | Gdk::EventMask | events | ) |

Sets the event mask (see Gdk::EventMask) for a widget.

The event mask determines which events a widget will receive. Keep in mind that different widgets have different default event masks, and by changing the event mask you may disrupt a widget’s functionality, so be careful. This function must be called while a widget is unrealized. Consider add_events() for widgets that are already realized, or if you want to preserve the existing event mask. This function can’t be used with widgets that have no window. (See get_has_window()). To get events on those widgets, place them inside a Gtk::EventBox and receive events on the event box.

Parameters

  events | Event mask.

## ◆ set_focus_on_click()

void Gtk::Widget::set_focus_on_click | ( | bool | focus_on_click = `true` | ) |

Sets whether the widget should grab focus when it is clicked with the mouse.

Making mouse clicks not grab focus is useful in places like toolbars where you don’t want the keyboard focus removed from the main area of the application.

Since gtkmm 3.20:

Parameters

  focus_on_click | Whether the widget should grab focus when clicked with the mouse.

## ◆ set_font_map()

void Gtk::Widget::set_font_map | ( | const Glib::RefPtr< Pango::FontMap > & | font_map | ) |

Sets the font map to use for Pango rendering.

When not set, the widget will inherit the font map from its parent.

Since gtkmm 3.18:

Parameters

  font_map | A Pango::FontMap, or `nullptr` to unset any previously set font map.

## ◆ set_font_options()

void Gtk::Widget::set_font_options | ( | const ::Cairo::FontOptions & | options | ) |

Sets the #cairo_font_options_t used for Pango rendering in this widget.

When not set, the default font options for the Gdk::Screen will be used.

Since gtkmm 3.18:

Parameters

  options | A #cairo_font_options_t, or `nullptr` to unset any previously set default font options.

## ◆ set_halign()

void Gtk::Widget::set_halign | ( | Align | align | ) |

Sets the horizontal alignment of widget.

See the Gtk::Widget::property_halign() property.

Parameters

  align | The horizontal alignment.

## ◆ set_has_tooltip()

void Gtk::Widget::set_has_tooltip | ( | bool | has_tooltip = `TRUE` | ) |

Sets the has-tooltip property on widget to has_tooltip.

See Gtk::Widget::property_has_tooltip() for more information.

Since gtkmm 2.12:

Parameters

  has_tooltip | Whether or not widget has a tooltip.

## ◆ set_has_window()

void Gtk::Widget::set_has_window | ( | bool | has_window = `true` | ) |
| protected

Specifies whether widget has a Gdk::Window of its own.

Note that all realized widgets have a non-`nullptr` “window” pointer (get_window() never returns a `nullptr` window when a widget is realized), but for many of them it’s actually the Gdk::Window of one of its parent widgets. Widgets that do not create a window for themselves in Gtk::Widget::signal_realize() must announce this by calling this function with has_window = `false`.

This function should only be called by widget implementations, and they should call it in their init() function.

Since gtkmm 2.18:

Parameters

  has_window | Whether or not widget has a window.

## ◆ set_hexpand()

void Gtk::Widget::set_hexpand | ( | bool | expand = `true` | ) |

Sets whether the widget would like any available extra horizontal space.

When a user resizes a Gtk::Window, widgets with expand=`true` generally receive the extra space. For example, a list or scrollable area or document in your window would often be set to expand.

Call this function to set the expand flag if you would like your widget to become larger horizontally when the window has extra room.

By default, widgets automatically expand if any of their children want to expand. (To see if a widget will automatically expand given its current children and state, call compute_expand(). A container can decide how the expandability of children affects the expansion of the container by overriding the compute_expand virtual method on Gtk::Widget.).

Setting hexpand explicitly with this function will override the automatic expand behavior.

This function forces the widget to expand or not to expand, regardless of children. The override occurs because set_hexpand() sets the hexpand-set property (see set_hexpand_set()) which causes the widget’s hexpand value to be used, rather than looking at children and widget state.

Parameters

  expand | Whether to expand.

## ◆ set_hexpand_set()

void Gtk::Widget::set_hexpand_set | ( | bool | set = `true` | ) |

Sets whether the hexpand flag (see get_hexpand()) will be used.

The hexpand-set property will be set automatically when you call set_hexpand() to set hexpand, so the most likely reason to use this function would be to unset an explicit expand flag.

If hexpand is set, then it overrides any computed expand value based on child widgets. If hexpand is not set, then the expand value depends on whether any children of the widget would like to expand.

There are few reasons to use this function, but it’s here for completeness and consistency.

Parameters

  set | Value for hexpand-set property.

## ◆ set_mapped()

void Gtk::Widget::set_mapped | ( | bool | mapped = `true` | ) |
| protected

Marks the widget as being mapped.

This function should only ever be called in a derived widget's “map” or “unmap” implementation.

Since gtkmm 2.20:

Parameters

  mapped | `true` to mark the widget as mapped.

## ◆ set_margin_bottom()

void Gtk::Widget::set_margin_bottom | ( | int | margin | ) |

Sets the bottom margin of widget.

See the Gtk::Widget::property_margin_bottom() property.

Since gtkmm 3.0:

Parameters

  margin | The bottom margin.

## ◆ set_margin_end()

void Gtk::Widget::set_margin_end | ( | int | margin | ) |

Sets the end margin of widget.

See the Gtk::Widget::property_margin_end() property.

Since gtkmm 3.12:

Parameters

  margin | The end margin.

## ◆ set_margin_left()

void Gtk::Widget::set_margin_left | ( | int | margin | ) |

Sets the left margin of widget.

See the Gtk::Widget::property_margin_left() property.

Deprecated: 3.12: Use set_margin_start() instead.

Since gtkmm 3.0:

Deprecated:
  Use set_margin_start() instead.

Parameters

  margin | The left margin.

## ◆ set_margin_right()

void Gtk::Widget::set_margin_right | ( | int | margin | ) |

Sets the right margin of widget.

See the Gtk::Widget::property_margin_right() property.

Deprecated: 3.12: Use set_margin_end() instead.

Since gtkmm 3.0:

Deprecated:
  Use set_margin_end() instead.

Parameters

  margin | The right margin.

## ◆ set_margin_start()

void Gtk::Widget::set_margin_start | ( | int | margin | ) |

Sets the start margin of widget.

See the Gtk::Widget::property_margin_start() property.

Since gtkmm 3.12:

Parameters

  margin | The start margin.

## ◆ set_margin_top()

void Gtk::Widget::set_margin_top | ( | int | margin | ) |

Sets the top margin of widget.

See the Gtk::Widget::property_margin_top() property.

Since gtkmm 3.0:

Parameters

  margin | The top margin.

## ◆ set_name()

void Gtk::Widget::set_name | ( | const Glib::ustring & | name | ) |

Widgets can be named, which allows you to refer to them from a CSS file.

You can apply a style to widgets with a particular name in the CSS file. See the documentation for the CSS syntax (on the same page as the docs for Gtk::StyleContext).

Note that the CSS syntax has certain special characters to delimit and represent elements in a selector (period, #, >, *...), so using these will make your widget impossible to match by name. Any combination of alphanumeric symbols, dashes and underscores will suffice.

Parameters

  name | Name for the widget.

## ◆ set_no_show_all()

void Gtk::Widget::set_no_show_all | ( | bool | no_show_all = `true` | ) |

Sets the Gtk::Widget::property_no_show_all() property, which determines whether calls to show_all() will affect this widget.

This is mostly for use in constructing widget hierarchies with externally controlled visibility, see Gtk::UIManager.

Since gtkmm 2.4:

Parameters

  no_show_all | The new value for the “no-show-all” property.

## ◆ set_opacity()

void Gtk::Widget::set_opacity | ( | double | opacity | ) |

Request the widget to be rendered partially transparent, with opacity 0 being fully transparent and 1 fully opaque.

(Opacity values are clamped to the [0,1] range.). This works on both toplevel widget, and child widgets, although there are some limitations:

For toplevel widgets this depends on the capabilities of the windowing system. On X11 this has any effect only on X screens with a compositing manager running. See is_composited(). On Windows it should work always, although setting a window’s opacity after the window has been shown causes it to flicker once on Windows.

For child widgets it doesn’t work if any affected widget has a native window, or disables double buffering.

Since gtkmm 3.8:

Parameters

  opacity | Desired opacity, between 0 and 1.

## ◆ set_parent()

void Gtk::Widget::set_parent | ( | Widget& | parent | ) |

This function is useful only when implementing subclasses of Gtk::Container.

Sets the container as the parent of widget, and takes care of some details such as updating the state and style of the child to reflect its new location. The opposite function is unparent().

Parameters

  parent | Parent container.

## ◆ set_parent_window()

void Gtk::Widget::set_parent_window | ( | const Glib::RefPtr< const Gdk::Window >& | parent_window | ) |

Sets a non default parent window for widget.

For Gtk::Window classes, setting a parent_window effects whether the window is a toplevel window or can be embedded into other widgets.

For Gtk::Window classes, this needs to be called before the window is realized.

Parameters

  parent_window | The new parent window.

## ◆ set_realized()

void Gtk::Widget::set_realized | ( | bool | realized = `true` | ) |
| protected

Marks the widget as being realized.

This function must only be called after all Gdk::Windows for the widget have been created and registered.

This function should only ever be called in a derived widget's “realize” or “unrealize” implementation.

Since gtkmm 2.20:

Parameters

  realized | `true` to mark the widget as realized.

## ◆ set_receives_default()

void Gtk::Widget::set_receives_default | ( | bool | receives_default = `true` | ) |

Specifies whether widget will be treated as the default widget within its toplevel when it has the focus, even if another widget is the default.

See grab_default() for details about the meaning of “default”.

Since gtkmm 2.18:

Parameters

  receives_default | Whether or not widget can be a default widget.

## ◆ set_redraw_on_allocate()

void Gtk::Widget::set_redraw_on_allocate | ( | bool | redraw_on_allocate = `true` | ) |

Sets whether the entire widget is queued for drawing when its size allocation changes.

By default, this setting is `true` and the entire widget is redrawn on every size change. If your widget leaves the upper left unchanged when made bigger, turning this setting off will improve performance.

Note that for widgets where get_has_window() is `false` setting this flag to `false` turns off all allocation on resizing: the widget will not even redraw if its position changes; this is to allow containers that don’t draw anything to avoid excess invalidations. If you set this flag on a widget with no window that does draw on widget->window, you are responsible for invalidating both the old and new allocation of the widget when the widget is moved and responsible for invalidating regions newly when the widget increases size.

Parameters

  redraw_on_allocate | If `true`, the entire widget will be redrawn when it is allocated to a new size. Otherwise, only the new portion of the widget will be redrawn.

## ◆ set_sensitive()

void Gtk::Widget::set_sensitive | ( | bool | sensitive = `true` | ) |

Sets the sensitivity of a widget.

A widget is sensitive if the user can interact with it. Insensitive widgets are “grayed out” and the user can’t interact with them. Insensitive widgets are known as “inactive”, “disabled”, or “ghosted” in some other toolkits.

Parameters

  sensitive | `true` to make the widget sensitive.

## ◆ set_size_request()

void Gtk::Widget::set_size_request | ( | int | width = `-1`,
|  | int | height = `-1`
| ) |  |

Sets the minimum size of a widget; that is, the widget’s size request will be at least width by height.

You can use this function to force a widget to be larger than it normally would be.

In most cases, Gtk::Window::set_default_size() is a better choice for toplevel windows than this function; setting the default size will still allow users to shrink the window. Setting the size request will force them to leave the window at least as large as the size request. When dealing with window sizes, Gtk::Window::set_geometry_hints() can be a useful function as well.

Note the inherent danger of setting any fixed size - themes, translations into other languages, different fonts, and user action can all change the appropriate size for a given widget. So, it's basically impossible to hardcode a size that will always be correct.

The size request of a widget is the smallest size a widget can accept while still functioning well and drawing itself correctly. However in some strange cases a widget may be allocated less than its requested size, and in many cases a widget may be allocated more space than it requested.

If the size request in a given direction is -1 (unset), then the “natural” size request of the widget will be used instead.

The size request set here does not include any margin from the Gtk::Widget properties margin-left, margin-right, margin-top, and margin-bottom, but it does include pretty much all other padding or border properties set by any subclass of Gtk::Widget.

Parameters

  width | Width widget should request, or -1 to unset.
  height | Height widget should request, or -1 to unset.

## ◆ set_state()

void Gtk::Widget::set_state | ( | StateType | state | ) |

This function is for use in widget implementations.

Sets the state of a widget (insensitive, prelighted, etc.) Usually you should set the state using wrapper functions such as set_sensitive().

Deprecated: 3.0: Use set_state_flags() instead.

Deprecated:
  Use set_state_flags() instead.

Parameters

  state | New state for widget.

## ◆ set_state_flags()

void Gtk::Widget::set_state_flags | ( | StateFlags | flags,
|  | bool | clear = `true`
| ) |  |

This function is for use in widget implementations.

Turns on flag values in the current widget state (insensitive, prelighted, etc.).

This function accepts the values Gtk::STATE_FLAG_DIR_LTR and Gtk::STATE_FLAG_DIR_RTL but ignores them. If you want to set the widget's direction, use set_direction().

It is worth mentioning that any other state than Gtk::STATE_FLAG_INSENSITIVE, will be propagated down to all non-internal children if widget is a Gtk::Container, while Gtk::STATE_FLAG_INSENSITIVE itself will be propagated down to all Gtk::Container children by different means than turning on the state flag down the hierarchy, both get_state_flags() and is_sensitive() will make use of these.

Since gtkmm 3.0:

Parameters

  flags | State flags to turn on.
  clear | Whether to clear state before turning on flags.

## ◆ set_support_multidevice()

void Gtk::Widget::set_support_multidevice | ( | bool | support_multidevice = `true` | ) |

Enables or disables multiple pointer awareness.

If this setting is `true`, widget will start receiving multiple, per device enter/leave events. Note that if custom Gdk::Windows are created in Gtk::Widget::signal_realize(), gdk_window_set_support_multidevice() will have to be called manually on them.

Since gtkmm 3.0:

Parameters

  support_multidevice | `true` to support input from multiple devices.

## ◆ set_tooltip_markup()

void Gtk::Widget::set_tooltip_markup | ( | const Glib::ustring & | markup | ) |

Sets markup as the contents of the tooltip, which is marked up with the Pango text markup language.

This function will take care of setting GtkWidget:has-tooltip to `true` and of the default handler for the GtkWidget::query-tooltip signal.

See also the GtkWidget:tooltip-markup property and Gtk::Tooltip::set_markup().

Since gtkmm 2.12:

Parameters

  markup | The contents of the tooltip for widget.

## ◆ set_tooltip_text()

void Gtk::Widget::set_tooltip_text | ( | const Glib::ustring & | text | ) |

Sets text as the contents of the tooltip.

This function will take care of setting Gtk::Widget::property_has_tooltip() to `true` and of the default handler for the Gtk::Widget::signal_query_tooltip() signal.

See also the Gtk::Widget::property_tooltip_text() property and Gtk::Tooltip::set_text().

Since gtkmm 2.12:

Parameters

  text | The contents of the tooltip for widget.

## ◆ set_tooltip_window()

void Gtk::Widget::set_tooltip_window | ( | Window& | custom_window | ) |

Replaces the default window used for displaying tooltips with custom_window.

GTK+ will take care of showing and hiding custom_window at the right moment, to behave likewise as the default tooltip window. If custom_window is `nullptr`, the default tooltip window will be used.

Since gtkmm 2.12:

Parameters

  custom_window | A Gtk::Window, or `nullptr`.

## ◆ set_valign()

void Gtk::Widget::set_valign | ( | Align | align | ) |

Sets the vertical alignment of widget.

See the Gtk::Widget::property_valign() property.

Parameters

  align | The vertical alignment.

## ◆ set_vexpand()

void Gtk::Widget::set_vexpand | ( | bool | expand = `true` | ) |

Sets whether the widget would like any available extra vertical space.

See set_hexpand() for more detail.

Parameters

  expand | Whether to expand.

## ◆ set_vexpand_set()

void Gtk::Widget::set_vexpand_set | ( | bool | set = `true` | ) |

Sets whether the vexpand flag (see get_vexpand()) will be used.

See set_hexpand_set() for more detail.

Parameters

  set | Value for vexpand-set property.

## ◆ set_visible()

void Gtk::Widget::set_visible | ( | bool | visible = `true` | ) |

Sets the visibility state of widget.

Note that setting this to `true` doesn’t mean the widget is actually viewable, see get_visible().

This function simply calls show() or hide() but is nicer to use when the visibility of the widget depends on some condition.

Since gtkmm 2.18:

Parameters

  visible | Whether the widget should be shown or not.

## ◆ set_window()

void Gtk::Widget::set_window | ( | const Glib::RefPtr< Gdk::Window >& | window | ) |
| protected

Sets a widget's window.

This function should only be used in a widget's Gtk::Widget::on_realize() implementation. The window passed is usually either a new window created with Gdk::Window::create(), or the window of its parent widget as returned by get_parent_window().

Widgets must indicate whether they will create their own Gdk::Window by calling set_has_window(). This is usually done in the widget's constructor.

This function should only be called by custom widget implementations, and they should call it in their on_realize() function.

Since gtkmm 2.18:

Parameters

  window | A Gdk::Window.

## ◆ shape_combine_region()

void Gtk::Widget::shape_combine_region | ( | const ::Cairo::RefPtr< const ::Cairo::Region > & | region | ) |

Sets a shape for this widget’s GDK window.

This allows for transparent windows etc., see gdk_window_shape_combine_region() for more information.

Since gtkmm 3.0:

Parameters

  region | Shape to be added, or `nullptr` to remove an existing shape.

## ◆ should_draw_window()

static bool Gtk::Widget::should_draw_window | ( | const ::Cairo::RefPtr< const ::Cairo::Context > & | cr,
|  | const Glib::RefPtr< const Gdk::Window >& | window
| ) |  |
| staticprotected

This function is supposed to be called in Gtk::Widget::signal_draw() implementations for widgets that support multiple windows.

cr must be untransformed from invoking of the draw function. This function will return `true` if the contents of the given window are supposed to be drawn and `false` otherwise. Note that when the drawing was not initiated by the windowing system this function will return `true` for all windows, so you need to draw the bottommost window first. Also, do not use “else if” statements to check which window should be drawn.

Since gtkmm 3.0:

Parameters

  cr | A cairo context.
  window | The window to check. window may not be an input-only window.

Returns
  `true` if window should be drawn.

## ◆ show()

void Gtk::Widget::show | ( |  | ) |

Flags a widget to be displayed.

Any widget that isn’t shown will not appear on the screen. If you want to show all the widgets in a container, it’s easier to call show_all() on the container, instead of individually showing the widgets.

Remember that you have to show the containers containing a widget, in addition to the widget itself, before it will appear onscreen.

When a toplevel container is shown, it is immediately realized and mapped; other shown widgets are realized and mapped when their toplevel container is realized and mapped.

## ◆ show_all()

void Gtk::Widget::show_all | ( |  | ) |

Recursively shows a widget, and any child widgets (if the widget is a container).

## ◆ show_all_vfunc()

virtual void Gtk::Widget::show_all_vfunc | ( |  | ) |
| protectedvirtual

## ◆ show_now()

void Gtk::Widget::show_now | ( |  | ) |

Shows a widget.

If the widget is an unmapped toplevel widget (i.e. a Gtk::Window that has not yet been shown), enter the main loop and wait for the window to actually be mapped. Be careful; because the main loop is running, anything can happen during this function.

## ◆ signal_button_press_event()

Glib::SignalProxy< bool,GdkEventButton* > Gtk::Widget::signal_button_press_event | ( |  | ) |

Event triggered by user pressing button.

Slot Prototype:
  `bool on_my_button_press_event(GdkEventButton* button_event)`

Flags: Run Last

The signal_button_press_event() signal will be emitted when a button (typically from a mouse) is pressed.

To receive this signal, the Gdk::Window associated to the widget needs to enable the Gdk::BUTTON_PRESS_MASK mask.

This signal will be sent to the grab widget if there is one.

Parameters

  button_event | The Gdk::EventButton which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_button_release_event()

Glib::SignalProxy< bool,GdkEventButton* > Gtk::Widget::signal_button_release_event | ( |  | ) |

Event triggered by user releasing button.

Slot Prototype:
  `bool on_my_button_release_event(GdkEventButton* release_event)`

Flags: Run Last

The signal_button_release_event() signal will be emitted when a button (typically from a mouse) is released.

To receive this signal, the Gdk::Window associated to the widget needs to enable the Gdk::BUTTON_RELEASE_MASK mask.

This signal will be sent to the grab widget if there is one.

Parameters

  release_event | The Gdk::EventButton which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_child_notify() [1/2]

Glib::SignalProxy< void,GParamSpec* > Gtk::Widget::signal_child_notify | ( |  | ) |

Slot Prototype:
  `void on_my_child_notify(GParamSpec* pspec)`

Flags: Run First, No Recurse, No Hooks

The signal_child_notify() signal is emitted for each [child property][child-properties] that has changed on an object. The signal's detail holds the property name.

Parameters

  pspec | The GParamSpec of the changed child property.

## ◆ signal_child_notify() [2/2]

Glib::SignalProxyDetailedAnyType< void,GParamSpec* > Gtk::Widget::signal_child_notify | ( | const Glib::ustring & | child_property_name | ) |

Slot Prototype:
  `void on_my_child_notify(GParamSpec* pspec)`

Flags: Run First, No Recurse, No Hooks

The signal_child_notify() signal is emitted for each [child property][child-properties] that has changed on an object. The signal's detail holds the property name.

Parameters

  pspec | The GParamSpec of the changed child property.

## ◆ signal_composited_changed()

Glib::SignalProxy< void > Gtk::Widget::signal_composited_changed | ( |  | ) |

Slot Prototype:
  `void on_my_composited_changed()`

Flags: Run Last, Action

The signal_composited_changed() signal is emitted when the composited status of widgets screen changes. See gdk_screen_is_composited().

Deprecated: 3.22: Use GdkScreen::composited-changed instead.

Deprecated:
  Use Gdk::Screen::signal_composited_changed() instead.

## ◆ signal_configure_event()

Glib::SignalProxy< bool,GdkEventConfigure* > Gtk::Widget::signal_configure_event | ( |  | ) |

Event triggered by a window resizing.

Slot Prototype:
  `bool on_my_configure_event(GdkEventConfigure* configure_event)`

Flags: Run Last

The signal_configure_event() signal will be emitted when the size, position or stacking of the widget's window has changed.

To receive this signal, the Gdk::Window associated to the widget needs to enable the Gdk::STRUCTURE_MASK mask. GDK will enable this mask automatically for all new windows.

Parameters

  configure_event | The Gdk::EventConfigure which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_damage_event()

Glib::SignalProxy< bool,GdkEventExpose* > Gtk::Widget::signal_damage_event | ( |  | ) |

Slot Prototype:
  `bool on_my_damage_event(GdkEventExpose* expose_event)`

Flags: Run Last

Emitted when a redirected window belonging to widget gets drawn into. The region/area members of the event shows what area of the redirected drawable was drawn into.

Since gtkmm 2.14:

Parameters

  expose_event | The Gdk::EventExpose event.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_delete_event()

Glib::SignalProxy< bool,GdkEventAny* > Gtk::Widget::signal_delete_event | ( |  | ) |

Slot Prototype:
  `bool on_my_delete_event(GdkEventAny* any_event)`

Flags: Run Last

The signal_delete_event() signal is emitted if a user requests that a toplevel window is closed. The default handler for this signal destroys the window. Connecting Gtk::Widget::hide_on_delete() to this signal will cause the window to be hidden instead, so that it can later be shown again without reconstructing it.

Parameters

  any_event | The event which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_direction_changed()

Glib::SignalProxy< void,TextDirection > Gtk::Widget::signal_direction_changed | ( |  | ) |

Slot Prototype:
  `void on_my_direction_changed(TextDirection direction)`

Flags: Run First

The signal_direction_changed() signal is emitted when the text direction of a widget changes.

Parameters

  direction | The previous text direction of widget.

## ◆ signal_drag_begin()

Glib::SignalProxy< void,const Glib::RefPtr<Gdk::DragContext>& > Gtk::Widget::signal_drag_begin | ( |  | ) |

Slot Prototype:
  `void on_my_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context)`

Flags: Run Last

The signal_drag_begin() signal is emitted on the drag source when a drag is started. A typical reason to connect to this signal is to set up a custom drag icon with e.g. gtk_drag_source_set_icon_pixbuf().

Note that some widgets set up a drag icon in the default handler of this signal, so you may have to use Glib::signal_connect_after() to override what the default handler did.

Parameters

  context | The drag context.

## ◆ signal_drag_data_delete()

Glib::SignalProxy< void,const Glib::RefPtr<Gdk::DragContext>& > Gtk::Widget::signal_drag_data_delete | ( |  | ) |

Slot Prototype:
  `void on_my_drag_data_delete(const Glib::RefPtr<Gdk::DragContext>& context)`

Flags: Run Last

The signal_drag_data_delete() signal is emitted on the drag source when a drag with the action Gdk::ACTION_MOVE is successfully completed. The signal handler is responsible for deleting the data that has been dropped. What "delete" means depends on the context of the drag operation.

Parameters

  context | The drag context.

## ◆ signal_drag_data_get()

Glib::SignalProxy< void,const Glib::RefPtr<Gdk::DragContext>&,SelectionData&,guint,guint > Gtk::Widget::signal_drag_data_get | ( |  | ) |

Slot Prototype:
  `void on_my_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& context, SelectionData& selection_data, guint info, guint time)`

Flags: Run Last

The signal_drag_data_get() signal is emitted on the drag source when the drop site requests the data which is dragged. It is the responsibility of the signal handler to fill selection_data with the data in the format which is indicated by info. See Gtk::SelectionData::set() and Gtk::SelectionData::set_text().

Parameters

  context | The drag context.
  selection_data | The Gtk::SelectionData to be filled with the dragged data.
  info | The info that has been registered with the target in the Gtk::TargetList.
  time | The timestamp at which the data was requested.

## ◆ signal_drag_data_received()

Glib::SignalProxy< void,const Glib::RefPtr<Gdk::DragContext>&,int,int,const SelectionData&,guint,guint > Gtk::Widget::signal_drag_data_received | ( |  | ) |

Slot Prototype:
  `void on_my_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, const SelectionData& selection_data, guint info, guint time)`

Flags: Run Last

The signal_drag_data_received() signal is emitted on the drop site when the dragged data has been received. If the data was received in order to determine whether the drop will be accepted, the handler is expected to call gdk_drag_status() and not finish the drag. If the data was received in response to a Gtk::Widget::signal_drag_drop() signal (and this is the last target to be received), the handler for this signal is expected to process the received data and then call gtk_drag_finish(), setting the success parameter depending on whether the data was processed successfully.

Applications must create some means to determine why the signal was emitted and therefore whether to call gdk_drag_status() or gtk_drag_finish().

The handler may inspect the selected action with gdk_drag_context_get_selected_action() before calling gtk_drag_finish(), e.g. to implement Gdk::ACTION_ASK as shown in the following example:

[C example ellipted]

Parameters

  context | The drag context.
  x | Where the drop happened.
  y | Where the drop happened.
  selection_data | The received data.
  info | The info that has been registered with the target in the Gtk::TargetList.
  time | The timestamp at which the data was received.

## ◆ signal_drag_drop()

Glib::SignalProxy< bool,const Glib::RefPtr<Gdk::DragContext>&,int,int,guint > Gtk::Widget::signal_drag_drop | ( |  | ) |

Slot Prototype:
  `bool on_my_drag_drop(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint time)`

Flags: Run Last

The signal_drag_drop() signal is emitted on the drop site when the user drops the data onto the widget. The signal handler must determine whether the cursor position is in a drop zone or not. If it is not in a drop zone, it returns `false` and no further processing is necessary. Otherwise, the handler returns `true`. In this case, the handler must ensure that gtk_drag_finish() is called to let the source know that the drop is done. The call to gtk_drag_finish() can be done either directly or in a Gtk::Widget::signal_drag_data_received() handler which gets triggered by calling gtk_drag_get_data() to receive the data for one or more of the supported targets.

Parameters

  context | The drag context.
  x | The x coordinate of the current cursor position.
  y | The y coordinate of the current cursor position.
  time | The timestamp of the motion event.

Returns
  Whether the cursor position is in a drop zone.

## ◆ signal_drag_end()

Glib::SignalProxy< void,const Glib::RefPtr<Gdk::DragContext>& > Gtk::Widget::signal_drag_end | ( |  | ) |

Slot Prototype:
  `void on_my_drag_end(const Glib::RefPtr<Gdk::DragContext>& context)`

Flags: Run Last

The signal_drag_end() signal is emitted on the drag source when a drag is finished. A typical reason to connect to this signal is to undo things done in Gtk::Widget::signal_drag_begin().

Parameters

  context | The drag context.

## ◆ signal_drag_failed()

Glib::SignalProxy< bool,const Glib::RefPtr<Gdk::DragContext>&,DragResult > Gtk::Widget::signal_drag_failed | ( |  | ) |

Slot Prototype:
  `bool on_my_drag_failed(const Glib::RefPtr<Gdk::DragContext>& context, DragResult result)`

Flags: Run Last

The signal_drag_failed() signal is emitted on the drag source when a drag has failed. The signal handler may hook custom code to handle a failed DnD operation based on the type of error, it returns `true` is the failure has been already handled (not showing the default "drag operation failed" animation), otherwise it returns `false`.

Since gtkmm 2.12:

Parameters

  context | The drag context.
  result | The result of the drag operation.

Returns
  `true` if the failed drag operation has been already handled.

## ◆ signal_drag_leave()

Glib::SignalProxy< void,const Glib::RefPtr<Gdk::DragContext>&,guint > Gtk::Widget::signal_drag_leave | ( |  | ) |

Slot Prototype:
  `void on_my_drag_leave(const Glib::RefPtr<Gdk::DragContext>& context, guint time)`

Flags: Run Last

The signal_drag_leave() signal is emitted on the drop site when the cursor leaves the widget. A typical reason to connect to this signal is to undo things done in Gtk::Widget::signal_drag_motion(), e.g. undo highlighting with gtk_drag_unhighlight().

Likewise, the Gtk::Widget::signal_drag_leave() signal is also emitted before the signal_drag_drop() signal, for instance to allow cleaning up of a preview item
created in the Gtk::Widget::signal_drag_motion() signal handler.

Parameters

  context | The drag context.
  time | The timestamp of the motion event.

## ◆ signal_drag_motion()

Glib::SignalProxy< bool,const Glib::RefPtr<Gdk::DragContext>&,int,int,guint > Gtk::Widget::signal_drag_motion | ( |  | ) |

Slot Prototype:
  `bool on_my_drag_motion(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint time)`

Flags: Run Last

The signal_drag_motion() signal is emitted on the drop site when the user moves the cursor over the widget during a drag. The signal handler must determine whether the cursor position is in a drop zone or not. If it is not in a drop zone, it returns `false` and no further processing is necessary. Otherwise, the handler returns `true`. In this case, the handler is responsible for providing the necessary information for displaying feedback to the user, by calling gdk_drag_status().

If the decision whether the drop will be accepted or rejected can't be made based solely on the cursor position and the type of the data, the handler may inspect the dragged data by calling gtk_drag_get_data() and defer the gdk_drag_status() call to the Gtk::Widget::signal_drag_data_received() handler. Note that you must pass Gtk::DEST_DEFAULT_DROP, Gtk::DEST_DEFAULT_MOTION or Gtk::DEST_DEFAULT_ALL to gtk_drag_dest_set() when using the drag-motion signal that way.

Also note that there is no drag-enter signal. The drag receiver has to keep track of whether he has received any drag-motion signals since the last Gtk::Widget::signal_drag_leave() and if not, treat the drag-motion signal as an "enter" signal. Upon an "enter", the handler will typically highlight the drop site with gtk_drag_highlight().

[C example ellipted]

Parameters

  context | The drag context.
  x | The x coordinate of the current cursor position.
  y | The y coordinate of the current cursor position.
  time | The timestamp of the motion event.

Returns
  Whether the cursor position is in a drop zone.

## ◆ signal_draw()

Glib::SignalProxy< bool,const ::Cairo::RefPtr< ::Cairo::Context>& > Gtk::Widget::signal_draw | ( |  | ) |

Slot Prototype:
  `bool on_my_draw(const ::Cairo::RefPtr< ::Cairo::Context>& cr)`

Flags: Run Last

This signal is emitted when a widget is supposed to render itself. The widget's top left corner must be painted at the origin of the passed in context and be sized to the values returned by Gtk::Widget::get_allocated_width() and Gtk::Widget::get_allocated_height().

Signal handlers connected to this signal can modify the cairo context passed as cr in any way they like and don't need to restore it. The signal emission takes care of calling cairo_save() before and cairo_restore() after invoking the handler.

The signal handler will get a cr with a clip region already set to the widget's dirty region, i.e. to the area that needs repainting. Complicated widgets that want to avoid redrawing themselves completely can get the full extents of the clip region with gdk_cairo_get_clip_rectangle(), or they can get a finer-grained representation of the dirty region with cairo_copy_clip_rectangle_list().

Since gtkmm 3.0:

Parameters

  cr | The cairo context to draw to.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_enter_notify_event()

Glib::SignalProxy< bool,GdkEventCrossing* > Gtk::Widget::signal_enter_notify_event | ( |  | ) |

Event triggered by pointer entering widget area.

Slot Prototype:
  `bool on_my_enter_notify_event(GdkEventCrossing* crossing_event)`

Flags: Run Last

The signal_enter_notify_event() will be emitted when the pointer enters the widget's window.

To receive this signal, the Gdk::Window associated to the widget needs to enable the Gdk::ENTER_NOTIFY_MASK mask.

This signal will be sent to the grab widget if there is one.

Parameters

  crossing_event | The Gdk::EventCrossing which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_event()

Glib::SignalProxy< bool,GdkEvent* > Gtk::Widget::signal_event | ( |  | ) |

Slot Prototype:
  `bool on_my_event(GdkEvent* gdk_event)`

Flags: Run Last

The GTK+ main loop will emit three signals for each GDK event delivered to a widget: one generic signal_event() signal, another, more specific, signal that matches the type of event delivered (e.g. Gtk::Widget::signal_key_press_event()) and finally a generic Gtk::Widget::signal_event_after() signal.

Parameters

  gdk_event | The Gdk::Event which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event and to cancel the emission of the second specific signal_event() signal. `false` to propagate the event further and to allow the emission of the second signal. The signal_event_after() signal is emitted regardless of the return value.

## ◆ signal_event_after()

Glib::SignalProxy< void,GdkEvent* > Gtk::Widget::signal_event_after | ( |  | ) |

Slot Prototype:
  `void on_my_event_after(GdkEvent* gdk_event)`

After the emission of the Gtk::Widget::signal_event() signal and (optionally) the second more specific signal, signal_event_after() will be emitted regardless of the previous two signals handlers return values.

Parameters

  gdk_event | The Gdk::Event which triggered this signal.

## ◆ signal_focus()

Glib::SignalProxy< bool,DirectionType > Gtk::Widget::signal_focus | ( |  | ) |

Slot Prototype:
  `bool on_my_focus(DirectionType direction)`

Flags: Run Last

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_focus_in_event()

Glib::SignalProxy< bool,GdkEventFocus* > Gtk::Widget::signal_focus_in_event | ( |  | ) |

Slot Prototype:
  `bool on_my_focus_in_event(GdkEventFocus* focus_event)`

Flags: Run Last

The signal_focus_in_event() signal will be emitted when the keyboard focus enters the widget's window.

To receive this signal, the Gdk::Window associated to the widget needs to enable the Gdk::FOCUS_CHANGE_MASK mask.

Parameters

  focus_event | The Gdk::EventFocus which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_focus_out_event()

Glib::SignalProxy< bool,GdkEventFocus* > Gtk::Widget::signal_focus_out_event | ( |  | ) |

Slot Prototype:
  `bool on_my_focus_out_event(GdkEventFocus* gdk_event)`

Flags: Run Last

The signal_focus_out_event() signal will be emitted when the keyboard focus leaves the widget's window.

To receive this signal, the Gdk::Window associated to the widget needs to enable the Gdk::FOCUS_CHANGE_MASK mask.

Parameters

  gdk_event | The Gdk::EventFocus which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_grab_broken_event()

Glib::SignalProxy< bool,GdkEventGrabBroken* > Gtk::Widget::signal_grab_broken_event | ( |  | ) |

Slot Prototype:
  `bool on_my_grab_broken_event(GdkEventGrabBroken* grab_broken_event)`

Flags: Run Last

Emitted when a pointer or keyboard grab on a window belonging to widget gets broken.

On X11, this happens when the grab window becomes unviewable (i.e. it or one of its ancestors is unmapped), or if the same application grabs the pointer or keyboard again.

Since gtkmm 2.8:

Parameters

  grab_broken_event | The Gdk::EventGrabBroken event.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_grab_focus()

Glib::SignalProxy< void > Gtk::Widget::signal_grab_focus | ( |  | ) |

Slot Prototype:
  `void on_my_grab_focus()`

Flags: Run Last, Action

## ◆ signal_grab_notify()

Glib::SignalProxy< void,bool > Gtk::Widget::signal_grab_notify | ( |  | ) |

Slot Prototype:
  `void on_my_grab_notify(bool was_grabbed)`

Flags: Run First

The signal_grab_notify() signal is emitted when a widget becomes shadowed by a GTK+ grab (not a pointer or keyboard grab) on another widget, or when it becomes unshadowed due to a grab being removed.

A widget is shadowed by a gtk_grab_add() when the topmost grab widget in the grab stack of its window group is not its ancestor.

Parameters

  was_grabbed | `false` if the widget becomes shadowed, `true` if it becomes unshadowed.

## ◆ signal_hide()

Glib::SignalProxy< void > Gtk::Widget::signal_hide | ( |  | ) |

Slot Prototype:
  `void on_my_hide()`

Flags: Run First

The signal_hide() signal is emitted when widget is hidden, for example with Gtk::Widget::hide().

## ◆ signal_hierarchy_changed()

Glib::SignalProxy< void,Widget* > Gtk::Widget::signal_hierarchy_changed | ( |  | ) |

Slot Prototype:
  `void on_my_hierarchy_changed(Widget* previous_toplevel)`

Flags: Run Last

The signal_hierarchy_changed() signal is emitted when the anchored state of a widget changes. A widget is “anchored” when its toplevel ancestor is a Gtk::Window. This signal is emitted when a widget changes from un-anchored to anchored or vice-versa.

Parameters

  previous_toplevel | The previous toplevel ancestor, or `nullptr` if the widget was previously unanchored.

## ◆ signal_key_press_event()

Glib::SignalProxy< bool,GdkEventKey* > Gtk::Widget::signal_key_press_event | ( |  | ) |

Event triggered by a key press will widget has focus.

Slot Prototype:
  `bool on_my_key_press_event(GdkEventKey* key_event)`

Flags: Run Last

The signal_key_press_event() signal is emitted when a key is pressed. The signal emission will reoccur at the key-repeat rate when the key is kept pressed.

To receive this signal, the Gdk::Window associated to the widget needs to enable the Gdk::KEY_PRESS_MASK mask.

This signal will be sent to the grab widget if there is one.

Parameters

  key_event | The Gdk::EventKey which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_key_release_event()

Glib::SignalProxy< bool,GdkEventKey* > Gtk::Widget::signal_key_release_event | ( |  | ) |

Event triggered by a key release will widget has focus.

Slot Prototype:
  `bool on_my_key_release_event(GdkEventKey* key_event)`

Flags: Run Last

The signal_key_release_event() signal is emitted when a key is released.

To receive this signal, the Gdk::Window associated to the widget needs to enable the Gdk::KEY_RELEASE_MASK mask.

This signal will be sent to the grab widget if there is one.

Parameters

  key_event | The Gdk::EventKey which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_leave_notify_event()

Glib::SignalProxy< bool,GdkEventCrossing* > Gtk::Widget::signal_leave_notify_event | ( |  | ) |

Event triggered by pointer leaving widget area.

Slot Prototype:
  `bool on_my_leave_notify_event(GdkEventCrossing* crossing_event)`

Flags: Run Last

The signal_leave_notify_event() will be emitted when the pointer leaves the widget's window.

To receive this signal, the Gdk::Window associated to the widget needs to enable the Gdk::LEAVE_NOTIFY_MASK mask.

This signal will be sent to the grab widget if there is one.

Parameters

  crossing_event | The Gdk::EventCrossing which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_map()

Glib::SignalProxy< void > Gtk::Widget::signal_map | ( |  | ) |

Emitted on mapping of a widget to the screen.

Slot Prototype:
  `void on_my_map()`

Flags: Run First

The signal_map() signal is emitted when widget is going to be mapped, that is when the widget is visible (which is controlled with Gtk::Widget::set_visible()) and all its parents up to the toplevel widget are also visible. Once the map has occurred, Gtk::Widget::signal_map_event() will be emitted.

The signal_map() signal can be used to determine whether a widget will be drawn, for instance it can resume an animation that was stopped during the emission of Gtk::Widget::signal_unmap().

## ◆ signal_map_event()

Glib::SignalProxy< bool,GdkEventAny* > Gtk::Widget::signal_map_event | ( |  | ) |

Slot Prototype:
  `bool on_my_map_event(GdkEventAny* any_event)`

Flags: Run Last

The signal_map_event() signal will be emitted when the widget's window is mapped. A window is mapped when it becomes visible on the screen.

To receive this signal, the Gdk::Window associated to the widget needs to enable the Gdk::STRUCTURE_MASK mask. GDK will enable this mask automatically for all new windows.

Parameters

  any_event | The Gdk::EventAny which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_mnemonic_activate()

Glib::SignalProxy< bool,bool > Gtk::Widget::signal_mnemonic_activate | ( |  | ) |

Slot Prototype:
  `bool on_my_mnemonic_activate(bool group_cycling)`

Flags: Run Last

The default handler for this signal activates widget if group_cycling is `false`, or just makes widget grab focus if group_cycling is `true`.

Parameters

  group_cycling | `true` if there are other widgets with the same mnemonic.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_motion_notify_event()

Glib::SignalProxy< bool,GdkEventMotion* > Gtk::Widget::signal_motion_notify_event | ( |  | ) |

Event triggered by user moving pointer.

Slot Prototype:
  `bool on_my_motion_notify_event(GdkEventMotion* motion_event)`

Flags: Run Last

The signal_motion_notify_event() signal is emitted when the pointer moves over the widget's Gdk::Window.

To receive this signal, the Gdk::Window associated to the widget needs to enable the Gdk::POINTER_MOTION_MASK mask.

This signal will be sent to the grab widget if there is one.

Parameters

  motion_event | The Gdk::EventMotion which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_parent_changed()

Glib::SignalProxy< void,Widget* > Gtk::Widget::signal_parent_changed | ( |  | ) |

Informs objects that their parent changed.

Slot Prototype:
  `void on_my_parent_changed(Widget* previous_parent)`

Flags: Run First

The signal_parent_set() signal is emitted when a new parent has been set on a widget.

Parameters

  previous_parent | The previous parent, or `nullptr` if the widget just got its initial parent.

## ◆ signal_popup_menu()

Glib::SignalProxy< bool > Gtk::Widget::signal_popup_menu | ( |  | ) |

Slot Prototype:
  `bool on_my_popup_menu()`

Flags: Run Last, Action

This signal gets emitted whenever a widget should pop up a context menu. This usually happens through the standard key binding mechanism; by pressing a certain key while a widget is focused, the user can cause the widget to pop up a menu. For example, the Gtk::Entry widget creates a menu with clipboard commands. See the [Popup Menu Migration Checklist][checklist-popup-menu] for an example of how to use this signal.

Returns
  `true` if a menu was activated.

## ◆ signal_property_notify_event()

Glib::SignalProxy< bool,GdkEventProperty* > Gtk::Widget::signal_property_notify_event | ( |  | ) |

Slot Prototype:
  `bool on_my_property_notify_event(GdkEventProperty* property_event)`

Flags: Run Last

The signal_property_notify_event() signal will be emitted when a property on the widget's window has been changed or deleted.

To receive this signal, the Gdk::Window associated to the widget needs to enable the Gdk::PROPERTY_CHANGE_MASK mask.

Parameters

  property_event | The Gdk::EventProperty which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_proximity_in_event()

Glib::SignalProxy< bool,GdkEventProximity* > Gtk::Widget::signal_proximity_in_event | ( |  | ) |

Slot Prototype:
  `bool on_my_proximity_in_event(GdkEventProximity* proximity_event)`

Flags: Run Last

To receive this signal the Gdk::Window associated to the widget needs to enable the Gdk::PROXIMITY_IN_MASK mask.

This signal will be sent to the grab widget if there is one.

Parameters

  proximity_event | The Gdk::EventProximity which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_proximity_out_event()

Glib::SignalProxy< bool,GdkEventProximity* > Gtk::Widget::signal_proximity_out_event | ( |  | ) |

Slot Prototype:
  `bool on_my_proximity_out_event(GdkEventProximity* proximity_event)`

Flags: Run Last

To receive this signal the Gdk::Window associated to the widget needs to enable the Gdk::PROXIMITY_OUT_MASK mask.

This signal will be sent to the grab widget if there is one.

Parameters

  proximity_event | The Gdk::EventProximity which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_query_tooltip()

Glib::SignalProxy< bool,int,int,bool,const Glib::RefPtr<Tooltip>& > Gtk::Widget::signal_query_tooltip | ( |  | ) |

Slot Prototype:
  `bool on_my_query_tooltip(int x, int y, bool keyboard_tooltip, const Glib::RefPtr<Tooltip>& tooltip)`

Flags: Run Last

Emitted when Gtk::Widget::property_has_tooltip() is `true` and the hover timeout has expired with the cursor hovering "above" widget; or emitted when widget got focus in keyboard mode.

Using the given coordinates, the signal handler should determine whether a tooltip should be shown for widget. If this is the case `true` should be returned, `false` otherwise. Note that if keyboard_tooltip is `true`, the values of x and y are undefined and should not be used.

The signal handler is free to manipulate tooltip with the therefore destined function calls.

Since gtkmm 2.12:

Parameters

  x | The x coordinate of the cursor position where the request has been emitted, relative to widget's left side.
  y | The y coordinate of the cursor position where the request has been emitted, relative to widget's top.
  keyboard_tooltip | `true` if the tooltip was triggered using the keyboard.
  tooltip | A Gtk::Tooltip.

Returns
  `true` if tooltip should be shown right now, `false` otherwise.

## ◆ signal_realize()

Glib::SignalProxy< void > Gtk::Widget::signal_realize | ( |  | ) |

Emitted on realization of a widget.

Slot Prototype:
  `void on_my_realize()`

Flags: Run First

The signal_realize() signal is emitted when widget is associated with a Gdk::Window, which means that Gtk::Widget::realize() has been called or the widget has been mapped (that is, it is going to be drawn).

## ◆ signal_screen_changed()

Glib::SignalProxy< void,const Glib::RefPtr<Gdk::Screen>& > Gtk::Widget::signal_screen_changed | ( |  | ) |

Slot Prototype:
  `void on_my_screen_changed(const Glib::RefPtr<Gdk::Screen>& previous_screen)`

Flags: Run Last

The signal_screen_changed() signal gets emitted when the screen of a widget has changed.

Parameters

  previous_screen | The previous screen, or `nullptr` if the widget was not associated with a screen before.

## ◆ signal_scroll_event()

Glib::SignalProxy< bool,GdkEventScroll* > Gtk::Widget::signal_scroll_event | ( |  | ) |

Slot Prototype:
  `bool on_my_scroll_event(GdkEventScroll* scroll_event)`

Flags: Run Last

The signal_scroll_event() signal is emitted when a button in the 4 to 7 range is pressed. Wheel mice are usually configured to generate button press events for buttons 4 and 5 when the wheel is turned.

To receive this signal, the Gdk::Window associated to the widget needs to enable the Gdk::SCROLL_MASK mask.

This signal will be sent to the grab widget if there is one.

Parameters

  scroll_event | The Gdk::EventScroll which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_selection_clear_event()

Glib::SignalProxy< bool,GdkEventSelection* > Gtk::Widget::signal_selection_clear_event | ( |  | ) |

Slot Prototype:
  `bool on_my_selection_clear_event(GdkEventSelection* selection_event)`

Flags: Run Last

The signal_selection_clear_event() signal will be emitted when the the widget's window has lost ownership of a selection.

Parameters

  selection_event | The Gdk::EventSelection which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_selection_get()

Glib::SignalProxy< void,SelectionData&,guint,guint > Gtk::Widget::signal_selection_get | ( |  | ) |

Slot Prototype:
  `void on_my_selection_get(SelectionData& selection_data, guint info, guint time)`

Flags: Run Last

## ◆ signal_selection_notify_event()

Glib::SignalProxy< bool,GdkEventSelection* > Gtk::Widget::signal_selection_notify_event | ( |  | ) |

Slot Prototype:
  `bool on_my_selection_notify_event(GdkEventSelection* selection_event)`

Flags: Run Last

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_selection_received()

Glib::SignalProxy< void,const SelectionData&,guint > Gtk::Widget::signal_selection_received | ( |  | ) |

Slot Prototype:
  `void on_my_selection_received(const SelectionData& selection_data, guint time)`

Flags: Run Last

## ◆ signal_selection_request_event()

Glib::SignalProxy< bool,GdkEventSelection* > Gtk::Widget::signal_selection_request_event | ( |  | ) |

Slot Prototype:
  `bool on_my_selection_request_event(GdkEventSelection* selection_event)`

Flags: Run Last

The signal_selection_request_event() signal will be emitted when another client requests ownership of the selection owned by the widget's window.

Parameters

  selection_event | The Gdk::EventSelection which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_show()

Glib::SignalProxy< void > Gtk::Widget::signal_show | ( |  | ) |

Slot Prototype:
  `void on_my_show()`

Flags: Run First

The signal_show() signal is emitted when widget is shown, for example with Gtk::Widget::show().

## ◆ signal_size_allocate()

Glib::SignalProxy< void,Allocation& > Gtk::Widget::signal_size_allocate | ( |  | ) |

Slot Prototype:
  `void on_my_size_allocate(Allocation& allocation)`

Flags: Run First

Parameters

  allocation | The region which has been allocated to the widget.

## ◆ signal_state_changed()

Glib::SignalProxy< void,Gtk::StateType > Gtk::Widget::signal_state_changed | ( |  | ) |

Slot Prototype:
  `void on_my_state_changed(Gtk::StateType previous_state)`

Flags: Run First

The signal_state_changed() signal is emitted when the widget state changes. See Gtk::Widget::get_state().

Deprecated: 3.0: Use Gtk::Widget::signal_state_flags_changed() instead.

Deprecated:
  Use signal_state_flags_changed() instead.

Parameters

  previous_state | The previous state.

## ◆ signal_state_flags_changed()

Glib::SignalProxy< void,Gtk::StateFlags > Gtk::Widget::signal_state_flags_changed | ( |  | ) |

Slot Prototype:
  `void on_my_state_flags_changed(Gtk::StateFlags previous_state_flags)`

Flags: Run First

The signal_state_flags_changed() signal is emitted when the widget state changes, see Gtk::Widget::get_state_flags().

Since gtkmm 3.0:

Parameters

  previous_state_flags | The previous state flags.

## ◆ signal_style_updated()

Glib::SignalProxy< void > Gtk::Widget::signal_style_updated | ( |  | ) |

Slot Prototype:
  `void on_my_style_updated()`

Flags: Run First

The signal_style_updated() signal is a convenience signal that is emitted when the Gtk::StyleContext::signal_changed() signal is emitted on the widget's associated Gtk::StyleContext as returned by Gtk::Widget::get_style_context().

Note that style-modifying functions like Gtk::Widget::override_color() also cause this signal to be emitted.

Since gtkmm 3.0:

## ◆ signal_touch_event()

Glib::SignalProxy< bool,GdkEventTouch* > Gtk::Widget::signal_touch_event | ( |  | ) |

Slot Prototype:
  `bool on_my_touch_event(GdkEventTouch* touch_event)`

Flags: Run Last

## ◆ signal_unmap()

Glib::SignalProxy< void > Gtk::Widget::signal_unmap | ( |  | ) |

Slot Prototype:
  `void on_my_unmap()`

Flags: Run First

The signal_unmap() signal is emitted when widget is going to be unmapped, which means that either it or any of its parents up to the toplevel widget have been set as hidden.

As signal_unmap() indicates that a widget will not be shown any longer, it can be used to, for example, stop an animation on the widget.

## ◆ signal_unmap_event()

Glib::SignalProxy< bool,GdkEventAny* > Gtk::Widget::signal_unmap_event | ( |  | ) |

Slot Prototype:
  `bool on_my_unmap_event(GdkEventAny* any_event)`

Flags: Run Last

The signal_unmap_event() signal will be emitted when the widget's window is unmapped. A window is unmapped when it becomes invisible on the screen.

To receive this signal, the Gdk::Window associated to the widget needs to enable the Gdk::STRUCTURE_MASK mask. GDK will enable this mask automatically for all new windows.

Parameters

  any_event | The Gdk::EventAny which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_unrealize()

Glib::SignalProxy< void > Gtk::Widget::signal_unrealize | ( |  | ) |

Slot Prototype:
  `void on_my_unrealize()`

Flags: Run Last

The signal_unrealize() signal is emitted when the Gdk::Window associated with widget is destroyed, which means that Gtk::Widget::unrealize() has been called or the widget has been unmapped (that is, it is going to be hidden).

## ◆ signal_visibility_notify_event()

Glib::SignalProxy< bool,GdkEventVisibility* > Gtk::Widget::signal_visibility_notify_event | ( |  | ) |

Slot Prototype:
  `bool on_my_visibility_notify_event(GdkEventVisibility* visibility_event)`

Flags: Run Last

The signal_visibility_notify_event() will be emitted when the widget's window is obscured or unobscured.

To receive this signal the Gdk::Window associated to the widget needs to enable the Gdk::VISIBILITY_NOTIFY_MASK mask.

Deprecated: 3.12: Modern composited windowing systems with pervasive transparency make it impossible to track the visibility of a window reliably, so this signal can not be guaranteed to provide useful information.

Deprecated:
  Modern composited windowing systems with pervasive transparency make it impossible to track the visibility of a window reliably, so this signal can not be guaranteed to provide useful information.

Parameters

  visibility_event | The Gdk::EventVisibility which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ signal_window_state_event()

Glib::SignalProxy< bool,GdkEventWindowState* > Gtk::Widget::signal_window_state_event | ( |  | ) |

Slot Prototype:
  `bool on_my_window_state_event(GdkEventWindowState* window_state_event)`

Flags: Run Last

The signal_window_state_event() will be emitted when the state of the toplevel window associated to the widget changes.

To receive this signal the Gdk::Window associated to the widget needs to enable the Gdk::STRUCTURE_MASK mask. GDK will enable this mask automatically for all new windows.

Parameters

  window_state_event | The Gdk::EventWindowState which triggered this signal.

Returns
  `true` to stop other handlers from being invoked for the event. `false` to propagate the event further.

## ◆ size_allocate() [1/2]

void Gtk::Widget::size_allocate | ( | const Allocation& | allocation | ) |

This function is only used by Gtk::Container subclasses, to assign a size and position to their child widgets.

In this function, the allocation may be adjusted. It will be forced to a 1x1 minimum size, and the adjust_size_allocation virtual method on the child will be used to adjust the allocation. Standard adjustments include removing the widget’s margins, and applying the widget’s Gtk::Widget::property_halign() and Gtk::Widget::property_valign() properties.

For baseline support in containers you need to use size_allocate_with_baseline() instead.

Parameters

  allocation | Position and size to be allocated to widget.

## ◆ size_allocate() [2/2]

void Gtk::Widget::size_allocate | ( | const Allocation& | allocation,
|  | int | baseline
| ) |  |

This function is only used by Gtk::Container subclasses, to assign a size, position and (optionally) baseline to their child widgets.

In this function, the allocation and baseline may be adjusted. It will be forced to a 1x1 minimum size, and the adjust_size_allocation virtual and adjust_baseline_allocation methods on the child will be used to adjust the allocation and baseline. Standard adjustments include removing the widget's margins, and applying the widget’s Gtk::Widget::property_halign() and Gtk::Widget::property_valign() properties.

If the child widget does not have a valign of Gtk::ALIGN_BASELINE the baseline argument is ignored and -1 is used instead.

Since gtkmm 3.10:

Parameters

  allocation | Position and size to be allocated to widget.
  baseline | The baseline of the child, or -1.

## ◆ thaw_child_notify()

void Gtk::Widget::thaw_child_notify | ( |  | ) |

Reverts the effect of a previous call to freeze_child_notify().

This causes all queued Gtk::Widget::signal_child_notify() signals on widget to be emitted.

## ◆ transform_cairo_context_to_window()

void Gtk::Widget::transform_cairo_context_to_window | ( | const ::Cairo::RefPtr< ::Cairo::Context > & | cr,
|  | const Glib::RefPtr< const Gdk::Window >& | window
| ) |  |
| protected

Transforms the given cairo context cr from widget-relative coordinates to window-relative coordinates.

If the widget's window is not an ancestor of window, no modification will be applied.

This is the inverse to the transformation GTK applies when preparing an expose event to be emitted with the Widget's draw signal. It is intended to help porting multiwindow widgets from GTK+ 2 to the rendering architecture of GTK+ 3.

Parameters

  cr | The cairo context to transform.
  window | The window to transform the context to.

Since gtkmm 3.0:

## ◆ translate_coordinates()

bool Gtk::Widget::translate_coordinates | ( | Widget& | dest_widget,
|  | int | src_x,
|  | int | src_y,
|  | int & | dest_x,
|  | int & | dest_y
| ) |  |

Translate coordinates relative to src_widget’s allocation to coordinates relative to dest_widget’s allocations.

In order to perform this operation, both widgets must be realized, and must share a common toplevel.

Parameters

  dest_widget | A Gtk::Widget.
  src_x | X position relative to src_widget.
  src_y | Y position relative to src_widget.
  dest_x | Location to store X position relative to dest_widget.
  dest_y | Location to store Y position relative to dest_widget.

Returns
  `false` if either widget was not realized, or there was no common ancestor. In this case, nothing is stored in
  - dest_x and * dest_y. Otherwise `true`.

## ◆ trigger_tooltip_query()

void Gtk::Widget::trigger_tooltip_query | ( |  | ) |

Triggers a tooltip query on the display where the toplevel of widget is located.

See Gtk::Tooltip::trigger_tooltip_query() for more information.

Since gtkmm 2.12:

## ◆ unmap()

void Gtk::Widget::unmap | ( |  | ) |

This function is only for use in widget implementations.

Causes a widget to be unmapped if it’s currently mapped.

## ◆ unparent()

void Gtk::Widget::unparent | ( |  | ) |

This function is only for use in widget implementations.

Should be called by implementations of the remove method on Gtk::Container, to dissociate a child from the container.

## ◆ unrealize()

void Gtk::Widget::unrealize | ( |  | ) |
| protected

This function is only useful in widget implementations.

Causes a widget to be unrealized (frees all GDK resources associated with the widget, such as widget->window).

## ◆ unregister_window()

void Gtk::Widget::unregister_window | ( | const Glib::RefPtr< Gdk::Window >& | window | ) |

Unregisters a Gdk::Window from the widget that was previously set up with register_window().

You need to call this when the window is no longer used by the widget, such as when you destroy it.

Since gtkmm 3.8:

Parameters

  window | A Gdk::Window.

## ◆ unset_background_color()

void Gtk::Widget::unset_background_color | ( | StateFlags | state = `STATE_FLAG_NORMAL` | ) |

Undoes the effect of previous calls to override_background_color().

Since gtkmm 3.0:

Deprecated:
  Use a custom style provider and style classes instead.

Parameters

  state | The state for which to use the background color of the user's theme.

## ◆ unset_color()

void Gtk::Widget::unset_color | ( | StateFlags | state = `STATE_FLAG_NORMAL` | ) |

Undoes the effect of previous calls to override_color().

Since gtkmm 3.0:

Deprecated:
  Use a custom style provider and style classes instead.

Parameters

  state | The state for which to use the color of the user's theme.

## ◆ unset_composite_name()

void Gtk::Widget::unset_composite_name | ( |  | ) |

Deprecated:
  Use gtk_widget_class_set_template(), or don't use this API at all.

## ◆ unset_cursor()

void Gtk::Widget::unset_cursor | ( |  | ) |

Undoes the effect of previous calls to override_cursor().

Since gtkmm 3.0:

Deprecated:
  Use a custom style provider and style classes instead.

## ◆ unset_font()

void Gtk::Widget::unset_font | ( |  | ) |

Undoes the effect of previous calls to override_font().

Since gtkmm 3.0:

Deprecated:
  Use a custom style provider and style classes instead.

## ◆ unset_font_options()

void Gtk::Widget::unset_font_options | ( |  | ) |

Undoes the effect of previous calls to set_font_options().

Since gtkmm 3.20:

## ◆ unset_name()

void Gtk::Widget::unset_name | ( |  | ) |

## ◆ unset_state_flags()

void Gtk::Widget::unset_state_flags | ( | StateFlags | flags | ) |

This function is for use in widget implementations.

Turns off flag values for the current widget state (insensitive, prelighted, etc.). See set_state_flags().

Since gtkmm 3.0:

Parameters

  flags | State flags to turn off.

## ◆ unset_symbolic_color()

void Gtk::Widget::unset_symbolic_color | ( | const Glib::ustring & | name | ) |

Undoes the effect of previous calls to override_symbolic_color().

Since gtkmm 3.0:

Deprecated:
  Use a custom style provider and style classes instead.

Parameters

  name | The name of the symbolic color to fetch from the user's theme.

## Friends And Related Function Documentation

## ◆ wrap()

Gtk::Widget* wrap | ( | GtkWidget * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.

Glib::RefPtr