#![allow(clippy::needless_lifetimes)]
#![cfg_attr(feature = "nightly", feature(closure_track_caller))]
#[macro_use]
extern crate bitflags;
pub mod animation;
pub mod builtin_widgets;
pub mod clipboard;
mod context;
pub mod data_widget;
pub mod declare;
pub mod events;
pub mod local_sender;
pub mod pipe;
pub(crate) mod render_helper;
mod state;
pub mod ticker;
pub mod timer;
pub mod widget;
pub mod widget_children;
pub(crate) mod widget_tree;
pub mod window;
pub use rxrust;
pub mod overlay;
pub mod query;
pub mod wrap_render;
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Measure {
Pixel(f32),
Percent(f32),
}
pub mod prelude {
pub use log;
pub use ribir_algo::*;
pub use ribir_geom::*;
pub use ribir_macros::*;
pub use ribir_painter::*;
#[doc(hidden)]
pub use rxrust::prelude::*;
pub use smallvec;
pub use super::{
Measure,
animation::*,
builtin_widgets::*,
class_names,
context::*,
declare::*,
events::*,
multi_class,
overlay::{AutoClosePolicy, Overlay, OverlayStyle},
pipe::{BoxPipe, FinalChain, MapPipe, ModifiesPipe, Pipe},
providers,
query::*,
state::*,
style_class,
ticker::{Duration, Instant},
widget::*,
widget_children::*,
widget_tree::{BoxClamp, DirtyPhase, LayoutInfo, TrackId, WidgetId},
window::Window,
};
pub use crate::{timer, *};
}
pub mod test_helper;
impl From<f32> for Measure {
fn from(value: f32) -> Self { Measure::Pixel(value) }
}
impl Default for Measure {
fn default() -> Self { Measure::Pixel(0.0) }
}
impl Measure {
pub fn into_pixel(self, max_clamp: f32) -> f32 {
match self {
Measure::Pixel(x) => x,
Measure::Percent(x) => {
if x.is_finite() {
x * max_clamp
} else {
0.
}
}
}
}
}