use crate::co;
use crate::decl::*;
use crate::macros::*;
use crate::msg::*;
use crate::prelude::*;
use crate::user::privs::*;
pub struct PsmAddPage<'a> {
pub hpspg: &'a HPROPSHEETPAGE,
}
impl<'a> MsgSend for PsmAddPage<'a> {
type RetType = SysResult<()>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::ADDPAGE.into(),
wparam: 0,
lparam: self.hpspg.ptr() as _,
}
}
}
pub struct PsmApply {}
impl MsgSend for PsmApply {
type RetType = SysResult<()>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::APPLY.into(),
wparam: 0,
lparam: 0,
}
}
}
pub_struct_msg_empty! { PsmCancelToClose: co::PSM::CANCELTOCLOSE.into();
}
pub_struct_msg_empty! { PsmChanged: co::PSM::CHANGED.into();
}
pub struct PsmEnableWizButtons {
pub btns_to_check: co::PSWIZB,
pub btns_to_enable: co::PSWIZB,
}
impl MsgSend for PsmEnableWizButtons {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::ENABLEWIZBUTTONS.into(),
wparam: self.btns_to_check.raw() as _,
lparam: self.btns_to_enable.raw() as _,
}
}
}
pub struct PsmGetCurrentPageHwnd {}
impl MsgSend for PsmGetCurrentPageHwnd {
type RetType = HWND;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
unsafe { HWND::from_ptr(v as _) }
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::GETCURRENTPAGEHWND.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct PsmGetResult {}
impl MsgSend for PsmGetResult {
type RetType = SysResult<co::ID_PB>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
minus1_as_badargs(v).map(|n| unsafe { co::ID_PB::from_raw(n as _) })
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::GETRESULT.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct PsmGetTabControl {}
impl MsgSend for PsmGetTabControl {
type RetType = HWND;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
unsafe { HWND::from_ptr(v as _) }
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::GETTABCONTROL.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct PsmHwndToIndex<'a> {
pub hwnd_page: &'a HWND,
}
impl<'a> MsgSend for PsmHwndToIndex<'a> {
type RetType = SysResult<u32>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
minus1_as_badargs(v).map(|n| n as _)
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::GETTABCONTROL.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct PsmIdToIndex {
pub pg_res_id: u32,
}
impl MsgSend for PsmIdToIndex {
type RetType = SysResult<u32>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
minus1_as_badargs(v).map(|n| n as _)
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::IDTOINDEX.into(),
wparam: 0,
lparam: self.pg_res_id as _,
}
}
}
pub struct PsmIndexToHwnd {
pub pg_index: u32,
}
impl MsgSend for PsmIndexToHwnd {
type RetType = SysResult<HWND>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|p| unsafe { HWND::from_ptr(p as _) })
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::INDEXTOHWND.into(),
wparam: self.pg_index as _,
lparam: 0,
}
}
}
pub struct PsmIndexToId {
pub pg_index: u32,
}
impl MsgSend for PsmIndexToId {
type RetType = SysResult<u32>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|n| n as _)
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::INDEXTOID.into(),
wparam: self.pg_index as _,
lparam: 0,
}
}
}
pub struct PsmIndexToPage {
pub pg_index: u32,
}
impl MsgSend for PsmIndexToPage {
type RetType = SysResult<HPROPSHEETPAGE>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|p| unsafe { HPROPSHEETPAGE::from_ptr(p as _) })
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::INDEXTOPAGE.into(),
wparam: self.pg_index as _,
lparam: 0,
}
}
}
pub struct PsmInsertPage<'a> {
pub index: u32,
pub hpage: &'a HPROPSHEETPAGE,
}
impl<'a> MsgSend for PsmInsertPage<'a> {
type RetType = SysResult<()>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::INSERTPAGE.into(),
wparam: self.index as _,
lparam: self.hpage.ptr() as _,
}
}
}
pub struct PsmIsDialogMessage<'a> {
pub msg: &'a mut MSG,
}
impl<'a> MsgSend for PsmIsDialogMessage<'a> {
type RetType = SysResult<()>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::ISDIALOGMESSAGE.into(),
wparam: 0,
lparam: self.msg as *mut _ as _,
}
}
}
pub struct PsmPageToIndex<'a> {
pub hpspg: &'a HPROPSHEETPAGE,
}
impl<'a> MsgSend for PsmPageToIndex<'a> {
type RetType = SysResult<u32>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|n| n as _)
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::PAGETOINDEX.into(),
wparam: 0,
lparam: self.hpspg.ptr() as _,
}
}
}
pub struct PsmPressButton {
pub index: co::PSBTN,
}
impl MsgSend for PsmPressButton {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::PRESSBUTTON.into(),
wparam: self.index.raw() as _,
lparam: 0,
}
}
}
pub struct PsmQuerySiblings {
pub param1: isize,
pub param2: isize,
}
impl MsgSend for PsmQuerySiblings {
type RetType = isize;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
v
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::QUERYSIBLINGS.into(),
wparam: self.param1 as _,
lparam: self.param2,
}
}
}
pub_struct_msg_empty! { PsmRebootSystem: co::PSM::REBOOTSYSTEM.into();
}
pub struct PsmRecalcPageSizes {}
impl MsgSend for PsmRecalcPageSizes {
type RetType = SysResult<()>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::RECALCPAGESIZES.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct PsmRemovePage<'a> {
pub index: Option<u32>,
pub hpspg: Option<&'a HPROPSHEETPAGE>,
}
impl<'a> MsgSend for PsmRemovePage<'a> {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::REMOVEPAGE.into(),
wparam: self.index.unwrap_or_default() as _,
lparam: self.hpspg.map_or(std::ptr::null_mut(), |h| h.ptr()) as _,
}
}
}
pub_struct_msg_empty! { PsmRestartWindows: co::PSM::RESTARTWINDOWS.into();
}
pub struct PsmSetButtonText {
pub btn: co::PSWIZB,
pub text: WString,
}
impl MsgSend for PsmSetButtonText {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::SETBUTTONTEXT.into(),
wparam: self.btn.raw() as _,
lparam: self.text.as_ptr() as _,
}
}
}
pub struct PsmSetCurSel<'a> {
pub index: Option<u32>,
pub hpspg: Option<&'a HPROPSHEETPAGE>,
}
impl<'a> MsgSend for PsmSetCurSel<'a> {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::SETCURSEL.into(),
wparam: self.index.unwrap_or_default() as _,
lparam: self.hpspg.map_or(std::ptr::null_mut(), |h| h.ptr()) as _,
}
}
}
pub struct PsmSetCurSelId {
pub id: u16,
}
impl MsgSend for PsmSetCurSelId {
type RetType = SysResult<()>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::SETCURSELID.into(),
wparam: self.id as _,
lparam: 0,
}
}
}
pub struct PsmSetFinishText {
pub text: WString,
}
impl MsgSend for PsmSetFinishText {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::SETFINISHTEXT.into(),
wparam: 0,
lparam: self.text.as_ptr() as _,
}
}
}
pub struct PsmSetHeaderSubtitle {
pub index: u32,
pub text: WString,
}
impl MsgSend for PsmSetHeaderSubtitle {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::SETHEADERSUBTITLE.into(),
wparam: self.index as _,
lparam: self.text.as_ptr() as _,
}
}
}
pub struct PsmSetHeaderTitle {
pub index: u32,
pub text: WString,
}
impl MsgSend for PsmSetHeaderTitle {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::SETHEADERTITLE.into(),
wparam: self.index as _,
lparam: self.text.as_ptr() as _,
}
}
}
pub struct PsmSetNextText {
pub text: WString,
}
impl MsgSend for PsmSetNextText {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::SETNEXTTEXT.into(),
wparam: 0,
lparam: self.text.as_ptr() as _,
}
}
}
pub struct PsmSetTitle {
pub incl_prefix_suffix: co::PSH,
pub title: IdStr,
}
impl MsgSend for PsmSetTitle {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::SETTITLE.into(),
wparam: self.incl_prefix_suffix.raw() as _,
lparam: self.title.as_ptr() as _,
}
}
}
pub struct PsmSetWizButtons {
pub elev_icon: co::PSWIZBF,
pub btns: co::PSWIZB,
}
impl MsgSend for PsmSetWizButtons {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::SETWIZBUTTONS.into(),
wparam: self.elev_icon.raw() as _,
lparam: self.btns.raw() as _,
}
}
}
pub struct PsmShowWizButtons {
pub btns_to_check: co::PSWIZB,
pub btns_to_enable: co::PSWIZB,
}
impl MsgSend for PsmShowWizButtons {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::SHOWWIZBUTTONS.into(),
wparam: self.btns_to_check.raw() as _,
lparam: self.btns_to_enable.raw() as _,
}
}
}
pub struct PsmUnchanged<'a> {
pub hpspg: &'a HPROPSHEETPAGE,
}
impl<'a> MsgSend for PsmUnchanged<'a> {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::PSM::UNCHANGED.into(),
wparam: self.hpspg.ptr() as _,
lparam: 0,
}
}
}