mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-23 21:55:11 +02:00
refactor: remove TypedBuilder for col row (#1158)
This commit is contained in:
parent
f541947a59
commit
a1a48bc647
@ -538,161 +538,143 @@ impl BottomLayout {
|
|||||||
vec![
|
vec![
|
||||||
BottomCol::builder()
|
BottomCol::builder()
|
||||||
.canvas_handle_width(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![BottomColRow::builder()
|
.children(vec![BottomColRow::new(vec![BottomWidget::builder()
|
||||||
.canvas_handle_height(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![BottomWidget::builder()
|
.widget_type(BottomWidgetType::Disk)
|
||||||
.canvas_handle_width(true)
|
.widget_id(4)
|
||||||
.widget_type(BottomWidgetType::Disk)
|
.up_neighbour(Some(100))
|
||||||
.widget_id(4)
|
.left_neighbour(Some(8))
|
||||||
.up_neighbour(Some(100))
|
.right_neighbour(Some(DEFAULT_WIDGET_ID + 2))
|
||||||
.left_neighbour(Some(8))
|
|
||||||
.right_neighbour(Some(DEFAULT_WIDGET_ID + 2))
|
|
||||||
.build()])
|
|
||||||
.build()])
|
.build()])
|
||||||
|
.canvas_handle_height(true)])
|
||||||
.build(),
|
.build(),
|
||||||
BottomCol::builder()
|
BottomCol::builder()
|
||||||
.canvas_handle_width(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![
|
.children(vec![
|
||||||
BottomColRow::builder()
|
BottomColRow::new(vec![
|
||||||
.canvas_handle_height(true)
|
BottomWidget::builder()
|
||||||
.total_widget_ratio(3)
|
|
||||||
.children(vec![
|
|
||||||
BottomWidget::builder()
|
|
||||||
.canvas_handle_width(true)
|
|
||||||
.widget_type(BottomWidgetType::ProcSort)
|
|
||||||
.widget_id(DEFAULT_WIDGET_ID + 2)
|
|
||||||
.up_neighbour(Some(100))
|
|
||||||
.down_neighbour(Some(DEFAULT_WIDGET_ID + 1))
|
|
||||||
.left_neighbour(Some(4))
|
|
||||||
.right_neighbour(Some(DEFAULT_WIDGET_ID))
|
|
||||||
.width_ratio(1)
|
|
||||||
.parent_reflector(Some((WidgetDirection::Right, 2)))
|
|
||||||
.build(),
|
|
||||||
BottomWidget::builder()
|
|
||||||
.canvas_handle_width(true)
|
|
||||||
.widget_type(BottomWidgetType::Proc)
|
|
||||||
.widget_id(DEFAULT_WIDGET_ID)
|
|
||||||
.up_neighbour(Some(100))
|
|
||||||
.down_neighbour(Some(DEFAULT_WIDGET_ID + 1))
|
|
||||||
.left_neighbour(Some(DEFAULT_WIDGET_ID + 2))
|
|
||||||
.right_neighbour(Some(7))
|
|
||||||
.width_ratio(2)
|
|
||||||
.build(),
|
|
||||||
])
|
|
||||||
.build(),
|
|
||||||
BottomColRow::builder()
|
|
||||||
.canvas_handle_height(true)
|
|
||||||
.children(vec![BottomWidget::builder()
|
|
||||||
.canvas_handle_width(true)
|
.canvas_handle_width(true)
|
||||||
.widget_type(BottomWidgetType::ProcSearch)
|
.widget_type(BottomWidgetType::ProcSort)
|
||||||
.widget_id(DEFAULT_WIDGET_ID + 1)
|
.widget_id(DEFAULT_WIDGET_ID + 2)
|
||||||
.up_neighbour(Some(DEFAULT_WIDGET_ID))
|
.up_neighbour(Some(100))
|
||||||
|
.down_neighbour(Some(DEFAULT_WIDGET_ID + 1))
|
||||||
.left_neighbour(Some(4))
|
.left_neighbour(Some(4))
|
||||||
|
.right_neighbour(Some(DEFAULT_WIDGET_ID))
|
||||||
|
.width_ratio(1)
|
||||||
|
.parent_reflector(Some((WidgetDirection::Right, 2)))
|
||||||
|
.build(),
|
||||||
|
BottomWidget::builder()
|
||||||
|
.canvas_handle_width(true)
|
||||||
|
.widget_type(BottomWidgetType::Proc)
|
||||||
|
.widget_id(DEFAULT_WIDGET_ID)
|
||||||
|
.up_neighbour(Some(100))
|
||||||
|
.down_neighbour(Some(DEFAULT_WIDGET_ID + 1))
|
||||||
|
.left_neighbour(Some(DEFAULT_WIDGET_ID + 2))
|
||||||
.right_neighbour(Some(7))
|
.right_neighbour(Some(7))
|
||||||
.parent_reflector(Some((WidgetDirection::Up, 1)))
|
.width_ratio(2)
|
||||||
.build()])
|
.build(),
|
||||||
.build(),
|
])
|
||||||
|
.canvas_handle_height(true)
|
||||||
|
.total_widget_ratio(3),
|
||||||
|
BottomColRow::new(vec![BottomWidget::builder()
|
||||||
|
.canvas_handle_width(true)
|
||||||
|
.widget_type(BottomWidgetType::ProcSearch)
|
||||||
|
.widget_id(DEFAULT_WIDGET_ID + 1)
|
||||||
|
.up_neighbour(Some(DEFAULT_WIDGET_ID))
|
||||||
|
.left_neighbour(Some(4))
|
||||||
|
.right_neighbour(Some(7))
|
||||||
|
.parent_reflector(Some((WidgetDirection::Up, 1)))
|
||||||
|
.build()])
|
||||||
|
.canvas_handle_height(true),
|
||||||
])
|
])
|
||||||
.build(),
|
.build(),
|
||||||
BottomCol::builder()
|
BottomCol::builder()
|
||||||
.canvas_handle_width(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![BottomColRow::builder()
|
.children(vec![BottomColRow::new(vec![BottomWidget::builder()
|
||||||
.canvas_handle_height(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![BottomWidget::builder()
|
.widget_type(BottomWidgetType::Temp)
|
||||||
.canvas_handle_width(true)
|
.widget_id(7)
|
||||||
.widget_type(BottomWidgetType::Temp)
|
.up_neighbour(Some(100))
|
||||||
.widget_id(7)
|
.left_neighbour(Some(DEFAULT_WIDGET_ID))
|
||||||
.up_neighbour(Some(100))
|
.right_neighbour(Some(8))
|
||||||
.left_neighbour(Some(DEFAULT_WIDGET_ID))
|
|
||||||
.right_neighbour(Some(8))
|
|
||||||
.build()])
|
|
||||||
.build()])
|
.build()])
|
||||||
|
.canvas_handle_height(true)])
|
||||||
.build(),
|
.build(),
|
||||||
BottomCol::builder()
|
BottomCol::builder()
|
||||||
.canvas_handle_width(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![BottomColRow::builder()
|
.children(vec![BottomColRow::new(vec![BottomWidget::builder()
|
||||||
.canvas_handle_height(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![BottomWidget::builder()
|
.widget_type(BottomWidgetType::Battery)
|
||||||
.canvas_handle_width(true)
|
.widget_id(8)
|
||||||
.widget_type(BottomWidgetType::Battery)
|
.up_neighbour(Some(100))
|
||||||
.widget_id(8)
|
.left_neighbour(Some(7))
|
||||||
.up_neighbour(Some(100))
|
.right_neighbour(Some(4))
|
||||||
.left_neighbour(Some(7))
|
|
||||||
.right_neighbour(Some(4))
|
|
||||||
.build()])
|
|
||||||
.build()])
|
.build()])
|
||||||
|
.canvas_handle_height(true)])
|
||||||
.build(),
|
.build(),
|
||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
vec![
|
vec![
|
||||||
BottomCol::builder()
|
BottomCol::builder()
|
||||||
.canvas_handle_width(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![BottomColRow::builder()
|
.children(vec![BottomColRow::new(vec![BottomWidget::builder()
|
||||||
.canvas_handle_height(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![BottomWidget::builder()
|
.widget_type(BottomWidgetType::Disk)
|
||||||
.canvas_handle_width(true)
|
.widget_id(4)
|
||||||
.widget_type(BottomWidgetType::Disk)
|
.up_neighbour(Some(100))
|
||||||
.widget_id(4)
|
.left_neighbour(Some(7))
|
||||||
.up_neighbour(Some(100))
|
.right_neighbour(Some(DEFAULT_WIDGET_ID + 2))
|
||||||
.left_neighbour(Some(7))
|
|
||||||
.right_neighbour(Some(DEFAULT_WIDGET_ID + 2))
|
|
||||||
.build()])
|
|
||||||
.build()])
|
.build()])
|
||||||
|
.canvas_handle_height(true)])
|
||||||
.build(),
|
.build(),
|
||||||
BottomCol::builder()
|
BottomCol::builder()
|
||||||
.canvas_handle_width(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![
|
.children(vec![
|
||||||
BottomColRow::builder()
|
BottomColRow::new(vec![
|
||||||
.canvas_handle_height(true)
|
BottomWidget::builder()
|
||||||
.children(vec![
|
|
||||||
BottomWidget::builder()
|
|
||||||
.canvas_handle_width(true)
|
|
||||||
.widget_type(BottomWidgetType::ProcSort)
|
|
||||||
.widget_id(DEFAULT_WIDGET_ID + 2)
|
|
||||||
.up_neighbour(Some(100))
|
|
||||||
.down_neighbour(Some(DEFAULT_WIDGET_ID + 1))
|
|
||||||
.left_neighbour(Some(4))
|
|
||||||
.right_neighbour(Some(DEFAULT_WIDGET_ID))
|
|
||||||
.parent_reflector(Some((WidgetDirection::Right, 2)))
|
|
||||||
.build(),
|
|
||||||
BottomWidget::builder()
|
|
||||||
.canvas_handle_width(true)
|
|
||||||
.widget_type(BottomWidgetType::Proc)
|
|
||||||
.widget_id(DEFAULT_WIDGET_ID)
|
|
||||||
.up_neighbour(Some(100))
|
|
||||||
.down_neighbour(Some(DEFAULT_WIDGET_ID + 1))
|
|
||||||
.left_neighbour(Some(DEFAULT_WIDGET_ID + 2))
|
|
||||||
.right_neighbour(Some(7))
|
|
||||||
.build(),
|
|
||||||
])
|
|
||||||
.build(),
|
|
||||||
BottomColRow::builder()
|
|
||||||
.canvas_handle_height(true)
|
|
||||||
.children(vec![BottomWidget::builder()
|
|
||||||
.canvas_handle_width(true)
|
.canvas_handle_width(true)
|
||||||
.widget_type(BottomWidgetType::ProcSearch)
|
.widget_type(BottomWidgetType::ProcSort)
|
||||||
.widget_id(DEFAULT_WIDGET_ID + 1)
|
.widget_id(DEFAULT_WIDGET_ID + 2)
|
||||||
.up_neighbour(Some(DEFAULT_WIDGET_ID))
|
.up_neighbour(Some(100))
|
||||||
|
.down_neighbour(Some(DEFAULT_WIDGET_ID + 1))
|
||||||
.left_neighbour(Some(4))
|
.left_neighbour(Some(4))
|
||||||
|
.right_neighbour(Some(DEFAULT_WIDGET_ID))
|
||||||
|
.parent_reflector(Some((WidgetDirection::Right, 2)))
|
||||||
|
.build(),
|
||||||
|
BottomWidget::builder()
|
||||||
|
.canvas_handle_width(true)
|
||||||
|
.widget_type(BottomWidgetType::Proc)
|
||||||
|
.widget_id(DEFAULT_WIDGET_ID)
|
||||||
|
.up_neighbour(Some(100))
|
||||||
|
.down_neighbour(Some(DEFAULT_WIDGET_ID + 1))
|
||||||
|
.left_neighbour(Some(DEFAULT_WIDGET_ID + 2))
|
||||||
.right_neighbour(Some(7))
|
.right_neighbour(Some(7))
|
||||||
.parent_reflector(Some((WidgetDirection::Up, 1)))
|
.build(),
|
||||||
.build()])
|
])
|
||||||
.build(),
|
.canvas_handle_height(true),
|
||||||
|
BottomColRow::new(vec![BottomWidget::builder()
|
||||||
|
.canvas_handle_width(true)
|
||||||
|
.widget_type(BottomWidgetType::ProcSearch)
|
||||||
|
.widget_id(DEFAULT_WIDGET_ID + 1)
|
||||||
|
.up_neighbour(Some(DEFAULT_WIDGET_ID))
|
||||||
|
.left_neighbour(Some(4))
|
||||||
|
.right_neighbour(Some(7))
|
||||||
|
.parent_reflector(Some((WidgetDirection::Up, 1)))
|
||||||
|
.build()])
|
||||||
|
.canvas_handle_height(true),
|
||||||
])
|
])
|
||||||
.build(),
|
.build(),
|
||||||
BottomCol::builder()
|
BottomCol::builder()
|
||||||
.canvas_handle_width(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![BottomColRow::builder()
|
.children(vec![BottomColRow::new(vec![BottomWidget::builder()
|
||||||
.canvas_handle_height(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![BottomWidget::builder()
|
.widget_type(BottomWidgetType::Temp)
|
||||||
.canvas_handle_width(true)
|
.widget_id(7)
|
||||||
.widget_type(BottomWidgetType::Temp)
|
.up_neighbour(Some(100))
|
||||||
.widget_id(7)
|
.left_neighbour(Some(DEFAULT_WIDGET_ID))
|
||||||
.up_neighbour(Some(100))
|
.right_neighbour(Some(4))
|
||||||
.left_neighbour(Some(DEFAULT_WIDGET_ID))
|
|
||||||
.right_neighbour(Some(4))
|
|
||||||
.build()])
|
|
||||||
.build()])
|
.build()])
|
||||||
|
.canvas_handle_height(true)])
|
||||||
.build(),
|
.build(),
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
@ -704,57 +686,51 @@ impl BottomLayout {
|
|||||||
.canvas_handle_height(true)
|
.canvas_handle_height(true)
|
||||||
.children(vec![BottomCol::builder()
|
.children(vec![BottomCol::builder()
|
||||||
.canvas_handle_width(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![BottomColRow::builder()
|
.children(vec![BottomColRow::new(vec![BottomWidget::builder()
|
||||||
.canvas_handle_height(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![BottomWidget::builder()
|
.widget_type(BottomWidgetType::BasicCpu)
|
||||||
.canvas_handle_width(true)
|
.widget_id(1)
|
||||||
.widget_type(BottomWidgetType::BasicCpu)
|
.down_neighbour(Some(2))
|
||||||
.widget_id(1)
|
|
||||||
.down_neighbour(Some(2))
|
|
||||||
.build()])
|
|
||||||
.build()])
|
.build()])
|
||||||
|
.canvas_handle_height(true)])
|
||||||
.build()])
|
.build()])
|
||||||
.build(),
|
.build(),
|
||||||
BottomRow::builder()
|
BottomRow::builder()
|
||||||
.canvas_handle_height(true)
|
.canvas_handle_height(true)
|
||||||
.children(vec![BottomCol::builder()
|
.children(vec![BottomCol::builder()
|
||||||
.canvas_handle_width(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![BottomColRow::builder()
|
.children(vec![BottomColRow::new(vec![
|
||||||
.canvas_handle_height(true)
|
BottomWidget::builder()
|
||||||
.children(vec![
|
.canvas_handle_width(true)
|
||||||
BottomWidget::builder()
|
.widget_type(BottomWidgetType::BasicMem)
|
||||||
.canvas_handle_width(true)
|
.widget_id(2)
|
||||||
.widget_type(BottomWidgetType::BasicMem)
|
.up_neighbour(Some(1))
|
||||||
.widget_id(2)
|
.down_neighbour(Some(100))
|
||||||
.up_neighbour(Some(1))
|
.right_neighbour(Some(3))
|
||||||
.down_neighbour(Some(100))
|
.build(),
|
||||||
.right_neighbour(Some(3))
|
BottomWidget::builder()
|
||||||
.build(),
|
.canvas_handle_width(true)
|
||||||
BottomWidget::builder()
|
.widget_type(BottomWidgetType::BasicNet)
|
||||||
.canvas_handle_width(true)
|
.widget_id(3)
|
||||||
.widget_type(BottomWidgetType::BasicNet)
|
.up_neighbour(Some(1))
|
||||||
.widget_id(3)
|
.down_neighbour(Some(100))
|
||||||
.up_neighbour(Some(1))
|
.left_neighbour(Some(2))
|
||||||
.down_neighbour(Some(100))
|
.build(),
|
||||||
.left_neighbour(Some(2))
|
])
|
||||||
.build(),
|
.canvas_handle_height(true)])
|
||||||
])
|
|
||||||
.build()])
|
|
||||||
.build()])
|
.build()])
|
||||||
.build(),
|
.build(),
|
||||||
BottomRow::builder()
|
BottomRow::builder()
|
||||||
.canvas_handle_height(true)
|
.canvas_handle_height(true)
|
||||||
.children(vec![BottomCol::builder()
|
.children(vec![BottomCol::builder()
|
||||||
.canvas_handle_width(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![BottomColRow::builder()
|
.children(vec![BottomColRow::new(vec![BottomWidget::builder()
|
||||||
.canvas_handle_height(true)
|
.canvas_handle_width(true)
|
||||||
.children(vec![BottomWidget::builder()
|
.widget_type(BottomWidgetType::BasicTables)
|
||||||
.canvas_handle_width(true)
|
.widget_id(100)
|
||||||
.widget_type(BottomWidgetType::BasicTables)
|
.up_neighbour(Some(2))
|
||||||
.widget_id(100)
|
|
||||||
.up_neighbour(Some(2))
|
|
||||||
.build()])
|
|
||||||
.build()])
|
.build()])
|
||||||
|
.canvas_handle_height(true)])
|
||||||
.build()])
|
.build()])
|
||||||
.build(),
|
.build(),
|
||||||
BottomRow::builder()
|
BottomRow::builder()
|
||||||
@ -804,23 +780,47 @@ pub struct BottomCol {
|
|||||||
pub flex_grow: bool,
|
pub flex_grow: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default, Debug, TypedBuilder)]
|
#[derive(Clone, Default, Debug)]
|
||||||
pub struct BottomColRow {
|
pub struct BottomColRow {
|
||||||
pub children: Vec<BottomWidget>,
|
pub children: Vec<BottomWidget>,
|
||||||
|
|
||||||
#[builder(default = 1)]
|
|
||||||
pub total_widget_ratio: u32,
|
pub total_widget_ratio: u32,
|
||||||
|
|
||||||
#[builder(default = 1)]
|
|
||||||
pub col_row_height_ratio: u32,
|
pub col_row_height_ratio: u32,
|
||||||
|
|
||||||
#[builder(default = false)]
|
|
||||||
pub canvas_handle_height: bool,
|
pub canvas_handle_height: bool,
|
||||||
|
|
||||||
#[builder(default = false)]
|
|
||||||
pub flex_grow: bool,
|
pub flex_grow: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl BottomColRow {
|
||||||
|
pub(crate) fn new(children: Vec<BottomWidget>) -> Self {
|
||||||
|
Self {
|
||||||
|
children,
|
||||||
|
total_widget_ratio: 1,
|
||||||
|
col_row_height_ratio: 1,
|
||||||
|
canvas_handle_height: false,
|
||||||
|
flex_grow: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn total_widget_ratio(mut self, total_widget_ratio: u32) -> Self {
|
||||||
|
self.total_widget_ratio = total_widget_ratio;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn col_row_height_ratio(mut self, col_row_height_ratio: u32) -> Self {
|
||||||
|
self.col_row_height_ratio = col_row_height_ratio;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn canvas_handle_height(mut self, canvas_handle_height: bool) -> Self {
|
||||||
|
self.canvas_handle_height = canvas_handle_height;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn flex_grow(mut self, flex_grow: bool) -> Self {
|
||||||
|
self.flex_grow = flex_grow;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||||
pub enum WidgetDirection {
|
pub enum WidgetDirection {
|
||||||
Left,
|
Left,
|
||||||
|
@ -59,49 +59,39 @@ impl Row {
|
|||||||
BottomCol::builder()
|
BottomCol::builder()
|
||||||
.col_width_ratio(width_ratio)
|
.col_width_ratio(width_ratio)
|
||||||
.children(if left_legend {
|
.children(if left_legend {
|
||||||
vec![BottomColRow::builder()
|
vec![BottomColRow::new(vec![
|
||||||
.total_widget_ratio(20)
|
BottomWidget::builder()
|
||||||
.children(vec![
|
.width_ratio(3)
|
||||||
BottomWidget::builder()
|
.widget_type(BottomWidgetType::CpuLegend)
|
||||||
.width_ratio(3)
|
.widget_id(*iter_id)
|
||||||
.widget_type(BottomWidgetType::CpuLegend)
|
.canvas_handle_width(true)
|
||||||
.widget_id(*iter_id)
|
.parent_reflector(Some((WidgetDirection::Right, 1)))
|
||||||
.canvas_handle_width(true)
|
.build(),
|
||||||
.parent_reflector(Some((
|
BottomWidget::builder()
|
||||||
WidgetDirection::Right,
|
.width_ratio(17)
|
||||||
1,
|
.widget_type(BottomWidgetType::Cpu)
|
||||||
)))
|
.widget_id(cpu_id)
|
||||||
.build(),
|
.flex_grow(true)
|
||||||
BottomWidget::builder()
|
.build(),
|
||||||
.width_ratio(17)
|
])
|
||||||
.widget_type(BottomWidgetType::Cpu)
|
.total_widget_ratio(20)]
|
||||||
.widget_id(cpu_id)
|
|
||||||
.flex_grow(true)
|
|
||||||
.build(),
|
|
||||||
])
|
|
||||||
.build()]
|
|
||||||
} else {
|
} else {
|
||||||
vec![BottomColRow::builder()
|
vec![BottomColRow::new(vec![
|
||||||
.total_widget_ratio(20)
|
BottomWidget::builder()
|
||||||
.children(vec![
|
.width_ratio(17)
|
||||||
BottomWidget::builder()
|
.widget_type(BottomWidgetType::Cpu)
|
||||||
.width_ratio(17)
|
.widget_id(cpu_id)
|
||||||
.widget_type(BottomWidgetType::Cpu)
|
.flex_grow(true)
|
||||||
.widget_id(cpu_id)
|
.build(),
|
||||||
.flex_grow(true)
|
BottomWidget::builder()
|
||||||
.build(),
|
.width_ratio(3)
|
||||||
BottomWidget::builder()
|
.widget_type(BottomWidgetType::CpuLegend)
|
||||||
.width_ratio(3)
|
.widget_id(*iter_id)
|
||||||
.widget_type(BottomWidgetType::CpuLegend)
|
.canvas_handle_width(true)
|
||||||
.widget_id(*iter_id)
|
.parent_reflector(Some((WidgetDirection::Left, 1)))
|
||||||
.canvas_handle_width(true)
|
.build(),
|
||||||
.parent_reflector(Some((
|
])
|
||||||
WidgetDirection::Left,
|
.total_widget_ratio(20)]
|
||||||
1,
|
|
||||||
)))
|
|
||||||
.build(),
|
|
||||||
])
|
|
||||||
.build()]
|
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
@ -113,46 +103,37 @@ impl Row {
|
|||||||
.total_col_row_ratio(2)
|
.total_col_row_ratio(2)
|
||||||
.col_width_ratio(width_ratio)
|
.col_width_ratio(width_ratio)
|
||||||
.children(vec![
|
.children(vec![
|
||||||
BottomColRow::builder()
|
BottomColRow::new(vec![
|
||||||
.children(vec![
|
BottomWidget::builder()
|
||||||
BottomWidget::builder()
|
.widget_type(BottomWidgetType::ProcSort)
|
||||||
.widget_type(BottomWidgetType::ProcSort)
|
.widget_id(*iter_id)
|
||||||
.widget_id(*iter_id)
|
.canvas_handle_width(true)
|
||||||
.canvas_handle_width(true)
|
.parent_reflector(Some((WidgetDirection::Right, 2)))
|
||||||
.parent_reflector(Some((
|
.width_ratio(1)
|
||||||
WidgetDirection::Right,
|
.build(),
|
||||||
2,
|
BottomWidget::builder()
|
||||||
)))
|
.widget_type(BottomWidgetType::Proc)
|
||||||
.width_ratio(1)
|
.widget_id(proc_id)
|
||||||
.build(),
|
.width_ratio(2)
|
||||||
BottomWidget::builder()
|
.build(),
|
||||||
.widget_type(BottomWidgetType::Proc)
|
])
|
||||||
.widget_id(proc_id)
|
.total_widget_ratio(3)
|
||||||
.width_ratio(2)
|
.flex_grow(true),
|
||||||
.build(),
|
BottomColRow::new(vec![BottomWidget::builder()
|
||||||
])
|
.widget_type(BottomWidgetType::ProcSearch)
|
||||||
.total_widget_ratio(3)
|
.widget_id(proc_search_id)
|
||||||
.flex_grow(true)
|
.parent_reflector(Some((WidgetDirection::Up, 1)))
|
||||||
.build(),
|
.build()])
|
||||||
BottomColRow::builder()
|
.canvas_handle_height(true),
|
||||||
.children(vec![BottomWidget::builder()
|
|
||||||
.widget_type(BottomWidgetType::ProcSearch)
|
|
||||||
.widget_id(proc_search_id)
|
|
||||||
.parent_reflector(Some((WidgetDirection::Up, 1)))
|
|
||||||
.build()])
|
|
||||||
.canvas_handle_height(true)
|
|
||||||
.build(),
|
|
||||||
])
|
])
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
_ => BottomCol::builder()
|
_ => BottomCol::builder()
|
||||||
.col_width_ratio(width_ratio)
|
.col_width_ratio(width_ratio)
|
||||||
.children(vec![BottomColRow::builder()
|
.children(vec![BottomColRow::new(vec![BottomWidget::builder()
|
||||||
.children(vec![BottomWidget::builder()
|
.widget_type(widget_type)
|
||||||
.widget_type(widget_type)
|
.widget_id(*iter_id)
|
||||||
.widget_id(*iter_id)
|
.build()])])
|
||||||
.build()])
|
|
||||||
.build()])
|
|
||||||
.build(),
|
.build(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -194,53 +175,49 @@ impl Row {
|
|||||||
*iter_id += 1;
|
*iter_id += 1;
|
||||||
if left_legend {
|
if left_legend {
|
||||||
col_row_children.push(
|
col_row_children.push(
|
||||||
BottomColRow::builder()
|
BottomColRow::new(vec![
|
||||||
.col_row_height_ratio(col_row_height_ratio)
|
BottomWidget::builder()
|
||||||
.total_widget_ratio(20)
|
.width_ratio(3)
|
||||||
.children(vec![
|
.widget_type(BottomWidgetType::CpuLegend)
|
||||||
BottomWidget::builder()
|
.widget_id(*iter_id)
|
||||||
.width_ratio(3)
|
.canvas_handle_width(true)
|
||||||
.widget_type(BottomWidgetType::CpuLegend)
|
.parent_reflector(Some((
|
||||||
.widget_id(*iter_id)
|
WidgetDirection::Right,
|
||||||
.canvas_handle_width(true)
|
1,
|
||||||
.parent_reflector(Some((
|
)))
|
||||||
WidgetDirection::Right,
|
.build(),
|
||||||
1,
|
BottomWidget::builder()
|
||||||
)))
|
.width_ratio(17)
|
||||||
.build(),
|
.widget_type(BottomWidgetType::Cpu)
|
||||||
BottomWidget::builder()
|
.widget_id(cpu_id)
|
||||||
.width_ratio(17)
|
.flex_grow(true)
|
||||||
.widget_type(BottomWidgetType::Cpu)
|
.build(),
|
||||||
.widget_id(cpu_id)
|
])
|
||||||
.flex_grow(true)
|
.col_row_height_ratio(col_row_height_ratio)
|
||||||
.build(),
|
.total_widget_ratio(20),
|
||||||
])
|
|
||||||
.build(),
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
col_row_children.push(
|
col_row_children.push(
|
||||||
BottomColRow::builder()
|
BottomColRow::new(vec![
|
||||||
.col_row_height_ratio(col_row_height_ratio)
|
BottomWidget::builder()
|
||||||
.total_widget_ratio(20)
|
.width_ratio(17)
|
||||||
.children(vec![
|
.widget_type(BottomWidgetType::Cpu)
|
||||||
BottomWidget::builder()
|
.widget_id(cpu_id)
|
||||||
.width_ratio(17)
|
.flex_grow(true)
|
||||||
.widget_type(BottomWidgetType::Cpu)
|
.build(),
|
||||||
.widget_id(cpu_id)
|
BottomWidget::builder()
|
||||||
.flex_grow(true)
|
.width_ratio(3)
|
||||||
.build(),
|
.widget_type(BottomWidgetType::CpuLegend)
|
||||||
BottomWidget::builder()
|
.widget_id(*iter_id)
|
||||||
.width_ratio(3)
|
.canvas_handle_width(true)
|
||||||
.widget_type(BottomWidgetType::CpuLegend)
|
.parent_reflector(Some((
|
||||||
.widget_id(*iter_id)
|
WidgetDirection::Left,
|
||||||
.canvas_handle_width(true)
|
1,
|
||||||
.parent_reflector(Some((
|
)))
|
||||||
WidgetDirection::Left,
|
.build(),
|
||||||
1,
|
])
|
||||||
)))
|
.col_row_height_ratio(col_row_height_ratio)
|
||||||
.build(),
|
.total_widget_ratio(20),
|
||||||
])
|
|
||||||
.build(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,48 +227,39 @@ impl Row {
|
|||||||
let proc_search_id = *iter_id + 1;
|
let proc_search_id = *iter_id + 1;
|
||||||
*iter_id += 2;
|
*iter_id += 2;
|
||||||
col_row_children.push(
|
col_row_children.push(
|
||||||
BottomColRow::builder()
|
BottomColRow::new(vec![
|
||||||
.children(vec![
|
BottomWidget::builder()
|
||||||
BottomWidget::builder()
|
.widget_type(BottomWidgetType::ProcSort)
|
||||||
.widget_type(BottomWidgetType::ProcSort)
|
.widget_id(*iter_id)
|
||||||
.widget_id(*iter_id)
|
.canvas_handle_width(true)
|
||||||
.canvas_handle_width(true)
|
.parent_reflector(Some((WidgetDirection::Right, 2)))
|
||||||
.parent_reflector(Some((
|
.width_ratio(1)
|
||||||
WidgetDirection::Right,
|
.build(),
|
||||||
2,
|
BottomWidget::builder()
|
||||||
)))
|
.widget_type(BottomWidgetType::Proc)
|
||||||
.width_ratio(1)
|
.widget_id(proc_id)
|
||||||
.build(),
|
.width_ratio(2)
|
||||||
BottomWidget::builder()
|
.build(),
|
||||||
.widget_type(BottomWidgetType::Proc)
|
])
|
||||||
.widget_id(proc_id)
|
.col_row_height_ratio(col_row_height_ratio)
|
||||||
.width_ratio(2)
|
.total_widget_ratio(3),
|
||||||
.build(),
|
|
||||||
])
|
|
||||||
.col_row_height_ratio(col_row_height_ratio)
|
|
||||||
.total_widget_ratio(3)
|
|
||||||
.build(),
|
|
||||||
);
|
);
|
||||||
col_row_children.push(
|
col_row_children.push(
|
||||||
BottomColRow::builder()
|
BottomColRow::new(vec![BottomWidget::builder()
|
||||||
.col_row_height_ratio(col_row_height_ratio)
|
.widget_type(BottomWidgetType::ProcSearch)
|
||||||
.children(vec![BottomWidget::builder()
|
.widget_id(proc_search_id)
|
||||||
.widget_type(BottomWidgetType::ProcSearch)
|
.parent_reflector(Some((WidgetDirection::Up, 1)))
|
||||||
.widget_id(proc_search_id)
|
.build()])
|
||||||
.parent_reflector(Some((WidgetDirection::Up, 1)))
|
.canvas_handle_height(true)
|
||||||
.build()])
|
.col_row_height_ratio(col_row_height_ratio),
|
||||||
.canvas_handle_height(true)
|
|
||||||
.build(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_ => col_row_children.push(
|
_ => col_row_children.push(
|
||||||
BottomColRow::builder()
|
BottomColRow::new(vec![BottomWidget::builder()
|
||||||
.col_row_height_ratio(col_row_height_ratio)
|
.widget_type(widget_type)
|
||||||
.children(vec![BottomWidget::builder()
|
.widget_id(*iter_id)
|
||||||
.widget_type(widget_type)
|
.build()])
|
||||||
.widget_id(*iter_id)
|
.col_row_height_ratio(col_row_height_ratio),
|
||||||
.build()])
|
|
||||||
.build(),
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user