move everything out of layout
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
pub struct Masked {
|
||||
pub inner: WidgetId,
|
||||
pub inner: WidgetHandle,
|
||||
}
|
||||
|
||||
impl Widget for Masked {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
pub struct Aligned {
|
||||
pub inner: WidgetId,
|
||||
pub inner: WidgetHandle,
|
||||
pub align: Align,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
pub struct LayerOffset {
|
||||
pub inner: WidgetId,
|
||||
pub inner: WidgetHandle,
|
||||
pub offset: usize,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
pub struct MaxSize {
|
||||
pub inner: WidgetId,
|
||||
pub inner: WidgetHandle,
|
||||
pub x: Option<Len>,
|
||||
pub y: Option<Len>,
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
pub struct Offset {
|
||||
pub inner: WidgetId,
|
||||
pub inner: WidgetHandle,
|
||||
pub amt: UiVec2,
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::prelude::*;
|
||||
|
||||
pub struct Pad {
|
||||
pub padding: Padding,
|
||||
pub inner: WidgetId,
|
||||
pub inner: WidgetHandle,
|
||||
}
|
||||
|
||||
impl Widget for Pad {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
pub struct Scroll {
|
||||
inner: WidgetId,
|
||||
inner: WidgetHandle,
|
||||
axis: Axis,
|
||||
amt: f32,
|
||||
snap_end: bool,
|
||||
@@ -41,7 +41,7 @@ impl Widget for Scroll {
|
||||
}
|
||||
|
||||
impl Scroll {
|
||||
pub fn new(inner: WidgetId, axis: Axis) -> Self {
|
||||
pub fn new(inner: WidgetHandle, axis: Axis) -> Self {
|
||||
Self {
|
||||
inner,
|
||||
axis,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
pub struct Sized {
|
||||
pub inner: WidgetId,
|
||||
pub inner: WidgetHandle,
|
||||
pub x: Option<Len>,
|
||||
pub y: Option<Len>,
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::prelude::*;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub struct Span {
|
||||
pub children: Vec<WidgetId>,
|
||||
pub children: Vec<WidgetHandle>,
|
||||
pub dir: Dir,
|
||||
pub gap: f32,
|
||||
}
|
||||
@@ -182,7 +182,7 @@ impl<const LEN: usize, Wa: WidgetArrLike<LEN, Tag>, Tag> SpanBuilder<LEN, Wa, Ta
|
||||
}
|
||||
|
||||
impl std::ops::Deref for Span {
|
||||
type Target = Vec<WidgetId>;
|
||||
type Target = Vec<WidgetHandle>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.children
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::marker::PhantomData;
|
||||
use crate::prelude::*;
|
||||
|
||||
pub struct Stack {
|
||||
pub children: Vec<WidgetId>,
|
||||
pub children: Vec<WidgetHandle>,
|
||||
pub size: StackSize,
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::prelude::*;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct WidgetPtr {
|
||||
pub inner: Option<WidgetId>,
|
||||
pub inner: Option<WidgetHandle>,
|
||||
}
|
||||
|
||||
impl Widget for WidgetPtr {
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
use iris_core::util::{HashMap, Id};
|
||||
use std::{
|
||||
ops::{BitOr, Deref, DerefMut},
|
||||
rc::Rc,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
layout::{UiModule, UiRegion},
|
||||
util::{HashMap, Id, Vec2},
|
||||
};
|
||||
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub enum Button {
|
||||
Left,
|
||||
@@ -125,7 +120,7 @@ pub struct CursorModule<Ctx> {
|
||||
}
|
||||
|
||||
impl<Ctx: 'static> UiModule for CursorModule<Ctx> {
|
||||
fn on_draw(&mut self, inst: &WidgetInstance) {
|
||||
fn on_draw(&mut self, inst: &ActiveData) {
|
||||
if self.map.contains_key(&inst.id) {
|
||||
self.active
|
||||
.entry(inst.layer)
|
||||
@@ -134,7 +129,7 @@ impl<Ctx: 'static> UiModule for CursorModule<Ctx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn on_undraw(&mut self, inst: &WidgetInstance) {
|
||||
fn on_undraw(&mut self, inst: &ActiveData) {
|
||||
if let Some(layer) = self.active.get_mut(&inst.layer) {
|
||||
layer.remove(&inst.id);
|
||||
}
|
||||
@@ -147,7 +142,7 @@ impl<Ctx: 'static> UiModule for CursorModule<Ctx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn on_move(&mut self, inst: &WidgetInstance) {
|
||||
fn on_move(&mut self, inst: &ActiveData) {
|
||||
if let Some(map) = self.active.get_mut(&inst.layer)
|
||||
&& let Some(region) = map.get_mut(&inst.id)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
use crate::prelude::*;
|
||||
use cosmic_text::{Affinity, Attrs, Cursor, FontSystem, LayoutRun, Motion};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
use winit::{
|
||||
event::KeyEvent,
|
||||
|
||||
@@ -3,8 +3,9 @@ mod edit;
|
||||
|
||||
pub use build::*;
|
||||
pub use edit::*;
|
||||
use iris_core::util::MutDetect;
|
||||
|
||||
use crate::{prelude::*, util::MutDetect};
|
||||
use crate::prelude::*;
|
||||
use cosmic_text::{Attrs, BufferLine, Cursor, Metrics, Shaping};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
@@ -21,11 +22,11 @@ pub struct TextView {
|
||||
// cache
|
||||
tex: Option<RenderedText>,
|
||||
width: Option<f32>,
|
||||
pub hint: Option<WidgetId>,
|
||||
pub hint: Option<WidgetHandle>,
|
||||
}
|
||||
|
||||
impl TextView {
|
||||
pub fn new(buf: TextBuffer, attrs: TextAttrs, hint: Option<WidgetId>) -> Self {
|
||||
pub fn new(buf: TextBuffer, attrs: TextAttrs, hint: Option<WidgetHandle>) -> Self {
|
||||
Self {
|
||||
attrs: attrs.into(),
|
||||
buf: buf.into(),
|
||||
|
||||
Reference in New Issue
Block a user