Skip to main content

WidgetClassSubclassExt

Trait WidgetClassSubclassExt 

Source
pub unsafe trait WidgetClassSubclassExt: ClassStruct<Type: WidgetImpl> {
    // Provided methods
    fn set_accessible_type(&mut self, type_: Type) { ... }
    fn set_accessible_role(&mut self, role: Role) { ... }
    fn set_template_bytes(&mut self, template: &Bytes) { ... }
    fn enable_baseline_support(&mut self) { ... }
    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 bind_template_child(&mut self, name: &str) { ... }
    unsafe fn bind_template_child_with_offset<T>(
        &mut self,
        name: &str,
        offset: FieldOffset<Self::Type, TemplateChild<T>>,
    )
       where T: ObjectType + FromGlibPtrNone<*mut <T as ObjectType>::GlibType> { ... }
    fn set_css_name(&mut self, name: &str) { ... }
    fn css_name(&self) -> GString { ... }
}

Provided Methods§

Source

fn set_accessible_type(&mut self, type_: Type)

Source

fn set_accessible_role(&mut self, role: Role)

Source

fn set_template_bytes(&mut self, template: &Bytes)

Source

fn enable_baseline_support(&mut self)

Enables baseline support for this widget class.

You call this for two reasons:

  1. You want your widget subclass to implement baseline support, in which case you must implement WidgetImpl::preferred_height_and_baseline_for_width. You should not implement WidgetImpl::preferred_height or WidgetImpl::preferred_height_for_width, as they will never be called.
  2. You are subclassing a widget that implements baselines, and you want the parent’s baselines to continue working. In that case you should call this function (as the baseline-enabled state is not inherited), but do not implement the height/height-for-width trait items yourself.

If you want to control sizing yourself, without baseline support, do not call this, and just implement WidgetImpl::preferred_height and WidgetImpl::preferred_height_for_width.

Source

fn set_template(&mut self, template: &[u8])

Source

fn set_template_static(&mut self, template: &'static [u8])

Source

fn set_template_from_resource(&mut self, resource_name: &str)

Source

fn bind_template_child(&mut self, name: &str)

Source

unsafe fn bind_template_child_with_offset<T>( &mut self, name: &str, offset: FieldOffset<Self::Type, TemplateChild<T>>, )

Source

fn set_css_name(&mut self, name: &str)

Source

fn css_name(&self) -> GString

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§