charming/element/
pointer.rs

1use super::{icon::Icon, item_style::ItemStyle};
2use charming_macros::CharmingSetters;
3use serde::{Deserialize, Serialize};
4
5#[serde_with::apply(
6  Option => #[serde(skip_serializing_if = "Option::is_none")],
7  Vec => #[serde(default, skip_serializing_if = "Vec::is_empty")]
8)]
9#[derive(Serialize, Deserialize, CharmingSetters, Debug, PartialEq, PartialOrd, Clone)]
10#[serde(rename_all = "camelCase")]
11pub struct Pointer {
12    show: Option<bool>,
13    show_above: Option<bool>,
14    icon: Option<Icon>,
15    #[charming_skip_setter]
16    offset_center: Option<(String, String)>,
17    length: Option<String>,
18    width: Option<f64>,
19    keep_aspect: Option<bool>,
20    item_style: Option<ItemStyle>,
21}
22
23impl Pointer {
24    pub fn offset_center<S: Into<String>>(mut self, offset_center: (S, S)) -> Self {
25        self.offset_center = Some((offset_center.0.into(), offset_center.1.into()));
26        self
27    }
28}