gtk4::prelude

Trait DrawingAreaExt

Source
pub trait DrawingAreaExt: IsA<DrawingArea> + 'static {
    // Provided methods
    fn content_height(&self) -> i32 { ... }
    fn content_width(&self) -> i32 { ... }
    fn set_content_height(&self, height: i32) { ... }
    fn set_content_width(&self, width: i32) { ... }
    fn connect_resize<F: Fn(&Self, i32, i32) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
    fn connect_content_height_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
    fn connect_content_width_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all DrawingArea methods.

§Implementors

DrawingArea

Provided Methods§

Source

fn content_height(&self) -> i32

Retrieves the content height of the DrawingArea.

§Returns

The height requested for content of the drawing area

Source

fn content_width(&self) -> i32

Retrieves the content width of the DrawingArea.

§Returns

The width requested for content of the drawing area

Source

fn set_content_height(&self, height: i32)

Sets the desired height of the contents of the drawing area.

Note that because widgets may be allocated larger sizes than they requested, it is possible that the actual height passed to your draw function is larger than the height set here. You can use WidgetExt::set_valign() to avoid that.

If the height is set to 0 (the default), the drawing area may disappear.

§height

the height of contents

Source

fn set_content_width(&self, width: i32)

Sets the desired width of the contents of the drawing area.

Note that because widgets may be allocated larger sizes than they requested, it is possible that the actual width passed to your draw function is larger than the width set here. You can use WidgetExt::set_halign() to avoid that.

If the width is set to 0 (the default), the drawing area may disappear.

§width

the width of contents

Source

fn connect_resize<F: Fn(&Self, i32, i32) + 'static>( &self, f: F, ) -> SignalHandlerId

Emitted once when the widget is realized, and then each time the widget is changed while realized.

This is useful in order to keep state up to date with the widget size, like for instance a backing surface.

§width

the width of the viewport

§height

the height of the viewport

Source

fn connect_content_height_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_content_width_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§