aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorTomaka17 <pierre.krieger1708@gmail.com>2014-11-01 09:02:01 +0100
committerTomaka17 <pierre.krieger1708@gmail.com>2014-11-01 09:03:21 +0100
commitb6f74911579f1a46bfa112032b2efc38aeff1a99 (patch)
tree1bad2622d17f139c3b072d72ae411103a1fcfc1d /src/lib.rs
parenta479b2f60c7917a7c7a73b15c22c0b20f54448b7 (diff)
downloadglutin-b6f74911579f1a46bfa112032b2efc38aeff1a99.tar.gz
glutin-b6f74911579f1a46bfa112032b2efc38aeff1a99.zip
Add visibility-related functions to window
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 096bae4..d8c546a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -74,6 +74,7 @@ pub struct WindowBuilder {
monitor: Option<winimpl::MonitorID>,
gl_version: Option<(uint, uint)>,
vsync: bool,
+ visible: bool,
}
#[cfg(feature = "window")]
@@ -86,6 +87,7 @@ impl WindowBuilder {
monitor: None,
gl_version: None,
vsync: false,
+ visible: true,
}
}
@@ -127,6 +129,12 @@ impl WindowBuilder {
self
}
+ /// Sets whether the window will be initially hidden or visible.
+ pub fn with_visibility(mut self, visible: bool) -> WindowBuilder {
+ self.visible = visible;
+ self
+ }
+
/// Builds the window.
///
/// Error should be very rare and only occur in case of permission denied, incompatible system,
@@ -252,6 +260,28 @@ impl Window {
self.window.set_title(title)
}
+ /// Shows the window if it was hidden.
+ ///
+ /// ## Platform-specific
+ ///
+ /// - Has no effect on Android
+ ///
+ #[inline]
+ pub fn show(&self) {
+ self.window.show()
+ }
+
+ /// Hides the window if it was visible.
+ ///
+ /// ## Platform-specific
+ ///
+ /// - Has no effect on Android
+ ///
+ #[inline]
+ pub fn hide(&self) {
+ self.window.hide()
+ }
+
/// Returns the position of the top-left hand corner of the window relative to the
/// top-left hand corner of the desktop.
///