forked from grantrostig/file_maintenance_clipped
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstate_menu.h
More file actions
55 lines (46 loc) · 3.43 KB
/
state_menu.h
File metadata and controls
55 lines (46 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// defines the state variables used by the menu system.
#ifndef STATE_H
#define STATE_H
#include "state_application.h"
#include <vector>
#include <memory>
#include <stack>
struct Menu; // forward declartion.
class State_menu { /// Holds all state/data used by the menu system, but not data of the user's application. TODO: we are not sure that extra state got in here, versus in the other state variable.
std::shared_ptr< Menu > menu_main_sp {}; /// required, must have at least one menu.
std::shared_ptr< Menu > menu_edit_sp {}; /// optional, edit is shown as example, programmer defined meaning.
std::shared_ptr< Menu > menu_file_sp {}; /// optional, file is shown as example, programmer defined meaning.
std::shared_ptr< Menu > menu_settings_sp {}; /// optional, settings is shown as example, programmer defined meaning.
std::stack< std::shared_ptr< Menu > > menu_stack {}; /// contains the current menu and menus navigated to get there, bottom of stack must be the main menu. Used to return to prior menu. Not sure of other uses?
std::stack< InteractionCategory > action_stack {}; /// contains the current action and prior actions navigated via menu or other actions.
/// This allows us to check Navigation completion codes, during user input entry of the action.
/// We push a very specialized Interaction category before calling the action.
/// After checking the return from the action, we pop.
std::shared_ptr< State_application > application_data_sp {}; /// TODO: I needed to store state for everything except the menu state, placed it in here for convience, perhaps it should be elsewhere?
bool advanced_menu_enabled {false}; /// the user is being shown the additional menu options designated as 'advanced', if there are any.
//bool is_data_saved {true}; /// TODO: not used, and worse, there is duplicate value in application_data.
public:
std::shared_ptr<Menu> menu_top_sp() const;
void push_menu_sp( std::shared_ptr<Menu> const); // TODO: rename to be consistent.
std::shared_ptr<Menu> menu_pop_top_sp();
std::shared_ptr<Menu> menu_pop_to_sp( std::shared_ptr<Menu> const);
InteractionCategory action_top() const;
void action_push( InteractionCategory const);
InteractionCategory action_pop_top();
bool is_menu_current_main () const;
bool getAdvanced_menu_enabled() const;
void setAdvanced_menu_enabled( bool value );
//bool getIs_data_unsaved() const;
//void setIs_data_unsaved( bool value );
std::shared_ptr<Menu> getMenu_main() const;
void setMenu_main( std::shared_ptr<Menu> const &);
std::shared_ptr<Menu> getMenu_edit() const;
void setMenu_edit( std::shared_ptr<Menu> const &);
std::shared_ptr<Menu> getMenu_file() const;
void setMenu_file( std::shared_ptr<Menu> const &);
std::shared_ptr<Menu> getMenu_settings() const;
void setMenu_settings( std::shared_ptr<Menu> const &);
std::shared_ptr<State_application> getApplication_data_sp() const;
void setApplication_data_sp( const std::shared_ptr<State_application> &);
};
#endif // STATE_H