TNB Library
TnbMfcSetRedrawEx.h
[詳解]
1#pragma once
11#include "TnbMfcCommon.h"
12
13
14
15//TNB Library
16namespace TNB {
17namespace MFC {
18
19
20
39template<typename TYP>
40class CSetRedrawExAddinT : public TYP
41{
42 DEFSUPER(TYP);
43public:
44
46 enum
47 {
49 };
50
57 void SetRedraw(BOOL bRedraw = TRUE)
58 {
59 _super::SetRedraw(bRedraw);
60 }
61
67 {
68 ASSERT( ::IsWindow(_super::GetSafeHwnd()) );
69 ::SendMessage(_super::GetSafeHwnd(), WM_SETREDRAW, 100, SET_REDRAW_COOKIE);
70 }
71
77 BOOL GetRedraw(void) const
78 {
79 LRESULT r = ::SendMessage(_super::GetSafeHwnd(), WM_SETREDRAW, 101, SET_REDRAW_COOKIE);
80 return r == 0;
81 }
82
83protected:
84
95 virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
96 {
97 if ( message == WM_SETREDRAW )
98 {
99 if ( lParam == SET_REDRAW_COOKIE )
100 {
101 if ( wParam == 100 )
102 {
103 // 描画しないカウンタ = 0。
104 m_count = 0;
105 return _super::WindowProc(message, TRUE, 0);
106 }
107 else if ( wParam == 101 )
108 {
109 // 描画しないカウンタ取得。
110 return m_count;
111 }
112 else
113 {
114 return 0;
115 }
116 }
117 if ( wParam == 0 )
118 {
119 // 描画しないカウンタ +1
120 m_count++;
121 if ( m_count == 1 )
122 {
123 return _super::WindowProc(message, FALSE, 0);
124 }
125 return 0;
126 }
127 else
128 {
129 // 描画しないカウンタ -1
130 if ( m_count > 0 )
131 {
132 m_count--;
133 if ( m_count == 0 )
134 {
135 return _super::WindowProc(message, TRUE, 0);
136 }
137 }
138 return 0;
139 }
140 }
141 return _super::WindowProc(message, wParam, lParam);
142 }
148 virtual void PreSubclassWindow(void)
149 {
150 m_count = 0;
151 _super::PreSubclassWindow();
152 }
160 virtual BOOL PreCreateWindow(CREATESTRUCT& cs)
161 {
162 m_count = 0;
163 return _super::PreCreateWindow(cs);
164 }
168 virtual void PostNcDestroy(void)
169 {
170 m_count = 0;
171 _super::PostNcDestroy();
172 }
173
174private:
175 int m_count;
176};
177
178
179
180}; // MFC
181}; // TNB
MFCコントロール共通のヘッダ
拡張 SetRedraw サポートクラス
void SetRedrawAbsolutely(void)
[設定] 再描画許可.
BOOL GetRedraw(void) const
[取得] 再描画状態取得.
void SetRedraw(BOOL bRedraw=TRUE)
[設定] 再描画許可・禁止設定.
virtual void PostNcDestroy(void)
[通知] 破棄終了通知
virtual void PreSubclassWindow(void)
[通知] subclassing/unsubclassing functions.
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
[通知] for processing Windows messages.
virtual BOOL PreCreateWindow(CREATESTRUCT &cs)
[通知] special pre-creation and window rect adjustment hooks.
TNB Library
Definition: TnbDoxyTitle.txt:2