aboutsummaryrefslogtreecommitdiff
path: root/src/handlers/view.rs
blob: 64aeb987b686c50fe77884ccd235c3c2ad7b06a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use relm4::gtk;

use crate::AppModel;
use crate::stages::ALL_STAGE_TYPES;

/// Toggles between horizontal and vertical layout orientation.
pub fn change_orientation(model: &mut AppModel) {
    model.orientation = match model.orientation {
        gtk::Orientation::Horizontal => gtk::Orientation::Vertical,
        _ => gtk::Orientation::Horizontal,
    };
}

/// Updates the selected stage type from dropdown selection.
pub fn stage_type_selected(model: &mut AppModel, index: usize) {
    if index < ALL_STAGE_TYPES.len() {
        model.stage_type = ALL_STAGE_TYPES[index];
        model.update_image();
    }
}