Compare commits

..

No commits in common. "03f1d75d3c473784979082d00ac9d05837e2edc8" and "f514746ecc3bd1c06c7e8ec1f920ddbdaee98fbe" have entirely different histories.

5 changed files with 11 additions and 40 deletions

View file

@ -34,17 +34,12 @@ ui_main!(
run: |ui, size, (ref mut counter, image)| { run: |ui, size, (ref mut counter, image)| {
Container::default() Container::default()
.with_size(size!(100%)) .with_size(size!(100%))
.with_padding(10.) .with_align(Alignment::Center)
.with_align((Alignment::Center, Alignment::Begin))
.with_direction(Direction::Horizontal) .with_direction(Direction::Horizontal)
.with_gap(5.) .with_gap(5.)
.with_background((0.1, 0.1, 0.1)) .with_background((0.1, 0.1, 0.1))
.with_wrap(true) .with_wrap(true)
.with_children(|ui| { .with_children(|ui| {
Text::new("Number of images:")
.with_text_size(24)
.add_child(ui);
Br.add_child(ui);
Container::default() Container::default()
.with_padding(10.) .with_padding(10.)
.with_background(color::ORANGE) .with_background(color::ORANGE)
@ -83,9 +78,11 @@ ui_main!(
}) })
.add_root(ui, size); .add_root(ui, size);
ui.process_signals(|sig| match sig { ui.process_signals(|sig| {
match sig {
CounterSignal::Increment => *counter += 1, CounterSignal::Increment => *counter += 1,
CounterSignal::Decrement => *counter -= 1, CounterSignal::Decrement => *counter -= 1,
}
}); });
} }
); );

View file

@ -22,9 +22,12 @@ glam = "0.25"
fontdue = "0.8" fontdue = "0.8"
rect_packer = "0.2" rect_packer = "0.2"
log = "0.4" log = "0.4"
nz = "0.3"
document-features = "0.2" document-features = "0.2"
derive_setters = "0.1" derive_setters = "0.1"
#smallvec = "1.13"
tinyset = "0.4" tinyset = "0.4"
#mopa = "0.2"
[features] [features]
default = ["builtin_elements", "builtin_font", "pixel_perfect_text"] default = ["builtin_elements", "builtin_font", "pixel_perfect_text"]

View file

@ -1,4 +1,4 @@
// Layout stuff: // "The essentials":
#[cfg(feature = "builtin_container")] #[cfg(feature = "builtin_container")]
pub mod container; pub mod container;
@ -12,7 +12,7 @@ pub mod spacer;
#[cfg(feature = "builtin_elements")] #[cfg(feature = "builtin_elements")]
pub mod br; pub mod br;
// Basic elements: // "The basics":
#[cfg(feature = "builtin_elements")] #[cfg(feature = "builtin_elements")]
pub mod text; pub mod text;
@ -20,15 +20,9 @@ pub mod text;
#[cfg(feature = "builtin_elements")] #[cfg(feature = "builtin_elements")]
pub mod image; pub mod image;
// "Extras":
// (meant to be replaced if needed)
#[cfg(feature = "builtin_elements")] #[cfg(feature = "builtin_elements")]
pub mod progress_bar; pub mod progress_bar;
#[cfg(feature = "builtin_elements")]
pub mod slider;
// Wrappers: // Wrappers:
#[cfg(feature = "builtin_elements")] #[cfg(feature = "builtin_elements")]

View file

@ -1,7 +0,0 @@
use crate::element::UiElement;
pub struct Slider {
pub value: f32,
}
//TODO

View file

@ -53,19 +53,3 @@ impl SignalStore {
self.sig.clear(); self.sig.clear();
} }
} }
//TODO this, simplifies handling signals
pub struct SignalTrigger<R: UiSignal + 'static, A = ()>(pub(crate) Box<dyn Fn(A) -> R>);
impl<R: UiSignal + 'static, A> SignalTrigger<R, A> {
pub fn new<F: Fn(A) -> R + 'static>(f: F) -> Self {
Self(Box::new(f))
}
}
impl<R: UiSignal + 'static, A, T: Fn(A) -> R + 'static> From<T> for SignalTrigger<R, A> {
fn from(f: T) -> Self {
Self(Box::new(f))
}
}