Mercurial > foo_out_sdl
comparison foosdk/sdk/libPPUI/CIconOverlayWindow.h @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 #pragma once | |
| 2 | |
| 3 #include "win32_op.h" | |
| 4 | |
| 5 typedef CWinTraits<WS_POPUP,WS_EX_LAYERED> _COverlayWindowTraits; | |
| 6 | |
| 7 class CIconOverlayWindow : public CWindowImpl<CIconOverlayWindow,CWindow,_COverlayWindowTraits> { | |
| 8 public: | |
| 9 DECLARE_WND_CLASS_EX(TEXT("{384298D0-4370-4f9b-9C36-49FC1A396DC7}"),0,(-1)); | |
| 10 | |
| 11 void AttachIcon(HICON p_icon) {m_icon = p_icon;} | |
| 12 bool HaveIcon() const {return m_icon != NULL;} | |
| 13 | |
| 14 enum { | |
| 15 ColorKey = 0xc0ffee | |
| 16 }; | |
| 17 | |
| 18 BEGIN_MSG_MAP_EX(CIconOverlayWindow) | |
| 19 MESSAGE_HANDLER(WM_CREATE,OnCreate); | |
| 20 MESSAGE_HANDLER(WM_PAINT,OnPaint); | |
| 21 MESSAGE_HANDLER(WM_ERASEBKGND,OnEraseBkgnd); | |
| 22 END_MSG_MAP() | |
| 23 private: | |
| 24 LRESULT OnCreate(UINT,WPARAM,LPARAM,BOOL&) { | |
| 25 ::SetLayeredWindowAttributes(*this,ColorKey,0,LWA_COLORKEY); | |
| 26 return 0; | |
| 27 } | |
| 28 LRESULT OnEraseBkgnd(UINT,WPARAM p_wp,LPARAM,BOOL&) { | |
| 29 CRect rcClient; | |
| 30 WIN32_OP_D( GetClientRect(rcClient) ); | |
| 31 CDCHandle((HDC)p_wp).FillSolidRect(rcClient,ColorKey); | |
| 32 return 1; | |
| 33 } | |
| 34 LRESULT OnPaint(UINT,WPARAM,LPARAM,BOOL& bHandled) { | |
| 35 if (m_icon != NULL) { | |
| 36 CPaintDC dc(*this); | |
| 37 CRect client; | |
| 38 WIN32_OP_D( GetClientRect(&client) ); | |
| 39 dc.DrawIconEx(0,0,m_icon,client.right,client.bottom); | |
| 40 //CDCHandle(ps.hdc).DrawIcon(0,0,m_icon); | |
| 41 } else { | |
| 42 bHandled = FALSE; | |
| 43 } | |
| 44 return 0; | |
| 45 } | |
| 46 CIcon m_icon; | |
| 47 }; |
