Trait gtk4::prelude::DrawingAreaExt

source ·
pub trait DrawingAreaExt: IsA<DrawingArea> + Sealed + '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

Object Safety§

This trait is not object safe.

Implementors§