Skip to content
This repository was archived by the owner on Apr 17, 2026. It is now read-only.

Commit 79bc89a

Browse files
committed
finish migration to iced 0.13
1 parent 233b945 commit 79bc89a

14 files changed

Lines changed: 296 additions & 240 deletions

Cargo.toml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "iced_baseview"
3-
version = "0.0.3"
3+
version = "0.1.0"
44
authors = [
55
"Billy Messenger <BillyDM@protonmail.com>",
66
"Robbert van der Helm <mail@robbertvanderhelm.nl>",
@@ -15,14 +15,17 @@ keywords = ["gui", "ui", "graphics", "interface", "widgets"]
1515
categories = ["gui"]
1616

1717
[features]
18+
default = ["wgpu"]
1819
# Enables a debug view in native platforms (press F12)
1920
debug = ["iced_runtime/debug"]
2021
# Enable the wgu renderer
21-
wgpu = ["iced_renderer/wgpu"]
22-
image = ["iced_widget/image"]
23-
svg = ["iced_widget/svg"]
22+
wgpu = ["iced_renderer/wgpu", "iced_widget/wgpu"]
23+
image = ["iced_graphics/image", "iced_widget/image", "iced_renderer/image"]
24+
svg = ["iced_graphics/svg", "iced_widget/svg", "iced_renderer/svg"]
25+
geometry = ["iced_graphics/geometry", "iced_renderer/geometry"]
26+
web-colors = ["iced_graphics/web-colors", "iced_renderer/web-colors"]
2427
canvas = ["iced_widget/canvas"]
25-
system = []
28+
system = ["dep:sysinfo"]
2629
trace = []
2730

2831
[dependencies]
@@ -38,3 +41,4 @@ log = "0.4"
3841
raw-window-handle = "0.5"
3942
raw-window-handle-06 = { package = "raw-window-handle", version = "0.6" }
4043
thiserror = "1.0"
44+
sysinfo = { version = "0.30", optional = true }

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
[![Crates.io](https://img.shields.io/crates/v/iced_baseview.svg)](https://crates.io/crates/iced_baseview)
55
[![License](https://img.shields.io/crates/l/iced_baseview.svg)](https://github.com/BillyDM/iced_baseview/blob/main/LICENSE)
66

7-
A [`baseview`] backend for the [`Iced`] GUI library.
7+
A [baseview] backend for the [Iced] GUI library
88

99
<div align="center">
1010
<img src="screenshot.png">
1111
</div>
1212

1313
The [main branch](https://github.com/BillyDM/iced_baseview/tree/main) of this repository tracks the latest crates.io release of iced, while [iced_git branch](https://github.com/BillyDM/iced_baseview/tree/iced_git) tracks its git repository.
1414

15-
## VST / LV2 / AU Plugins
15+
## VST3 / CLAP / AU Plugins
1616

1717
Examples of how to use this library for audio plugins can be found here:
18-
* [`iced-baseplug-examples`]
18+
* [nih_plug_iced](https://github.com/robbert-vdh/nih-plug/tree/master/nih_plug_iced)
19+
* [iced-baseplug-examples](https://github.com/BillyDM/iced-baseplug-examples)
1920

20-
[`Iced`]: https://github.com/hecrj/iced
21-
[`baseview`]: https://github.com/RustAudio/baseview
22-
[`iced-baseplug-examples`]: https://github.com/BillyDM/iced-baseplug-examples
21+
[Iced]: https://github.com/hecrj/iced
22+
[baseview]: https://github.com/RustAudio/baseview

examples/counter.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
use iced_baseview::{
22
baseview::{Size, WindowOpenOptions, WindowScalePolicy},
3-
core::Element,
43
settings::IcedBaseviewSettings,
54
widget::{button, column, text},
6-
Application, Center, Renderer, Settings, Task,
5+
Application, Center, Element, Renderer, Settings, Task, Theme,
76
};
87

98
fn main() {
109
let settings = Settings {
1110
window: WindowOpenOptions {
12-
title: String::from("iced_baseview hello world"),
11+
title: String::from("iced_baseview counter demo"),
1312
size: Size::new(500.0, 300.0),
1413
scale: WindowScalePolicy::SystemScaleFactor,
1514
},
1615
graphics_settings: iced_graphics::Settings {
1716
..Default::default()
1817
},
1918
iced_baseview: IcedBaseviewSettings {
20-
always_redraw: true,
2119
..Default::default()
2220
},
2321
..Default::default()
@@ -44,7 +42,7 @@ struct MyProgram {
4442
impl Application for MyProgram {
4543
type Message = Message;
4644
type Flags = Flags;
47-
type Theme = iced_baseview::Theme;
45+
type Theme = Theme;
4846
type Executor = iced_baseview::executor::Default;
4947

5048
fn new(flags: Flags) -> (Self, Task<Self::Message>) {
@@ -83,6 +81,6 @@ impl Application for MyProgram {
8381
}
8482

8583
fn theme(&self) -> Self::Theme {
86-
iced_baseview::Theme::Light
84+
Theme::Dark
8785
}
8886
}

examples/custom_styles.rs

Lines changed: 0 additions & 129 deletions
This file was deleted.

examples/hello_world.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use iced_baseview::{
22
baseview::{Size, WindowOpenOptions, WindowScalePolicy},
3-
core::{Alignment, Element, Length},
4-
settings::IcedBaseviewSettings,
53
widget::{Column, Container, Rule, Text},
6-
Application, Renderer, Settings, Task,
4+
Alignment, Application, Element, Length, Renderer, Settings, Task, Theme,
75
};
86

97
fn main() {
@@ -13,13 +11,6 @@ fn main() {
1311
size: Size::new(500.0, 300.0),
1412
scale: WindowScalePolicy::SystemScaleFactor,
1513
},
16-
graphics_settings: iced_graphics::Settings {
17-
..Default::default()
18-
},
19-
iced_baseview: IcedBaseviewSettings {
20-
always_redraw: true,
21-
..Default::default()
22-
},
2314
..Default::default()
2415
};
2516

@@ -31,7 +22,7 @@ struct MyProgram;
3122
impl Application for MyProgram {
3223
type Message = ();
3324
type Flags = ();
34-
type Theme = iced_baseview::Theme;
25+
type Theme = Theme;
3526
type Executor = iced_baseview::executor::Default;
3627

3728
fn new(_flags: ()) -> (Self, Task<Self::Message>) {
@@ -61,6 +52,6 @@ impl Application for MyProgram {
6152
}
6253

6354
fn theme(&self) -> Self::Theme {
64-
iced_baseview::Theme::Light
55+
Theme::Dark
6556
}
6657
}

examples/slider.rs

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
use iced_baseview::{
2+
baseview::{Size, WindowOpenOptions, WindowScalePolicy},
3+
settings::IcedBaseviewSettings,
4+
widget::{column, container, slider, text, vertical_slider},
5+
Application, Center, Element, Fill, Renderer, Settings, Task, Theme,
6+
};
7+
8+
fn main() {
9+
let settings = Settings {
10+
window: WindowOpenOptions {
11+
title: String::from("iced_baseview slider demo"),
12+
size: Size::new(500.0, 320.0),
13+
scale: WindowScalePolicy::SystemScaleFactor,
14+
},
15+
graphics_settings: iced_graphics::Settings {
16+
..Default::default()
17+
},
18+
iced_baseview: IcedBaseviewSettings {
19+
..Default::default()
20+
},
21+
..Default::default()
22+
};
23+
24+
iced_baseview::open_blocking::<MyProgram>((), settings);
25+
}
26+
27+
#[derive(Debug, Clone, Copy)]
28+
enum Message {
29+
SliderChanged(u8),
30+
}
31+
32+
struct MyProgram {
33+
value: u8,
34+
}
35+
36+
impl Application for MyProgram {
37+
type Message = Message;
38+
type Flags = ();
39+
type Theme = Theme;
40+
type Executor = iced_baseview::executor::Default;
41+
42+
fn new(_flags: Self::Flags) -> (Self, Task<Self::Message>) {
43+
(Self { value: 0 }, Task::none())
44+
}
45+
46+
fn update(&mut self, message: Self::Message) -> Task<Self::Message> {
47+
match message {
48+
Message::SliderChanged(value) => {
49+
self.value = value;
50+
}
51+
}
52+
53+
Task::none()
54+
}
55+
56+
fn view(&self) -> Element<'_, Self::Message, Self::Theme, Renderer> {
57+
let h_slider = container(
58+
slider(1..=100, self.value, Message::SliderChanged)
59+
.default(50)
60+
.shift_step(5),
61+
)
62+
.width(250);
63+
64+
let v_slider = container(
65+
vertical_slider(1..=100, self.value, Message::SliderChanged)
66+
.default(50)
67+
.shift_step(5),
68+
)
69+
.height(200);
70+
71+
let text = text(self.value);
72+
73+
column![v_slider, h_slider, text,]
74+
.width(Fill)
75+
.align_x(Center)
76+
.spacing(20)
77+
.padding(20)
78+
.into()
79+
}
80+
81+
fn theme(&self) -> Self::Theme {
82+
Theme::Dark
83+
}
84+
}

0 commit comments

Comments
 (0)