Widget Set
Introduction
This is a suggested design of the widgets in the code. The old code is several years old, with very little work done on it.
Widgets
Base
Status: complete
This interface defines the draw(), keyup(), and keydown() methods. Every widget will inherit this class. keyup()/keydown() have boolean return types. These methods should return true if they processed the keystroke, and false if they did not.
Widget
Status: complete
A base Widget. This class can have a background image. Any class which will actually draw something to the screen should inherit this class. This class can draw a halo or something similar around itself if it is the active widget.
Label
Status: complete
Can draw a string
TextEdit
Status: complete
Can take input, handles string modification.
Button
Status: Partially complete, need to improve callback mechanism
A label that can activate a callback. It will contain separate images for each state.
Option
Status: Complete
A button that has a state.
OptionList
Status: not started
A list of options. This class verifies that only one Option object is selected at a time.
Layout
Status: complete
An object of this class can contain other objects. It handles focus and widget traversal by the user. This base class will take coordinates to position its children.
GridLayout
Status: Not started
Positions its children in a 2 dimensional grid.
ListLayout
Status: Not started
Positions its children in a horizontal or vertically drawn list
Possible Changes
- It may not be necessary for base and widget to be to separate classes. The only reason is if there is a need to differentiate between widget and layout objects.
Screen Shot of Current Work
Beware, programmer art shown:
Shown here are two option boxes, three labels, three textboxes, and two buttons. These are contained by a hierarchy of three layout objects.