From 08cb9502266547cd0478f95c8aff3ec2c6e11520 Mon Sep 17 00:00:00 2001 From: Marcus Willock Date: Wed, 16 Oct 2019 12:18:02 -0400 Subject: [PATCH] Link WindowBuilder documentation to corresponding Window methods (fixes #1070) (#1216) * fixes #1070 * Continuing adding documentation links for #1070 --- src/window.rs | 79 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 27 deletions(-) diff --git a/src/window.rs b/src/window.rs index a74fab01..6ff27d50 100644 --- a/src/window.rs +++ b/src/window.rs @@ -192,36 +192,43 @@ impl WindowBuilder { } /// Requests the window to be of specific dimensions. + /// + /// See [`Window::set_inner_size`] for details. + /// + /// [`Window::set_inner_size`]: struct.Window.html#method.set_inner_size #[inline] pub fn with_inner_size(mut self, size: LogicalSize) -> Self { self.window.inner_size = Some(size); self } - /// Sets a minimum dimension size for the window + /// Sets a minimum dimension size for the window. + /// + /// See [`Window::set_min_inner_size`] for details. + /// + /// [`Window::set_min_inner_size`]: struct.Window.html#method.set_min_inner_size #[inline] pub fn with_min_inner_size(mut self, min_size: LogicalSize) -> Self { self.window.min_inner_size = Some(min_size); self } - /// Sets a maximum dimension size for the window + /// Sets a maximum dimension size for the window. + /// + /// See [`Window::set_max_inner_size`] for details. + /// + /// [`Window::set_max_inner_size`]: struct.Window.html#method.set_max_inner_size #[inline] pub fn with_max_inner_size(mut self, max_size: LogicalSize) -> Self { self.window.max_inner_size = Some(max_size); self } - /// Sets whether the window is resizable or not + /// Sets whether the window is resizable or not. /// - /// Note that making the window unresizable doesn't exempt you from handling `Resized`, as that event can still be - /// triggered by DPI scaling, entering fullscreen mode, etc. + /// See [`Window::set_resizable`] for details. /// - /// ## Platform-specific - /// - /// This only has an effect on desktop platforms. - /// - /// Due to a bug in XFCE, this has no effect on Xfwm. + /// [`Window::set_resizable`]: struct.Window.html#method.set_resizable #[inline] pub fn with_resizable(mut self, resizable: bool) -> Self { self.window.resizable = resizable; @@ -229,18 +236,21 @@ impl WindowBuilder { } /// Requests a specific title for the window. + /// + /// See [`Window::set_title`] for details. + /// + /// [`Window::set_title`]: struct.Window.html#method.set_title #[inline] pub fn with_title>(mut self, title: T) -> Self { self.window.title = title.into(); self } - /// Sets the window fullscreen state. None means a normal window, Some(Fullscreen) - /// means a fullscreen window on that specific monitor + /// Sets the window fullscreen state. /// - /// ## Platform-specific + /// See [`Window::set_fullscreen`] for details. /// - /// - **Windows:** Screen saver is disabled in fullscreen mode. + /// [`Window::set_fullscreen`]: struct.Window.html#method.set_fullscreen #[inline] pub fn with_fullscreen(mut self, monitor: Option) -> Self { self.window.fullscreen = monitor; @@ -248,6 +258,10 @@ impl WindowBuilder { } /// Requests maximized mode. + /// + /// See [`Window::set_maximized`] for details. + /// + /// [`Window::set_maximized`]: struct.Window.html#method.set_maximized #[inline] pub fn with_maximized(mut self, maximized: bool) -> Self { self.window.maximized = maximized; @@ -255,6 +269,10 @@ impl WindowBuilder { } /// Sets whether the window will be initially hidden or visible. + /// + /// See [`Window::set_visible`] for details. + /// + /// [`Window::set_visible`]: struct.Window.html#method.set_visible #[inline] pub fn with_visible(mut self, visible: bool) -> Self { self.window.visible = visible; @@ -269,6 +287,10 @@ impl WindowBuilder { } /// Sets whether the window should have a border, a title bar, etc. + /// + /// See [`Window::set_decorations`] for details. + /// + /// [`Window::set_decorations`]: struct.Window.html#method.set_decorations #[inline] pub fn with_decorations(mut self, decorations: bool) -> Self { self.window.decorations = decorations; @@ -276,24 +298,21 @@ impl WindowBuilder { } /// Sets whether or not the window will always be on top of other windows. + /// + /// See [`Window::set_always_on_top`] for details. + /// + /// [`Window::set_always_on_top`]: struct.Window.html#method.set_always_on_top #[inline] pub fn with_always_on_top(mut self, always_on_top: bool) -> Self { self.window.always_on_top = always_on_top; self } - /// Sets the window icon. On Windows and X11, this is typically the small icon in the top-left - /// corner of the titlebar. + /// Sets the window icon. /// - /// ## Platform-specific + /// See [`Window::set_window_icon`] for details. /// - /// This only has an effect on Windows and X11. - /// - /// On Windows, this sets `ICON_SMALL`. The base size for a window icon is 16x16, but it's - /// recommended to account for screen scaling and pick a multiple of that, i.e. 32x32. - /// - /// X11 has no universal guidelines for icon sizes, so you're at the whims of the WM. That - /// said, it's usually in the same ballpark as on Windows. + /// [`Window::set_window_icon`]: struct.Window.html#method.set_window_icon #[inline] pub fn with_window_icon(mut self, window_icon: Option) -> Self { self.window.window_icon = window_icon; @@ -317,10 +336,12 @@ impl WindowBuilder { impl Window { /// Creates a new Window for platforms where this is appropriate. /// - /// This function is equivalent to `WindowBuilder::new().build(event_loop)`. + /// This function is equivalent to [`WindowBuilder::new().build(event_loop)`]. /// /// Error should be very rare and only occur in case of permission denied, incompatible system, /// out of memory, etc. + /// + /// [`WindowBuilder::new().build(event_loop)`]: struct.WindowBuilder.html#method.build #[inline] pub fn new(event_loop: &EventLoopWindowTarget) -> Result { let builder = WindowBuilder::new(); @@ -605,11 +626,15 @@ impl Window { /// Sets the window icon. On Windows and X11, this is typically the small icon in the top-left /// corner of the titlebar. /// - /// For more usage notes, see `WindowBuilder::with_window_icon`. - /// /// ## Platform-specific /// /// This only has an effect on Windows and X11. + /// + /// On Windows, this sets `ICON_SMALL`. The base size for a window icon is 16x16, but it's + /// recommended to account for screen scaling and pick a multiple of that, i.e. 32x32. + /// + /// X11 has no universal guidelines for icon sizes, so you're at the whims of the WM. That + /// said, it's usually in the same ballpark as on Windows. #[inline] pub fn set_window_icon(&self, window_icon: Option) { self.window.set_window_icon(window_icon)