use crate::{
elements::{Element, PopupMenuButtonElement},
foundation::{colorspace::Color, Id, Key, WidgetProperties},
painting::{EdgeInsetsGeometry, NoneEdgeInsetsGeometry, NoneShapeBorder, ShapeBorder},
ui::Offset,
widgets::{NoneWidget, Widget},
};
pub struct PopupMenuButton {
pub key: Key,
pub tooltip: String,
pub elevation: f32,
pub padding: Box<dyn EdgeInsetsGeometry>,
pub child: Box<dyn Widget>,
pub icon: Box<dyn Widget>,
pub icon_size: f32,
pub offset: Offset,
pub enabled: bool,
pub shape: Box<dyn ShapeBorder>,
pub color: Color,
pub enable_feedback: bool,
}
impl Default for PopupMenuButton {
fn default() -> Self {
Self {
key: Default::default(),
tooltip: Default::default(),
elevation: Default::default(),
padding: box NoneEdgeInsetsGeometry,
child: box NoneWidget,
icon: box NoneWidget,
icon_size: Default::default(),
offset: Default::default(),
enabled: Default::default(),
shape: box NoneShapeBorder,
color: Default::default(),
enable_feedback: Default::default(),
}
}
}
impl Widget for PopupMenuButton {
fn create_element(&self) -> Box<dyn Element> {
box PopupMenuButtonElement::new(self)
}
}
impl WidgetProperties for PopupMenuButton {
fn key(&self) -> &Key {
&self.key
}
fn x(&self) -> f32 {
0.0
}
fn y(&self) -> f32 {
0.0
}
fn w(&self) -> f32 {
0.0
}
fn h(&self) -> f32 {
0.0
}
fn w_min(&self) -> f32 {
0.0
}
fn h_min(&self) -> f32 {
0.0
}
fn w_max(&self) -> f32 {
0.0
}
fn h_max(&self) -> f32 {
0.0
}
fn parent(&self) -> Option<Id> {
None
}
fn depth(&self) -> f32 {
0.0
}
fn visible(&self) -> bool {
true
}
fn mouse_input(&self) -> bool {
true
}
fn key_input(&self) -> bool {
true
}
fn renderable(&self) -> bool {
true
}
fn internal_visible(&self) -> bool {
true
}
}