In FW there should be 2-4 levels menu system.
Here is the picture, how it is going to be
Actually the last menu picture should not have lines around the arrows, but for now it is not too important.
So, I need an advice how to make this part more correct.
First scenario:
- Using one big enough static thread for all menus;
- Use one ShowMenu() function for all menus by calling this function with appropriate menulists (used that structure in previous projects);
- Items structures of the menus don't have callbacks;
- All buttons event signals come to this thread and it processes info from buttons based on information which menu is active: changing active item in menulist, calling next menu, calling another function...
Second scenario:
- Each menu uses its own thread. Only main screen uses static thread, all the others - dynamic threads. All threads become small chunks of the memory, but there might be 3-4 menu levels deep and in this case I might actually need to use more memory, than for one big thread.
- Each thread uses its own menulist and use ShowMenu() function with menulist defined for each particular thread;
- Each items structures of the menus have callbacks for corresponding functions;
- All buttons event signals come to the active menu thread and only the active thread processes info from buttons based on callback defined for the chosen button: changing active item in menulist, calling next menu/thread, calling another function...
The first scenario seems easy for me, but the second one looks like more structured. Which one is more appropriate?
For the second scenario need to find solutions for three things that I don't know yet:
- How to create and close dynamic thread. Actually did not check it, I guess it should not be a problem
- How to know which menu thread is active, how to define to which menu thread the buttons events have to go.
- How to define the callback arguments. Could not find that information yet.