polyhorn_ios_sys/polykit/
status_bar.rs1use objc::runtime::*;
2use objc::*;
3
4use super::PLYWindow;
5use crate::uikit::UIStatusBarStyle;
6use crate::Raw;
7
8pub struct PLYStatusBar {
11 object: *mut Object,
12}
13
14impl PLYStatusBar {
15 pub fn new(window: &PLYWindow) -> PLYStatusBar {
17 unsafe {
18 let mut object: *mut Object = msg_send![class!(PLYStatusBar), alloc];
19 object = msg_send![object, initWithWindow: window.as_raw()];
20 PLYStatusBar { object }
21 }
22 }
23
24 pub fn set_style(&mut self, style: UIStatusBarStyle) {
26 unsafe {
27 let _: () = msg_send![self.object, setStyle: style];
28 }
29 }
30}
31
32impl Raw for PLYStatusBar {
33 unsafe fn from_raw(object: *mut Object) -> Self {
34 PLYStatusBar { object }
35 }
36
37 unsafe fn as_raw(&self) -> *mut Object {
38 self.object
39 }
40}
41
42impl Drop for PLYStatusBar {
43 fn drop(&mut self) {
44 unsafe { objc_release(self.object) }
45 }
46}