Rename inaccurately named widget
This commit is contained in:
parent
8f571e9e25
commit
96cca005b7
3 changed files with 10 additions and 11 deletions
|
|
@ -250,7 +250,7 @@ pub(crate) fn toplevel_preview(toplevel: &Toplevel) -> cosmic::Element<Msg> {
|
|||
row![label]
|
||||
}
|
||||
.padding(4);
|
||||
crate::widgets::workspace_item(
|
||||
crate::widgets::toplevel_item(
|
||||
vec![
|
||||
close_button(Msg::CloseToplevel(toplevel.handle.clone())),
|
||||
widget::button(capture_image(toplevel.img.as_ref()))
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ mod image_bg;
|
|||
pub use image_bg::image_bg;
|
||||
mod workspace_bar;
|
||||
pub use workspace_bar::workspace_bar;
|
||||
mod workspace_item;
|
||||
pub use workspace_item::workspace_item;
|
||||
mod toplevel_item;
|
||||
pub use toplevel_item::toplevel_item;
|
||||
mod mouse_interaction_wrapper;
|
||||
pub use mouse_interaction_wrapper::mouse_interaction_wrapper;
|
||||
mod toplevels;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
// TODO rename
|
||||
// combine widgets
|
||||
// Hack: this widget defines it's width as the second child's width
|
||||
// So the width of the image will be the overall width.
|
||||
|
|
@ -45,26 +44,26 @@ impl AxisExt for Axis {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn workspace_item<Msg>(children: Vec<cosmic::Element<Msg>>, axis: Axis) -> WorkspaceItem<Msg> {
|
||||
WorkspaceItem {
|
||||
pub fn toplevel_item<Msg>(children: Vec<cosmic::Element<Msg>>, axis: Axis) -> ToplevelItem<Msg> {
|
||||
ToplevelItem {
|
||||
axis,
|
||||
children,
|
||||
_msg: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WorkspaceItem<'a, Msg> {
|
||||
pub struct ToplevelItem<'a, Msg> {
|
||||
axis: Axis,
|
||||
children: Vec<cosmic::Element<'a, Msg>>,
|
||||
_msg: PhantomData<Msg>,
|
||||
}
|
||||
|
||||
impl<'a, Msg> Widget<Msg, cosmic::Theme, cosmic::Renderer> for WorkspaceItem<'a, Msg> {
|
||||
impl<'a, Msg> Widget<Msg, cosmic::Theme, cosmic::Renderer> for ToplevelItem<'a, Msg> {
|
||||
fn size(&self) -> Size<Length> {
|
||||
Size {
|
||||
// width: Length::Fill
|
||||
// XXX doesn't work when used in standard `row` widget
|
||||
// But fixes allocation of `dnd_source` wrapping this, within `Workspaces` row
|
||||
// But fixes allocation of `dnd_source` wrapping this, within `Toplevels` row
|
||||
width: Length::Shrink,
|
||||
// TODO Make depend on orientation or drop that option
|
||||
height: Length::Shrink,
|
||||
|
|
@ -220,8 +219,8 @@ impl<'a, Msg> Widget<Msg, cosmic::Theme, cosmic::Renderer> for WorkspaceItem<'a,
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, Msg: 'static> From<WorkspaceItem<'a, Msg>> for cosmic::Element<'a, Msg> {
|
||||
fn from(widget: WorkspaceItem<'a, Msg>) -> Self {
|
||||
impl<'a, Msg: 'static> From<ToplevelItem<'a, Msg>> for cosmic::Element<'a, Msg> {
|
||||
fn from(widget: ToplevelItem<'a, Msg>) -> Self {
|
||||
cosmic::Element::new(widget)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue