This was a necessary design step that I skipped earlier because I first wanted to build out a class which requires passing data between states. The PR for that isn't up yet, as its implementation also depends on this code. This PR renames a bunch of the 'data' structs 'info' structs, as that's what they really were in the first place.
The most important addition is the config field in the StateInfo (formerly StateData) struct. This field is a map (or dictionary if you'd like) which takes a property id in the form of a uint8 and returns info associated with that key, if it exists. This allows Controller classes to check for data they might want or need when setting up their UI elements or displaying data.
Changes
Application Context
rename currentState_ and _nextState to currentStateInfo_, _nextStateInfo
begin: adds text header field to StateInfo::config before passing the state info object to the controller factory for construction
setNextState: changes param from ApplicationState to StateInfo, so Controller can pass config info to next controller which will be instantiated
ControllerBase
constructor no longer takes inFocus param, as that information is now passed into derived classes' init methods with StateInfo object
ControllerFactory
create now only takes StateInfo object
ControllerMenu
strips down unordered_map _buttonToCallback to a vector of pairs--the unordered map was using sequential indices from 0 as keys, so it was basically a vector anyways
replaces callback functions with MenuButtonInfo objects--all callbacks were calling ApplicationContext::setNextState anyways so there was no need for that flexibility
Notes
This was a necessary design step that I skipped earlier because I first wanted to build out a class which requires passing data between states. The PR for that isn't up yet, as its implementation also depends on this code. This PR renames a bunch of the 'data' structs 'info' structs, as that's what they really were in the first place.
The most important addition is the config field in the StateInfo (formerly StateData) struct. This field is a map (or dictionary if you'd like) which takes a property id in the form of a uint8 and returns info associated with that key, if it exists. This allows Controller classes to check for data they might want or need when setting up their UI elements or displaying data.
Changes
Application Context
ControllerBase
ControllerFactory
ControllerMenu
closes #52