comparison foosdk/sdk/libPPUI/CFlashWindow.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_TRANSPARENT|WS_EX_LAYERED|WS_EX_TOPMOST|WS_EX_TOOLWINDOW> CFlashWindowTraits;
6
7 class CFlashWindow : public CWindowImpl<CFlashWindow,CWindow,CFlashWindowTraits> {
8 public:
9 void Activate(CWindow parent) {
10 ShowAbove(parent);
11 m_tickCount = 0;
12 SetTimer(KTimerID, 500);
13 }
14 void Deactivate() throw() {
15 ShowWindow(SW_HIDE); KillTimer(KTimerID);
16 }
17
18 void ShowAbove(CWindow parent) {
19 if (m_hWnd == NULL) {
20 WIN32_OP( Create(NULL) != NULL );
21 }
22 CRect rect;
23 WIN32_OP_D( parent.GetWindowRect(rect) );
24 WIN32_OP_D( SetWindowPos(NULL,rect,SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW) );
25 m_parent = parent;
26 }
27
28 void CleanUp() throw() {
29 if (m_hWnd != NULL) DestroyWindow();
30 }
31
32 BEGIN_MSG_MAP_EX(CFlashWindow)
33 MSG_WM_CREATE(OnCreate)
34 MSG_WM_TIMER(OnTimer)
35 MSG_WM_DESTROY(OnDestroy)
36 END_MSG_MAP()
37
38 DECLARE_WND_CLASS_EX(TEXT("{2E124D52-131F-4004-A569-2316615BE63F}"),0,COLOR_HIGHLIGHT);
39 private:
40 void OnDestroy() throw() {
41 KillTimer(KTimerID);
42 }
43 enum {
44 KTimerID = 0x47f42dd0
45 };
46 void OnTimer(WPARAM id) {
47 if (id == KTimerID) {
48 switch(++m_tickCount) {
49 case 1:
50 ShowWindow(SW_HIDE);
51 break;
52 case 2:
53 ShowAbove(m_parent);
54 break;
55 case 3:
56 ShowWindow(SW_HIDE);
57 KillTimer(KTimerID);
58 break;
59 }
60 }
61 }
62 LRESULT OnCreate(LPCREATESTRUCT) throw() {
63 SetLayeredWindowAttributes(*this,0,128,LWA_ALPHA);
64 return 0;
65 }
66 CWindow m_parent;
67 uint32_t m_tickCount;
68 };
69