Skip to main content

tree_table/args/
args_readonly.rs

1use crate::SpanKey;
2use crate::statics::default_emit_event_for_api;
3use crate::statics::default_expand_for_api;
4use crate::statics::default_save_selection_for_api;
5use crate::statics::default_undo_for_api;
6
7#[cfg_attr(feature = "tsify", derive(tsify::Tsify))]
8#[cfg_attr(feature = "tsify", tsify(from_wasm_abi))]
9#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
10#[derive(Debug, Clone, PartialEq)]
11pub struct ReadonlyArgs {
12    pub key: SpanKey,
13    pub readonly: bool,
14    #[cfg_attr(feature = "serde", serde(default = "default_emit_event_for_api"))]
15    pub emit: bool,
16    #[cfg_attr(feature = "serde", serde(default = "default_undo_for_api"))]
17    pub undo: bool,
18    #[cfg_attr(feature = "serde", serde(default = "default_save_selection_for_api"))]
19    pub save_selection: bool,
20    #[cfg_attr(feature = "serde", serde(default = "default_expand_for_api"))]
21    pub expand: bool,
22}
23
24impl Default for ReadonlyArgs {
25    fn default() -> Self {
26        ReadonlyArgs {
27            key: SpanKey::None,
28            readonly: false, // matches CellProps::new()
29            emit: default_emit_event_for_api(),
30            undo: default_undo_for_api(),
31            save_selection: default_save_selection_for_api(),
32            expand: default_expand_for_api(),
33        }
34    }
35}