Skip to content

Commit

Permalink
Merge pull request #390 from kas-gui/work1
Browse files Browse the repository at this point in the history
New layout macro syntax incl. stand-alone mode
  • Loading branch information
dhardy authored Jun 9, 2023
2 parents e914a10 + 31d4ddd commit 6577ecb
Show file tree
Hide file tree
Showing 32 changed files with 1,093 additions and 538 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
-A clippy::module-inception \
-A clippy::too-many-arguments \
-A clippy::comparison_chain \
-A clippy::redundant_pattern_matching \
-A clippy::unit_arg
test:
Expand Down Expand Up @@ -120,4 +121,5 @@ jobs:
-A clippy::module-inception \
-A clippy::too-many-arguments \
-A clippy::comparison_chain \
-A clippy::redundant_pattern_matching \
-A clippy::unit_arg
2 changes: 1 addition & 1 deletion crates/kas-core/src/core/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ pub trait Layout {
/// impl_scope! {
/// /// A push-button with a text label
/// #[widget {
/// layout = button: self.label;
/// layout = button!(self.label);
/// navigable = true;
/// hover_highlight = true;
/// }]
Expand Down
6 changes: 3 additions & 3 deletions crates/kas-core/src/layout/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ impl<'a> Visitor<'a> {
/// Construct a grid layout over an iterator of `(cell, layout)` items
pub fn grid<I, S>(iter: I, dim: GridDimensions, data: &'a mut S) -> Self
where
I: Iterator<Item = (GridChildInfo, Visitor<'a>)> + 'a,
I: DoubleEndedIterator<Item = (GridChildInfo, Visitor<'a>)> + 'a,
S: GridStorage,
{
let layout = LayoutType::BoxComponent(Box::new(Grid {
Expand Down Expand Up @@ -457,7 +457,7 @@ struct Grid<'a, S, I> {

impl<'a, S: GridStorage, I> Layout for Grid<'a, S, I>
where
I: Iterator<Item = (GridChildInfo, Visitor<'a>)>,
I: DoubleEndedIterator<Item = (GridChildInfo, Visitor<'a>)>,
{
fn size_rules(&mut self, mgr: SizeMgr, axis: AxisInfo) -> SizeRules {
let mut solver = GridSolver::<Vec<_>, Vec<_>, _>::new(axis, self.dim, self.data);
Expand All @@ -480,7 +480,7 @@ where
}

fn draw(&mut self, mut draw: DrawMgr) {
for (_, child) in &mut self.children {
for (_, child) in (&mut self.children).rev() {
child.draw(draw.re_clone());
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/kas-core/src/title_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl_scope! {
/// A window's title bar (part of decoration)
#[derive(Clone, Default)]
#[widget{
layout = row: [
layout = row! [
// self.icon,
self.title,
MarkButton::new(MarkStyle::Point(Direction::Down), TitleBarButton::Minimize),
Expand Down
Loading

0 comments on commit 6577ecb

Please sign in to comment.