gtkmm  3.95.1
Public Types | Public Member Functions | Static Public Member Functions | 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:
Inheritance graph
[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 Types inherited from sigc::notifiable
typedef internal::func_destroy_notify func_destroy_notify
 

Public Member Functions

 Widget (Widget&& src) noexcept
 
Widgetoperator= (Widget&& src) noexcept
 
 Widget (const Widget&)=delete
 
Widgetoperator= (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 hide ()
 Reverses the effects of show(), causing the widget to be hidden (invisible to the user). More...
 
void queue_draw ()
 Schedules this widget to be redrawn in paint phase of the current or the next frame. 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, int baseline)
 This is a simple form of allocate() that takes the new position of widget as part of allocation. More...
 
SizeRequestMode get_request_mode () const
 Gets whether the widget prefers a height-for-width layout or a width-for-height layout. More...
 
void measure (Orientation orientation, int for_size, int& minimum, int& natural, int& minimum_baseline, int& natural_baseline) const
 Measures widget in the orientation orientation and for the given for_size. 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 set_layout_manager (const Glib::RefPtr< LayoutManager >& layout_manager)
 Sets the layout manager delegate instance that provides an implementation for measuring and allocating the children of widget. More...
 
void unset_layout_manager ()
 Undoes the effect of a previous call to set_layout_manager(). More...
 
Glib::RefPtr< LayoutManagerget_layout_manager ()
 Retrieves the layout manager set using set_layout_manager(). More...
 
Glib::RefPtr< const LayoutManagerget_layout_manager () const
 Retrieves the layout manager set using set_layout_manager(). 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 (const Glib::RefPtr< const Gdk::Event >& gdk_event)
 Rarely-used function. More...
 
bool activate ()
 For widgets that can be “activated” (buttons, menu items, etc.) this function activates them. More...
 
void reparent (Container& new_parent)
 Moves a widget from one Gtk::Container to another, handling reference count issues to avoid destroying the widget. 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 (or one of its descendents) 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_target (bool can_target=true)
 Sets whether widget can be the target of pointer events. More...
 
bool get_can_target () const
 Queries whether widget can be the target of pointer events. More...
 
bool has_default () const
 Determines whether widget is the current default widget within its toplevel. 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_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_surface () const
 Determines whether widget has a Gdk::Surface 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_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::Surfaceget_surface ()
 Returns the widget’s surface if it is realized, nullptr otherwise. More...
 
Glib::RefPtr< const Gdk::Surfaceget_surface () const
 Returns the widget’s surface if it is realized, nullptr otherwise. More...
 
void register_surface (const Glib::RefPtr< Gdk::Surface >& surface)
 Registers a Gdk::Surface with the widget and sets it up so that the widget receives events for it. More...
 
void unregister_surface (const Glib::RefPtr< Gdk::Surface >& surface)
 Unregisters a Gdk::Surface from the widget that was previously set up with register_surface(). 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...
 
Allocation get_allocation () const
 Retrieves the widget's location. More...
 
int get_width () const
 Returns the content width of the widget, as passed to its size-allocate implementation. More...
 
int get_height () const
 Returns the content height of the widget, as passed to its size-allocate implementation. More...
 
Containerget_parent ()
 Returns the parent widget of widget. More...
 
const Containerget_parent () const
 Returns the parent widget of widget. More...
 
Rootget_root ()
 Returns the Gtk::Root widget of widget or nullptr if the widget is not contained inside a widget tree with a root widget. More...
 
const Rootget_root () const
 Returns the Gtk::Root widget of widget or nullptr if the widget is not contained inside a widget tree with a root 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. 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_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_overflow (Overflow overflow)
 Sets how widget treats content that is drawn outside the widget's content area. More...
 
Overflow get_overflow () const
 Returns the value set via set_overflow(). More...
 
Containerget_toplevel ()
 This function returns the topmost widget in the container hierarchy widget is a part of. More...
 
const Containerget_toplevel () const
 This function returns the topmost widget in the container hierarchy widget is a part of. More...
 
Widgetget_ancestor (GType widget_type)
 Gets the first ancestor of widget with type widget_type. More...
 
const Widgetget_ancestor (GType widget_type) const
 Gets the first ancestor of widget with type widget_type. 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::Displayget_display ()
 Get the Gdk::Display for the toplevel window associated with this widget. More...
 
Glib::RefPtr< const Gdk::Displayget_display () const
 Get the Gdk::Display for the toplevel window associated with this widget. More...
 
Glib::RefPtr< Settingsget_settings ()
 Gets the settings object holding the settings used for this widget. More...
 
Glib::RefPtr< Gdk::Clipboardget_clipboard ()
 This is a utility function to get the clipboard object for the Gdk::Display that widget is using. More...
 
Glib::RefPtr< const Gdk::Clipboardget_clipboard () const
 This is a utility function to get the clipboard object for the Gdk::Display that widget is using. More...
 
Glib::RefPtr< Gdk::Clipboardget_primary_clipboard ()
 This is a utility function to get the primary clipboard object for the Gdk::Display that widget is using. More...
 
Glib::RefPtr< const Gdk::Clipboardget_primary_clipboard () const
 This is a utility function to get the primary clipboard object for the Gdk::Display that widget is using. 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...
 
void set_expand (bool expand=true)
 Sets whether the widget would like any available extra space in both directions. 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::Objectget_accessible ()
 Returns the accessible object that describes the widget to an assistive technology. More...
 
Glib::RefPtr< const Atk::Objectget_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...
 
void set_valign (Align align)
 Sets the vertical alignment 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...
 
void set_margin (int margin)
 Set all 4 margins to the same value. 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...
 
bool contains (double x, double y) const
 Tests if the point at ( x, y) is contained in widget. More...
 
Widgetpick (double x, double y, PickFlags flags=PickFlags::DEFAULT)
 Finds the descendant of widget (including widget itself) closest to the screen at the point ( x, y). More...
 
const Widgetpick (double x, double y, PickFlags flags=PickFlags::DEFAULT) const
 Finds the descendant of widget (including widget itself) closest to the screen at the point ( x, y). More...
 
void add_controller (const Glib::RefPtr< EventController >& controller)
 Adds controller to widget so that it will receive events. More...
 
void remove_controller (const Glib::RefPtr< EventController >& controller)
 Removes controller from widget, so that it doesn't process events anymore. More...
 
void reset_style ()
 Updates the style context of widget and all descendants by updating its widget path. More...
 
Glib::RefPtr< Pango::Contextcreate_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::Contextget_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::Layoutcreate_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...
 
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 input_shape_combine_region (const Cairo::RefPtr< const Cairo::Region >& region)
 Sets an input shape for this widget’s GDK surface. More...
 
void set_cursor (const Glib::RefPtr< Gdk::Cursor >& cursor)
 Sets the cursor to be shown when pointer devices point towards widget. More...
 
void set_cursor (const Glib::ustring& name={})
 Sets a named cursor to be shown when pointer devices point towards the widget. More...
 
Glib::RefPtr< Gdk::Cursorget_cursor ()
 Queries the cursor set via set_cursor(). More...
 
Glib::RefPtr< const Gdk::Cursorget_cursor () const
 Queries the cursor set via set_cursor(). 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::Drop >& drop, const Glib::ustring& target)
 Gets the data associated with a drag. More...
 
void drag_highlight ()
 Highlights a widget as a currently hovered drop target. More...
 
void drag_unhighlight ()
 Removes a highlight set by gtk_drag_highlight() from a widget. More...
 
void drag_dest_set (DestDefaults flags=DestDefaults(0), Gdk::DragAction actions=Gdk::DragAction(0))
 Sets a widget as a potential drop destination, and adds default behaviors. More...
 
void drag_dest_set (const Glib::RefPtr< Gdk::ContentFormats >& targets, DestDefaults flags=DestDefaults::ALL, Gdk::DragAction actions=Gdk::DragAction::COPY)
 Sets a widget as a potential drop destination, and adds default behaviors. 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::Drop >& drop, const Glib::RefPtr< Gdk::ContentFormats >& target_list={}) const
 Looks for a match between the supported targets of drop and the target_list, returning the first matching target, otherwise returning an empty string. More...
 
Glib::RefPtr< Gdk::ContentFormatsdrag_dest_get_target_list ()
 Returns the list of targets this widget can accept from drag-and-drop. More...
 
Glib::RefPtr< const Gdk::ContentFormatsdrag_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< Gdk::ContentFormats >& 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_dest_set_track_motion (bool track_motion=true)
 Tells the widget to emit Gtk::Widget::signal_drag_motion() and Gtk::Widget::signal_drag_leave() events regardless of the targets and the Gtk::DestDefaults::MOTION flag. More...
 
bool drag_dest_get_track_motion () const
 Returns whether the widget has been configured to always emit Gtk::Widget::signal_drag_motion() signals. More...
 
void drag_source_set (const Glib::RefPtr< Gdk::ContentFormats >& targets, Gdk::ModifierType start_button_mask=Gdk::ModifierType::MODIFIER_MASK, Gdk::DragAction actions=Gdk::DragAction::COPY)
 Sets up a widget so that GTK+ will start a drag operation when the user clicks and drags on the widget. More...
 
void drag_source_unset ()
 Undoes the effects of gtk_drag_source_set(). More...
 
Glib::RefPtr< Gdk::ContentFormatsdrag_source_get_target_list ()
 Gets the list of targets this widget can provide for drag-and-drop. More...
 
Glib::RefPtr< const Gdk::ContentFormatsdrag_source_get_target_list () const
 Gets the list of targets this widget can provide for drag-and-drop. More...
 
void drag_source_set_target_list (const Glib::RefPtr< Gdk::ContentFormats >& target_list)
 Changes the target types that this widget offers for drag-and-drop. 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_set_icon (const Glib::RefPtr< Gio::Icon >& icon)
 Sets the icon that will be used for drags from a particular source to icon. More...
 
void drag_source_set_icon (const Glib::RefPtr< Gdk::Paintable >& paintable)
 Sets the icon that will be used for drags from a particular source to paintable. 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::Dragdrag_begin (const Glib::RefPtr< Gdk::Device >& device, const Glib::RefPtr< Gdk::ContentFormats >& targets, Gdk::DragAction actions, int x, int y)
 Initiates a drag on the source side. More...
 
bool drag_check_threshold (int start_x, int start_y, int current_x, int current_y)
 Checks to see if a mouse drag starting at ( start_x, start_y) and ending at ( current_x, current_y) has passed the GTK+ drag threshold, and thus should trigger the beginning of a drag-and-drop operation. More...
 
void queue_resize_no_redraw ()
 This function works like queue_resize(), except that the widget is not invalidated. More...
 
Glib::RefPtr< Gdk::FrameClockget_frame_clock ()
 Obtains the frame clock for a widget. More...
 
Glib::RefPtr< const Gdk::FrameClockget_frame_clock () const
 Obtains the frame clock for a widget. More...
 
void set_parent (Widget& parent)
 This function is useful only when implementing subclasses of Gtk::Widget. 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 set_tooltip_window (Window& custom_window)
 Replaces the default window used for displaying tooltips with custom_window. More...
 
Windowget_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...
 
bool in_destruction () const
 Returns whether the widget is currently being destroyed. More...
 
Glib::RefPtr< StyleContextget_style_context ()
 Returns the style context associated to widget. More...
 
Glib::RefPtr< Gtk::StyleContextget_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::ActionGroupget_action_group (const Glib::ustring& prefix)
 Retrieves the Gio::ActionGroup that was registered using prefix. More...
 
Glib::RefPtr< const Gio::ActionGroupget_action_group (const Glib::ustring& prefix) const
 Retrieves the Gio::ActionGroup that was registered using prefix. More...
 
std::vector< Glib::ustringlist_action_prefixes () const
 Retrieves a nullptr-terminated array of strings containing the prefixes of Gio::ActionGroup's available to widget. More...
 
void activate_action (const Glib::ustring& name, const Glib::VariantBase& parameter)
 Looks up the action in the action groups associated with widget and its ancestors, and activates it. More...
 
void activate_default ()
 Activate the default.activate action from 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::FontMapget_font_map ()
 Gets the font map that has been set with set_font_map(). More...
 
Glib::RefPtr< const Pango::FontMapget_font_map () const
 Gets the font map that has been set with set_font_map(). More...
 
Widgetget_first_child ()
 
const Widgetget_first_child () const
 
Widgetget_last_child ()
 
const Widgetget_last_child () const
 
Widgetget_next_sibling ()
 
const Widgetget_next_sibling () const
 
Widgetget_prev_sibling ()
 
const Widgetget_prev_sibling () const
 
Glib::RefPtr< Gio::ListModelobserve_children ()
 Returns a ListModel to track the children of widget. More...
 
Glib::RefPtr< const Gio::ListModelobserve_children () const
 Returns a ListModel to track the children of widget. More...
 
Glib::RefPtr< Gio::ListModelobserve_controllers ()
 Returns a ListModel to track the Gtk::EventControllers of widget. More...
 
Glib::RefPtr< const Gio::ListModelobserve_controllers () const
 Returns a ListModel to track the Gtk::EventControllers of widget. More...
 
void insert_after (Widget& parent, const Widget& previous_sibling)
 Inserts the Widget into the child widget list of parent after previous_sibling. More...
 
void insert_before (Widget& parent, const Widget& next_sibling)
 Inserts the Widget into the child widget list of parent before next_sibling. More...
 
void insert_at_start (Widget& parent)
 Inserts the Widget at the beginning of the child widget list of parent. More...
 
void insert_at_end (Widget& parent)
 Inserts the Widget at the end of the child widget list of parent. More...
 
void snapshot_child (Widget& child, const Glib::RefPtr< Gtk::Snapshot >& snapshot)
 When a widget receives a call to the snapshot function, it must send synthetic Gtk::Widget::signal_snapshot() calls to all children. 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(int, int, int)> signal_size_allocate ()
 
Glib::SignalProxy< void(Gtk::StateFlags)> signal_state_flags_changed ()
 
Glib::SignalProxy< void()> signal_style_updated ()
 
Glib::SignalProxy< void(TextDirection)> signal_direction_changed ()
 
Glib::SignalProxy< void(bool)> signal_grab_notify ()
 
Glib::SignalProxy< bool(bool)> signal_mnemonic_activate ()
 
Glib::SignalProxy< void(const Glib::RefPtr< Gdk::Drag >&)> signal_drag_begin ()
 
Glib::SignalProxy< void(const Glib::RefPtr< Gdk::Drag >&)> signal_drag_end ()
 
Glib::SignalProxy< void(const Glib::RefPtr< Gdk::Drag >&, SelectionData&)> signal_drag_data_get ()
 
Glib::SignalProxy< void(const Glib::RefPtr< Gdk::Drag >&)> signal_drag_data_delete ()
 
Glib::SignalProxy< bool(const Glib::RefPtr< Gdk::Drag >&, DragResult)> signal_drag_failed ()
 
Glib::SignalProxy< void(const Glib::RefPtr< Gdk::Drop >&)> signal_drag_leave ()
 
Glib::SignalProxy< bool(const Glib::RefPtr< Gdk::Drop >&, int, int)> signal_drag_motion ()
 
Glib::SignalProxy< bool(const Glib::RefPtr< Gdk::Drop >&, int, int)> signal_drag_drop ()
 
Glib::SignalProxy< void(const Glib::RefPtr< Gdk::Drop >&, const SelectionData&)> signal_drag_data_received ()
 
Glib::SignalProxy< void()> signal_accel_closures_changed ()
 
Glib::SignalProxy< bool()> signal_popup_menu ()
 
Glib::SignalProxy< bool(int, int, bool, const Glib::RefPtr< Tooltip >&)> signal_query_tooltip ()
 
Glib::PropertyProxy< Glib::ustringproperty_name ()
 The name of the widget. More...
 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_name () const
 The name of the widget. More...
 
Glib::PropertyProxy_ReadOnly< Container* > property_parent () const
 The parent widget of this widget. More...
 
Glib::PropertyProxy_ReadOnly< Root* > property_root () const
 The Gtk::Root widget of the widget tree containing this widget or nullptr if the widget is not contained in a root 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_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_can_target ()
 Whether the widget can receive pointer events. More...
 
Glib::PropertyProxy_ReadOnly< bool > property_can_target () const
 Whether the widget can receive pointer events. 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_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< Glib::RefPtr< Gdk::Cursor > > property_cursor ()
 The cursor used by widget. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gdk::Cursor > > property_cursor () const
 The cursor used by widget. 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::ustringproperty_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::ustringproperty_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::ustringproperty_tooltip_text ()
 Sets the text of tooltip to be the given string. More...
 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_tooltip_text () const
 Sets the text of tooltip to be the given string. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gdk::Surface > > property_surface () const
 The widget's surface if it is realized, nullptr otherwise. More...
 
Glib::PropertyProxy< Alignproperty_halign ()
 How to distribute horizontal space if widget gets extra space, see Gtk::Align. More...
 
Glib::PropertyProxy_ReadOnly< Alignproperty_halign () const
 How to distribute horizontal space if widget gets extra space, see Gtk::Align. More...
 
Glib::PropertyProxy< Alignproperty_valign ()
 How to distribute vertical space if widget gets extra space, see Gtk::Align. More...
 
Glib::PropertyProxy_ReadOnly< Alignproperty_valign () const
 How to distribute vertical space if widget gets extra space, see Gtk::Align. 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< Overflowproperty_overflow ()
 How content outside the widget's content area is treated. More...
 
Glib::PropertyProxy_ReadOnly< Overflowproperty_overflow () const
 How content outside the widget's content area is treated. More...
 
Glib::PropertyProxy_ReadOnly< int > property_scale_factor () const
 The scale factor of the widget. More...
 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_css_name () const
 The name of this widget in the CSS tree. More...
 
Glib::PropertyProxy< Glib::RefPtr< LayoutManager > > property_layout_manager ()
 The Gtk::LayoutManager instance to use to compute the preferred size of the widget, and allocate its children. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< LayoutManager > > property_layout_manager () const
 The Gtk::LayoutManager instance to use to compute the preferred size of the widget, and allocate its children. More...
 
- Public Member Functions inherited from Gtk::Object
 Object (Object&& src) noexcept
 
Objectoperator= (Object&& src) noexcept
 
 ~Object () noexcept override
 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (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::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (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
 
PropertyType get_property (const Glib::ustring &property_name) const
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
 
sigc::connection connect_property_changed (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) noexcept
 
 ~trackable ()
 
void add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
 
void notify_callbacks ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (trackable &&src) noexcept
 
void remove_destroy_notify_callback (notifiable *data) const
 
- Public Member Functions inherited from Gtk::Buildable
 Buildable (Buildable&& src) noexcept
 
Buildableoperator= (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
 
Interfaceoperator= (Interface &&src) noexcept
 
 Interface (const Glib::Interface_Class &interface_class)
 
 Interface (GObject *castitem)
 
 ~Interface () noexcept override
 
 Interface (const Interface &)=delete
 
Interfaceoperator= (const Interface &)=delete
 
GObject * gobj ()
 
const GObject * gobj () const
 
- Public Member Functions inherited from Atk::Implementor
 Implementor (Implementor &&src) noexcept
 
Implementoroperator= (Implementor &&src) noexcept
 
 ~Implementor () noexcept override
 
AtkImplementor * gobj ()
 
const AtkImplementor * gobj () const
 
Glib::RefPtr< Atk::Implementorwrap (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 Widgetget_current_modal_grab ()
 Retrieve the widget which is currently grabbing all events. 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 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 root_vfunc ()
 
virtual void unroot_vfunc ()
 
virtual SizeRequestMode get_request_mode_vfunc () const
 
virtual void measure_vfunc (Orientation orientation, int for_size, int& minimum, int& natural, int& minimum_baseline, int& natural_baseline) const
 
virtual void grab_focus_vfunc ()
 
virtual Glib::RefPtr< Atk::Objectget_accessible_vfunc ()
 
virtual void compute_expand_vfunc (bool& hexpand_p, bool& vexpand_p)
 
virtual bool contains_vfunc (double x, double y) const
 
virtual void snapshot_vfunc (const Glib::RefPtr< Gtk::Snapshot >& snapshot)
 
 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 set_has_surface (bool has_surface=true)
 Specifies whether widget has a Gdk::Surface of its own. More...
 
void set_surface (const Glib::RefPtr< Gdk::Surface >& surface)
 Sets a widget's surface. More...
 
void realize_if_needed ()
 
void set_focus_child (Widget& child)
 Set child as the current focus child of widget. More...
 
void unset_focus_child ()
 Unsets the focus child of the widget. More...
 
Widgetget_focus_child ()
 Returns the current focus child of widget. More...
 
const Widgetget_focus_child () const
 Returns the current focus child of widget. More...
 
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 (int width, int height, int baseline)
 This is a default handler for the signal signal_size_allocate(). More...
 
virtual void on_state_flags_changed (Gtk::StateFlags previous_state_flags)
 This is a default handler for the signal signal_state_flags_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 bool on_mnemonic_activate (bool group_cycling)
 This is a default handler for the signal signal_mnemonic_activate(). More...
 
virtual void on_drag_begin (const Glib::RefPtr< Gdk::Drag >& drag)
 This is a default handler for the signal signal_drag_begin(). More...
 
virtual void on_drag_end (const Glib::RefPtr< Gdk::Drag >& drag)
 This is a default handler for the signal signal_drag_end(). More...
 
virtual void on_drag_data_get (const Glib::RefPtr< Gdk::Drag >& drag, SelectionData& selection_data)
 This is a default handler for the signal signal_drag_data_get(). More...
 
virtual void on_drag_data_delete (const Glib::RefPtr< Gdk::Drag >& drag)
 This is a default handler for the signal signal_drag_data_delete(). More...
 
virtual bool on_drag_failed (const Glib::RefPtr< Gdk::Drag >& drag, DragResult result)
 This is a default handler for the signal signal_drag_failed(). More...
 
virtual void on_drag_leave (const Glib::RefPtr< Gdk::Drop >& drop)
 This is a default handler for the signal signal_drag_leave(). More...
 
virtual bool on_drag_motion (const Glib::RefPtr< Gdk::Drop >& drop, int x, int y)
 This is a default handler for the signal signal_drag_motion(). More...
 
virtual bool on_drag_drop (const Glib::RefPtr< Gdk::Drop >& drop, int x, int y)
 This is a default handler for the signal signal_drag_drop(). More...
 
virtual void on_drag_data_received (const Glib::RefPtr< Gdk::Drop >& drop, const SelectionData& selection_data)
 This is a default handler for the signal signal_drag_data_received(). More...
 
virtual bool on_popup_menu ()
 This is a default handler for the signal signal_popup_menu(). More...
 
virtual bool on_query_tooltip (int x, int y, bool keyboard_tooltip, const Glib::RefPtr< Tooltip >& tooltip)
 This is a default handler for the signal signal_query_tooltip(). More...
 
- 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
 
ObjectBaseoperator= (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< Objectref_accessibile_vfunc ()
 

Related Functions

(Note that these are not member functions.)

Gtk::Widgetwrap (GtkWidget* 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::Surface on the server side are allowed to capture events.

Member Typedef Documentation

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_clockThe 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

Gtk::Widget::Widget ( Widget&&  src)
noexcept
Gtk::Widget::Widget ( const Widget )
delete
Gtk::Widget::~Widget ( )
overridenoexcept

Destroys the widget.

The widget will be automatically removed from the parent container.

Gtk::Widget::Widget ( )
protected

Member Function Documentation

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.
void Gtk::Widget::activate_action ( const Glib::ustring name,
const Glib::VariantBase parameter 
)

Looks up the action in the action groups associated with widget and its ancestors, and activates it.

The action name is expected to be prefixed with the prefix that was used when adding the action group with insert_action_group().

The parameter must match the actions expected parameter type, as returned by Glib::action_get_parameter_type().

Parameters
nameA prefixed action name.
parameterParameters that required by the action.
void Gtk::Widget::activate_default ( )

Activate the default.activate action from widget.

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_signalWidget signal to emit on accelerator activation.
accel_groupAccel group for this widget, added to its toplevel.
accel_keyGDK keyval of the accelerator.
accel_modsModifier key combination of the accelerator.
accel_flagsFlag accelerators, e.g. Gtk::AccelFlags::VISIBLE.
void Gtk::Widget::add_controller ( const Glib::RefPtr< EventController >&  controller)

Adds controller to widget so that it will receive events.

You will usually want to call this function right after creating any kind of Gtk::EventController.

Parameters
controllerA Gtk::EventController that hasn't been added to a widget yet.
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
labelA Gtk::Widget that acts as a mnemonic label for widget.
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.

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
slotSlot to call for updating animations.
Returns
An id for the connection of this callback. Remove the callback by passing it to remove_tick_callback().
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.

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
directionDirection of focus movement.
Returns
true if focus ended up inside widget.
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
orientationExpand direction.
Returns
Whether widget tree rooted here should be expanded.
virtual void Gtk::Widget::compute_expand_vfunc ( bool &  hexpand_p,
bool &  vexpand_p 
)
protectedvirtual
bool Gtk::Widget::contains ( double  x,
double  y 
) const

Tests if the point at ( x, y) is contained in widget.

The coordinates for ( x, y) must be in widget coordinates, so (0, 0) is assumed to be the top left of widget's content area.

Parameters
xX coordinate to test, relative to widget's origin.
yY coordinate to test, relative to widget's origin.
Returns
true if widget contains ( x, y).
virtual bool Gtk::Widget::contains_vfunc ( double  x,
double  y 
) const
protectedvirtual
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.
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_display_changed() signal on the widget.

Parameters
textText to set on the layout (can be nullptr).
Returns
The new Pango::Layout.
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().

Parameters
deviceA Gdk::Device.
Returns
true if there is an ongoing grab on device by another Gtk::Widget than widget.
Glib::RefPtr<Gdk::Drag> Gtk::Widget::drag_begin ( const Glib::RefPtr< Gdk::Device >&  device,
const Glib::RefPtr< Gdk::ContentFormats >&  targets,
Gdk::DragAction  actions,
int  x,
int  y 
)

Initiates a drag on the source side.

The function only needs to be used when the application is starting drags itself, and is not needed when gtk_drag_source_set() is used.

Parameters
deviceThe device that starts the drag or nullptr to use the default pointer.
targetsThe targets (data formats) in which the source can provide the data.
actionsA bitmask of the allowed drag actions for this drag.
xThe initial x coordinate to start dragging from, in the coordinate space of widget.
yThe initial y coordinate to start dragging from, in the coordinate space of widget.
Returns
The context for this drag.
bool Gtk::Widget::drag_check_threshold ( int  start_x,
int  start_y,
int  current_x,
int  current_y 
)

Checks to see if a mouse drag starting at ( start_x, start_y) and ending at ( current_x, current_y) has passed the GTK+ drag threshold, and thus should trigger the beginning of a drag-and-drop operation.

Parameters
start_xX coordinate of start of drag.
start_yY coordinate of start of drag.
current_xCurrent X coordinate.
current_yCurrent Y coordinate.
Returns
true if the drag threshold has been passed.
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_target_list_add_image_targets() and gtk_drag_dest_set_target_list().

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_target_list_add_text_targets() and gtk_drag_dest_set_target_list().

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_target_list_add_uri_targets() and gtk_drag_dest_set_target_list().

Glib::ustring Gtk::Widget::drag_dest_find_target ( const Glib::RefPtr< Gdk::Drop >&  drop,
const Glib::RefPtr< Gdk::ContentFormats >&  target_list = {} 
) const

Looks for a match between the supported targets of drop and the target_list, returning the first matching target, otherwise returning an empty string.

target_list should usually be the return value from 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
dropGdk::Drop.
target_listList of droppable targets, or an empty Glib::RefPtr to use drag_dest_get_target_list().
Returns
First target that the source offers and the dest can accept, or an empty string.
Glib::RefPtr<Gdk::ContentFormats> Gtk::Widget::drag_dest_get_target_list ( )

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

Returns
The Gdk::ContentFormats, or nullptr if none.
Glib::RefPtr<const Gdk::ContentFormats> Gtk::Widget::drag_dest_get_target_list ( ) const

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

Returns
The Gdk::ContentFormats, or nullptr if none.
bool Gtk::Widget::drag_dest_get_track_motion ( ) const

Returns whether the widget has been configured to always emit Gtk::Widget::signal_drag_motion() signals.

Returns
true if the widget always emits Gtk::Widget::signal_drag_motion() events.
void Gtk::Widget::drag_dest_set ( DestDefaults  flags = DestDefaults(0),
Gdk::DragAction  actions = Gdk::DragAction(0) 
)

Sets a widget as a potential drop destination, and adds default behaviors.

This drag_dest_set() overload, with its default values of flags and actions, is useful if you provide your own signal handlers for signal_drag_motion() and signal_drag_drop() and let the signal handlers decide if a drop is possible.

See also
drag_dest_set(const Glib::RefPtr<Gdk::ContentFormats>&, DestDefaults, Gdk::DragAction)
Parameters
flagsWhich types of default drag behavior to use.
actionsA bitmask of possible actions for a drop onto this widget.
void Gtk::Widget::drag_dest_set ( const Glib::RefPtr< Gdk::ContentFormats >&  targets,
DestDefaults  flags = DestDefaults::ALL,
Gdk::DragAction  actions = Gdk::DragAction::COPY 
)

Sets a widget as a potential drop destination, and adds default behaviors.

The default behaviors listed in flags have an effect similar to installing default handlers for the widget’s drag-and-drop signals (Gtk::Widget::signal_drag_motion(), Gtk::Widget::signal_drag_drop(), ...). They all exist for convenience. When passing Gtk::DestDefaults::ALL for instance it is sufficient to connect to the widget’s Gtk::Widget::signal_drag_data_received() signal to get primitive, but consistent drag-and-drop support.

Things become more complicated when you try to preview the dragged data, as described in the documentation for Gtk::Widget::signal_drag_motion(). The default behaviors described by flags make some assumptions, that can conflict with your own signal handlers. For instance Gtk::DestDefaults::DROP causes invokations of gdk_drag_status() in the context of Gtk::Widget::signal_drag_motion(), and invokations of gdk_drag_finish() in Gtk::Widget::signal_drag_data_received(). Especially the later is dramatic, when your own Gtk::Widget::signal_drag_motion() handler calls gtk_drag_get_data() to inspect the dragged data.

There’s no way to set a default action here, you can use the Gtk::Widget::signal_drag_motion() callback for that. Here’s an example which selects the action to use depending on whether the control key is pressed or not:

[C example ellipted]

Parameters
flagsWhich types of default drag behavior to use.
targetsThe drop types that this widget will accept, or nullptr. Later you can access the list with gtk_drag_dest_get_target_list() and gtk_drag_dest_find_target().
actionsA bitmask of possible actions for a drop onto this widget.
void Gtk::Widget::drag_dest_set_target_list ( const Glib::RefPtr< Gdk::ContentFormats >&  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_listList of droppable targets, or nullptr for none.
void Gtk::Widget::drag_dest_set_track_motion ( bool  track_motion = true)

Tells the widget to emit Gtk::Widget::signal_drag_motion() and Gtk::Widget::signal_drag_leave() events regardless of the targets and the Gtk::DestDefaults::MOTION flag.

This may be used when a widget wants to do generic actions regardless of the targets that the source offers.

Parameters
track_motionWhether to accept all targets.
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.

void Gtk::Widget::drag_get_data ( const Glib::RefPtr< Gdk::Drop >&  drop,
const Glib::ustring target 
)

Gets the data associated with a drag.

When the data is received or the retrieval fails, GTK+ will emit a Gtk::Widget::signal_drag_data_received() signal. Failure of the retrieval is indicated by the length field of the selection_data signal parameter being negative. However, when gtk_drag_get_data() is called implicitely because the Gtk::DestDefaults::DROP was set, then the widget will not receive notification of failed drops.

Parameters
dropThe Gdk::Drop.
targetThe target (form of the data) to retrieve.
void Gtk::Widget::drag_highlight ( )

Highlights a widget as a currently hovered drop target.

To end the highlight, call gtk_drag_unhighlight(). GTK+ calls this automatically if Gtk::DestDefaults::HIGHLIGHT is set.

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_target_list_add_image_targets() and gtk_drag_source_set_target_list().

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_content_formats_add_text_targets() and gtk_drag_source_set_target_list().

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_content_formats_add_uri_targets() and gtk_drag_source_set_target_list().

Glib::RefPtr<Gdk::ContentFormats> Gtk::Widget::drag_source_get_target_list ( )

Gets the list of targets this widget can provide for drag-and-drop.

Returns
The Gdk::ContentFormats, or nullptr if none.
Glib::RefPtr<const Gdk::ContentFormats> Gtk::Widget::drag_source_get_target_list ( ) const

Gets the list of targets this widget can provide for drag-and-drop.

Returns
The Gdk::ContentFormats, or nullptr if none.
void Gtk::Widget::drag_source_set ( const Glib::RefPtr< Gdk::ContentFormats >&  targets,
Gdk::ModifierType  start_button_mask = Gdk::ModifierType::MODIFIER_MASK,
Gdk::DragAction  actions = Gdk::DragAction::COPY 
)

Sets up a widget so that GTK+ will start a drag operation when the user clicks and drags on the widget.

The widget must have a window.

Parameters
start_button_maskThe bitmask of buttons that can start the drag.
targetsThe targets that the drag will support, may be nullptr.
actionsThe bitmask of possible actions for a drag from this widget.
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.

Parameters
icon_nameName of icon to use.
void Gtk::Widget::drag_source_set_icon ( const Glib::RefPtr< Gio::Icon > &  icon)

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

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

Parameters
iconA Gio::Icon.
void Gtk::Widget::drag_source_set_icon ( const Glib::RefPtr< Gdk::Paintable >&  paintable)

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

Parameters
paintableA Gdk::Paintable.
void Gtk::Widget::drag_source_set_target_list ( const Glib::RefPtr< Gdk::ContentFormats >&  target_list)

Changes the target types that this widget offers for drag-and-drop.

The widget must first be made into a drag source with gtk_drag_source_set().

Parameters
target_listList of draggable targets, or nullptr for none.
void Gtk::Widget::drag_source_unset ( )

Undoes the effects of gtk_drag_source_set().

void Gtk::Widget::drag_unhighlight ( )

Removes a highlight set by gtk_drag_highlight() from a widget.

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::Surface::beep(), otherwise it does nothing.

Note that the effect of Gdk::Surface::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:
bool Gtk::Widget::event ( const Glib::RefPtr< const Gdk::Event >&  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.

Parameters
gdk_eventA Gdk::Event.
Returns
Return from the event signal emission (true if the event was handled).
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.
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.
virtual Glib::RefPtr<Atk::Object> Gtk::Widget::get_accessible_vfunc ( )
protectedvirtual
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.

Parameters
prefixThe “prefix” of the action group.
Returns
A Gio::ActionGroup or nullptr.
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.

Parameters
prefixThe “prefix” of the action group.
Returns
A Gio::ActionGroup or nullptr.
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_snapshot() function, and when allocating child widgets in Gtk::Widget::size_allocate.

Returns
The baseline of the widget, or -1 if none.
int Gtk::Widget::get_allocated_height ( ) const

Returns the height that has currently been allocated to widget.

Returns
The height of the widget.
int Gtk::Widget::get_allocated_width ( ) const

Returns the width that has currently been allocated to widget.

Returns
The width of the widget.
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.
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_typeAncestor type.
Returns
The ancestor widget, or nullptr if not found.
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_typeAncestor type.
Returns
The ancestor widget, or nullptr if not found.
bool Gtk::Widget::get_can_focus ( ) const

Determines whether widget can own the input focus.

See set_can_focus().

Returns
true if widget can own the input focus, false otherwise.
bool Gtk::Widget::get_can_target ( ) const

Queries whether widget can be the target of pointer events.

Returns
true if widget can receive pointer events.
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.
Glib::RefPtr<Gdk::Clipboard> Gtk::Widget::get_clipboard ( )

This is a utility function to get the clipboard object for the Gdk::Display that widget is using.

Note that this function always works, even when widget is not realized yet.

Returns
The appropriate clipboard object.
Glib::RefPtr<const Gdk::Clipboard> Gtk::Widget::get_clipboard ( ) const

This is a utility function to get the clipboard object for the Gdk::Display that widget is using.

Note that this function always works, even when widget is not realized yet.

Returns
The appropriate clipboard object.
static Widget* Gtk::Widget::get_current_modal_grab ( )
static

Retrieve the widget which is currently grabbing all events.

Glib::RefPtr<Gdk::Cursor> Gtk::Widget::get_cursor ( )

Queries the cursor set via set_cursor().

See that function for details.

Returns
The cursor currently in use or nullptr to use the default.
Glib::RefPtr<const Gdk::Cursor> Gtk::Widget::get_cursor ( ) const

Queries the cursor set via set_cursor().

See that function for details.

Returns
The cursor currently in use or nullptr to use the default.
static TextDirection Gtk::Widget::get_default_direction ( )
static

Obtains the current default reading direction.

See set_default_direction().

Returns
The current default 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.
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.

Returns
The Gdk::Display for the toplevel for this widget.
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.

Returns
The Gdk::Display for the toplevel for this widget.
Widget* Gtk::Widget::get_first_child ( )
Returns
The widget's first child.
const Widget* Gtk::Widget::get_first_child ( ) const
Returns
The widget's first child.
Widget* Gtk::Widget::get_focus_child ( )
protected

Returns the current focus child of widget.

Returns
The current focus child of widget, or nullptr in case the focus child is unset.
const Widget* Gtk::Widget::get_focus_child ( ) const
protected

Returns the current focus child of widget.

Returns
The current focus child of widget, or nullptr in case the focus child is unset.
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().

Returns
true if the widget should grab focus when it is clicked with the mouse.
Glib::RefPtr<Pango::FontMap> Gtk::Widget::get_font_map ( )

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

Returns
A Pango::FontMap, or nullptr.
Glib::RefPtr<const Pango::FontMap> Gtk::Widget::get_font_map ( ) const

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

Returns
A Pango::FontMap, or nullptr.
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::Display will be used.

Returns
The #cairo_font_options_t or nullptr if not set.
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.
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.
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.
bool Gtk::Widget::get_has_surface ( ) const

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

See set_has_surface().

Returns
true if widget has a surface, false otherwise.
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.

Returns
Current value of has-tooltip on widget.
int Gtk::Widget::get_height ( ) const

Returns the content height of the widget, as passed to its size-allocate implementation.

This is the size you should be using in GtkWidgetClass.snapshot(). For pointer events, see contains().

Returns
The height of widget.
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.
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.
bool Gtk::Widget::get_is_drawable ( ) const

Determines whether widget can be drawn to.

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

Returns
true if widget is drawable, false otherwise.
bool Gtk::Widget::get_is_toplevel ( ) const

Determines whether widget is a toplevel widget.

Currently only Gtk::Windows are toplevel widgets. Toplevel widgets have no parent widget and implement the Gtk::Root interface.

Returns
true if widget is a toplevel, false otherwise.
Widget* Gtk::Widget::get_last_child ( )
Returns
The widget's last child.
const Widget* Gtk::Widget::get_last_child ( ) const
Returns
The widget's last child.
Glib::RefPtr<LayoutManager> Gtk::Widget::get_layout_manager ( )

Retrieves the layout manager set using set_layout_manager().

Returns
A Gtk::LayoutManager.
Glib::RefPtr<const LayoutManager> Gtk::Widget::get_layout_manager ( ) const

Retrieves the layout manager set using set_layout_manager().

Returns
A Gtk::LayoutManager.
bool Gtk::Widget::get_mapped ( ) const

Whether the widget is mapped.

Returns
true if the widget is mapped, false otherwise.
int Gtk::Widget::get_margin_bottom ( ) const

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

Returns
The bottom margin of widget.
int Gtk::Widget::get_margin_end ( ) const

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

Returns
The end margin of widget.
int Gtk::Widget::get_margin_start ( ) const

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

Returns
The start margin of widget.
int Gtk::Widget::get_margin_top ( ) const

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

Returns
The top margin of widget.
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().

Parameters
intentThe use case for the modifier mask.
Returns
The modifier mask used for intent.
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.
Widget* Gtk::Widget::get_next_sibling ( )
Returns
The widget's next sibling.
const Widget* Gtk::Widget::get_next_sibling ( ) const
Returns
The widget's next sibling.
double Gtk::Widget::get_opacity ( ) const

Fetches the requested opacity for this widget.

See set_opacity().

Returns
The requested opacity for this widget.
Overflow Gtk::Widget::get_overflow ( ) const

Returns the value set via set_overflow().

Since gtkmm 3.96:
Returns
The widget's overflow.
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_display_changed() signal on the widget.

Returns
The Pango::Context for the widget.
Container* Gtk::Widget::get_parent ( )

Returns the parent widget of widget.

Returns
The parent widget of widget, or nullptr.
const Container* Gtk::Widget::get_parent ( ) const

Returns the parent widget of widget.

Returns
The parent widget of widget, or nullptr.
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.
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 measure() if you want to support baseline alignment.

Parameters
minimum_sizeLocation for storing the minimum size, or nullptr.
natural_sizeLocation for storing the natural size, or nullptr.
Widget* Gtk::Widget::get_prev_sibling ( )
Returns
The widget's previous sibling.
const Widget* Gtk::Widget::get_prev_sibling ( ) const
Returns
The widget's previous sibling.
Glib::RefPtr<Gdk::Clipboard> Gtk::Widget::get_primary_clipboard ( )

This is a utility function to get the primary clipboard object for the Gdk::Display that widget is using.

Note that this function always works, even when widget is not realized yet.

Returns
The appropriate clipboard object.
Glib::RefPtr<const Gdk::Clipboard> Gtk::Widget::get_primary_clipboard ( ) const

This is a utility function to get the primary clipboard object for the Gdk::Display that widget is using.

Note that this function always works, even when widget is not realized yet.

Returns
The appropriate clipboard object.
bool Gtk::Widget::get_realized ( ) const

Determines whether widget is realized.

Returns
true if widget is realized, false otherwise.
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().

Returns
true if widget acts as the default widget when focused, false otherwise.
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.

Returns
The Gtk::SizeRequestMode preferred by widget.
virtual SizeRequestMode Gtk::Widget::get_request_mode_vfunc ( ) const
protectedvirtual
Root* Gtk::Widget::get_root ( )

Returns the Gtk::Root widget of widget or nullptr if the widget is not contained inside a widget tree with a root widget.

Gtk::Root widgets will return themselves here.

Returns
The root widget of widget, or nullptr.
const Root* Gtk::Widget::get_root ( ) const

Returns the Gtk::Root widget of widget or nullptr if the widget is not contained inside a widget tree with a root widget.

Gtk::Root widgets will return themselves here.

Returns
The root widget of widget, or nullptr.
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_surface_get_scale_factor().

Returns
The scale factor for widget.
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().

Returns
true if the widget is sensitive.
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::Display.

Returns
The relevant Gtk::Settings object.
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 measure() instead of this function.

Parameters
widthReturn location for width, or nullptr.
heightReturn location for height, or nullptr.
StateFlags Gtk::Widget::get_state_flags ( ) const

Returns the widget state as a flag set.

It is worth mentioning that the effective Gtk::StateFlags::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().

Returns
The state flags for widget.
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.
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.
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.
Glib::RefPtr<Gdk::Surface> Gtk::Widget::get_surface ( )

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

Returns
widget’s surface.
Glib::RefPtr<const Gdk::Surface> Gtk::Widget::get_surface ( ) const

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

Returns
widget’s surface.
Glib::ustring Gtk::Widget::get_tooltip_markup ( ) const

Gets the contents of the tooltip for widget.

Returns
The tooltip text.
Glib::ustring Gtk::Widget::get_tooltip_text ( ) const

Gets the contents of the tooltip for widget.

Returns
The tooltip text.
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().

Returns
The Gtk::Window of the current tooltip.
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.

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.
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.

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.
static GType Gtk::Widget::get_type ( )
static

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

Align Gtk::Widget::get_valign ( ) const

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

Returns
The vertical alignment of widget.
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.
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.
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().

Returns
true if the widget is visible.
int Gtk::Widget::get_width ( ) const

Returns the content width of the widget, as passed to its size-allocate implementation.

This is the size you should be using in GtkWidgetClass.snapshot(). For pointer events, see contains().

Returns
The width of widget.
GtkWidget* Gtk::Widget::gobj ( )
inline

Provides access to the underlying C GObject.

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

Provides access to the underlying C GObject.

void Gtk::Widget::grab_focus ( )

Causes widget (or one of its descendents) to have the keyboard focus for the Gtk::Window it's inside.

widget must be focusable, or have a ::grab_focus implementation that transfers the focus to a descendant of widget that is focusable.

virtual void Gtk::Widget::grab_focus_vfunc ( )
protectedvirtual
bool Gtk::Widget::has_default ( ) const

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

Returns
true if widget is the current default widget within its toplevel, false otherwise.
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.

Returns
true if the widget has the global input focus.
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().

Returns
true if the widget is in the grab_widgets stack.
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().

Returns
true if the widget should display a “focus rectangle”.
void Gtk::Widget::hide ( )

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

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.
void Gtk::Widget::input_shape_combine_region ( const Cairo::RefPtr< const Cairo::Region > &  region)

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

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

Parameters
regionShape to be added, or nullptr to remove an existing shape.
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.

Parameters
nameThe prefix for actions in group.
groupA Gio::ActionGroup, or nullptr.
void Gtk::Widget::insert_after ( Widget parent,
const Widget previous_sibling 
)

Inserts the Widget into the child widget list of parent after previous_sibling.

After calling this function, get_prev_sibling() will return previous_sibling.

If parent is already set as the parent widget of the Widget, this function can also be used to reorder the Widget in the child widget list of parent.

Parameters
parentThe parent Gtk::Widget to insert the Widget into.
previous_siblingThe new previous sibling of the Widget.
void Gtk::Widget::insert_at_end ( Widget parent)

Inserts the Widget at the end of the child widget list of parent.

After calling this function, get_next_sibling() will return nullptr.

If parent is already set as the parent of the Widget, this function can also be used to reorder the Widget in the child widget list of parent.

Parameters
parentThe parent Gtk::Widget to insert the Widget into.
void Gtk::Widget::insert_at_start ( Widget parent)

Inserts the Widget at the beginning of the child widget list of parent.

After calling this function, get_prev_sibling() will return nullptr.

If parent is already set as the parent of the Widget, this function can also be used to reorder the Widget in the child widget list of parent.

Parameters
parentThe parent Gtk::Widget to insert the Widget into.
void Gtk::Widget::insert_before ( Widget parent,
const Widget next_sibling 
)

Inserts the Widget into the child widget list of parent before next_sibling.

After calling this function, get_next_sibling() will return next_sibling.

If parent is already set as the parent widget of the Widget, this function can also be used to reorder the Widget in the child widget list of parent.

Parameters
parentThe parent Gtk::Widget to insert the Widget into.
next_siblingThe new next sibling of the Widget.
bool Gtk::Widget::is_ancestor ( Widget ancestor) const

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

Parameters
ancestorAnother Gtk::Widget.
Returns
true if ancestor contains widget as a child, grandchild, great grandchild, etc.
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.
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.

Returns
true if the widget is effectively sensitive.
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()

Returns
true if the widget and all its parents are visible.
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::DirectionType::TAB_FORWARD and Gtk::DirectionType::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.

Parameters
directionDirection 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).
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.

Returns
A nullptr-terminated array of strings.
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.

Returns
The list of mnemonic labels; free this list with Glib::list_free() when you are done with it.
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.

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

This function is only for use in widget implementations.

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

void Gtk::Widget::measure ( Orientation  orientation,
int  for_size,
int &  minimum,
int &  natural,
int &  minimum_baseline,
int &  natural_baseline 
) const

Measures widget in the orientation orientation and for the given for_size.

As an example, if orientation is Gtk::Orientation::HORIZONTAL and for_size is 300, this functions will compute the minimum and natural width of widget if it is allocated at a height of 300 pixels.

See [GtkWidget’s geometry management section][geometry-management] for a more details on implementing Gtk::WidgetClass.measure().

Parameters
orientationThe orientation to measure.
for_sizeSize for the opposite of orientation, i.e. if orientation is Gtk::Orientation::HORIZONTAL, this is the height the widget should be measured with. The Gtk::Orientation::VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
minimumLocation to store the minimum size, or nullptr.
naturalLocation to store the natural size, or nullptr.
minimum_baselineLocation to store the baseline position for the minimum size, or nullptr.
natural_baselineLocation to store the baseline position for the natural size, or nullptr.
virtual void Gtk::Widget::measure_vfunc ( Orientation  orientation,
int  for_size,
int &  minimum,
int &  natural,
int &  minimum_baseline,
int &  natural_baseline 
) const
protectedvirtual
bool Gtk::Widget::mnemonic_activate ( bool  group_cycling)

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

Parameters
group_cyclingtrue if there are other widgets with the same mnemonic.
Returns
true if the signal has been handled.
Glib::RefPtr<Gio::ListModel> Gtk::Widget::observe_children ( )

Returns a ListModel to track the children of widget.

Calling this function will enable extra internal bookkeeping to track children and emit signals on the returned listmodel. It may slow down operations a lot.

Applications should try hard to avoid calling this function because of the slowdowns.

Returns
A ListModel tracking widget's children.
Glib::RefPtr<const Gio::ListModel> Gtk::Widget::observe_children ( ) const

Returns a ListModel to track the children of widget.

Calling this function will enable extra internal bookkeeping to track children and emit signals on the returned listmodel. It may slow down operations a lot.

Applications should try hard to avoid calling this function because of the slowdowns.

Returns
A ListModel tracking widget's children.
Glib::RefPtr<Gio::ListModel> Gtk::Widget::observe_controllers ( )

Returns a ListModel to track the Gtk::EventControllers of widget.

Calling this function will enable extra internal bookkeeping to track controllers and emit signals on the returned listmodel. It may slow down operations a lot.

Applications should try hard to avoid calling this function because of the slowdowns.

Returns
A ListModel tracking widget's controllers.
Glib::RefPtr<const Gio::ListModel> Gtk::Widget::observe_controllers ( ) const

Returns a ListModel to track the Gtk::EventControllers of widget.

Calling this function will enable extra internal bookkeeping to track controllers and emit signals on the returned listmodel. It may slow down operations a lot.

Applications should try hard to avoid calling this function because of the slowdowns.

Returns
A ListModel tracking widget's controllers.
virtual void Gtk::Widget::on_direction_changed ( TextDirection  direction)
protectedvirtual

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

virtual void Gtk::Widget::on_drag_begin ( const Glib::RefPtr< Gdk::Drag >&  drag)
protectedvirtual

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

virtual void Gtk::Widget::on_drag_data_delete ( const Glib::RefPtr< Gdk::Drag >&  drag)
protectedvirtual

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

virtual void Gtk::Widget::on_drag_data_get ( const Glib::RefPtr< Gdk::Drag >&  drag,
SelectionData selection_data 
)
protectedvirtual

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

virtual void Gtk::Widget::on_drag_data_received ( const Glib::RefPtr< Gdk::Drop >&  drop,
const SelectionData selection_data 
)
protectedvirtual

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

virtual bool Gtk::Widget::on_drag_drop ( const Glib::RefPtr< Gdk::Drop >&  drop,
int  x,
int  y 
)
protectedvirtual

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

virtual void Gtk::Widget::on_drag_end ( const Glib::RefPtr< Gdk::Drag >&  drag)
protectedvirtual

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

virtual bool Gtk::Widget::on_drag_failed ( const Glib::RefPtr< Gdk::Drag >&  drag,
DragResult  result 
)
protectedvirtual

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

virtual void Gtk::Widget::on_drag_leave ( const Glib::RefPtr< Gdk::Drop >&  drop)
protectedvirtual

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

virtual bool Gtk::Widget::on_drag_motion ( const Glib::RefPtr< Gdk::Drop >&  drop,
int  x,
int  y 
)
protectedvirtual

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

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

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

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

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

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

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

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

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

virtual bool Gtk::Widget::on_popup_menu ( )
protectedvirtual

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

virtual bool Gtk::Widget::on_query_tooltip ( int  x,
int  y,
bool  keyboard_tooltip,
const Glib::RefPtr< Tooltip >&  tooltip 
)
protectedvirtual

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

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

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

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

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

virtual void Gtk::Widget::on_size_allocate ( int  width,
int  height,
int  baseline 
)
protectedvirtual

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

virtual void Gtk::Widget::on_state_flags_changed ( Gtk::StateFlags  previous_state_flags)
protectedvirtual

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

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

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

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

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

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

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

Widget& Gtk::Widget::operator= ( Widget&&  src)
noexcept
Widget& Gtk::Widget::operator= ( const Widget )
delete
Widget* Gtk::Widget::pick ( double  x,
double  y,
PickFlags  flags = PickFlags::DEFAULT 
)

Finds the descendant of widget (including widget itself) closest to the screen at the point ( x, y).

The point must be given in widget coordinates, so (0, 0) is assumed to be the top left of widget's content area.

Usually widgets will return nullptr if the given coordinate is not contained in widget checked via contains(). Otherwise they will recursively try to find a child that does not return nullptr. Widgets are however free to customize their picking algorithm.

This function is used on the toplevel to determine the widget below the mouse cursor for purposes of hover hilighting and delivering events.

Parameters
xX coordinate to test, relative to widget's origin.
yY coordinate to test, relative to widget's origin.
flagsFlags to influence what is picked.
Returns
The widget descendant at the given coordinate or nullptr if none.
const Widget* Gtk::Widget::pick ( double  x,
double  y,
PickFlags  flags = PickFlags::DEFAULT 
) const

Finds the descendant of widget (including widget itself) closest to the screen at the point ( x, y).

The point must be given in widget coordinates, so (0, 0) is assumed to be the top left of widget's content area.

Usually widgets will return nullptr if the given coordinate is not contained in widget checked via contains(). Otherwise they will recursively try to find a child that does not return nullptr. Widgets are however free to customize their picking algorithm.

This function is used on the toplevel to determine the widget below the mouse cursor for purposes of hover hilighting and delivering events.

Parameters
xX coordinate to test, relative to widget's origin.
yY coordinate to test, relative to widget's origin.
flagsFlags to influence what is picked.
Returns
The widget descendant at the given coordinate or nullptr if none.
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.
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.
Glib::PropertyProxy< bool > Gtk::Widget::property_can_target ( )

Whether the widget can receive pointer events.

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.
Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_can_target ( ) const

Whether the widget can receive pointer events.

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.
Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::Widget::property_css_name ( ) const

The name of this widget in the CSS tree.

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.
Glib::PropertyProxy< Glib::RefPtr<Gdk::Cursor> > Gtk::Widget::property_cursor ( )

The cursor used by widget.

See Gtk::Widget::set_cursor() for details.

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.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Cursor> > Gtk::Widget::property_cursor ( ) const

The cursor used by widget.

See Gtk::Widget::set_cursor() for details.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
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()

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.
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()

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.
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.

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.
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.

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.
Glib::PropertyProxy< Align > Gtk::Widget::property_halign ( )

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

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.
Glib::PropertyProxy_ReadOnly< Align > Gtk::Widget::property_halign ( ) const

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

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.
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.
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.
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.
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.

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.
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.

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.
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.
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.
Glib::PropertyProxy< bool > Gtk::Widget::property_hexpand ( )

Whether to expand horizontally.

See Gtk::Widget::set_hexpand().

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.
Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_hexpand ( ) const

Whether to expand horizontally.

See Gtk::Widget::set_hexpand().

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.
Glib::PropertyProxy< bool > Gtk::Widget::property_hexpand_set ( )

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

See Gtk::Widget::get_hexpand_set().

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.
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().

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.
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.
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.
Glib::PropertyProxy< Glib::RefPtr<LayoutManager> > Gtk::Widget::property_layout_manager ( )

The Gtk::LayoutManager instance to use to compute the preferred size of the widget, and allocate its children.

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.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<LayoutManager> > Gtk::Widget::property_layout_manager ( ) const

The Gtk::LayoutManager instance to use to compute the preferred size of the widget, and allocate its children.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy< int > Gtk::Widget::property_margin ( )

Sets all four sides' margin at once.

If read, returns max margin on any side.

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.
Glib::PropertyProxy_ReadOnly< int > Gtk::Widget::property_margin ( ) const

Sets all four sides' margin at once.

If read, returns max margin on any side.

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.
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.

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.
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.

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.
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.

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.
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.

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.
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.

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.
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.

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.
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.

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.
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.

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.
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.
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.
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

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.
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

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.
Glib::PropertyProxy< Overflow > Gtk::Widget::property_overflow ( )

How content outside the widget's content area is treated.

Since gtkmm 3.96:

Default value: Gtk::Overflow::VISIBLE

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.
Glib::PropertyProxy_ReadOnly< Overflow > Gtk::Widget::property_overflow ( ) const

How content outside the widget's content area is treated.

Since gtkmm 3.96:

Default value: Gtk::Overflow::VISIBLE

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Container* > Gtk::Widget::property_parent ( ) const

The parent widget of this 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.
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.
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.
Glib::PropertyProxy_ReadOnly< Root* > Gtk::Widget::property_root ( ) const

The Gtk::Root widget of the widget tree containing this widget or nullptr if the widget is not contained in a root 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.
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.

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.
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.
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.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Surface> > Gtk::Widget::property_surface ( ) const

The widget's surface if it is realized, nullptr otherwise.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
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.

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.
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.

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.
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.

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.
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.

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.
Glib::PropertyProxy< Align > Gtk::Widget::property_valign ( )

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

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.
Glib::PropertyProxy_ReadOnly< Align > Gtk::Widget::property_valign ( ) const

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

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.
Glib::PropertyProxy< bool > Gtk::Widget::property_vexpand ( )

Whether to expand vertically.

See Gtk::Widget::set_vexpand().

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.
Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_vexpand ( ) const

Whether to expand vertically.

See Gtk::Widget::set_vexpand().

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.
Glib::PropertyProxy< bool > Gtk::Widget::property_vexpand_set ( )

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

See Gtk::Widget::get_vexpand_set().

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.
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().

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.
Glib::PropertyProxy< bool > Gtk::Widget::property_visible ( )

Whether the widget is visible.

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.
Glib::PropertyProxy_ReadOnly< bool > Gtk::Widget::property_visible ( ) const

Whether the widget is visible.

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.
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.
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.
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().

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().

void Gtk::Widget::queue_draw ( )

Schedules this widget to be redrawn in paint phase of the current or the next frame.

This means widget's GtkWidgetClass.snapshot() implementation will be called.

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.

void Gtk::Widget::queue_resize_no_redraw ( )

This function works like queue_resize(), except that the widget is not invalidated.

void Gtk::Widget::realize ( )
protected

Creates the GDK (windowing system) resources associated with a widget.

For example, widget->surface 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_realize().

void Gtk::Widget::realize_if_needed ( )
protected
void Gtk::Widget::register_surface ( const Glib::RefPtr< Gdk::Surface >&  surface)

Registers a Gdk::Surface with the widget and sets it up so that the widget receives events for it.

Call unregister_surface() when destroying the surface.

Before 3.8 you needed to call gdk_surface_set_user_data() directly to set this up. This is now deprecated and you should use register_surface() instead. Old code will keep working as is, although some new features like transparency might not work perfectly.

Parameters
surfaceA Gdk::Surface.
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_groupAccel group for this widget.
accel_keyGDK keyval of the accelerator.
accel_modsModifier key combination of the accelerator.
Returns
Whether an accelerator was installed and could be removed.
void Gtk::Widget::remove_action_group ( const Glib::ustring name)

Removes a group from the widget.

See insert_action_group().

Parameters
nameThe prefix for actions.
Since gtkmm 3.10:
void Gtk::Widget::remove_controller ( const Glib::RefPtr< EventController >&  controller)

Removes controller from widget, so that it doesn't process events anymore.

It should not be used again.

Widgets will remove all event controllers automatically when they are destroyed, there is normally no need to call this function.

Parameters
controllerA Gtk::EventController.
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().

Parameters
labelA Gtk::Widget that was previously set as a mnemonic label for widget with add_mnemonic_label().
void Gtk::Widget::remove_modal_grab ( )

Remove the modal grab of the widget in case it was previously grabbed.

void Gtk::Widget::remove_tick_callback ( guint  id)

Removes a tick callback previously registered with add_tick_callback().

Since gtkmm 3.24:
Parameters
idAn id returned by add_tick_callback().
void Gtk::Widget::reparent ( Container new_parent)

Moves a widget from one Gtk::Container to another, handling reference count issues to avoid destroying the widget.

Parameters
new_parentA Gtk::Container to move the widget into.
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().

virtual void Gtk::Widget::root_vfunc ( )
protectedvirtual
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.

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_pathPath used to look up the accelerator.
accel_groupA Gtk::AccelGroup.
void Gtk::Widget::set_can_focus ( bool  can_focus = true)

Specifies whether widget can own the input focus.

Note that having can_focus be true is only one of the necessary conditions for being focusable. A widget must also be sensitive and not have a ancestor that is marked as not child-focusable in order to receive input focus.

See grab_focus() for actually setting the input focus on a widget.

Parameters
can_focusWhether or not widget can own the input focus.
void Gtk::Widget::set_can_target ( bool  can_target = true)

Sets whether widget can be the target of pointer events.

Parameters
can_targetWhether this widget should be able to receive pointer events.
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
visibleIf true, widget should be mapped along with its parent.
void Gtk::Widget::set_cursor ( const Glib::RefPtr< Gdk::Cursor >&  cursor)

Sets the cursor to be shown when pointer devices point towards widget.

If the cursor is nullptr, widget will use the cursor inherited from the parent widget.

Parameters
cursorThe new cursor or nullptr to use the default cursor.
void Gtk::Widget::set_cursor ( const Glib::ustring name = {})

Sets a named cursor to be shown when pointer devices point towards the widget.

This is a utility function that creates a cursor and then sets it on the widget.

If the name is an empty string, the widget will use the cursor specified via CSS or the parent widget. If neither specifies a cursor, the default cursor will be shown. This is the default behavior.

Since gtkmm 3.94:
Parameters
nameThe name of the cursor, or an empty string to use the default cursor.
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
dirThe new default direction. This cannot be Gtk::TextDirection::NONE.
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::TextDirection::NONE, then the value set by set_default_direction() will be used.

Parameters
dirThe new direction.
void Gtk::Widget::set_expand ( bool  expand = true)

Sets whether the widget would like any available extra space in both directions.

See also
set_hexpand() for more detail.
Parameters
expandWhether to expand in horizontal and vertical direction.
void Gtk::Widget::set_focus_child ( Widget child)
protected

Set child as the current focus child of widget.

The previous focus child will be unset.

This function is only suitable for widget implementations. If you want a certain widget to get the input focus, call grab_focus() on it.

Parameters
childA direct child widget of widget or nullptr to unset the focus child of widget.
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.

Parameters
focus_on_clickWhether the widget should grab focus when clicked with the mouse.
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.

Parameters
font_mapA Pango::FontMap, or nullptr to unset any previously set font map.
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::Display will be used.

Parameters
optionsA #cairo_font_options_t, or nullptr to unset any previously set default font options.
void Gtk::Widget::set_halign ( Align  align)

Sets the horizontal alignment of widget.

See the Gtk::Widget::property_halign() property.

Parameters
alignThe horizontal alignment.
void Gtk::Widget::set_has_surface ( bool  has_surface = true)
protected

Specifies whether widget has a Gdk::Surface of its own.

Note that all realized widgets have a non-nullptr “window” pointer (get_surface() never returns a nullptr surface when a widget is realized), but for many of them it’s actually the Gdk::Surface 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_surface = false.

This function should only be called by widget implementations, and they should call it in their init() function.

Parameters
has_surfaceWhether or not widget has a surface.
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.

Parameters
has_tooltipWhether or not widget has a tooltip.
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
expandWhether to expand.
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
setValue for hexpand-set property.
void Gtk::Widget::set_layout_manager ( const Glib::RefPtr< LayoutManager >&  layout_manager)

Sets the layout manager delegate instance that provides an implementation for measuring and allocating the children of widget.

Parameters
layout_managerA Gtk::LayoutManager.
void Gtk::Widget::set_margin ( int  margin)

Set all 4 margins to the same value.

Parameters
marginThe start, end, top, and bottom margin.
void Gtk::Widget::set_margin_bottom ( int  margin)

Sets the bottom margin of widget.

See the Gtk::Widget::property_margin_bottom() property.

Parameters
marginThe bottom margin.
void Gtk::Widget::set_margin_end ( int  margin)

Sets the end margin of widget.

See the Gtk::Widget::property_margin_end() property.

Parameters
marginThe end margin.
void Gtk::Widget::set_margin_start ( int  margin)

Sets the start margin of widget.

See the Gtk::Widget::property_margin_start() property.

Parameters
marginThe start margin.
void Gtk::Widget::set_margin_top ( int  margin)

Sets the top margin of widget.

See the Gtk::Widget::property_margin_top() property.

Parameters
marginThe top margin.
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
nameName for the widget.
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 displays with a compositing manager running. See gdk_display_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.

Parameters
opacityDesired opacity, between 0 and 1.
void Gtk::Widget::set_overflow ( Overflow  overflow)

Sets how widget treats content that is drawn outside the widget's content area.

See the definition of Gtk::Overflow for details.

This setting is provided for widget implementations and should not be used by application code.

The default value is Gtk::Overflow::VISIBLE.

Since gtkmm 3.96:
Parameters
overflowDesired overflow.
void Gtk::Widget::set_parent ( Widget parent)

This function is useful only when implementing subclasses of Gtk::Widget.

Sets parent as the parent widget of widget, and takes care of some details such as updating the state and style of the child to reflect its new location and resizing the parent. The opposite function is unparent().

Parameters
parentParent widget.
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.

Parameters
receives_defaultWhether or not widget can be a default widget.
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
sensitivetrue to make the widget sensitive.
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
widthWidth widget should request, or -1 to unset.
heightHeight widget should request, or -1 to unset.
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::StateFlags::DIR_LTR and Gtk::StateFlags::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::StateFlags::INSENSITIVE, will be propagated down to all non-internal children if widget is a Gtk::Container, while Gtk::StateFlags::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.

Parameters
flagsState flags to turn on.
clearWhether to clear state before turning on flags.
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::Surfaces are created in Gtk::Widget::signal_realize(), gdk_surface_set_support_multidevice() will have to be called manually on them.

Parameters
support_multidevicetrue to support input from multiple devices.
void Gtk::Widget::set_surface ( const Glib::RefPtr< Gdk::Surface >&  surface)
protected

Sets a widget's surface.

This function should only be used in a widget's Gtk::Widget::on_realize() implementation. The a surface passed is usually either a new surface created with Gdk::Surface::create(), or the surface of its parent widget as returned by get_parent()->get_surface().

Widgets must indicate whether they will create their own Gdk::Surface by calling set_has_surface(). 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
surfaceA Gdk::Surface.
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
markupThe contents of the tooltip for widget.
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().

Parameters
textThe contents of the tooltip for widget.
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.

Parameters
custom_windowA Gtk::Window, or nullptr.
void Gtk::Widget::set_valign ( Align  align)

Sets the vertical alignment of widget.

See the Gtk::Widget::property_valign() property.

Parameters
alignThe vertical alignment.
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
expandWhether to expand.
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
setValue for vexpand-set property.
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.

Parameters
visibleWhether the widget should be shown or not.
void Gtk::Widget::show ( )

Flags a widget to be displayed.

Any widget that isn’t shown will not appear on the screen.

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.

Glib::SignalProxy<void()> Gtk::Widget::signal_accel_closures_changed ( )
Slot Prototype:
void on_my_accel_closures_changed()

The signal_accel_closures_changed() signal gets emitted when accelerators for this widget get added, removed or 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
directionThe previous text direction of widget.
Glib::SignalProxy<void(const Glib::RefPtr<Gdk::Drag>&)> Gtk::Widget::signal_drag_begin ( )
Slot Prototype:
void on_my_drag_begin(const Glib::RefPtr<Gdk::Drag>& drag)

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_paintable().

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
dragThe drag context.
Glib::SignalProxy<void(const Glib::RefPtr<Gdk::Drag>&)> Gtk::Widget::signal_drag_data_delete ( )
Slot Prototype:
void on_my_drag_data_delete(const Glib::RefPtr<Gdk::Drag>& drag)

Flags: Run Last

The signal_drag_data_delete() signal is emitted on the drag source when a drag with the action Gdk::DragAction::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
dragThe drag context.
Glib::SignalProxy<void(const Glib::RefPtr<Gdk::Drag>&, SelectionData&)> Gtk::Widget::signal_drag_data_get ( )
Slot Prototype:
void on_my_drag_data_get(const Glib::RefPtr<Gdk::Drag>& drag, SelectionData& selection_data)

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. See Gtk::SelectionData::set() and Gtk::SelectionData::set_text().

Parameters
dragThe drag context.
selection_dataThe Gtk::SelectionData to be filled with the dragged data.
Glib::SignalProxy<void(const Glib::RefPtr<Gdk::Drop>&, const SelectionData&)> Gtk::Widget::signal_drag_data_received ( )
Slot Prototype:
void on_my_drag_data_received(const Glib::RefPtr<Gdk::Drop>& drop, const SelectionData& selection_data)

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 gdk_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 gdk_drag_finish().

The handler may inspect the selected action with gdk_drag_context_get_selected_action() before calling gdk_drag_finish(), e.g. to implement Gdk::DragAction::ASK as shown in the following example:

[C example ellipted]

Parameters
dropThe Gdk::Drop.
selection_dataThe received data.
Glib::SignalProxy<bool(const Glib::RefPtr<Gdk::Drop>&, int, int)> Gtk::Widget::signal_drag_drop ( )
Slot Prototype:
bool on_my_drag_drop(const Glib::RefPtr<Gdk::Drop>& drop, int x, int y)

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 gdk_drag_finish() is called to let the source know that the drop is done. The call to gdk_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
dropThe Gdk::Drop.
xThe x coordinate of the current cursor position.
yThe y coordinate of the current cursor position.
Returns
Whether the cursor position is in a drop zone.
Glib::SignalProxy<void(const Glib::RefPtr<Gdk::Drag>&)> Gtk::Widget::signal_drag_end ( )
Slot Prototype:
void on_my_drag_end(const Glib::RefPtr<Gdk::Drag>& drag)

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
dragThe drag context.
Glib::SignalProxy<bool(const Glib::RefPtr<Gdk::Drag>&, DragResult)> Gtk::Widget::signal_drag_failed ( )
Slot Prototype:
bool on_my_drag_failed(const Glib::RefPtr<Gdk::Drag>& drag, 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.

Parameters
dragThe drag context.
resultThe result of the drag operation.
Returns
true if the failed drag operation has been already handled.
Glib::SignalProxy<void(const Glib::RefPtr<Gdk::Drop>&)> Gtk::Widget::signal_drag_leave ( )
Slot Prototype:
void on_my_drag_leave(const Glib::RefPtr<Gdk::Drop>& drop)

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
dropThe Gdk::Drop.
Glib::SignalProxy<bool(const Glib::RefPtr<Gdk::Drop>&, int, int)> Gtk::Widget::signal_drag_motion ( )
Slot Prototype:
bool on_my_drag_motion(const Glib::RefPtr<Gdk::Drop>& drop, int x, int y)

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::DestDefaults::DROP, Gtk::DestDefaults::MOTION or Gtk::DestDefaults::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
dropThe Gdk::Drop.
xThe x coordinate of the current cursor position.
yThe y coordinate of the current cursor position.
Returns
Whether the cursor position is in a drop zone.
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_grabbedfalse if the widget becomes shadowed, true if it becomes unshadowed.
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().

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.

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().

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_cyclingtrue 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.
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.
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.

Parameters
xThe x coordinate of the cursor position where the request has been emitted, relative to widget's left side.
yThe y coordinate of the cursor position where the request has been emitted, relative to widget's top.
keyboard_tooltiptrue if the tooltip was triggered using the keyboard.
tooltipA Gtk::Tooltip.
Returns
true if tooltip should be shown right now, false otherwise.
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::Surface, which means that Gtk::Widget::realize() has been called or the widget has been mapped (that is, it is going to be drawn).

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().

Glib::SignalProxy<void(int, int, int)> Gtk::Widget::signal_size_allocate ( )
Slot Prototype:
void on_my_size_allocate(int width, int height, int baseline)

Flags: Run First

Parameters
widthThe content width of the widget.
heightThe content height of the widget.
baselineThe baseline.
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().

Parameters
previous_state_flagsThe previous state flags.
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().

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.

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::Surface 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).

void Gtk::Widget::size_allocate ( const Allocation allocation,
int  baseline 
)

This is a simple form of allocate() that takes the new position of widget as part of allocation.

Parameters
allocationPosition and size to be allocated to widget.
baselineThe baseline of the child, or -1.
void Gtk::Widget::snapshot_child ( Widget child,
const Glib::RefPtr< Gtk::Snapshot >&  snapshot 
)

When a widget receives a call to the snapshot function, it must send synthetic Gtk::Widget::signal_snapshot() calls to all children.

This function provides a convenient way of doing this. A widget, when it receives a call to its Gtk::Widget::signal_snapshot() function, calls snapshot_child() once for each child, passing in the snapshot the widget received.

snapshot_child() takes care of translating the origin of snapshot, and deciding whether the child needs to be snapshot.

Parameters
childA child of widget.
snapshotGtk::Snapshot as passed to the widget. In particular, no calls to Gtk::Snapshot::translate() or other transform calls should have been made.
virtual void Gtk::Widget::snapshot_vfunc ( const Glib::RefPtr< Gtk::Snapshot >&  snapshot)
protectedvirtual
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 widget must share a common toplevel.

Parameters
dest_widgetA Gtk::Widget.
src_xX position relative to src_widget.
src_yY position relative to src_widget.
dest_xLocation to store X position relative to dest_widget.
dest_yLocation to store Y position relative to dest_widget.
Returns
false if src_widget and dest_widget have no common ancestor. In this case, 0 is stored in
  • dest_x and * dest_y. Otherwise true.
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.

void Gtk::Widget::unmap ( )

This function is only for use in widget implementations.

Causes a widget to be unmapped if it’s currently mapped.

void Gtk::Widget::unparent ( )

This function is only for use in widget implementations.

Should be called by parent widgets to dissociate widget from the parent.

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->surface).

void Gtk::Widget::unregister_surface ( const Glib::RefPtr< Gdk::Surface >&  surface)

Unregisters a Gdk::Surface from the widget that was previously set up with register_surface().

You need to call this when the surface is no longer used by the widget, such as when you destroy it.

Parameters
surfaceA Gdk::Surface.
virtual void Gtk::Widget::unroot_vfunc ( )
protectedvirtual
void Gtk::Widget::unset_focus_child ( )
protected

Unsets the focus child of the widget.

The previous focus child will be unset.

This function is only suitable for widget implementations.

void Gtk::Widget::unset_font_options ( )

Undoes the effect of previous calls to set_font_options().

Since gtkmm 3.20:
void Gtk::Widget::unset_layout_manager ( )

Undoes the effect of a previous call to set_layout_manager().

void Gtk::Widget::unset_name ( )
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().

Parameters
flagsState flags to turn off.

Friends And Related Function Documentation

Gtk::Widget* wrap ( GtkWidget *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse 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.