use crate::co;
use crate::decl::*;
use crate::msg::*;
use crate::prelude::*;
use crate::user::privs::*;
pub struct AddPage<'a> {
pub hpspg: &'a HPROPSHEETPAGE,
}
impl<'a> MsgSend for AddPage<'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) -> WndMsg {
WndMsg {
msg_id: co::PSM::ADDPAGE.into(),
wparam: 0,
lparam: self.hpspg.ptr() as _,
}
}
}
pub struct Apply {}
impl MsgSend for Apply {
type RetType = SysResult<()>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::PSM::APPLY.into(),
wparam: 0,
lparam: 0,
}
}
}
pub_struct_msg_empty! { CancelToClose: co::PSM::CANCELTOCLOSE.into();
}
pub_struct_msg_empty! { Changed: co::PSM::CHANGED.into();
}
pub struct EnableWizButtons {
pub btns_to_check: co::PSWIZB,
pub btns_to_enable: co::PSWIZB,
}
impl MsgSend for EnableWizButtons {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::PSM::ENABLEWIZBUTTONS.into(),
wparam: self.btns_to_check.raw() as _,
lparam: self.btns_to_enable.raw() as _,
}
}
}
pub struct GetCurrentPageHwnd {}
impl MsgSend for GetCurrentPageHwnd {
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) -> WndMsg {
WndMsg {
msg_id: co::PSM::GETCURRENTPAGEHWND.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetResult {}
impl MsgSend for GetResult {
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) -> WndMsg {
WndMsg {
msg_id: co::PSM::GETRESULT.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetTabControl {}
impl MsgSend for GetTabControl {
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) -> WndMsg {
WndMsg {
msg_id: co::PSM::GETTABCONTROL.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct HwndToIndex<'a> {
pub hwnd_page: &'a HWND,
}
impl<'a> MsgSend for HwndToIndex<'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) -> WndMsg {
WndMsg {
msg_id: co::PSM::GETTABCONTROL.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct IdToIndex {
pub pg_res_id: u32,
}
impl MsgSend for IdToIndex {
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) -> WndMsg {
WndMsg {
msg_id: co::PSM::IDTOINDEX.into(),
wparam: 0,
lparam: self.pg_res_id as _,
}
}
}
pub struct IndexToHwnd {
pub pg_index: u32,
}
impl MsgSend for IndexToHwnd {
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) -> WndMsg {
WndMsg {
msg_id: co::PSM::INDEXTOHWND.into(),
wparam: self.pg_index as _,
lparam: 0,
}
}
}
pub struct IndexToId {
pub pg_index: u32,
}
impl MsgSend for IndexToId {
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) -> WndMsg {
WndMsg {
msg_id: co::PSM::INDEXTOID.into(),
wparam: self.pg_index as _,
lparam: 0,
}
}
}
pub struct IndexToPage {
pub pg_index: u32,
}
impl MsgSend for IndexToPage {
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) -> WndMsg {
WndMsg {
msg_id: co::PSM::INDEXTOPAGE.into(),
wparam: self.pg_index as _,
lparam: 0,
}
}
}
pub struct InsertPage<'a> {
pub index: u32,
pub hpage: &'a HPROPSHEETPAGE,
}
impl<'a> MsgSend for InsertPage<'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) -> WndMsg {
WndMsg {
msg_id: co::PSM::INSERTPAGE.into(),
wparam: self.index as _,
lparam: self.hpage.ptr() as _,
}
}
}
pub struct IsDialogMessage<'a> {
pub msg: &'a mut MSG,
}
impl<'a> MsgSend for IsDialogMessage<'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) -> WndMsg {
WndMsg {
msg_id: co::PSM::ISDIALOGMESSAGE.into(),
wparam: 0,
lparam: self.msg as *mut _ as _,
}
}
}
pub struct PageToIndex<'a> {
pub hpspg: &'a HPROPSHEETPAGE,
}
impl<'a> MsgSend for PageToIndex<'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) -> WndMsg {
WndMsg {
msg_id: co::PSM::PAGETOINDEX.into(),
wparam: 0,
lparam: self.hpspg.ptr() as _,
}
}
}
pub struct PressButton {
pub index: co::PSBTN,
}
impl MsgSend for PressButton {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::PSM::PRESSBUTTON.into(),
wparam: self.index.raw() as _,
lparam: 0,
}
}
}
pub struct QuerySiblings {
pub param1: isize,
pub param2: isize,
}
impl MsgSend for QuerySiblings {
type RetType = isize;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
v
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::PSM::QUERYSIBLINGS.into(),
wparam: self.param1 as _,
lparam: self.param2,
}
}
}
pub_struct_msg_empty! { RebootSystem: co::PSM::REBOOTSYSTEM.into();
}
pub struct RecalcPageSizes {}
impl MsgSend for RecalcPageSizes {
type RetType = SysResult<()>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::PSM::RECALCPAGESIZES.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct RemovePage<'a> {
pub index: Option<u32>,
pub hpspg: Option<&'a HPROPSHEETPAGE>,
}
impl<'a> MsgSend for RemovePage<'a> {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
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! { RestartWindows: co::PSM::RESTARTWINDOWS.into();
}
pub struct SetButtonText {
pub btn: co::PSWIZB,
pub text: WString,
}
impl MsgSend for SetButtonText {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::PSM::SETBUTTONTEXT.into(),
wparam: self.btn.raw() as _,
lparam: self.text.as_ptr() as _,
}
}
}
pub struct SetCurSel<'a> {
pub index: Option<u32>,
pub hpspg: Option<&'a HPROPSHEETPAGE>,
}
impl<'a> MsgSend for SetCurSel<'a> {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
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 SetCurSelId {
pub id: u16,
}
impl MsgSend for SetCurSelId {
type RetType = SysResult<()>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::PSM::SETCURSELID.into(),
wparam: self.id as _,
lparam: 0,
}
}
}
pub struct SetFinishText {
pub text: WString,
}
impl MsgSend for SetFinishText {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::PSM::SETFINISHTEXT.into(),
wparam: 0,
lparam: self.text.as_ptr() as _,
}
}
}
pub struct SetHeaderSubtitle {
pub index: u32,
pub text: WString,
}
impl MsgSend for SetHeaderSubtitle {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::PSM::SETHEADERSUBTITLE.into(),
wparam: self.index as _,
lparam: self.text.as_ptr() as _,
}
}
}
pub struct SetHeaderTitle {
pub index: u32,
pub text: WString,
}
impl MsgSend for SetHeaderTitle {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::PSM::SETHEADERTITLE.into(),
wparam: self.index as _,
lparam: self.text.as_ptr() as _,
}
}
}
pub struct SetNextText {
pub text: WString,
}
impl MsgSend for SetNextText {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::PSM::SETNEXTTEXT.into(),
wparam: 0,
lparam: self.text.as_ptr() as _,
}
}
}
pub struct SetTitle {
pub incl_prefix_suffix: co::PSH,
pub title: IdStr,
}
impl MsgSend for SetTitle {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::PSM::SETTITLE.into(),
wparam: self.incl_prefix_suffix.raw() as _,
lparam: self.title.as_ptr() as _,
}
}
}
pub struct SetWizButtons {
pub elev_icon: co::PSWIZBF,
pub btns: co::PSWIZB,
}
impl MsgSend for SetWizButtons {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::PSM::SETWIZBUTTONS.into(),
wparam: self.elev_icon.raw() as _,
lparam: self.btns.raw() as _,
}
}
}
pub struct ShowWizButtons {
pub btns_to_check: co::PSWIZB,
pub btns_to_enable: co::PSWIZB,
}
impl MsgSend for ShowWizButtons {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::PSM::SHOWWIZBUTTONS.into(),
wparam: self.btns_to_check.raw() as _,
lparam: self.btns_to_enable.raw() as _,
}
}
}
pub struct Unchanged<'a> {
pub hpspg: &'a HPROPSHEETPAGE,
}
impl<'a> MsgSend for Unchanged<'a> {
type RetType = ();
unsafe fn isize_to_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::PSM::UNCHANGED.into(),
wparam: self.hpspg.ptr() as _,
lparam: 0,
}
}
}