Struct winsafe::gui::Resizer[][src]

pub struct Resizer(_);
Expand description

When the parent window is resized, automatically adjusts position and size of child controls.

Implementations

Instantiates a new Resizer, receiving the controls along with their horizontal and vertical behaviors when the owner window is resized.

Examples

use winsafe::gui::{Button, Edit, Resizer, Resz, WindowMain};

let wnd: WindowMain; // initialized somewhere
let txt_name: Edit;
let txt_surname: Edit;
let txt_another: Edit;
let btn_click: Button;
let rads_countries: gui::RadioGroup,

let layout_resizer = Resizer::new(&wnd, &[

    // The first parameter of the tuple is the horizontal behavior,
    // the second one is the vertical behavior,
    // and the third specifies all controls to which the behaviors apply.
    //
    // Horizontally: stretch or shrink.
    // Vertically: don't move or stretch/shrink; do nothing.
    (Resz::Resize, Resz::Nothing, &[&txt_name, &txt_surname]),

    // Horizontally: don't move or stretch/shrink; do nothing.
    // Vertically: move up or down.
    (Resz::Resize, Resz::Repos, &[&txt_another]),

    // Horizontally: move left or right.
    // Vertically: move up or down.
    (Resz::Repos, Resz::Repos, &[&btn_click]),

    // Add all radio buttons of the radio group at once.
    (Resz::Repos, Resz::Repos, &rads_countries.as_child_vec()),
]);

Panics

Panics if no child controls are passed.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.