summaryrefslogtreecommitdiffstats
path: root/src/hbox.rs
diff options
context:
space:
mode:
authorrabite <rabite@posteo.de>2019-04-02 22:17:07 +0200
committerrabite <rabite@posteo.de>2019-04-02 22:17:07 +0200
commite99a3d993cc401720dc5f1c649cd3436fb47d3b3 (patch)
tree13b6f35b90dbc0616869581408336934de7c563c /src/hbox.rs
parented32c83aca9acf40b09c5fb4e7a24cbc2d76d7c9 (diff)
move widgets/files around instead of caching
Diffstat (limited to 'src/hbox.rs')
-rw-r--r--src/hbox.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/hbox.rs b/src/hbox.rs
index 0be0408..4537961 100644
--- a/src/hbox.rs
+++ b/src/hbox.rs
@@ -66,6 +66,11 @@ impl<T> HBox<T> where T: Widget + PartialEq {
self.widgets.insert(index, widget);
}
+ pub fn replace_widget(&mut self, index: usize, mut widget: T) -> T {
+ std::mem::swap(&mut self.widgets[index], &mut widget);
+ widget
+ }
+
pub fn toggle_zoom(&mut self) -> HResult<()> {
self.clear().log();
self.zoom_active = !self.zoom_active;