Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setting BorderType for TuiLoggerSmartWidget #33

Merged
merged 1 commit into from
Apr 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ use tui::buffer::Buffer;
use tui::layout::{Constraint, Direction, Layout, Rect};
use tui::style::{Modifier, Style};
use tui::text::Spans;
use tui::widgets::{Block, Borders, Widget};
use tui::widgets::{Block, BorderType, Borders, Widget};

mod circular;
#[cfg(feature = "slog-support")]
Expand Down Expand Up @@ -1239,6 +1239,7 @@ pub struct TuiLoggerSmartWidget<'a> {
title_target: Spans<'a>,
style: Option<Style>,
border_style: Style,
border_type: BorderType,
highlight_style: Option<Style>,
style_error: Option<Style>,
style_warn: Option<Style>,
Expand All @@ -1264,6 +1265,7 @@ impl<'a> Default for TuiLoggerSmartWidget<'a> {
title_target: Spans::from("Tui Target Selector"),
style: None,
border_style: Style::default(),
border_type: BorderType::Plain,
highlight_style: None,
style_error: None,
style_warn: None,
Expand Down Expand Up @@ -1292,6 +1294,10 @@ impl<'a> TuiLoggerSmartWidget<'a> {
self.border_style = style;
self
}
pub fn border_type(mut self, border_type: BorderType) -> Self {
self.border_type = border_type;
self
}
pub fn style(mut self, style: Style) -> Self {
self.style = Some(style);
self
Expand Down Expand Up @@ -1438,6 +1444,7 @@ impl<'a> Widget for TuiLoggerSmartWidget<'a> {
Block::default()
.title(title_log)
.border_style(self.border_style)
.border_type(self.border_type)
.borders(Borders::ALL),
)
.opt_style(self.style)
Expand Down Expand Up @@ -1483,6 +1490,7 @@ impl<'a> Widget for TuiLoggerSmartWidget<'a> {
Block::default()
.title(self.title_target)
.border_style(self.border_style)
.border_type(self.border_type)
.borders(Borders::ALL),
)
.opt_style(self.style)
Expand All @@ -1497,6 +1505,7 @@ impl<'a> Widget for TuiLoggerSmartWidget<'a> {
Block::default()
.title(title_log)
.border_style(self.border_style)
.border_type(self.border_type)
.borders(Borders::ALL),
)
.opt_style(self.style)
Expand Down