aboutsummaryrefslogtreecommitdiff
path: root/src/handlers/view.rs
diff options
context:
space:
mode:
authorRubén Beltrán del Río <jj@r.bdr.sh>2026-03-26 18:13:49 +0100
committerRubén Beltrán del Río <jj@r.bdr.sh>2026-03-26 23:02:28 +0100
commitc5d45b748d90c79f881c4e054b425d68801dad14 (patch)
treeb39ddf37fb74d761b98d4e0e8f2abdb1a764273e /src/handlers/view.rs
parent5f5b94474c83f85d95be5c53d148c4205c17d8e1 (diff)
Spin header into its own component
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));
}