use std::collections::{HashMap, HashSet}; use crate::{any, area, window, Id, InputState, LayerId, Pos2, Rect, Style}; // ---------------------------------------------------------------------------- /// The data that egui persists between frames. /// /// This includes window positions and sizes, /// how far the user has scrolled in a `ScrollArea` etc. /// /// If you want this to persist when closing your app you should serialize `Memory` and store it. /// /// If you want to store data for your widgets, you should look at `data`/`data_temp` and `id_data`/`id_data_temp` fields, and read the documentation of [`any`] module. #[derive(Clone, Debug, Default)] #[cfg_attr(feature = "persistence", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "persistence", serde(default))] pub struct Memory { pub options: Options, /// This map stores current states for widgets that don't require `Id`. This will be saved between different program runs if you use the `persistence` feature. #[cfg(feature = "persistence")] pub data: any::serializable::TypeMap, /// This map stores current states for widgets that don't require `Id`. This will be saved between different program runs if you use the `persistence` feature. #[cfg(not(feature = "persistence"))] pub data: any::TypeMap, /// Same as `data`, but this data will not be saved between runs. #[cfg_attr(feature = "persistence", serde(skip))] pub data_temp: any::TypeMap, /// This map stores current states for all widgets with custom `Id`s. This will be saved between different program runs if you use the `persistence` feature. #[cfg(feature = "persistence")] pub id_data: any::serializable::AnyMap, /// This map stores current states for all widgets with custom `Id`s. This will be saved between different program runs if you use the `persistence` feature. #[cfg(not(feature = "persistence"))] pub id_data: any::AnyMap, /// Same as `id_data`, but this data will not be saved between runs. #[cfg_attr(feature = "persistence", serde(skip))] pub id_data_temp: any::AnyMap, /// new scale that will be applied at the start of the next frame pub(crate) new_pixels_per_point: Option, /// new fonts that will be applied at the start of the next frame pub(crate) new_font_definitions: Option, #[cfg_attr(feature = "persistence", serde(skip))] pub(crate) interaction: Interaction, #[cfg_attr(feature = "persistence", serde(skip))] pub(crate) window_interaction: Option, #[cfg_attr(feature = "persistence", serde(skip))] pub(crate) drag_value: crate::widgets::drag_value::MonoState, pub(crate) areas: Areas, /// Which popup-window is open (if any)? /// Could be a combo box, color picker, menu etc. #[cfg_attr(feature = "persistence", serde(skip))] popup: Option, #[cfg_attr(feature = "persistence", serde(skip))] everything_is_visible: bool, } // ---------------------------------------------------------------------------- /// Some global options that you can read and write. #[derive(Clone, Debug, Default)] #[cfg_attr(feature = "persistence", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "persistence", serde(default))] pub struct Options { /// The default style for new `Ui`:s. #[cfg_attr(feature = "persistence", serde(skip))] pub(crate) style: std::sync::Arc