1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
use crate::co;
use crate::decl::*;
use crate::kernel::privs::*;
/// Variant parameter for:
///
/// * [`HDC::GetCurrentObject`](crate::prelude::gdi_Hdc::GetCurrentObject).
///
/// The enum values match those in [`co::CUR_OBJ`](crate::co::CUR_OBJ) constant
/// type.
pub enum CurObj {
Bitmap(HBITMAP),
Brush(HBRUSH),
Font(HFONT),
Pal(HPALETTE),
Pen(HPEN),
}
/// Variant parameter for:
///
/// * [`HINSTANCE::LoadImageBitmap`](crate::prelude::gdi_Hinstance::LoadImageBitmap).
#[derive(Clone)]
pub enum IdObmStr {
/// A resource ID.
Id(u16),
/// A [`co::OBM`](crate::co::OBM) constant for an OEM bitmap.
Obm(co::OBM),
/// A resource string identifier or file path.
Str(WString),
}
impl IdObmStr {
/// Constructs the enum directly from a string.
#[must_use]
pub fn from_str(v: &str) -> Self {
Self::Str(WString::from_str(v))
}
/// Returns a pointer to the raw data content, or null if no content.
#[must_use]
pub fn as_ptr(&self) -> *const u16 {
match self {
Self::Id(id) => MAKEINTRESOURCE(*id as _),
Self::Obm(obm) => MAKEINTRESOURCE(obm.raw() as _),
Self::Str(ws) => ws.as_ptr(),
}
}
}
/// Variant parameter for:
///
/// * [`HINSTANCE::LoadImageCursor`](crate::prelude::gdi_Hinstance::LoadImageCursor).
#[derive(Clone)]
pub enum IdOcrStr {
/// A resource ID.
Id(u16),
/// A [`co::OCR`](crate::co::OCR) constant for an OEM cursor.
Ocr(co::OCR),
/// A resource string identifier or file path.
Str(WString),
}
impl IdOcrStr {
/// Constructs the enum directly from a string.
#[must_use]
pub fn from_str(v: &str) -> Self {
Self::Str(WString::from_str(v))
}
/// Returns a pointer to the raw data content, or null if no content.
#[must_use]
pub fn as_ptr(&self) -> *const u16 {
match self {
Self::Id(id) => MAKEINTRESOURCE(*id as _),
Self::Ocr(ocr) => MAKEINTRESOURCE(ocr.raw() as _),
Self::Str(ws) => ws.as_ptr(),
}
}
}
/// Variant parameter for:
///
/// * [`HINSTANCE::LoadImageIcon`](crate::prelude::gdi_Hinstance::LoadImageIcon).
#[derive(Clone)]
pub enum IdOicStr {
/// A resource ID.
Id(u16),
/// A [`co::OIC`](crate::co::OIC) constant for an OEM icon.
Oic(co::OIC),
/// A resource string identifier or file path.
Str(WString),
}
impl IdOicStr {
/// Constructs the enum directly from a string.
#[must_use]
pub fn from_str(v: &str) -> Self {
Self::Str(WString::from_str(v))
}
/// Returns a pointer to the raw data content, or null if no content.
#[must_use]
pub fn as_ptr(&self) -> *const u16 {
match self {
Self::Id(id) => MAKEINTRESOURCE(*id as _),
Self::Oic(oic) => MAKEINTRESOURCE(oic.raw() as _),
Self::Str(ws) => ws.as_ptr(),
}
}
}