use crate::types::WidgetId;
macro_rules! state_handle {
($name:ident, $doc:expr) => {
#[doc = $doc]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct $name {
pub(crate) id: WidgetId,
}
impl $name {
pub fn new(id: WidgetId) -> Self {
Self { id }
}
pub fn id(&self) -> &WidgetId {
&self.id
}
pub fn id_str(&self) -> &str {
self.id.as_str()
}
}
};
}
state_handle!(ModalHandle, "Opaque handle to a modal composite.");
state_handle!(PopupHandle, "Opaque handle to a popup composite.");
state_handle!(DropdownHandle, "Opaque handle to a dropdown composite.");
state_handle!(ToolbarHandle, "Opaque handle to a toolbar composite.");
state_handle!(SidebarHandle, "Opaque handle to a sidebar composite.");
state_handle!(ContextMenuHandle, "Opaque handle to a context menu composite.");