Sets the accelerator path of the menu item, through which runtime changes of the menu item's accelerator caused by the user can be identified and saved to persistant storage.
Whether the widget is double buffered.
Whether to expand in both directions. Setting this sets both #GtkWidget:hexpand and #GtkWidget:vexpand
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.
How to distribute horizontal space if widget gets extra space, see #GtkAlign
Enables or disables the emission of #GtkWidget::query-tooltip on widget
.
A value of %TRUE indicates that widget
can have a tooltip, in this case
the widget will be queried using #GtkWidget::query-tooltip to determine
whether it will provide a tooltip or not.
Note that setting this property to %TRUE for the first time will change the event masks of the GdkWindows of this widget to include leave-notify and motion-notify events. This cannot and will not be undone when the property is set to %FALSE again.
Whether to expand horizontally. See gtk_widget_set_hexpand().
Whether to use the #GtkWidget:hexpand property. See gtk_widget_get_hexpand_set().
The text for the child label.
Sets all four sides' margin at once. If read, returns max margin on any side.
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.
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.
Margin on left side of widget.
This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.
Margin on right side of widget.
This property adds margin outside of the widget's normal size request, the margin will be added in addition to the size from gtk_widget_set_size_request() for example.
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.
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.
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
The action that this activatable will activate and receive updates from for various states and possibly appearance.
#GtkActivatable implementors need to handle the this property and call gtk_activatable_do_set_related_action() when it changes.
Sets whether the menu item appears justified at the right side of a menu bar.
The scale factor of the widget. See gtk_widget_get_scale_factor() for more details about widget scaling.
The style of the widget, which contains information about how it will look (colors, etc).
The submenu attached to the menu item, or %NULL if it has none.
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 %NULL: #GtkWidget:has-tooltip will automatically be set to %TRUE and there will be taken care of #GtkWidget::query-tooltip in the default signal handler.
Note that if both #GtkWidget:tooltip-text and #GtkWidget:tooltip-markup are set, the last one wins.
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 %NULL: #GtkWidget:has-tooltip will automatically be set to %TRUE and there will be taken care of #GtkWidget::query-tooltip in the default signal handler.
Note that if both #GtkWidget:tooltip-text and #GtkWidget:tooltip-markup are set, the last one wins.
Whether this activatable should reset its layout and appearance when setting the related action or when the action changes appearance.
See the #GtkAction documentation directly to find which properties should be ignored by the #GtkActivatable when this property is %FALSE.
#GtkActivatable implementors need to handle this property and call gtk_activatable_sync_action_properties() on the activatable widget when it changes.
%TRUE if underlines in the text indicate mnemonics.
How to distribute vertical space if widget gets extra space, see #GtkAlign
Whether to expand vertically. See gtk_widget_set_vexpand().
Whether to use the #GtkWidget:vexpand property. See gtk_widget_get_vexpand_set().
The widget's window if it is realized, %NULL otherwise.
Emits the #GtkMenuItem::activate signal on the given item
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.
Adds widget
to container
. Typically used for simple containers
such as #GtkWindow, #GtkFrame, or #GtkButton; for more complicated
layout containers such as #GtkBox or #GtkGrid, this function will
pick default packing parameters that may not be correct. So
consider functions such as gtk_box_pack_start() and
gtk_grid_attach() as an alternative to gtk_container_add() in
those cases. A widget may be added to only one container at a time;
you can’t place the same widget inside two different containers.
Note that some containers, such as #GtkScrolledWindow or #GtkListBox, may add intermediate children between the added widget and the container.
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_accel_map_add_entry() and gtk_widget_set_accel_path() or
gtk_menu_item_set_accel_path() instead.
widget signal to emit on accelerator activation
accel group for this widget, added to its toplevel
GDK keyval of the accelerator
modifier key combination of the accelerator
flag accelerators, e.g. %GTK_ACCEL_VISIBLE
Adds the events in the bitfield events
to the event mask for
widget
. See gtk_widget_set_events() and the
[input handling overview][event-masks] for details.
an event mask, see #GdkEventMask
Adds a widget to the list of mnemonic labels for this widget. (See gtk_widget_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, by using a connection to the #GtkWidget::destroy signal or a weak notifier.
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 #GtkLabel), then you will have to call gtk_widget_queue_resize() or gtk_widget_queue_draw_area() yourself.
gdk_frame_clock_get_frame_time() should generally be used for timing continuous animations and gdk_frame_timings_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 #GdkFrameClock::update signal of #GdkFrameClock, since you don't have to worry about when a #GdkFrameClock is assigned to a widget.
function to call for updating animations
Creates a binding between source_property
on source
and target_property
on target
.
Whenever the source_property
is changed the target_property
is
updated using the same value. For instance:
g_object_bind_property (action, "active", widget, "sensitive", 0);
Will result in the "sensitive" property of the widget #GObject instance to be updated with the same value of the "active" property of the action #GObject instance.
If flags
contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
if target_property
on target
changes then the source_property
on source
will be updated as well.
The binding will automatically be removed when either the source
or the
target
instances are finalized. To remove the binding without affecting the
source
and the target
you can just call g_object_unref() on the returned
#GBinding instance.
Removing the binding by calling g_object_unref() on it must only be done if
the binding, source
and target
are only used from a single thread and it
is clear that both source
and target
outlive the binding. Especially it
is not safe to rely on this if the binding, source
or target
can be
finalized from different threads. Keep another reference to the binding and
use g_binding_unbind() instead to be on the safe side.
A #GObject can have multiple bindings.
the property on source
to bind
the target #GObject
the property on target
to bind
flags to pass to #GBinding
Creates a binding between source_property
on source
and target_property
on target,
allowing you to set the transformation functions to be used by
the binding.
This function is the language bindings friendly version of g_object_bind_property_full(), using #GClosures instead of function pointers.
the property on source
to bind
the target #GObject
the property on target
to bind
flags to pass to #GBinding
a #GClosure wrapping the transformation function from the source
to the target,
or %NULL to use the default
a #GClosure wrapping the transformation function from the target
to the source,
or %NULL to use the default
Determines whether an accelerator that activates the signal
identified by signal_id
can currently be activated.
This is done by emitting the #GtkWidget::can-activate-accel
signal on widget;
if the signal isn’t overridden by a
handler or in a derived widget, then the default check is
that the widget must be sensitive, and the widget and all
its ancestors mapped.
the ID of a signal installed on widget
This function is used by custom widget implementations; if you're writing an app, you’d use gtk_widget_grab_focus() to move the focus to a particular widget, and gtk_container_set_focus_chain() to change the focus tab order. So you may want to investigate those functions instead.
gtk_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). gtk_widget_child_focus() emits the
#GtkWidget::focus signal; widgets override the default handler
for this signal in order to implement appropriate focus behavior.
The default ::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 gtk_widget_grab_focus() to place the focus accordingly;
if returning %FALSE, they don’t modify the current focus location.
direction of focus movement
Emits a #GtkWidget::child-notify signal for the
[child property][child-properties] child_property
on widget
.
This is the analogue of g_object_notify() for child properties.
Also see gtk_container_child_notify().
Emits a #GtkWidget::child-notify signal for the
[child property][child-properties] specified by
pspec
on the child.
This is an analogue of g_object_notify_by_pspec() for child properties.
the child widget
the #GParamSpec of a child property instealled on the class of container
Returns the type of the children supported by the container.
Note that this may return %G_TYPE_NONE to indicate that no more children can be added, e.g. for a #GtkPaned which already has two children.
Same as gtk_widget_path(), but always uses the name of a widget’s type, never uses a custom name set with gtk_widget_set_name().
Computes whether a container should give this widget extra space when possible. Containers should check this, rather than looking at gtk_widget_get_hexpand() or gtk_widget_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.
expand direction
Creates a new #PangoLayout with the appropriate font map, font description, and base direction for drawing text for this widget.
If you keep a #PangoLayout created in this way around, you need to re-create it when the widget #PangoContext is replaced. This can be tracked by using the #GtkWidget::screen-changed signal on the widget.
text to set on the layout (can be %NULL)
This is similar to gtk_buildable_parser_finished() but is
called once for each custom tag handled by the buildable
.
a #GtkBuilder
child object or %NULL for non-child tags
the name of the tag
user data created in custom_tag_start
This is called at the end of each custom element handled by the buildable.
#GtkBuilder used to construct this object
child object or %NULL for non-child tags
name of tag
user data that will be passed in to parser functions
This is called for each unknown element under <child>
.
a #GtkBuilder used to construct this object
child object or %NULL for non-child tags
name of tag
Emits the #GtkMenuItem::deselect signal on the given item.
Destroys a widget.
When a widget is destroyed all references it holds on other objects will be released:
It's expected that all references held on the widget will also
be released; you should connect to the #GtkWidget::destroy signal
if you hold a reference to widget
and you wish to remove it when
this function is called. It is not necessary to do so if you are
implementing a #GtkContainer, as you'll be able to use the
#GtkContainerClass.remove() virtual function for that.
It's important to notice that gtk_widget_destroy() will only cause
the widget
to be finalized if no additional references, acquired
using g_object_ref(), are held on it. In case additional references
are in place, the widget
will be in an "inert" state after calling
this function; widget
will still point to valid memory, allowing you
to release the references you hold, but you may not query the widget's
own state.
You should typically call this function on top level widgets, and rarely on child widgets.
See also: gtk_container_remove()
This function sets *widget_pointer
to %NULL if widget_pointer
!=
%NULL. It’s intended to be used as a callback connected to the
“destroy” signal of a widget. You connect gtk_widget_destroyed()
as a signal handler, and pass the address of your widget variable
as user data. Then when the widget is destroyed, the variable will
be set to %NULL. Useful for example to avoid multiple copies
of the same dialog.
This is a utility function for #GtkActivatable implementors.
When implementing #GtkActivatable you must call this when handling changes of the #GtkActivatable:related-action, and you must also use this to break references in #GObject->dispose().
This function adds a reference to the currently set related action for you, it also makes sure the #GtkActivatable->update() method is called when the related #GtkAction properties change and registers to the action’s proxy list.
Be careful to call this before setting the local copy of the #GtkAction property, since this function uses gtk_activatable_get_related_action() to retrieve the previous action.
This function is equivalent to gtk_drag_begin_with_coordinates(), passing -1, -1 as coordinates.
The targets (data formats) in which the source can provide the data
A bitmask of the allowed drag actions for this drag
The button the user clicked to start the drag
The event that triggered the start of the drag, or %NULL if none can be obtained.
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.
The event
is used to retrieve the timestamp that will be used internally to
grab the pointer. If event
is %NULL, then %GDK_CURRENT_TIME will be used.
However, you should try to pass a real event in all cases, since that can be
used to get information about the drag.
Generally there are three cases when you want to start a drag by hand by calling this function:
During a #GtkWidget::button-press-event handler, if you want to start a drag
immediately when the user presses the mouse button. Pass the event
that you have in your #GtkWidget::button-press-event handler.
During a #GtkWidget::motion-notify-event handler, if you want to start a drag
when the mouse moves past a certain threshold distance after a button-press.
Pass the event
that you have in your #GtkWidget::motion-notify-event handler.
During a timeout handler, if you want to start a drag after the mouse button is held down for some time. Try to save the last event that you got from the mouse, using gdk_event_copy(), and pass it to this function (remember to free the event with gdk_event_free() when you are done). If you really cannot pass a real event, pass %NULL instead.
The targets (data formats) in which the source can provide the data
A bitmask of the allowed drag actions for this drag
The button the user clicked to start the drag
The event that triggered the start of the drag, or %NULL if none can be obtained.
The initial x coordinate to start dragging from, in the coordinate space of widget
. If -1 is passed, the coordinates are retrieved from event
or the current pointer position
The initial y coordinate to start dragging from, in the coordinate space of widget
. If -1 is passed, the coordinates are retrieved from event
or the current pointer position
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.
X coordinate of start of drag
Y coordinate of start of drag
current X coordinate
current Y coordinate
Add the image targets supported by #GtkSelectionData 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().
Add the text targets supported by #GtkSelectionData 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().
Add the URI targets supported by #GtkSelectionData 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().
Looks for a match between the supported targets of context
and the
dest_target_list,
returning the first matching target, otherwise
returning %GDK_NONE. dest_target_list
should usually be the return
value from gtk_drag_dest_get_target_list(), but some widgets may
have different valid targets for different parts of the widget; in
that case, they will have to implement a drag_motion handler that
passes the correct target list to this function.
drag context
list of droppable targets, or %NULL to use gtk_drag_dest_get_target_list (widget)
.
Returns the list of targets this widget can accept from drag-and-drop.
Returns whether the widget has been configured to always emit #GtkWidget::drag-motion signals.
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
(#GtkWidget::drag-motion, #GtkWidget::drag-drop, ...). They all exist
for convenience. When passing #GTK_DEST_DEFAULT_ALL for instance it is
sufficient to connect to the widget’s #GtkWidget::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 #GtkWidget::drag-motion. The default
behaviors described by flags
make some assumptions, that can conflict
with your own signal handlers. For instance #GTK_DEST_DEFAULT_DROP causes
invokations of gdk_drag_status() in the context of #GtkWidget::drag-motion,
and invokations of gtk_drag_finish() in #GtkWidget::drag-data-received.
Especially the later is dramatic, when your own #GtkWidget::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 #GtkWidget::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:
static void
drag_motion (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time)
{
GdkModifierType mask;
gdk_window_get_pointer (gtk_widget_get_window (widget),
NULL, NULL, &mask);
if (mask & GDK_CONTROL_MASK)
gdk_drag_status (context, GDK_ACTION_COPY, time);
else
gdk_drag_status (context, GDK_ACTION_MOVE, time);
}
which types of default drag behavior to use
a pointer to an array of #GtkTargetEntrys indicating the drop types that this widget
will accept, or %NULL. Later you can access the list with gtk_drag_dest_get_target_list() and gtk_drag_dest_find_target().
a bitmask of possible actions for a drop onto this widget
.
Sets this widget as a proxy for drops to another window.
the window to which to forward drag events
the drag protocol which the proxy_window
accepts (You can use gdk_drag_get_protocol() to determine this)
If %TRUE, send the same coordinates to the destination, because it is an embedded subwindow.
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().
list of droppable targets, or %NULL for none
Tells the widget to emit #GtkWidget::drag-motion and #GtkWidget::drag-leave events regardless of the targets and the %GTK_DEST_DEFAULT_MOTION flag.
This may be used when a widget wants to do generic actions regardless of the targets that the source offers.
whether to accept all targets
Clears information about a drop destination set with gtk_drag_dest_set(). The widget will no longer receive notification of drags.
Gets the data associated with a drag. When the data
is received or the retrieval fails, GTK+ will emit a
#GtkWidget::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_DEST_DEFAULT_DROP was set,
then the widget will not receive notification of failed
drops.
the drag context
the target (form of the data) to retrieve
a timestamp for retrieving the data. This will generally be the time received in a #GtkWidget::drag-motion or #GtkWidget::drag-drop signal
Highlights a widget as a currently hovered drop target. To end the highlight, call gtk_drag_unhighlight(). GTK+ calls this automatically if %GTK_DEST_DEFAULT_HIGHLIGHT is set.
Add the writable image targets supported by #GtkSelectionData 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().
Add the text targets supported by #GtkSelectionData 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_text_targets() and
gtk_drag_source_set_target_list().
Add the URI targets supported by #GtkSelectionData 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_uri_targets() and
gtk_drag_source_set_target_list().
Gets the list of targets this widget can provide for drag-and-drop.
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.
the bitmask of buttons that can start the drag
the table of targets that the drag will support, may be %NULL
the bitmask of possible actions for a drag from this widget
Sets the icon that will be used for drags from a particular source to a themed icon. See the docs for #GtkIconTheme for more details.
name of icon to use
Sets the icon that will be used for drags from a particular widget
from a #GdkPixbuf. GTK+ retains a reference for pixbuf
and will
release it when it is no longer needed.
the #GdkPixbuf for the drag icon
Sets the icon that will be used for drags from a particular source to a stock icon.
the ID of the stock icon to use
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().
list of draggable targets, or %NULL for none
Undoes the effects of gtk_drag_source_set().
Removes a highlight set by gtk_drag_highlight() from a widget.
Draws widget
to cr
. The top left corner of the widget will be
drawn to the currently set origin point of cr
.
You should pass a cairo context as cr
argument that is in an
original state. Otherwise the resulting drawing is undefined. For
example changing the operator using cairo_set_operator() or the
line width using cairo_set_line_width() might have unwanted side
effects.
You may however change the context’s transform matrix - like with
cairo_scale(), cairo_translate() or cairo_set_matrix() and clip
region with cairo_clip() prior to calling this function. Also, it
is fine to modify the context with cairo_save() and
cairo_push_group() prior to calling this function.
Note that special-purpose widgets may contain special code for rendering to the screen and might appear differently on screen and when rendered using gtk_widget_draw().
Ensures that widget
has a style (widget->
style).
Not a very useful function; most of the time, if you want the style, the widget is realized, and realized widgets are guaranteed to have a style already.
Notifies the user about an input-related error on this widget. If the #GtkSettings:gtk-error-bell setting is %TRUE, it calls gdk_window_beep(), otherwise it does nothing.
Note that the effect of gdk_window_beep() can be configured in many ways, depending on the windowing backend and the desktop environment or window manager that is used.
Rarely-used function. This function is used to emit the event signals on a widget (those signals should never be emitted without using this function to do so). If you want to synthesize an event though, don’t use this function; instead, use gtk_main_do_event() so the event will behave as if it were in the event queue. Don’t synthesize expose events; instead, use gdk_window_invalidate_rect() to invalidate a region of the window.
Invokes callback
on each direct child of container,
including
children that are considered “internal” (implementation details
of the container). “Internal” children generally weren’t added
by the user of the container, but were added by the container
implementation itself.
Most applications should use gtk_container_foreach(), rather than gtk_container_forall().
This function is intended for #GObject implementations to re-enforce a [floating][floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink().
Invokes callback
on each non-internal child of container
.
See gtk_container_forall() for details on what constitutes
an “internal” child. For all practical purposes, this function
should iterate over precisely those child widgets that were
added to the container by the application with explicit add()
calls.
It is permissible to remove the child from the callback
handler.
Most applications should use gtk_container_foreach(), rather than gtk_container_forall().
Stops emission of #GtkWidget::child-notify signals on widget
. The
signals are queued until gtk_widget_thaw_child_notify() is called
on widget
.
This is the analogue of g_object_freeze_notify() for child properties.
Increases the freeze count on object
. If the freeze count is
non-zero, the emission of "notify" signals on object
is
stopped. The signals are queued until the freeze count is decreased
to zero. Duplicate notifications are squashed so that at most one
#GObject::notify signal is emitted for each property modified while the
object is frozen.
This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.
Retrieve the accelerator path that was previously set on menu_item
.
See gtk_menu_item_set_accel_path() for details.
Returns the accessible object that describes the widget to an assistive technology.
If accessibility support is not available, this #AtkObject instance may be a no-op. Likewise, if no class-specific #AtkObject implementation is available for the widget instance in question, it will inherit an #AtkObject 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.
Retrieves the #GActionGroup that was registered using prefix
. The resulting
#GActionGroup may have been registered to widget
or any #GtkWidget in its
ancestry.
If no action group was found matching prefix,
then %NULL is returned.
The “prefix” of the action group.
Gets the action name for actionable
.
See gtk_actionable_set_action_name() for more information.
Returns the baseline that has currently been allocated to widget
.
This function is intended to be used when implementing handlers
for the #GtkWidget::draw function, and when allocating child
widgets in #GtkWidget::size_allocate.
Returns the height that has currently been allocated to widget
.
This function is intended to be used when implementing handlers
for the #GtkWidget::draw function.
Retrieves the widget’s allocated size.
This function returns the last values passed to gtk_widget_size_allocate_with_baseline(). The value differs from the size returned in gtk_widget_get_allocation() in that functions like gtk_widget_set_halign() can adjust the allocation, but not the value returned by this function.
If a widget is not visible, its allocated size is 0.
Returns the width that has currently been allocated to widget
.
This function is intended to be used when implementing handlers
for the #GtkWidget::draw function.
Retrieves the widget’s allocation.
Note, when implementing a #GtkContainer: a widget’s allocation will be its “adjusted” allocation, that is, the widget’s parent container typically calls gtk_widget_size_allocate() with an allocation, and that allocation is then adjusted (to handle margin and alignment for example) before assignment to the widget. gtk_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 gtk_widget_size_allocate() allocation, however. So a #GtkContainer 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 gtk_widget_size_allocate(), since it isn’t stored; if a container implementation needs that information it will have to track it itself.
Gets the first ancestor of widget
with type widget_type
. For example,
gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)
gets
the first #GtkBox 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 #GtkWindow in the docs for
gtk_widget_get_toplevel().
Note that unlike gtk_widget_is_ancestor(), gtk_widget_get_ancestor()
considers widget
to be an ancestor of itself.
ancestor type
Determines whether the application intends to draw on the widget in an #GtkWidget::draw handler.
See gtk_widget_set_app_paintable()
Retrieves the border width of the container. See gtk_container_set_border_width().
Determines whether widget
can be a default widget. See
gtk_widget_set_can_default().
Determines whether widget
can own the input focus. See
gtk_widget_set_can_focus().
This function is only for use in widget implementations. Obtains
widget->
requisition, unless someone has forced a particular
geometry on the widget (e.g. with gtk_widget_set_size_request()),
in which case it returns that geometry instead of the widget's
requisition.
This function differs from gtk_widget_size_request() in that
it retrieves the last size request value from widget->
requisition,
while gtk_widget_size_request() actually calls the "size_request" method
on widget
to compute the size request and fill in widget->
requisition,
and only then returns widget->
requisition.
Because this function does not call the “size_request” method, it
can only be used when you know that widget->
requisition is
up-to-date, that is, gtk_widget_size_request() has been called
since the last time a resize was queued. In general, only container
implementations have this information; applications should use
gtk_widget_size_request().
Gets the value set with gtk_widget_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 the clipboard object for the given selection to
be used with widget
. widget
must have a #GdkDisplay
associated with it, so must be attached to a toplevel
window.
a #GdkAtom which identifies the clipboard to use. %GDK_SELECTION_CLIPBOARD gives the default clipboard. Another common value is %GDK_SELECTION_PRIMARY, which gives the primary X selection.
Obtains the composite name of a widget.
Gets a named field from the objects table of associations (see g_object_set_data()).
name of the key for that association
The #GtkMenuItem widget and the derived widgets are the only valid children for menus. Their function is to correctly handle highlighting, alignment, events and submenus.
As a GtkMenuItem derives from #GtkBin it can hold any valid child widget, although only a few are really useful.
By default, a GtkMenuItem sets a #GtkAccelLabel as its child. GtkMenuItem has direct functions to set the label and its mnemonic. For more advanced label settings, you can fetch the child widget from the GtkBin.
An example for setting markup and accelerator on a MenuItem:
GtkMenuItem as GtkBuildable
The GtkMenuItem implementation of the #GtkBuildable interface supports adding a submenu by specifying “submenu” as the “type” attribute of a
<child>
element.An example of UI definition fragment with submenus:
|[
GtkMenuItem has a single CSS node with name menuitem. If the menuitem has a submenu, it gets another CSS node with name arrow, which has the .left or .right style class.