IWidget
Description
Base interface for general-purpose application widgets.
After creating a IWidget instance, the SettingsPath may be specified while the object is in the LifecycleState.Created state. Calling Initialize will put it into the LifecycleState.Initialized state, where the settings path cannot be changed any more. As best practice, initialization code that does not depend on any settings and does complete quickly should be placed into the constructor, the remaining code should be put into Initialize.
Usually, an IApplication hosts one or more IWidget objects. Application input events are forwarded to widgets unmodified, i.e. the widget is responsible for translating them to its Bounds as necessary (e.g. using a BoundedInput object). Widgets are not required to limit their rendering to their bounds.
The ILocalizable.Localize2 will store the given labels in an own set that belongs to the widget. The ILocalizable.Localize1 method will delegate to the attached widget GUI (see IWidgetGuiConsumer.WidgetGuiAttach), if a label is not present in that set.
- See also
Public / Methods
Public / Attributes
SettingsPath
Path to a directory that this widget can use to store own data and settings.
The settings path may only be set before Initialize is called on the widget. Afterwards, the settings path cannot be changed.
Extensions
Render2DWithSetup
Calls IRenderable2D.Render2D of this IWidget after having performed the necessary setup.
The setup involves these steps:
-
Call IBeginEnd.Begin on g in.
-
Set Graphics.Bounds of g in to IWidget.ActualBounds.
-
Delegate to IRenderable2D.Render2D of this widget, passing g in.
-
Call IBeginEnd.End on g in.
SettingsLoad
Loads the settings of this widget.
- IOException
-
If an I/O error has occurred while reading the settings file.
- ValidatingException
-
If the contents of the settings file is malformed.
SettingsSave
Saves the settings of this widget.
- IOException
-
If an I/O error has occurred while writing the settings file.