Expand description
Integrate highly customizable widgets and themes for any Rust application or GUI library.
§Introduction
More than explaining how to use this crate, this documentation want to help understand how the project is organized, and how the functions actually work. Tutorials, examples and more can be found on the repository (GitHub).
However, some examples can be found in this documentation when they are useful to understand how the item works. Sometimes, a good example is better than lines of documentation.
This documentation is for people who want to contribute to the project but also for people who just want to understand some concepts.
§Purpose
This project is not a GUI library itself, but it gives highly customizable
widgets and themes to be integrated in a GUI library or directly in an
application using a system API
(windows-rs,
x11rb, …). Furthermore, the crate
contains tools to transform widgets into shapes and to place and align
widgets on a drawable surface. The Drawer
trait can be
implemented on a drawable surface to easily draw widgets on it.
§Organization
The crate is organized in different parts:
- Widgets (located in
widgets
) - Controllers (located in
controllers
), they are also widgets but not designed to be drawn but to wrap a widget and control stuff like events on it. - Utilities: simple structures, parameters for widgets… (located in
crate
) - Graphics: drawer, aligner, shapes… (located in
graphics
)
§Note
This project want to have the simplest usage possible. Indeed, imports are
simplified the most possible (well, it does not mean all elements can be
imported from the crate, but repetition is avoided and imports like
crate::widgets::Widget
are replaced by crate::Widget
for example) and
widgets have different constructors to avoid filling all the fields when
they are not all defined (check the widgets documentation).
Re-exports§
pub use widgets::DebugWidget;
pub use widgets::Widget;
Modules§
- controllers
- Controllers are wrappers for
Widget
s having a function to call when a certain event happen. - graphics
- Tools to draw, to align in layouts, to shape and to colour
Widget
s. - widgets
- Widgets are items to be placed on a drawable surface and managed by layouts.
Macros§
- dynamic_
controller - Same as
dynamic_widget
but for controller widgets since controllers have a generic parameters as following :<'a, T: Widget + 'static>
. - dynamic_
widget - Implements what it is needed to make a widget a clean
dyn Widget
to be inserted in layouts etc… - widgets
- Creates a vector of dynamic widgets from a series of widgets, no matter
their type as long as they implement the
Widget
trait.
Structs§
- Border
- Rectangle border of width a width and a colour.
- Font
Family - Font family with a name for the whole family.
- Radius
- Radius definition for a shape.
- TTFFont
- Named local TTF font.
- Text
Theme - Theme for a text with a font.
- Theme
- Global theme to be used as a fallback theme when a widget does not have its own theme.
Enums§
- Align
- Alignment rule.
- Direction
- Direction rule for a
Layout
. - Font
Weight - The weight for a font.
- Overflow
- Rules about widget overflowing.
Traits§
- ToAny
- Trait to implement on any object in order to be able to convert it as a
std::any::Any
value.