use super::ICommandBarElement;
use crate::primitives::TemplatedControlImpl;
use crate::{ControlImpl, Separator};
use ferroui_base::input::InputElementImpl;
use ferroui_base::interactivity::InteractiveImpl;
use ferroui_base::layout::LayoutableImpl;
use ferroui_base::{
ferro_class, ferro_class_info, ferro_impl_classes, ferro_properties, instantiate, FerroObject, FerroObjectImpl,
FerroProperty, Ref, StyledElementImpl, StyledProperty, VisualImpl,
};
use std::rc::Rc;
#[repr(C)]
pub struct CommandBarSeparator {
base: Separator,
}
ferro_class!(CommandBarSeparator: Separator);
ferro_class_info!(CommandBarSeparator {
new: CommandBarSeparator::new,
interfaces: [
Rc<dyn ICommandBarElement> => |separator: Ref<CommandBarSeparator>| separator.as_command_bar_element(),
],
});
ferro_impl_classes!(
CommandBarSeparator: FerroObjectImpl,
StyledElementImpl,
VisualImpl,
LayoutableImpl,
InteractiveImpl,
InputElementImpl,
ControlImpl,
TemplatedControlImpl
);
struct CommandBarSeparatorElement(Ref<CommandBarSeparator>);
impl ICommandBarElement for CommandBarSeparatorElement {
fn is_compact(&self) -> bool {
self.0.is_compact()
}
fn set_is_compact(&self, value: bool) {
self.0.set_is_compact(value)
}
fn is_in_overflow(&self) -> bool {
self.0.is_in_overflow()
}
fn set_is_in_overflow(&self, value: bool) {
self.0.set_is_in_overflow(value)
}
fn as_object(&self) -> Option<&FerroObject> {
let object: &FerroObject = &self.0;
Some(object)
}
}
ferro_properties! {
impl CommandBarSeparator {
pub fn is_compact_property() -> StyledProperty<bool> {
FerroProperty::register::<CommandBarSeparator, _>("IsCompact", false)
}
pub fn is_in_overflow_property() -> StyledProperty<bool> {
FerroProperty::register::<CommandBarSeparator, _>("IsInOverflow", false)
}
}
}
impl CommandBarSeparator {
pub fn construct() -> Self {
Self { base: Separator::construct() }
}
pub fn new() -> Ref<Self> {
instantiate(Self::construct())
}
pub fn as_command_bar_element(&self) -> Rc<dyn ICommandBarElement> {
Rc::new(CommandBarSeparatorElement(self.to_ref()))
}
pub fn is_compact(&self) -> bool {
self.get_value(Self::is_compact_property())
}
pub fn set_is_compact(&self, value: bool) {
self.set_value(Self::is_compact_property(), value)
}
pub fn is_in_overflow(&self) -> bool {
self.get_value(Self::is_in_overflow_property())
}
pub fn set_is_in_overflow(&self, value: bool) {
self.set_value(Self::is_in_overflow_property(), value)
}
}