TNB Library
TnbMfcDelayedRedraw.h
[詳解]
1#pragma once
13#include "TnbMfcSetRedrawEx.h"
14
15
16
17//TNB Library
18namespace TNB {
19namespace MFC {
20
21
22
48template<typename TYP = CStatic>
50{
52public:
53
55 CDelayedRedrawAddinT(void) : m_postDrawTiming(200), m_lastDrawInterval(100)
56 {
57 }
58
64 void SetTiming(DWORD postDrawTiming, DWORD lastDrawInterval)
65 {
66 m_postDrawTiming = postDrawTiming;
67 m_lastDrawInterval = lastDrawInterval;
68 }
69
74 void DelayedRedraw(void)
75 {
76 if ( _super::GetRedraw() )
77 {
78 _super::SetRedraw(FALSE);
79 }
80 _super::SetTimer(TIMERID_LAST, m_lastDrawInterval, NULL);
81 if ( ! m_isOnRedrawTimer )
82 {
83 m_isOnRedrawTimer = true;
84 _super::SetTimer(TIMERID_POST, m_postDrawTiming, NULL);
85 }
86 }
87
92 void SetWindowText(LPCTSTR lpszString)
93 {
95 _super::SetWindowText(lpszString);
96 }
97
102 void UpdateWindow(void)
103 {
104 m_isOnRedrawTimer = false;
105 _super::KillTimer(TIMERID_POST);
106 _super::KillTimer(TIMERID_LAST);
107 _super::SetRedraw(TRUE);
108 _super::Invalidate(FALSE);
109 _super::UpdateWindow();
110 }
111
112protected:
113
119 virtual void PreSubclassWindow(void)
120 {
121 m_isOnRedrawTimer = false;
122 _super::PreSubclassWindow();
123 }
124
134 virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
135 {
136 if ( message == WM_TIMER )
137 {
138 if ( wParam == TIMERID_POST )
139 {
140 _super::KillTimer(TIMERID_POST);
141 m_isOnRedrawTimer = false;
142 _super::SetRedraw(TRUE);
143 _super::RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
144 _super::SetRedraw(FALSE);
145 _super::SetTimer(TIMERID_LAST, m_lastDrawInterval, NULL);
146 }
147 else if ( wParam == TIMERID_LAST )
148 {
149 // 更新無くなって 100msたった
150 _super::KillTimer(TIMERID_LAST);
151 _super::SetRedraw(TRUE);
152 _super::RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
153 }
154 }
155 return _super::WindowProc(message, wParam, lParam);
156 }
157
158private:
159 enum
160 {
161 TIMERID_POST = 20001,
162 TIMERID_LAST = 20002,
163 };
164 bool m_isOnRedrawTimer;
165 DWORD m_postDrawTiming;
166 DWORD m_lastDrawInterval;
167};
168
169
170
171}; //MFC
172}; //TNB
173
174
175
拡張 SetRedraw 関係のヘッダ
遅延再描画アドイン
void SetWindowText(LPCTSTR lpszString)
[設定] ウィンドウタイトル設定.
void UpdateWindow(void)
[処理] 再描画.
void SetTiming(DWORD postDrawTiming, DWORD lastDrawInterval)
[設定] タイミング設定.
void DelayedRedraw(void)
[設定] 遅延再描画指定.
CDelayedRedrawAddinT(void)
コンストラクタ
virtual void PreSubclassWindow(void)
[通知] subclassing/unsubclassing functions.
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
[通知] for processing Windows messages.
拡張 SetRedraw サポートクラス
TNB Library
Definition: TnbDoxyTitle.txt:2