use super::grid;
use super::pack;
use super::widget;
use super::wish;
#[derive(Clone)]
pub struct TkLabelFrame {
pub id: String,
}
pub fn make_label_frame(parent: &impl widget::TkWidget) -> TkLabelFrame {
let id = wish::next_wid(parent.id());
let msg = format!("ttk::labelframe {}", id);
wish::tell_wish(&msg);
TkLabelFrame { id }
}
impl widget::TkWidget for TkLabelFrame {
fn id(&self) -> &str {
&self.id
}
}
impl grid::TkGridLayout for TkLabelFrame {}
impl pack::TkPackLayout for TkLabelFrame {}
impl TkLabelFrame {
pub fn border_width(&self, width: u64) {
widget::configure(&self.id, "borderwidth", &width.to_string());
}
pub fn height(&self, height: u64) {
widget::configure(&self.id, "height", &height.to_string());
}
pub fn label_anchor(&self, value: widget::Anchor) {
let value = match value {
widget::Anchor::N => "n",
widget::Anchor::NE => "ne",
widget::Anchor::E => "e",
widget::Anchor::SE => "se",
widget::Anchor::S => "s",
widget::Anchor::SW => "sw",
widget::Anchor::W => "w",
widget::Anchor::NW => "nw",
widget::Anchor::Center | widget::Anchor::Centre => "center",
};
if value != "center" {
widget::configure(&self.id, "anchor", value);
}
}
pub fn padding(&self, values: &[u64]) {
widget::padding(&self.id, values);
}
pub fn relief(&self, value: widget::Relief) {
widget::configure(&self.id, "relief", &value.to_string());
}
pub fn state(&self, value: widget::State) {
widget::configure(&self.id, "state", &value.to_string());
}
pub fn text(&self, value: &str) {
widget::configure(&self.id, "text", value);
}
pub fn underline(&self, index: u64) {
widget::configure(&self.id, "underline", &index.to_string());
}
pub fn width(&self, width: u64) {
widget::configure(&self.id, "width", &width.to_string());
}
}