use crate::co;
use crate::decl::*;
use crate::msg::*;
use crate::prelude::*;
use crate::user::privs::*;
pub struct EmGetCueBanner<'a> {
pub buffer: &'a mut WString,
}
impl<'a> MsgSend for EmGetCueBanner<'a> {
type RetType = SysResult<()>;
unsafe fn isize_to_ret(&self, v: isize) -> Self::RetType {
match v {
0 | 1 => Ok(()),
_ => Err(co::ERROR::BAD_ARGUMENTS),
}
}
fn as_generic_wm(&mut self) -> Wm {
Wm {
msg_id: co::EM::GETCUEBANNER.into(),
wparam: unsafe { self.buffer.as_mut_ptr() } as _,
lparam: self.buffer.buf_len() as _,
}
}
}
pub struct EmHideBalloonTip {}
impl MsgSend for EmHideBalloonTip {
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::EM::HIDEBALLOONTIP.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct EmSetCueBanner {
pub show_even_with_focus: bool,
pub text: WString,
}
impl MsgSend for EmSetCueBanner {
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::EM::SETCUEBANNER.into(),
wparam: self.show_even_with_focus as _,
lparam: self.text.as_ptr() as _,
}
}
}
pub struct EmShowBalloonTip<'a, 'b, 'c> {
pub info: &'c EDITBALLOONTIP<'a, 'b>,
}
impl<'a, 'b, 'c> MsgSend for EmShowBalloonTip<'a, 'b, 'c> {
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::EM::SHOWBALLOONTIP.into(),
wparam: 0,
lparam: self.info as *const _ as _,
}
}
}