pub unsafe trait WidgetClassExt: ClassStruct {
Show 16 methods
// Provided methods
fn set_template_bytes(&mut self, template: &Bytes) { ... }
fn set_template(&mut self, template: &[u8]) { ... }
fn set_template_static(&mut self, template: &'static [u8]) { ... }
fn set_template_from_resource(&mut self, resource_name: &str) { ... }
fn install_action_async<Fut, F>(
&mut self,
action_name: &str,
parameter_type: Option<&VariantTy>,
activate: F,
)
where F: Fn(<<Self as ClassStruct>::Type as ObjectSubclass>::Type, String, Option<Variant>) -> Fut + 'static + Clone,
Fut: Future<Output = ()> { ... }
fn install_action<F>(
&mut self,
action_name: &str,
parameter_type: Option<&VariantTy>,
activate: F,
)
where F: Fn(&<<Self as ClassStruct>::Type as ObjectSubclass>::Type, &str, Option<&Variant>) + 'static { ... }
fn set_template_scope<S: IsA<BuilderScope>>(&mut self, scope: &S) { ... }
fn add_binding<F: Fn(&<<Self as ClassStruct>::Type as ObjectSubclass>::Type) -> Propagation + 'static>(
&mut self,
keyval: Key,
mods: ModifierType,
callback: F,
) { ... }
fn add_binding_signal(
&mut self,
keyval: Key,
mods: ModifierType,
signal_name: &str,
) { ... }
fn set_activate_signal(&mut self, signal_id: SignalId) { ... }
fn set_activate_signal_from_name(&mut self, signal_name: &str) { ... }
fn set_layout_manager_type<T: IsA<LayoutManager>>(&mut self) { ... }
fn set_css_name(&mut self, name: &str) { ... }
fn set_accessible_role(&mut self, role: AccessibleRole) { ... }
unsafe fn bind_template_child_with_offset<T>(
&mut self,
name: &str,
internal: bool,
offset: FieldOffset<Self::Type, TemplateChild<T>>,
)
where T: ObjectType + FromGlibPtrNone<*mut <T as ObjectType>::GlibType> { ... }
fn rust_template_scope(&mut self) -> BuilderRustScope { ... }
}Provided Methods§
fn set_template_bytes(&mut self, template: &Bytes)
Sourcefn set_template(&mut self, template: &[u8])
fn set_template(&mut self, template: &[u8])
This should be called at class initialization time to specify
the Builder XML to be used to extend a widget.
For convenience, 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.
§template_bytes
GBytes holding the Builder XML
fn set_template_static(&mut self, template: &'static [u8])
Sourcefn set_template_from_resource(&mut self, resource_name: &str)
fn set_template_from_resource(&mut self, resource_name: &str)
A convenience function that calls set_template()
with the contents of a resource.
Note that any class that installs templates must call
Gtk::Widget::init_template() in the widget’s instance
initializer.
§resource_name
resource path to load the template from
fn install_action_async<Fut, F>( &mut self, action_name: &str, parameter_type: Option<&VariantTy>, activate: F, )
Sourcefn install_action<F>(
&mut self,
action_name: &str,
parameter_type: Option<&VariantTy>,
activate: F,
)where
F: Fn(&<<Self as ClassStruct>::Type as ObjectSubclass>::Type, &str, Option<&Variant>) + 'static,
fn install_action<F>(
&mut self,
action_name: &str,
parameter_type: Option<&VariantTy>,
activate: F,
)where
F: Fn(&<<Self as ClassStruct>::Type as ObjectSubclass>::Type, &str, Option<&Variant>) + 'static,
Adds an action for all instances of a widget class.
This function should be called at class initialization time.
Actions installed by this function are stateless. The only state
they have is whether they are enabled or not (which can be changed
with WidgetExt::action_set_enabled()).
§action_name
a prefixed action name, such as “clipboard.paste”
§parameter_type
the parameter type
§activate
callback to use when the action is activated
Sourcefn set_template_scope<S: IsA<BuilderScope>>(&mut self, scope: &S)
fn set_template_scope<S: IsA<BuilderScope>>(&mut self, scope: &S)
Overrides the default scope to be used when parsing the class template.
This function is intended for language bindings.
Note that this must be called from a composite widget classes class
initializer after calling set_template().
§scope
BuilderScope to use when loading
the class template
Sourcefn add_binding<F: Fn(&<<Self as ClassStruct>::Type as ObjectSubclass>::Type) -> Propagation + 'static>(
&mut self,
keyval: Key,
mods: ModifierType,
callback: F,
)
fn add_binding<F: Fn(&<<Self as ClassStruct>::Type as ObjectSubclass>::Type) -> Propagation + 'static>( &mut self, keyval: Key, mods: ModifierType, callback: F, )
Creates a new shortcut for @self that calls the given @callback with arguments according to @format_string.
The arguments and format string must be provided in the same way as
with GLib::Variant::new().
This function is a convenience wrapper around
[add_shortcut()][Self::add_shortcut()] and must be called during class
initialization. It does not provide for user data, if you need that,
you will have to use [add_shortcut()][Self::add_shortcut()] with a custom
shortcut.
§keyval
key value of binding to install
§mods
key modifier of binding to install
§callback
the callback to call upon activation
§format_string
GVariant format string for arguments
Sourcefn add_binding_signal(
&mut self,
keyval: Key,
mods: ModifierType,
signal_name: &str,
)
fn add_binding_signal( &mut self, keyval: Key, mods: ModifierType, signal_name: &str, )
Creates a new shortcut for @self that emits the given action @signal with arguments read according to @format_string.
The arguments and format string must be provided in the same way as
with GLib::Variant::new().
This function is a convenience wrapper around
[add_shortcut()][Self::add_shortcut()] and must be called during class
initialization.
§keyval
key value of binding to install
§mods
key modifier of binding to install
§signal
the signal to execute
§format_string
GVariant format string for arguments
Sourcefn set_activate_signal(&mut self, signal_id: SignalId)
fn set_activate_signal(&mut self, signal_id: SignalId)
Sets the activation signal for a widget class.
The signal will be emitted when calling WidgetExt::activate().
The @signal_id must have been registered with [function.GObject.signal_new]
or signal_newv() before calling this function.
§signal_id
the id for the activate signal
Sourcefn set_activate_signal_from_name(&mut self, signal_name: &str)
fn set_activate_signal_from_name(&mut self, signal_name: &str)
Sets the activation signal for a widget class.
The signal id will by looked up by @signal_name.
The signal will be emitted when calling WidgetExt::activate().
The @signal_name must have been registered with [function.GObject.signal_new]
or signal_newv() before calling this function.
§signal_name
the name of the activate signal of @widget_type
Sourcefn set_layout_manager_type<T: IsA<LayoutManager>>(&mut self)
fn set_layout_manager_type<T: IsA<LayoutManager>>(&mut self)
Sets the type to be used for creating layout managers for widgets of @self.
The given @type_ must be a subtype of LayoutManager.
This function should only be called from class init functions of widgets.
§type_
the object type that implements the LayoutManager
for @self
Sourcefn set_css_name(&mut self, name: &str)
fn set_css_name(&mut self, name: &str)
Sourcefn set_accessible_role(&mut self, role: AccessibleRole)
fn set_accessible_role(&mut self, role: AccessibleRole)
Sets the accessible role used by the given widget class.
Different accessible roles have different states, and are rendered differently by assistive technologies.
§accessible_role
the accessible role to use
unsafe fn bind_template_child_with_offset<T>( &mut self, name: &str, internal: bool, offset: FieldOffset<Self::Type, TemplateChild<T>>, )
fn rust_template_scope(&mut self) -> BuilderRustScope
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".