Trait gtk4::prelude::DrawingAreaExt
source · pub trait DrawingAreaExt: 'static {
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
Required Methods§
sourcefn content_height(&self) -> i32
fn content_height(&self) -> i32
Retrieves the content height of the DrawingArea
.
Returns
The height requested for content of the drawing area
sourcefn content_width(&self) -> i32
fn content_width(&self) -> i32
Retrieves the content width of the DrawingArea
.
Returns
The width requested for content of the drawing area
sourcefn set_content_height(&self, height: i32)
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
sourcefn set_content_width(&self, width: i32)
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