mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-19 07:08:48 +01:00
This commit migrates the komorebi-bar from komorebi for Windows. Mostly lifting and shifting code, exposing stuff we need in komorebi-client etc. A few widgets will need to be reworked completely so they have been removed for now. Mouse and command stuff also needs updating a little so that has also been removed for now.
23 lines
595 B
Rust
23 lines
595 B
Rust
use eframe::egui::Align;
|
|
use eframe::egui::Layout;
|
|
use eframe::egui::Response;
|
|
use eframe::egui::Ui;
|
|
use eframe::egui::Vec2;
|
|
use eframe::egui::Widget;
|
|
|
|
pub struct CustomUi<'ui>(pub &'ui mut Ui);
|
|
|
|
impl CustomUi<'_> {
|
|
pub fn add_sized_left_to_right(
|
|
&mut self,
|
|
max_size: impl Into<Vec2>,
|
|
widget: impl Widget,
|
|
) -> Response {
|
|
let layout =
|
|
Layout::from_main_dir_and_cross_align(self.0.layout().main_dir(), Align::Center);
|
|
self.0
|
|
.allocate_ui_with_layout(max_size.into(), layout, |ui| ui.add(widget))
|
|
.inner
|
|
}
|
|
}
|