aboutsummaryrefslogtreecommitdiff
path: root/src/handlers/view.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/handlers/view.rs')
-rw-r--r--src/handlers/view.rs21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/handlers/view.rs b/src/handlers/view.rs
index 660f7b9..87c4172 100644
--- a/src/handlers/view.rs
+++ b/src/handlers/view.rs
@@ -13,9 +13,11 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-use relm4::gtk;
+use relm4::prelude::*;
+use crate::components::header::HeaderAction;
use crate::AppModel;
+use wmap_renderer::StageType;
/// Toggles between horizontal and vertical layout orientation.
pub fn change_orientation(model: &mut AppModel) {
@@ -23,14 +25,17 @@ pub fn change_orientation(model: &mut AppModel) {
gtk::Orientation::Horizontal => gtk::Orientation::Vertical,
_ => gtk::Orientation::Horizontal,
};
+ model.header.emit(HeaderAction::SetLayoutOrientation(model.orientation));
}
/// Updates the selected stage type from dropdown selection.
-pub fn stage_type_selected(model: &mut AppModel, index: usize) {
- if index < model.available_stage_types.len()
- && let Some(stage_type) = model.available_stage_types.get(index)
- {
- model.stage_type = stage_type.clone();
- model.update_image();
- }
+pub fn stage_type_selected(model: &mut AppModel, stage_type: StageType) {
+ model.stage_type = stage_type;
+ model.update_image();
+}
+
+/// Updates the selected stage type from dropdown selection.
+pub fn change_horizontal_layout(model: &mut AppModel, is_enabled: bool) {
+ model.horizontal_layout_enabled = is_enabled;
+ model.header.emit(HeaderAction::SetHorizontalLayoutEnabled(is_enabled));
}