Skip to main content

MonitorExt

Trait MonitorExt 

Source
pub trait MonitorExt:
    IsA<Monitor>
    + Sealed
    + 'static {
Show 21 methods // Provided methods fn display(&self) -> Option<Display> { ... } fn geometry(&self) -> Rectangle { ... } fn height_mm(&self) -> i32 { ... } fn manufacturer(&self) -> Option<GString> { ... } fn model(&self) -> Option<GString> { ... } fn refresh_rate(&self) -> i32 { ... } fn scale_factor(&self) -> i32 { ... } fn subpixel_layout(&self) -> SubpixelLayout { ... } fn width_mm(&self) -> i32 { ... } fn workarea(&self) -> Rectangle { ... } fn is_primary(&self) -> bool { ... } fn connect_invalidate<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_geometry_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_height_mm_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_manufacturer_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_model_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_refresh_rate_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_scale_factor_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_subpixel_layout_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_width_mm_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_workarea_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all Monitor methods.

§Implementors

Monitor

Provided Methods§

Source

fn display(&self) -> Option<Display>

Gets the display that this monitor belongs to.

§Returns

the display

Source

fn geometry(&self) -> Rectangle

Retrieves the size and position of an individual monitor within the display coordinate space. The returned geometry is in ”application pixels”, not in ”device pixels” (see scale_factor()).

§Returns
§geometry

a Rectangle to be filled with the monitor geometry

Source

fn height_mm(&self) -> i32

Gets the height in millimeters of the monitor.

§Returns

the physical height of the monitor

Source

fn manufacturer(&self) -> Option<GString>

Gets the name or PNP ID of the monitor’s manufacturer, if available.

Note that this value might also vary depending on actual display backend.

PNP ID registry is located at https://uefi.org/pnp_id_list

§Returns

the name of the manufacturer, or None

Source

fn model(&self) -> Option<GString>

Gets the a string identifying the monitor model, if available.

§Returns

the monitor model, or None

Source

fn refresh_rate(&self) -> i32

Gets the refresh rate of the monitor, if available.

The value is in milli-Hertz, so a refresh rate of 60Hz is returned as 60000.

§Returns

the refresh rate in milli-Hertz, or 0

Source

fn scale_factor(&self) -> i32

Gets the internal scale factor that maps from monitor coordinates to the actual device pixels. On traditional systems this is 1, but on very high density outputs this can be a higher value (often 2).

This can be used if you want to create pixel based data for a particular monitor, but most of the time you’re drawing to a window where it is better to use Window::scale_factor() instead.

§Returns

the scale factor

Source

fn subpixel_layout(&self) -> SubpixelLayout

Gets information about the layout of red, green and blue primaries for each pixel in this monitor, if available.

§Returns

the subpixel layout

Source

fn width_mm(&self) -> i32

Gets the width in millimeters of the monitor.

§Returns

the physical width of the monitor

Source

fn workarea(&self) -> Rectangle

Retrieves the size and position of the “work area” on a monitor within the display coordinate space. The returned geometry is in ”application pixels”, not in ”device pixels” (see scale_factor()).

The work area should be considered when positioning menus and similar popups, to avoid placing them below panels, docks or other desktop components.

Note that not all backends may have a concept of workarea. This function will return the monitor geometry if a workarea is not available, or does not apply.

§Returns
§workarea

a Rectangle to be filled with the monitor workarea

Source

fn is_primary(&self) -> bool

Gets whether this monitor should be considered primary (see Display::primary_monitor()).

§Returns

true if self is primary

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

fn connect_workarea_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".

Implementors§