Graphical User Interfaces are notoriously tricky and difficult to program: so much information to keep track of, events that must be handled, anticipating user actions, keeping all widgets properly updated, etc.
One aspect of good UI design is maintaining an accurate and consistent relationship between the User Interface state (at any given moment) and how all widgets should be presented when any given UI state is "active".
However, keeping this relationship well-behaved, consistent, and always accurate is a non-trivial exercise in programming GUI applications. And, worse still, when the total number of states and total number of widgets that must be managed is large, the problem increases dramatically in scale and complexity.
But why must this be so? Isn't there an easy way to handle this situation without all the work and pulling-of-hair that normally comes with it?
With the GTK+ Widget State Manager (WSM) maintaining this relationship is made easy, logical and obvious.
Now, instead of having to keep track of what you need to do to every widget at every UI state change, simply call the WSM routine to invoke the new UI state and all widgets are updated automatically, guaranteeing consistency and accuracy 100% of the time.
You do this by registering each widget needing to be managed (at widget creation) with the WSM library, defining exactly how the widget should appear for each defined UI state.
As delivered the WSM allows control of the following widget state settings:
- Visible - wsmassignvisible()
- Editable - wsmassigneditable()
- Sensitive - wsmassignsensitive()
- Any widget having the concept of visibility, editibility, and/or sensitivity is handled
- UI states are defined per application at design time, i.e., they are fully descriptive for proper implementation of widget details during the coding phase.
- Widgets are registered once at creation, and may also be de-registered, if this is needed
- No need to keep track of the previous state
- Adding new widgets in the future as the application evolves is simply a matter of registering the widget, as per UI state specifications require, and you're done.
- Changing a UI state is done by simply calling:
wsm_set_UIState( WSM_UISTATE_**APP-STATE** )
- Logical and Easy to Implement
- Implementing into pre-existing code is straight-forward
- What was once a head-ache is now simple and easy
- You will gain a deeper understanding of your application, its behaviours and how these relate to end-user interactions.
- Widget settings other than the three provided can be added to the library quite easily. This extends, then, any other widget-related behaviour(s) having a relationship to a GUI's display state.
- Code Base is very small, thus, quite easy to adapt. Either by adding language bindings for GTK+, or even adapting to other toolkits, e.g., Qt.
- Source Code, Header Files, and makefile to create the wsm.a library archive
- Registration functions to handle widget visibility, editibility, and sensitivity
- Complete Documentation describing all aspects of how to use the library, detailed instructions to create new registration functions, etc.
- A GUI example implementation demonstrating 4 different UI states, how to register widgets and how to set the UI states.
- All GTK+ developers interested in having precise control over widget states and their relationship to UI states.
- Up-to-date C compiler
- GTK+-2 installed. Gtk+-2 is standard on all *NIX platforms and should not be an issue.
- Library is provided as a single file source code (plus header files) for compilation.
- Makefile is provided to create an archive named wsm.a, to be used when linking the final program.