Gtk.WidgetClass¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
activate_signal |
r |
The signal to emit when a widget of this class is activated, |
|
adjust_baseline_allocation |
r |
||
adjust_baseline_request |
r |
||
adjust_size_allocation |
r |
||
adjust_size_request |
r |
||
button_press_event |
r |
||
button_release_event |
r |
||
can_activate_accel |
r |
||
child_notify |
r |
||
composited_changed |
r |
||
compute_expand |
r |
||
configure_event |
r |
||
damage_event |
r |
||
delete_event |
r |
||
destroy |
r |
||
destroy_event |
r |
||
direction_changed |
r |
||
dispatch_child_properties_changed |
r |
||
drag_begin |
r |
||
drag_data_delete |
r |
||
drag_data_get |
r |
||
drag_data_received |
r |
||
drag_drop |
r |
||
drag_end |
r |
||
drag_failed |
r |
||
drag_leave |
r |
||
drag_motion |
r |
||
draw |
r |
||
enter_notify_event |
r |
||
event |
r |
||
focus |
r |
||
focus_in_event |
r |
||
focus_out_event |
r |
||
get_accessible |
r |
||
get_preferred_height |
r |
||
get_preferred_height_and_baseline_for_width |
r |
||
get_preferred_height_for_width |
r |
||
get_preferred_width |
r |
||
get_preferred_width_for_height |
r |
||
get_request_mode |
r |
||
grab_broken_event |
r |
||
grab_focus |
r |
||
grab_notify |
r |
||
hide |
r |
||
hierarchy_changed |
r |
||
key_press_event |
r |
||
key_release_event |
r |
||
keynav_failed |
r |
||
leave_notify_event |
r |
||
map |
r |
||
map_event |
r |
||
mnemonic_activate |
r |
||
motion_notify_event |
r |
||
move_focus |
r |
||
parent_class |
r |
The object class structure needs to be the first element in the widget class structure in order for the class mechanism to work correctly. This allows a |
|
parent_set |
r |
||
popup_menu |
r |
||
property_notify_event |
r |
||
proximity_in_event |
r |
||
proximity_out_event |
r |
||
query_tooltip |
r |
||
queue_draw_region |
r |
||
realize |
r |
||
screen_changed |
r |
||
scroll_event |
r |
||
selection_clear_event |
r |
||
selection_get |
r |
||
selection_notify_event |
r |
||
selection_received |
r |
||
selection_request_event |
r |
||
show |
r |
||
show_all |
r |
||
show_help |
r |
||
size_allocate |
r |
||
state_changed |
r |
||
state_flags_changed |
r |
||
style_set |
r |
||
style_updated |
r |
||
touch_event |
r |
||
unmap |
r |
||
unmap_event |
r |
||
unrealize |
r |
||
visibility_notify_event |
r |
||
window_state_event |
r |
Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Gtk.WidgetClass¶
- bind_template_callback_full(callback_name, callback_symbol)[source]¶
- Parameters:
callback_name (
str
) – The name of the callback as expected in the template XMLcallback_symbol (
GObject.Callback
) – The callback symbol
Declares a callback_symbol to handle callback_name from the template XML defined for widget_type. See
Gtk.Builder.add_callback_symbol
().Note that this must be called from a composite widget classes class initializer after calling
Gtk.WidgetClass.set_template
().New in version 3.10.
- bind_template_child_full(name, internal_child, struct_offset)[source]¶
- Parameters:
name (
str
) – The “id” of the child defined in the template XMLinternal_child (
bool
) – Whether the child should be accessible as an “internal-child” when this class is used inGtk.Builder
XMLstruct_offset (
int
) – The structure offset into the composite widget’s instance public or private structure where the automated child pointer should be set, or 0 to not assign the pointer.
Automatically assign an object declared in the class template XML to be set to a location on a freshly built instance’s private data, or alternatively accessible via
Gtk.Widget.get_template_child
().The struct can point either into the public instance, then you should use G_STRUCT_OFFSET(WidgetType, member) for struct_offset, or in the private struct, then you should use G_PRIVATE_OFFSET(WidgetType, member).
An explicit strong reference will be held automatically for the duration of your instance’s life cycle, it will be released automatically when
GObject.Object.do_dispose
() runs on your instance and if a struct_offset that is != 0 is specified, then the automatic location in your instance public or private data will be set toNone
. You can however access an automated child pointer the first time your classesGObject.Object.do_dispose
() runs, or alternatively inGtk.Widget.do_destroy
().If internal_child is specified,
Gtk.Buildable.do_get_internal_child
() will be automatically implemented by theGtk.Widget
class so there is no need to implement it manually.The wrapper macros gtk_widget_class_bind_template_child(), gtk_widget_class_bind_template_child_internal(), gtk_widget_class_bind_template_child_private() and gtk_widget_class_bind_template_child_internal_private() might be more convenient to use.
Note that this must be called from a composite widget classes class initializer after calling
Gtk.WidgetClass.set_template
().New in version 3.10.
- find_style_property(property_name)[source]¶
- Parameters:
property_name (
str
) – the name of the style property to find- Returns:
the
GObject.ParamSpec
of the style property orNone
if class has no style property with that name.- Return type:
Finds a style property of a widget class by name.
New in version 2.2.
- get_css_name()[source]¶
- Returns:
the CSS name of the given class
- Return type:
Gets the name used by this class for matching in CSS code. See
Gtk.WidgetClass.set_css_name
() for details.New in version 3.20.
- install_style_property(pspec)[source]¶
- Parameters:
pspec (
GObject.ParamSpec
) – theGObject.ParamSpec
for the property
Installs a style property on a widget class. The parser for the style property is determined by the value type of pspec.
- list_style_properties()[source]¶
- Returns:
a newly allocated array of
GObject.ParamSpec
. The array must be freed withGLib.free
().- Return type:
Returns all style properties of a widget class.
New in version 2.2.
- set_accessible_role(role)[source]¶
- Parameters:
role (
Atk.Role
) – The role to use for accessibles created for self
Sets the default
Atk.Role
to be set on accessibles created for widgets of self. Accessibles may decide to not honor this setting if their role reporting is more refined. Calls toGtk.WidgetClass.set_accessible_type
() will reset this value.In cases where you want more fine-grained control over the role of accessibles created for self, you should provide your own accessible type and use
Gtk.WidgetClass.set_accessible_type
() instead.If role is
Atk.Role.INVALID
, the default role will not be changed and the accessible’s default role will be used instead.This function should only be called from class init functions of widgets.
New in version 3.2.
- set_accessible_type(type)[source]¶
- Parameters:
type (
GObject.GType
) – The object type that implements the accessible for self
Sets the type to be used for creating accessibles for widgets of self. The given type must be a subtype of the type used for accessibles of the parent class.
This function should only be called from class init functions of widgets.
New in version 3.2.
- set_connect_func(connect_func, *connect_data)[source]¶
- Parameters:
connect_func (
Gtk.BuilderConnectFunc
) – TheGtk.BuilderConnectFunc
to use when connecting signals in the class templateconnect_data (
object
orNone
) – The data to pass to connect_func
For use in language bindings, this will override the default
Gtk.BuilderConnectFunc
to be used when parsingGtk.Builder
XML from this class’s template data.Note that this must be called from a composite widget classes class initializer after calling
Gtk.WidgetClass.set_template
().New in version 3.10.
- set_css_name(name)[source]¶
- Parameters:
name (
str
) – name to use
Sets the name to be used for CSS matching of widgets.
If this function is not called for a given class, the name of the parent class is used.
New in version 3.20.
- set_template(template_bytes)[source]¶
- Parameters:
template_bytes (
GLib.Bytes
) – AGLib.Bytes
holding theGtk.Builder
XML
This should be called at class initialization time to specify the
Gtk.Builder
XML to be used to extend a widget.For convenience,
Gtk.WidgetClass.set_template_from_resource
() is also provided.Note that any class that installs templates must call
Gtk.Widget.init_template
() in the widget’s instance initializer.New in version 3.10.
- set_template_from_resource(resource_name)[source]¶
- Parameters:
resource_name (
str
) – The name of the resource to load the template from
A convenience function to call
Gtk.WidgetClass.set_template
().Note that any class that installs templates must call
Gtk.Widget.init_template
() in the widget’s instance initializer.New in version 3.10.