mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +00:00
TabControl::has_tab
This commit is contained in:
@@ -269,6 +269,7 @@ impl TabControl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize_drag(&mut self, from: usize, to: usize, ui: &mut UserInterface) {
|
fn finalize_drag(&mut self, from: usize, to: usize, ui: &mut UserInterface) {
|
||||||
let uuid = self.active_tab.map(|i| self.tabs[i].uuid);
|
let uuid = self.active_tab.map(|i| self.tabs[i].uuid);
|
||||||
let tab = self.tabs.remove(from);
|
let tab = self.tabs.remove(from);
|
||||||
@@ -282,10 +283,17 @@ impl TabControl {
|
|||||||
WidgetMessage::ReplaceChildren(new_tab_handles),
|
WidgetMessage::ReplaceChildren(new_tab_handles),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Use a tab's UUID to look up the tab.
|
/// Use a tab's UUID to look up the tab.
|
||||||
pub fn get_tab_by_uuid(&self, uuid: Uuid) -> Option<&Tab> {
|
pub fn get_tab_by_uuid(&self, uuid: Uuid) -> Option<&Tab> {
|
||||||
self.tabs.iter().find(|t| t.uuid == uuid)
|
self.tabs.iter().find(|t| t.uuid == uuid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Checks if a tab with the given uuid exists.
|
||||||
|
pub fn has_tab(&self, uuid: Uuid) -> bool {
|
||||||
|
self.get_tab_by_uuid(uuid).is_some()
|
||||||
|
}
|
||||||
|
|
||||||
/// Send the necessary messages to activate the tab at the given index, or deactivate all tabs if no index is given.
|
/// Send the necessary messages to activate the tab at the given index, or deactivate all tabs if no index is given.
|
||||||
/// Do nothing if the given index does not refer to any existing tab.
|
/// Do nothing if the given index does not refer to any existing tab.
|
||||||
/// If the index was valid, send FromWidget messages to notify listeners of the change, using messages with the given flags.
|
/// If the index was valid, send FromWidget messages to notify listeners of the change, using messages with the given flags.
|
||||||
@@ -323,6 +331,7 @@ impl TabControl {
|
|||||||
msg.delivery_mode = delivery_mode;
|
msg.delivery_mode = delivery_mode;
|
||||||
ui.send_message(msg);
|
ui.send_message(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send the messages necessary to remove the tab at the given index and update the currently active tab.
|
/// Send the messages necessary to remove the tab at the given index and update the currently active tab.
|
||||||
/// This does not include sending FromWidget messages to notify listeners.
|
/// This does not include sending FromWidget messages to notify listeners.
|
||||||
/// If the given index does not refer to any tab, do nothing and return false.
|
/// If the given index does not refer to any tab, do nothing and return false.
|
||||||
|
|||||||
Reference in New Issue
Block a user