From 0addbd825ae89bc3211404f7d43a1f5cafcf4c53 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 3 Jul 2023 13:54:46 +0200 Subject: [PATCH] icon: Add Signed-off-by: Simon Rozman --- include/WinStd/GDI.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/include/WinStd/GDI.h b/include/WinStd/GDI.h index e8c1effa..9bf3bd4e 100644 --- a/include/WinStd/GDI.h +++ b/include/WinStd/GDI.h @@ -46,6 +46,37 @@ namespace winstd } }; + /// + /// Windows HICON wrapper class + /// + class icon : public handle + { + WINSTD_HANDLE_IMPL(icon, NULL) + + public: + /// + /// Closes an open object handle. + /// + /// \sa [DestroyIcon function](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-destroyicon) + /// + virtual ~icon() + { + if (m_h != invalid) + free_internal(); + } + + protected: + /// + /// Closes an open object handle. + /// + /// \sa [DestroyIcon function](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-destroyicon) + /// + void free_internal() noexcept override + { + DestroyIcon(m_h); + } + }; + /// /// Device context wrapper class ///