AdvancedExample/actions/
buttons_actions.rs1use crate::ui::pages::{
2 ButtonId::{self},
3 PageId, persistent_elements2
4};
5use rust_page_system::system::{page_system::PageData, state::AppState};
6
7pub fn button_action(app_state: &mut AppState<PageId, ButtonId>, button_id: &ButtonId, app_data: &mut PageData<PageId, ButtonId>)
8{
9 if !app_state.capturing_input.0
10 {
11 if &ButtonId::ButtonPage1 == button_id
12 {
13 app_state.all_events_disable = true;
15 app_data.forced_persistent_elements = Some(vec![persistent_elements2()]);
16 app_state.change_current_page(app_data, PageId::Page1, button_id);
17 app_state.all_events_disable = false;
18 return;
19 };
20 if &ButtonId::ButtonPage2 == button_id
21 {
22 app_state.change_current_page(app_data, PageId::Page2, button_id);
23 return;
24 };
25 if &ButtonId::ButtonSubPage == button_id
26 {
27 app_state.change_current_page(app_data, PageId::Page2SubPage, button_id);
28 return;
29 };
30 if &ButtonId::ButtonBack == button_id
31 {
32 app_state.change_current_page(app_data, PageId::Page2, button_id);
33 return;
34 };
35 app_state.capturing_input = (true, Some(*button_id));
37 }
38}