Skip to main content

nominal_api_conjure/conjure/objects/scout/layout/api/
canvas_panel.rs

1/// A panel node or HMI widget placed on a canvas. Other CanvasObject variants may represent
2/// different node types and have their own behavior.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    conjure_object::private::DeriveWith
9)]
10#[serde(crate = "conjure_object::serde")]
11#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[conjure_object::private::staged_builder::staged_builder]
13#[builder(crate = conjure_object::private::staged_builder, update, inline)]
14pub struct CanvasPanel {
15    #[builder(custom(type = super::CanvasRect, convert = Box::new))]
16    #[serde(rename = "rect")]
17    rect: Box<super::CanvasRect>,
18    #[builder(default, into)]
19    #[serde(rename = "hideLegend", skip_serializing_if = "Option::is_none", default)]
20    hide_legend: Option<bool>,
21}
22impl CanvasPanel {
23    /// Constructs a new instance of the type.
24    #[inline]
25    pub fn new(rect: super::CanvasRect) -> Self {
26        Self::builder().rect(rect).build()
27    }
28    #[inline]
29    pub fn rect(&self) -> &super::CanvasRect {
30        &*self.rect
31    }
32    #[deprecated(note = "Deprecated.")]
33    #[inline]
34    pub fn hide_legend(&self) -> Option<bool> {
35        self.hide_legend.as_ref().map(|o| *o)
36    }
37}