1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

Allow changing titles

This commit is contained in:
Emil Ernerfeldt
2023-11-06 20:14:24 +01:00
parent 291ab1ee7b
commit 8aa14d2fae
5 changed files with 105 additions and 90 deletions

View File

@@ -1149,7 +1149,7 @@ impl Context {
///
/// This will repaint the current viewport
pub fn request_repaint(&self) {
self.request_repaint_for(self.viewport_id());
self.request_repaint_of(self.viewport_id());
}
/// Call this if there is need to repaint the UI, i.e. if you are showing an animation.
@@ -1162,7 +1162,7 @@ impl Context {
/// (this will work on `eframe`).
///
/// This will repaint the specified viewport
pub fn request_repaint_for(&self, id: ViewportId) {
pub fn request_repaint_of(&self, id: ViewportId) {
self.write(|ctx| ctx.repaint.request_repaint(id));
}

View File

@@ -102,7 +102,7 @@ pub struct ViewportBuilder {
/// The title of the vieweport.
/// `eframe` will use this as the title of the native window.
pub title: String,
pub title: Option<String>,
/// This is wayland only. See [`Self::with_name`].
pub name: Option<(String, String)>,
@@ -138,7 +138,7 @@ impl ViewportBuilder {
pub fn new(id: ViewportId) -> Self {
Self {
id,
title: "egui".into(),
title: None,
name: None,
position: None,
inner_size: Some(Some(Vec2::new(300.0, 200.0))),
@@ -172,7 +172,7 @@ impl ViewportBuilder {
pub fn empty(id: ViewportId) -> Self {
Self {
id,
title: "egui".into(),
title: None,
name: None,
position: None,
inner_size: None,
@@ -199,11 +199,9 @@ impl ViewportBuilder {
/// Sets the initial title of the window in the title bar.
///
/// The default is `"egui"`.
///
/// Look at winit for more details
pub fn with_title(mut self, title: impl Into<String>) -> Self {
self.title = title.into();
self.title = Some(title.into());
self
}