use crate::dc::DeviceContext;
use crate::window::WxWidget;
pub struct PaintDC {
dc_ptr: *mut wxdragon_sys::wxd_PaintDC_t,
}
impl PaintDC {
pub fn new<W: WxWidget>(window: &W) -> Self {
let ptr = window.handle_ptr();
let dc_ptr = unsafe { wxdragon_sys::wxd_PaintDC_Create(ptr) };
Self { dc_ptr }
}
}
impl DeviceContext for PaintDC {
fn dc_ptr(&self) -> *mut wxdragon_sys::wxd_DC_t {
unsafe { wxdragon_sys::wxd_PaintDC_AsDC(self.dc_ptr) }
}
}
impl Drop for PaintDC {
fn drop(&mut self) {
unsafe {
wxdragon_sys::wxd_PaintDC_Destroy(self.dc_ptr);
}
}
}