Because several button states may have changed, we simply redraw them all:
As you have noticed, this method does not check the logic of state changes. The derived class or whoever else called this method, is responsible for this check.
If you would like to see the complete source code of the cDConsoleView class, here's the header and the C++ file.
In order to test the console class we just created, we are going to derive it and implement the button pressed callbacks. Then, we will assemble a simple test application.
Here's the declaration of the class cMyConsoleView:
No surprise here. The class will implement the callback for each button of the console.
The method NewL() needs to be re-implemented, even though it is already in the base class:
The implementation of NewL() is very close to the one we have in the base class. In fact, such methods are always very similar, since their purpose is to create a new object and construct it. The method NewL() from the base class is not really necessary because it is very unlikely that someone will want to use that class without deriving it, but you never know ... :)
I have added the method Reset() to the class. Its purpose is to reset the console to its stopped state:
Our implementation of the button callbacks that will be presented, is as simple as it can get. Real world implementations will likely be a bit more complex, although they will perform the same basic actions as here, such as changing the console state:
If you would like to see the complete source code of the cMyConsoleView class, here's the header and the C++ file.
Now that we have implemented the console class and specialized it, we can move on to the window and application. We will also have a look at the main of the test program.
Here's the window declaration from DWindow.h:
The cSettings class provides access to the application specific settings, which will be saved and restored each time the application runs. We will save in it the position of the window on screen. This is not a requirement for any window or application with the Zinzala SDK, but rather a personal preference. I prefer that my window always appears at the last place I left it.