use windows::Win32::UI::Shell::Common::COMDLG_FILTERSPEC;
use windows::core::{HSTRING, PCWSTR};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct WinFileFilter {
pub name: HSTRING,
pub patterns: HSTRING,
}
impl WinFileFilter {
pub fn new(name: impl Into<HSTRING>, patterns: impl Into<HSTRING>) -> Self {
Self {
name: name.into(),
patterns: patterns.into(),
}
}
pub fn as_comdlg_filterspec(&self) -> COMDLG_FILTERSPEC {
COMDLG_FILTERSPEC {
pszName: PCWSTR(self.name.as_ptr()),
pszSpec: PCWSTR(self.patterns.as_ptr()),
}
}
}