# ferroui

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui/

**module** · [`ferroui`](/docs/0.5.0/api/ferroui/) · v0.5.0

```rust
module ferroui
```

FerroUI in one dependency.

The facade crate of FerroUI: it has no code of its own. It re-exports the
crates of the framework, each under the name of its crate without the
`ferroui-` prefix (`ferroui-base` is `base`, `ferroui-themes-fluent` is
`themes_fluent`), and gathers the types of a minimal application in a
[`prelude`](/docs/0.5.0/api/ferroui/prelude/). Features choose the parts, so that an application names one
dependency:

```toml
[dependencies]
ferroui = "=0.1.0-preview.2"
```

The crates of one release depend on one another at exactly that version,
so the facade selects one consistent set of them.
## Modules and features

| Module | Crate | Feature | Default |
|---|---|---|---|
| `base` | `ferroui-base` | always | |
| `controls` | `ferroui-controls` | always | |
| `markup` | `ferroui-markup` | always | |
| `desktop`, `skia`, `harfbuzz`; `native` on macOS, `win32` on Windows, `x11` on Linux | `ferroui-desktop` and the crates it selects among | `desktop` | yes |
| `themes_fluent` | `ferroui-themes-fluent` | `fluent` | yes |
| `themes_simple` | `ferroui-themes-simple` | `simple` | no |
| `themes_winui` | `ferroui-themes-winui` | `winui-theme` | no |
| `themes_macos` | `ferroui-themes-macos` | `macos-theme` | no |
| `themes_material` | `ferroui-themes-material` | `material-theme` | no |
| `markup_xaml`, `markup_xaml_loader` | `ferroui-markup-xaml`, `ferroui-markup-xaml-loader` (run-time loading) | `xaml` | no |
| `markup_xaml_winui` | `ferroui-markup-xaml-winui` (the WinUI XAML importer and its loading entry points) | `winui-xaml` | no |
| `controls_color_picker` | `ferroui-controls-color-picker` | `color-picker` | no |
| `controls_charts` | `ferroui-controls-charts` | `charts` | no |
| `controls_inking` | `ferroui-controls-inking` | `inking` | no |
| `controls_repeater` | `ferroui-controls-repeater` | `repeater` | no |
| `pretext`, `pretext_layout`, `pretext_media` | prepared text, custom flow and native text services | `pretext` | no |
| `controls_treedatagrid`, `treedatagrid_core` | `ferroui-controls-treedatagrid`, `ferroui-treedatagrid-core` | `treedatagrid` | no |
| `dialogs` | `ferroui-dialogs` | `dialogs` | no |
| `diagnostics` | `ferroui-diagnostics` (the developer tools) | `diagnostics` | no |
| `designer` | `ferroui-designer` (the visual designer of Designer Studio) | `designer` | no |
| `system`, `reactive` | `ferroui-system`, `ferroui-reactive` (Rx) | `reactive` | no |
| `dynamic_data` | `ferroui-dynamic-data` (DynamicData) | `dynamic-data` | no |
| `splat`, `reactiveui`, `reactiveui_controls` | `ferroui-splat`, `ferroui-reactiveui`, `ferroui-reactiveui-controls` (ReactiveUI and its integration) | `reactiveui` | no |
| `browser`, `skia`, `harfbuzz` | `ferroui-browser` | `browser` | no |
| `vello` | `ferroui-vello`; its GPU modes with `vello-hybrid` and `vello-gpu` | `vello` | no |
| `headless` | `ferroui-headless` | `headless` | no |
| `media3d` | `ferroui-media3d` (WPF-style 3D: `Viewport3D` and the Media3D scene model) | `media3d` | no |
| `opengl`, `metal`, `vulkan` | the platform graphics contracts | `opengl`, `metal`, `vulkan` | no |

An application for the browser turns the default features off and names
`browser` and a theme. The build-time crates (`ferroui-build`,
`ferroui-build-scan`, `xamlx`) are not part of the facade: a crate that
compiles its markup in its build script names `ferroui-build` as a build
dependency, and the code the compiler writes names the crates it calls by
their own names, so such a crate depends on those crates directly.
## A minimal application

An application is a class derived from `Application`
that adds a theme to its styles and creates its main window when the
framework has finished initialising; `main` configures it with the
application builder and starts it with the classic desktop lifetime:

```no_run
use ferroui::prelude::*;

#[repr(C)]
pub struct App {
    base: Application,
}

ferro_class!(App: Application);
ferro_impl_classes!(App: FerroObjectImpl);

impl NewApplication for App {
    fn new_application() -> Ref<Self> {
        instantiate(Self { base: Application::construct() })
    }
}

impl ApplicationImpl for App {
    fn initialize(this: &Self) {
        Self::parent_initialize(this);
        this.styles().add(FluentTheme::new().as_style());
    }

    fn on_framework_initialization_completed(this: &Self) {
        let lifetime = this.application_lifetime();
        if let Some(desktop) = lifetime.as_ref().and_then(|l| l.as_classic_desktop_style_application_lifetime()) {
            let button = Button::new();
            button.set_content(Some(std::rc::Rc::new("Click me".to_string())));
            button.click(|_, _| println!("Button clicked"));

            let window = Window::new();
            window.set_title(Some("Hello".to_string()));
            window.set_content(Some(Control::boxed(button)));
            desktop.set_main_window(Some(window));
        }
        Self::parent_on_framework_initialization_completed(this);
    }
}

fn main() -> std::process::ExitCode {
    let args: Vec<String> = std::env::args().skip(1).collect();
    let exit_code = AppBuilder::configure::<App>()
        .use_platform_detect()
        .start_with_classic_desktop_lifetime(&args);
    std::process::ExitCode::from(exit_code as u8)
}
```

The same program with a few more controls is the example `hello` of this
crate (`cargo run -p ferroui --example hello`).

The application builder of the facade is the one of the crates it
re-exports: on the desktop, platform detection selects the platform of
the operating system, Skia and HarfBuzz, and nothing is initialised until
the application is set up.

```
## #[cfg(any(target_os = "macos", windows, target_os = "linux"))]
## {
use ferroui::prelude::*;

let builder = AppBuilder::configure::<Application>().use_platform_detect();
assert_eq!(builder.rendering_subsystem_name().as_deref(), Some("Skia"));
assert_eq!(builder.text_shaping_subsystem_name().as_deref(), Some("HarfBuzz"));
assert!(builder.instance().is_none());
## }
```

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI/lib.rs#L1)

## Contents

- [`prelude`](/docs/0.5.0/api/ferroui/prelude/) — module
- [`base`](/docs/0.5.0/api/ferroui/use-base/) — use
- [`controls`](/docs/0.5.0/api/ferroui/use-controls/) — use
- [`markup`](/docs/0.5.0/api/ferroui/use-markup/) — use
- [`desktop`](/docs/0.5.0/api/ferroui/use-desktop/) — use
- [`native`](/docs/0.5.0/api/ferroui/use-native/) — use
- [`harfbuzz`](/docs/0.5.0/api/ferroui/use-harfbuzz/) — use
- [`skia`](/docs/0.5.0/api/ferroui/use-skia/) — use
- [`themes_fluent`](/docs/0.5.0/api/ferroui/use-themes_fluent/) — use
- [`themes_simple`](/docs/0.5.0/api/ferroui/use-themes_simple/) — use
- [`themes_winui`](/docs/0.5.0/api/ferroui/use-themes_winui/) — use
- [`themes_macos`](/docs/0.5.0/api/ferroui/use-themes_macos/) — use
- [`themes_material`](/docs/0.5.0/api/ferroui/use-themes_material/) — use
- [`markup_xaml`](/docs/0.5.0/api/ferroui/use-markup_xaml/) — use
- [`markup_xaml_loader`](/docs/0.5.0/api/ferroui/use-markup_xaml_loader/) — use
- [`markup_xaml_winui`](/docs/0.5.0/api/ferroui/use-markup_xaml_winui/) — use
- [`controls_color_picker`](/docs/0.5.0/api/ferroui/use-controls_color_picker/) — use
- [`controls_charts`](/docs/0.5.0/api/ferroui/use-controls_charts/) — use
- [`controls_inking`](/docs/0.5.0/api/ferroui/use-controls_inking/) — use
- [`controls_repeater`](/docs/0.5.0/api/ferroui/use-controls_repeater/) — use
- [`livecharts`](/docs/0.5.0/api/ferroui/use-livecharts/) — use
- [`controls_livecharts`](/docs/0.5.0/api/ferroui/use-controls_livecharts/) — use
- [`controls_treedatagrid`](/docs/0.5.0/api/ferroui/use-controls_treedatagrid/) — use
- [`treedatagrid_core`](/docs/0.5.0/api/ferroui/use-treedatagrid_core/) — use
- [`dialogs`](/docs/0.5.0/api/ferroui/use-dialogs/) — use
- [`diagnostics`](/docs/0.5.0/api/ferroui/use-diagnostics/) — use
- [`system`](/docs/0.5.0/api/ferroui/use-system/) — use
- [`reactive`](/docs/0.5.0/api/ferroui/use-reactive/) — use
- [`dynamic_data`](/docs/0.5.0/api/ferroui/use-dynamic_data/) — use
- [`splat`](/docs/0.5.0/api/ferroui/use-splat/) — use
- [`reactiveui`](/docs/0.5.0/api/ferroui/use-reactiveui/) — use
- [`reactiveui_controls`](/docs/0.5.0/api/ferroui/use-reactiveui_controls/) — use
- [`browser`](/docs/0.5.0/api/ferroui/use-browser/) — use
- [`headless`](/docs/0.5.0/api/ferroui/use-headless/) — use

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
