Expand description
§Create an application with Suzy
Suzy allows you to create a GUI comprised of widgets.
The most basic app template will look something like this:
#[derive(Default)]
struct Data { }
impl WidgetContent for Data {
fn init(_init: impl WidgetInit<Self>) {}
fn children(&mut self, _receiver: impl WidgetChildReceiver) {}
fn graphics(&mut self, _receiver: impl WidgetGraphicReceiver) {}
}
fn main() {
Data::run_as_app();
}§Watch System
Suzy’s watch system provides the main way to define functionality within the framework. It enables you to describe the relationships between widgets in a declarative way.
For example, if you wanted to make a widget half the width of its parent:
init.watch(|this, rect| {
this.child.set_width(rect.width() / 2.0);
});When the parent changes size, the closure will be re-run and update the size of the child.
See the watch module documentation for more
information about the watch system.
Modules§
- adapter
- Adapters enable an arbitrarily large scrolling list of widgets to be created using finite memory.
- animation
- Animations integrate with Suzy’s watch system to interpolate values over time.
- app
- An App describes the context in which widgets exist.
- dims
- Types dealing with the dimensions of widgets.
- graphics
- Graphics control the visual appearance of Widgets.
- platform
- A flexible interface for the low-level aspects of the GUI system.
- pointer
- Pointer events are considered the primary input mechanism.
- selectable
- An interface for Widgets to respond to interaction.
- units
- Convenience functions to convert between measurable units of visible size.
- watch
- Suzy’s watch system provides the main way to define functionality within the framework. It enables you to describe the relationships between widgets in a declaritive way.
- widget
- This module contains all the types associated with defining custom widgets.
- widgets
- Suzy comes with a set of built-in widgets.
- window
- Types associated with the creation and control of windows.
Macros§
- tweak
- A version of the tweak! macro from the crate
inline_tweak, but designed to work within Suzy’s watch system.