Link WindowBuilder documentation to corresponding Window methods (fixes #1070) (#1216)

* fixes #1070

* Continuing adding documentation links for #1070
This commit is contained in:
Marcus Willock 2019-10-16 12:18:02 -04:00 committed by Osspial
parent 765225d918
commit 08cb950226

View file

@ -192,36 +192,43 @@ impl WindowBuilder {
} }
/// Requests the window to be of specific dimensions. /// 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] #[inline]
pub fn with_inner_size(mut self, size: LogicalSize) -> Self { pub fn with_inner_size(mut self, size: LogicalSize) -> Self {
self.window.inner_size = Some(size); self.window.inner_size = Some(size);
self 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] #[inline]
pub fn with_min_inner_size(mut self, min_size: LogicalSize) -> Self { pub fn with_min_inner_size(mut self, min_size: LogicalSize) -> Self {
self.window.min_inner_size = Some(min_size); self.window.min_inner_size = Some(min_size);
self 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] #[inline]
pub fn with_max_inner_size(mut self, max_size: LogicalSize) -> Self { pub fn with_max_inner_size(mut self, max_size: LogicalSize) -> Self {
self.window.max_inner_size = Some(max_size); self.window.max_inner_size = Some(max_size);
self 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 /// See [`Window::set_resizable`] for details.
/// triggered by DPI scaling, entering fullscreen mode, etc.
/// ///
/// ## Platform-specific /// [`Window::set_resizable`]: struct.Window.html#method.set_resizable
///
/// This only has an effect on desktop platforms.
///
/// Due to a bug in XFCE, this has no effect on Xfwm.
#[inline] #[inline]
pub fn with_resizable(mut self, resizable: bool) -> Self { pub fn with_resizable(mut self, resizable: bool) -> Self {
self.window.resizable = resizable; self.window.resizable = resizable;
@ -229,18 +236,21 @@ impl WindowBuilder {
} }
/// Requests a specific title for the window. /// Requests a specific title for the window.
///
/// See [`Window::set_title`] for details.
///
/// [`Window::set_title`]: struct.Window.html#method.set_title
#[inline] #[inline]
pub fn with_title<T: Into<String>>(mut self, title: T) -> Self { pub fn with_title<T: Into<String>>(mut self, title: T) -> Self {
self.window.title = title.into(); self.window.title = title.into();
self self
} }
/// Sets the window fullscreen state. None means a normal window, Some(Fullscreen) /// Sets the window fullscreen state.
/// means a fullscreen window on that specific monitor
/// ///
/// ## 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] #[inline]
pub fn with_fullscreen(mut self, monitor: Option<Fullscreen>) -> Self { pub fn with_fullscreen(mut self, monitor: Option<Fullscreen>) -> Self {
self.window.fullscreen = monitor; self.window.fullscreen = monitor;
@ -248,6 +258,10 @@ impl WindowBuilder {
} }
/// Requests maximized mode. /// Requests maximized mode.
///
/// See [`Window::set_maximized`] for details.
///
/// [`Window::set_maximized`]: struct.Window.html#method.set_maximized
#[inline] #[inline]
pub fn with_maximized(mut self, maximized: bool) -> Self { pub fn with_maximized(mut self, maximized: bool) -> Self {
self.window.maximized = maximized; self.window.maximized = maximized;
@ -255,6 +269,10 @@ impl WindowBuilder {
} }
/// Sets whether the window will be initially hidden or visible. /// 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] #[inline]
pub fn with_visible(mut self, visible: bool) -> Self { pub fn with_visible(mut self, visible: bool) -> Self {
self.window.visible = visible; self.window.visible = visible;
@ -269,6 +287,10 @@ impl WindowBuilder {
} }
/// Sets whether the window should have a border, a title bar, etc. /// 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] #[inline]
pub fn with_decorations(mut self, decorations: bool) -> Self { pub fn with_decorations(mut self, decorations: bool) -> Self {
self.window.decorations = decorations; self.window.decorations = decorations;
@ -276,24 +298,21 @@ impl WindowBuilder {
} }
/// Sets whether or not the window will always be on top of other windows. /// 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] #[inline]
pub fn with_always_on_top(mut self, always_on_top: bool) -> Self { pub fn with_always_on_top(mut self, always_on_top: bool) -> Self {
self.window.always_on_top = always_on_top; self.window.always_on_top = always_on_top;
self self
} }
/// Sets the window icon. On Windows and X11, this is typically the small icon in the top-left /// Sets the window icon.
/// corner of the titlebar.
/// ///
/// ## Platform-specific /// See [`Window::set_window_icon`] for details.
/// ///
/// This only has an effect on Windows and X11. /// [`Window::set_window_icon`]: struct.Window.html#method.set_window_icon
///
/// 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] #[inline]
pub fn with_window_icon(mut self, window_icon: Option<Icon>) -> Self { pub fn with_window_icon(mut self, window_icon: Option<Icon>) -> Self {
self.window.window_icon = window_icon; self.window.window_icon = window_icon;
@ -317,10 +336,12 @@ impl WindowBuilder {
impl Window { impl Window {
/// Creates a new Window for platforms where this is appropriate. /// 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, /// Error should be very rare and only occur in case of permission denied, incompatible system,
/// out of memory, etc. /// out of memory, etc.
///
/// [`WindowBuilder::new().build(event_loop)`]: struct.WindowBuilder.html#method.build
#[inline] #[inline]
pub fn new<T: 'static>(event_loop: &EventLoopWindowTarget<T>) -> Result<Window, OsError> { pub fn new<T: 'static>(event_loop: &EventLoopWindowTarget<T>) -> Result<Window, OsError> {
let builder = WindowBuilder::new(); 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 /// Sets the window icon. On Windows and X11, this is typically the small icon in the top-left
/// corner of the titlebar. /// corner of the titlebar.
/// ///
/// For more usage notes, see `WindowBuilder::with_window_icon`.
///
/// ## Platform-specific /// ## Platform-specific
/// ///
/// This only has an effect on Windows and X11. /// 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] #[inline]
pub fn set_window_icon(&self, window_icon: Option<Icon>) { pub fn set_window_icon(&self, window_icon: Option<Icon>) {
self.window.set_window_icon(window_icon) self.window.set_window_icon(window_icon)