use crate::{ffi,LockscreenPage};
use glib::{object::ObjectType as _,prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
use std::{boxed::Box as Box_};
glib::wrapper! {
#[doc(alias = "PhoshLockscreen")]
pub struct Lockscreen(Object<ffi::PhoshLockscreen, ffi::PhoshLockscreenClass>) @extends gtk::Window, gtk::Bin, gtk::Container, gtk::Widget;
match fn {
type_ => || ffi::phosh_lockscreen_get_type(),
}
}
impl Lockscreen {
pub const NONE: Option<&'static Lockscreen> = None;
pub fn builder() -> LockscreenBuilder {
LockscreenBuilder::new()
}
}
#[must_use = "The builder must be built to be used"]
pub struct LockscreenBuilder {
builder: glib::object::ObjectBuilder<'static, Lockscreen>,
}
impl LockscreenBuilder {
fn new() -> Self {
Self { builder: glib::object::Object::builder() }
}
pub fn require_unlock(self, require_unlock: bool) -> Self {
Self { builder: self.builder.property("require-unlock", require_unlock), }
}
#[cfg(feature = "gtk_v2_4")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v2_4")))]
pub fn accept_focus(self, accept_focus: bool) -> Self {
Self { builder: self.builder.property("accept-focus", accept_focus), }
}
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3")))]
#[cfg(feature = "gtk_v3_4")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3_4")))]
pub fn attached_to(self, attached_to: &impl IsA<gtk::Widget>) -> Self {
Self { builder: self.builder.property("attached-to", attached_to.clone().upcast()), }
}
#[cfg(feature = "gtk_v2_4")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v2_4")))]
pub fn decorated(self, decorated: bool) -> Self {
Self { builder: self.builder.property("decorated", decorated), }
}
pub fn default_height(self, default_height: i32) -> Self {
Self { builder: self.builder.property("default-height", default_height), }
}
pub fn default_width(self, default_width: i32) -> Self {
Self { builder: self.builder.property("default-width", default_width), }
}
#[cfg(feature = "gtk_v2_10")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v2_10")))]
pub fn deletable(self, deletable: bool) -> Self {
Self { builder: self.builder.property("deletable", deletable), }
}
pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
Self { builder: self.builder.property("destroy-with-parent", destroy_with_parent), }
}
#[cfg(feature = "gtk_v2_6")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v2_6")))]
pub fn focus_on_map(self, focus_on_map: bool) -> Self {
Self { builder: self.builder.property("focus-on-map", focus_on_map), }
}
#[cfg(feature = "gtk_v2_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v2_20")))]
pub fn focus_visible(self, focus_visible: bool) -> Self {
Self { builder: self.builder.property("focus-visible", focus_visible), }
}
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v2_4")))]
#[cfg(feature = "gtk_v3")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3")))]
#[cfg_attr(feature = "v3_14", deprecated = "Since 3.14")]
pub fn has_resize_grip(self, has_resize_grip: bool) -> Self {
Self { builder: self.builder.property("has-resize-grip", has_resize_grip), }
}
#[cfg(feature = "gtk_v3_4")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3_4")))]
pub fn hide_titlebar_when_maximized(self, hide_titlebar_when_maximized: bool) -> Self {
Self { builder: self.builder.property("hide-titlebar-when-maximized", hide_titlebar_when_maximized), }
}
#[cfg(feature = "gtk_v2_6")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v2_6")))]
pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
Self { builder: self.builder.property("icon-name", icon_name.into()), }
}
#[cfg(feature = "gtk_v2_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v2_20")))]
pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
Self { builder: self.builder.property("mnemonics-visible", mnemonics_visible), }
}
pub fn modal(self, modal: bool) -> Self {
Self { builder: self.builder.property("modal", modal), }
}
pub fn resizable(self, resizable: bool) -> Self {
Self { builder: self.builder.property("resizable", resizable), }
}
pub fn role(self, role: impl Into<glib::GString>) -> Self {
Self { builder: self.builder.property("role", role.into()), }
}
pub fn skip_pager_hint(self, skip_pager_hint: bool) -> Self {
Self { builder: self.builder.property("skip-pager-hint", skip_pager_hint), }
}
pub fn skip_taskbar_hint(self, skip_taskbar_hint: bool) -> Self {
Self { builder: self.builder.property("skip-taskbar-hint", skip_taskbar_hint), }
}
#[cfg(feature = "gtk_v2_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v2_12")))]
pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
Self { builder: self.builder.property("startup-id", startup_id.into()), }
}
pub fn title(self, title: impl Into<glib::GString>) -> Self {
Self { builder: self.builder.property("title", title.into()), }
}
#[cfg(feature = "gtk_v2_10")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v2_10")))]
pub fn transient_for(self, transient_for: &impl IsA<gtk::Window>) -> Self {
Self { builder: self.builder.property("transient-for", transient_for.clone().upcast()), }
}
pub fn urgency_hint(self, urgency_hint: bool) -> Self {
Self { builder: self.builder.property("urgency-hint", urgency_hint), }
}
pub fn border_width(self, border_width: u32) -> Self {
Self { builder: self.builder.property("border-width", border_width), }
}
pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
Self { builder: self.builder.property("child", child.clone().upcast()), }
}
pub fn app_paintable(self, app_paintable: bool) -> Self {
Self { builder: self.builder.property("app-paintable", app_paintable), }
}
pub fn can_default(self, can_default: bool) -> Self {
Self { builder: self.builder.property("can-default", can_default), }
}
pub fn can_focus(self, can_focus: bool) -> Self {
Self { builder: self.builder.property("can-focus", can_focus), }
}
#[cfg(feature = "gtk_v2_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v2_18")))]
#[cfg_attr(feature = "v3_14", deprecated = "Since 3.14")]
pub fn double_buffered(self, double_buffered: bool) -> Self {
Self { builder: self.builder.property("double-buffered", double_buffered), }
}
#[cfg(feature = "gtk_v3")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3")))]
pub fn expand(self, expand: bool) -> Self {
Self { builder: self.builder.property("expand", expand), }
}
#[cfg(feature = "gtk_v3_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3_20")))]
pub fn focus_on_click(self, focus_on_click: bool) -> Self {
Self { builder: self.builder.property("focus-on-click", focus_on_click), }
}
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3")))]
pub fn has_default(self, has_default: bool) -> Self {
Self { builder: self.builder.property("has-default", has_default), }
}
pub fn has_focus(self, has_focus: bool) -> Self {
Self { builder: self.builder.property("has-focus", has_focus), }
}
#[cfg(feature = "gtk_v2_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v2_12")))]
pub fn has_tooltip(self, has_tooltip: bool) -> Self {
Self { builder: self.builder.property("has-tooltip", has_tooltip), }
}
pub fn height_request(self, height_request: i32) -> Self {
Self { builder: self.builder.property("height-request", height_request), }
}
#[cfg(feature = "gtk_v3")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3")))]
pub fn hexpand(self, hexpand: bool) -> Self {
Self { builder: self.builder.property("hexpand", hexpand), }
}
#[cfg(feature = "gtk_v3")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3")))]
pub fn hexpand_set(self, hexpand_set: bool) -> Self {
Self { builder: self.builder.property("hexpand-set", hexpand_set), }
}
pub fn is_focus(self, is_focus: bool) -> Self {
Self { builder: self.builder.property("is-focus", is_focus), }
}
#[cfg(feature = "gtk_v3")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3")))]
pub fn margin(self, margin: i32) -> Self {
Self { builder: self.builder.property("margin", margin), }
}
#[cfg(feature = "gtk_v3")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3")))]
pub fn margin_bottom(self, margin_bottom: i32) -> Self {
Self { builder: self.builder.property("margin-bottom", margin_bottom), }
}
#[cfg(feature = "gtk_v3_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3_12")))]
pub fn margin_end(self, margin_end: i32) -> Self {
Self { builder: self.builder.property("margin-end", margin_end), }
}
#[cfg(feature = "gtk_v3")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3")))]
#[cfg_attr(feature = "v3_12", deprecated = "Since 3.12")]
pub fn margin_left(self, margin_left: i32) -> Self {
Self { builder: self.builder.property("margin-left", margin_left), }
}
#[cfg(feature = "gtk_v3")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3")))]
#[cfg_attr(feature = "v3_12", deprecated = "Since 3.12")]
pub fn margin_right(self, margin_right: i32) -> Self {
Self { builder: self.builder.property("margin-right", margin_right), }
}
#[cfg(feature = "gtk_v3_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3_12")))]
pub fn margin_start(self, margin_start: i32) -> Self {
Self { builder: self.builder.property("margin-start", margin_start), }
}
#[cfg(feature = "gtk_v3")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3")))]
pub fn margin_top(self, margin_top: i32) -> Self {
Self { builder: self.builder.property("margin-top", margin_top), }
}
pub fn name(self, name: impl Into<glib::GString>) -> Self {
Self { builder: self.builder.property("name", name.into()), }
}
pub fn no_show_all(self, no_show_all: bool) -> Self {
Self { builder: self.builder.property("no-show-all", no_show_all), }
}
#[cfg(feature = "gtk_v3_8")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3_8")))]
pub fn opacity(self, opacity: f64) -> Self {
Self { builder: self.builder.property("opacity", opacity), }
}
pub fn parent(self, parent: &impl IsA<gtk::Container>) -> Self {
Self { builder: self.builder.property("parent", parent.clone().upcast()), }
}
pub fn receives_default(self, receives_default: bool) -> Self {
Self { builder: self.builder.property("receives-default", receives_default), }
}
pub fn sensitive(self, sensitive: bool) -> Self {
Self { builder: self.builder.property("sensitive", sensitive), }
}
#[cfg(feature = "gtk_v2_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v2_12")))]
pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
Self { builder: self.builder.property("tooltip-markup", tooltip_markup.into()), }
}
#[cfg(feature = "gtk_v2_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v2_12")))]
pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
Self { builder: self.builder.property("tooltip-text", tooltip_text.into()), }
}
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3")))]
#[cfg(feature = "gtk_v3")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3")))]
pub fn vexpand(self, vexpand: bool) -> Self {
Self { builder: self.builder.property("vexpand", vexpand), }
}
#[cfg(feature = "gtk_v3")]
#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v3")))]
pub fn vexpand_set(self, vexpand_set: bool) -> Self {
Self { builder: self.builder.property("vexpand-set", vexpand_set), }
}
pub fn visible(self, visible: bool) -> Self {
Self { builder: self.builder.property("visible", visible), }
}
pub fn width_request(self, width_request: i32) -> Self {
Self { builder: self.builder.property("width-request", width_request), }
}
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
pub fn build(self) -> Lockscreen {
assert_initialized_main_thread!();
self.builder.build() }
}
pub trait LockscreenExt: IsA<Lockscreen> + 'static {
#[doc(alias = "phosh_lockscreen_add_extra_page")]
fn add_extra_page(&self, widget: &impl IsA<gtk::Widget>) {
unsafe {
ffi::phosh_lockscreen_add_extra_page(self.as_ref().to_glib_none().0, widget.as_ref().to_glib_none().0);
}
}
#[doc(alias = "phosh_lockscreen_clear_pin_entry")]
fn clear_pin_entry(&self) {
unsafe {
ffi::phosh_lockscreen_clear_pin_entry(self.as_ref().to_glib_none().0);
}
}
#[doc(alias = "phosh_lockscreen_get_page")]
#[doc(alias = "get_page")]
fn page(&self) -> LockscreenPage {
unsafe {
from_glib(ffi::phosh_lockscreen_get_page(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "phosh_lockscreen_get_pin_entry")]
#[doc(alias = "get_pin_entry")]
fn pin_entry(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::phosh_lockscreen_get_pin_entry(self.as_ref().to_glib_none().0))
}
}
#[doc(alias = "phosh_lockscreen_set_default_page")]
fn set_default_page(&self, page: LockscreenPage) {
unsafe {
ffi::phosh_lockscreen_set_default_page(self.as_ref().to_glib_none().0, page.into_glib());
}
}
#[doc(alias = "phosh_lockscreen_set_page")]
fn set_page(&self, page: LockscreenPage) {
unsafe {
ffi::phosh_lockscreen_set_page(self.as_ref().to_glib_none().0, page.into_glib());
}
}
#[doc(alias = "phosh_lockscreen_set_unlock_status")]
fn set_unlock_status(&self, status: &str) {
unsafe {
ffi::phosh_lockscreen_set_unlock_status(self.as_ref().to_glib_none().0, status.to_glib_none().0);
}
}
#[doc(alias = "phosh_lockscreen_shake_pin_entry")]
fn shake_pin_entry(&self) {
unsafe {
ffi::phosh_lockscreen_shake_pin_entry(self.as_ref().to_glib_none().0);
}
}
#[doc(alias = "require-unlock")]
fn requires_unlock(&self) -> bool {
ObjectExt::property(self.as_ref(), "require-unlock")
}
#[doc(alias = "require-unlock")]
fn set_require_unlock(&self, require_unlock: bool) {
ObjectExt::set_property(self.as_ref(),"require-unlock", require_unlock)
}
#[doc(alias = "lockscreen-unlock")]
fn connect_lockscreen_unlock<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn lockscreen_unlock_trampoline<P: IsA<Lockscreen>, F: Fn(&P) + 'static>(this: *mut ffi::PhoshLockscreen, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(Lockscreen::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"lockscreen-unlock".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(lockscreen_unlock_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "wakeup-output")]
fn connect_wakeup_output<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn wakeup_output_trampoline<P: IsA<Lockscreen>, F: Fn(&P) + 'static>(this: *mut ffi::PhoshLockscreen, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(Lockscreen::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"wakeup-output".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(wakeup_output_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "page")]
fn connect_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_page_trampoline<P: IsA<Lockscreen>, F: Fn(&P) + 'static>(this: *mut ffi::PhoshLockscreen, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(Lockscreen::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::page".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_page_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
#[doc(alias = "require-unlock")]
fn connect_require_unlock_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_require_unlock_trampoline<P: IsA<Lockscreen>, F: Fn(&P) + 'static>(this: *mut ffi::PhoshLockscreen, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(Lockscreen::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, c"notify::require-unlock".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_require_unlock_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
}
}
}
impl<O: IsA<Lockscreen>> LockscreenExt for O {}