From bbc6e91429ff94c3792de9d874999818b2c84a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Wed, 19 Aug 2020 01:59:31 +0200 Subject: [PATCH] Implement `hash_layout` for `pane_grid::TitleBar` --- native/src/widget/pane_grid/content.rs | 4 ++++ native/src/widget/pane_grid/title_bar.rs | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/native/src/widget/pane_grid/content.rs b/native/src/widget/pane_grid/content.rs index 39a92186..1d339b75 100644 --- a/native/src/widget/pane_grid/content.rs +++ b/native/src/widget/pane_grid/content.rs @@ -183,6 +183,10 @@ where } pub(crate) fn hash_layout(&self, state: &mut Hasher) { + if let Some(title_bar) = &self.title_bar { + title_bar.hash_layout(state); + } + self.body.hash_layout(state); } diff --git a/native/src/widget/pane_grid/title_bar.rs b/native/src/widget/pane_grid/title_bar.rs index 1d4a32e9..9dfb9ae4 100644 --- a/native/src/widget/pane_grid/title_bar.rs +++ b/native/src/widget/pane_grid/title_bar.rs @@ -1,6 +1,8 @@ use crate::layout; use crate::pane_grid; -use crate::{Clipboard, Element, Event, Layout, Point, Rectangle, Size}; +use crate::{ + Clipboard, Element, Event, Hasher, Layout, Point, Rectangle, Size, +}; /// The title bar of a [`Pane`]. /// @@ -176,6 +178,14 @@ where } } + pub(crate) fn hash_layout(&self, hasher: &mut Hasher) { + use std::hash::Hash; + + self.title.hash(hasher); + self.title_size.hash(hasher); + self.padding.hash(hasher); + } + pub(crate) fn layout( &self, renderer: &Renderer,