Implement Gui Ideas - paua-app/PyBalone GitHub Wiki
On this site we want to document ideas for the implementation of the gui
current MockUps
Implementation ideas
Here' some basic ideas of how to create things:
- There is a superclass (like
UIComponent
orControl
or something) that offeres basic stuff like settings position, make (in)visible, disable/enable (in order to (not) receive input) - There are listener interfaces for every kind of input (left click, right click, writing char, removing char, ...). We may put some together (like left and right click into one interface), but won't combine them too much.
Now there're two solutions to manage input and rendering in a smart way so that a UI class doesn't have to register a control to any other classes. The first:
- There's a class that hold all controls and managed input events and renderes them.
- Every control is created via a factory
UIComponentFactory
or something like that. - The factory will create the control and add this to this overall control holding class. There's no observer pattern here, the only one would be in the UI class for implementing logic to an input event.
The second way:
- There's also a class where all controls will register them in order to receive input (via observer pattern).
- The UI class then registers himself to the control in order to do something when input comes.
- The observer pattern would be like
[mainLoop]-->[inputObservable]<-->[control]<-->[UIClass]
- The UI class has to call the render method on the control which can be an advantage but also a disadvantage.