use super::grid;
use super::pack;
use super::widget;
use super::wish;
#[derive(Clone, Debug, PartialEq)]
pub struct TkPanedWindow {
pub id: String,
}
pub fn make_paned_window(
parent: &impl widget::TkWidget,
orientation: widget::Orientation,
) -> TkPanedWindow {
let id = wish::next_wid(parent.id());
let msg = format!("ttk::panedwindow {} -orient {}", id, orientation);
wish::tell_wish(&msg);
TkPanedWindow { id }
}
impl widget::TkWidget for TkPanedWindow {
fn id(&self) -> &str {
&self.id
}
}
impl grid::TkGridLayout for TkPanedWindow {}
impl pack::TkPackLayout for TkPanedWindow {}
impl TkPanedWindow {
pub fn add(&self, pane: &impl widget::TkWidget) {
let msg = format!("{} add {}", self.id, pane.id());
wish::tell_wish(&msg);
}
pub fn add_weighted(&self, pane: &impl widget::TkWidget, weight: u64) {
let msg = format!("{} add {} -weight {}", self.id, pane.id(), weight);
wish::tell_wish(&msg);
}
pub fn forget(&self, pane: &impl widget::TkWidget) {
let msg = format!("{} forget {}", self.id, pane.id());
wish::tell_wish(&msg);
}
pub fn height(&self, height: u64) {
widget::configure(&self.id, "height", &height.to_string());
}
pub fn insert(&self, index: u64, pane: &impl widget::TkWidget) {
let msg = format!("{} insert {} {}", self.id, index, pane.id());
wish::tell_wish(&msg);
}
pub fn insert_weighted(&self, index: u64, pane: &impl widget::TkWidget, weight: u64) {
let msg = format!(
"{} insert {} {} -weight {}",
self.id,
index,
pane.id(),
weight
);
wish::tell_wish(&msg);
}
pub fn width(&self, width: u64) {
widget::configure(&self.id, "width", &width.to_string());
}
}