use super::grid;
use super::pack;
use super::widget;
use super::wish;
#[derive(Clone, Debug, PartialEq)]
pub struct TkLabel {
pub id: String,
}
pub fn make_label(parent: &impl widget::TkWidget) -> TkLabel {
let id = wish::next_wid(parent.id());
let msg = format!("ttk::label {}", id);
wish::tell_wish(&msg);
TkLabel { id }
}
impl widget::TkWidget for TkLabel {
fn id(&self) -> &str {
&self.id
}
}
impl grid::TkGridLayout for TkLabel {}
impl pack::TkPackLayout for TkLabel {}
impl widget::TkLabelOptions for TkLabel {}
impl TkLabel {
pub fn anchor(&self, value: widget::Anchor) {
widget::configure(&self.id, "anchor", &value.to_string());
}
pub fn background(&self, colour: &str) {
widget::configure(&self.id, "background", colour);
}
pub fn justify(&self, value: widget::Justify) {
widget::configure(&self.id, "justify", &value.to_string());
}
pub fn relief(&self, value: widget::Relief) {
widget::configure(&self.id, "relief", &value.to_string());
}
pub fn wrap_length(&self, length: u64) {
widget::configure(&self.id, "wraplength", &length.to_string());
}
}