WIL説明書(C++)  3.0.0
EvMessageMap.h
[詳解]
1 // $Revision: 1.1 $
2 /*
3  @file EvMessageMap.h
4  @brief CEvMessageMap class header
5  @author FAST Corporation
6 */
7 
8 #ifndef _EVMESSAGEMAP_H_INCLUDED_
9 #define _EVMESSAGEMAP_H_INCLUDED_
10 
11 #if _MSC_VER > 1000
12 #pragma once
13 #endif // _MSC_VER > 1000
14 
15 // ///////////////////////////////////////////////////////////////////////////
16 // INCLUDE
17 #include "FvObject.h"
18 #include "MultiData/FvList.h"
19 
20 // ///////////////////////////////////////////////////////////////////////////
21 // CLASS
22 #pragma pack(push,_FVCL_PACKING)
23 
24 template<class TYPE> class CEvMessageMap : public FVCL::CFvObject
25 {
26 public:
27  // TYPEDEF
28  typedef void (*LPCOMMANDHANDLER)( void*, TYPE*, WPARAM, LPARAM );
29  typedef void (*LPWNDMSGHANDLER)( void*, TYPE*, UINT, WPARAM, LPARAM );
30 
31 public:
32 // ///////////////////////////////////////////////////////////////////////////
33 // CONSTRUCTOR/DESTRUCTOR
34 
35 // =================================================================
37 {
38  m_OnCommandPre = NULL;
39  m_OnCommandPost = NULL;
40  m_OnWndMsgPre = NULL;
41  m_OnWndMsgPost = NULL;
42 
43  m_pvCommandPre = NULL;
44  m_pvCommandPost = NULL;
45  m_pvWndMsgPre = NULL;
46  m_pvWndMsgPost = NULL;
47 
48  m_blCommandPre = true;
49  m_blCommandPost = true;
50  m_blWndMsgPre = true;
51  m_blWndMsgPost = true;
52 }
53 
54 // =================================================================
56 {
57 }
58 
60 // METHOD
61 
62 // =================================================================
63 bool SetCommandPre( LPCOMMANDHANDLER function, void* owner )
64 {
65  m_OnCommandPre = function;
66  m_pvCommandPre = owner;
67  return true;
68 }
69 
70 // =================================================================
71 bool GetCommandPre( LPCOMMANDHANDLER* function, void** owner ) const
72 {
73  if( function ) *function = m_OnCommandPre;
74  if( owner ) *owner = m_pvCommandPre;
75  return true;
76 }
77 
78 // =================================================================
79 bool SetCommandPost( LPCOMMANDHANDLER function, void* owner )
80 {
81  m_OnCommandPost = function;
82  m_pvCommandPost = owner;
83  return true;
84 }
85 
86 // =================================================================
87 bool GetCommandPost( LPCOMMANDHANDLER* function, void** owner ) const
88 {
89  if( function ) *function = m_OnCommandPost;
90  if( owner ) *owner = m_pvCommandPost;
91  return true;
92 }
93 
94 
95 // =================================================================
96 bool SetWndMsgPre( LPWNDMSGHANDLER function, void* owner )
97 {
98  m_OnWndMsgPre = function;
99  m_pvWndMsgPre = owner;
100  return true;
101 }
102 
103 // =================================================================
104 bool GetWndMsgPre( LPWNDMSGHANDLER* function, void** owner ) const
105 {
106  if( function ) *function = m_OnWndMsgPre;
107  if( owner ) *owner = m_pvWndMsgPre;
108  return true;
109 }
110 
111 
112 // =================================================================
113 bool SetWndMsgPost( LPWNDMSGHANDLER function, void* owner )
114 {
115  m_OnWndMsgPost = function;
116  m_pvWndMsgPost = owner;
117  return true;
118 }
119 
120 // =================================================================
121 bool GetWndMsgPost( LPWNDMSGHANDLER* function, void** owner ) const
122 {
123  if( function ) *function = m_OnWndMsgPost;
124  if( owner ) *owner = m_pvWndMsgPost;
125  return true;
126 }
127 
128 // =================================================================
129 bool AddDialog( TYPE* dlg, UINT filter=FVCL::DlgCtrlFilter::NONE )
130 {
131  if( dlg == NULL ) return false;
132 
133  for( UINT i=0 ; i<m_dialogs.size() ; i++ )
134  {
135  if( m_dialogs[i] == dlg )
136  return false;
137  }
138 
139  m_dialogs.push_back( dlg );
140  if( filter != FVCL::DlgCtrlFilter::NONE )
141  m_filters.push_back( filter );
142  else
143  m_filters.push_back( dlg->GetDlgCtrlFilter() );
144 
145  dlg->AddMessageMap( this );
146 
147  return true;
148 }
149 
150 // =================================================================
151 bool DelDialog( const TYPE* dlg )
152 {
153  if( dlg == NULL ) return false;
154 
155  for( UINT i=0 ; i<m_dialogs.size() ; i++ )
156  {
157  if( m_dialogs[i] == dlg )
158  {
159  m_dialogs[i]->DelMessageMap( this );
160 
163  iter1 += (INT)i;
164  iter2 += (INT)i;
165  m_dialogs.erase( iter1 );
166  m_filters.erase( iter2 );
167  return true;
168  }
169  }
170  return false;
171 }
172 
173 // =================================================================
174 UINT GetDialogCount( UINT fixedID=0, UINT filter=FVCL::DlgCtrlFilter::NONE ) const
175 {
176  if( fixedID == 0 && filter == FVCL::DlgCtrlFilter::NONE )
177  return m_dialogs.size();
178 
179  INT count = 0;
180  for( UINT i=0 ; i<m_dialogs.size() ; i++ )
181  {
182  TYPE* dlg = m_dialogs[i];
183  UINT flt = m_filters[i];
184 
185  if( fixedID != 0 && fixedID != dlg->GetDlgCtrlFixedID() )
186  continue;
187  if( filter != FVCL::DlgCtrlFilter::NONE && !(filter & flt) )
188  continue;
189 
190  count++;
191  }
192  return count;
193 }
194 
195 // =================================================================
196 TYPE* GetDialog( UINT index ) const
197 {
198  return m_dialogs[index];
199 }
200 
201 // =================================================================
202 TYPE* GetDialogByFixedID( UINT fixedID=0, UINT filter=FVCL::DlgCtrlFilter::NONE ) const
203 {
204  for( UINT i=0 ; i<m_dialogs.size() ; i++ )
205  {
206  TYPE* dlg = m_dialogs[i];
207  UINT flt = m_filters[i];
208 
209  if( fixedID != 0 && fixedID != dlg->GetDlgCtrlFixedID() )
210  continue;
211  if( filter != FVCL::DlgCtrlFilter::NONE && !(filter & flt) )
212  continue;
213 
214  return dlg;
215  }
216  return NULL;
217 }
218 
219 // =================================================================
220 bool SetDialogFilter( UINT index, UINT filter )
221 {
222  if( m_filters.size() <= index ) return false;
223  m_filters[index] = filter;
224  return true;
225 }
226 
227 // =================================================================
228 UINT GetDialogFilter( UINT index ) const
229 {
230  return m_filters[index];
231 }
232 
233 // =================================================================
234 UINT UpdateDialog( bool bReDraw=true, UINT fixedID=0, UINT filter=FVCL::DlgCtrlFilter::NONE )
235 {
236  INT count = 0;
237  for( UINT i=0 ; i<m_dialogs.size() ; i++ )
238  {
239  TYPE* dlg = m_dialogs[i];
240  UINT flt = m_filters[i];
241 
242  if( fixedID != 0 && fixedID != dlg->GetDlgCtrlFixedID() )
243  continue;
244  if( filter != FVCL::DlgCtrlFilter::NONE && !(filter & flt) )
245  continue;
246 
247  if( dlg->Update( bReDraw ) )
248  count++;
249  }
250  return count;
251 }
252 
254 // EVENT HANDLER
255 
256 // =================================================================
257 static void ICommandPre( void* pvParam, TYPE* dlg, WPARAM wParam, LPARAM lParam )
258 {
259  CEvMessageMap* pThis = static_cast<CEvMessageMap*>(pvParam);
260  if( !pThis->m_blCommandPre ) return;
261 
262  LPCOMMANDHANDLER function = pThis->m_OnCommandPre;
263  void* owner = pThis->m_pvCommandPre;
264 
265  if( function )
266  function( owner, dlg, wParam, lParam );
267  else
268  pThis->OnCommandPre( dlg, wParam, lParam );
269 }
270 
271 // =================================================================
272 static void ICommandPost( void* pvParam, TYPE* dlg, WPARAM wParam, LPARAM lParam )
273 {
274  CEvMessageMap* pThis = static_cast<CEvMessageMap*>(pvParam);
275  if( !pThis->m_blCommandPost ) return;
276 
277  LPCOMMANDHANDLER function = pThis->m_OnCommandPost;
278  void* owner = pThis->m_pvCommandPost;
279 
280  if( function )
281  function( owner, dlg, wParam, lParam );
282  else
283  pThis->OnCommandPost( dlg, wParam, lParam );
284 }
285 
286 // =================================================================
287 static void IWndMsgPre( void* pvParam, TYPE* dlg, UINT message, WPARAM wParam, LPARAM lParam )
288 {
289  CEvMessageMap* pThis = static_cast<CEvMessageMap*>(pvParam);
290  if( !pThis->m_blWndMsgPre ) return;
291 
292  LPWNDMSGHANDLER function = pThis->m_OnWndMsgPre;
293  void* owner = pThis->m_pvWndMsgPre;
294 
295  if( function )
296  function( owner, dlg, message, wParam, lParam );
297  else
298  pThis->OnWndMsgPre( dlg, message, wParam, lParam );
299 }
300 
301 // =================================================================
302 static void IWndMsgPost( void* pvParam, TYPE* dlg, UINT message, WPARAM wParam, LPARAM lParam )
303 {
304  CEvMessageMap* pThis = static_cast<CEvMessageMap*>(pvParam);
305  if( !pThis->m_blWndMsgPost ) return;
306 
307  LPWNDMSGHANDLER function = pThis->m_OnWndMsgPost;
308  void* owner = pThis->m_pvWndMsgPost;
309 
310  if( function )
311  function( owner, dlg, message, wParam, lParam );
312  else
313  pThis->OnWndMsgPost( dlg, message, wParam, lParam );
314 }
315 
316 protected:
318 // PROTECTED FUNCTION
319 
320 // =================================================================
321 virtual void OnCommandPre( TYPE* dlg, WPARAM wParam, LPARAM lParam )
322 {
323 }
324 
325 // =================================================================
326 virtual void OnCommandPost( TYPE* dlg, WPARAM wParam, LPARAM lParam )
327 {
328 }
329 
330 // =================================================================
331 virtual void OnWndMsgPre( TYPE* dlg, UINT message, WPARAM wParam, LPARAM lParam )
332 {
333 }
334 
335 // =================================================================
336 virtual void OnWndMsgPost( TYPE* dlg, UINT message, WPARAM wParam, LPARAM lParam )
337 {
338 }
339 
340 public:
341  // OBJECT
346 
347 protected:
348  // OBJECT
351 
356 
361 };
362 
363 #pragma pack(pop)
364 
365 #endif // _EVMESSAGEMAP_H_INCLUDED_
virtual bool push_back(const_reference _Val)
配列への要素の追加
Definition: FvMultiData.h:196
void * m_pvWndMsgPost
(処理後)ウィンドウメッセージ処理関数へ渡すオブジェクトへのポインタ
Definition: EvMessageMap.h:360
static void ICommandPost(void *pvParam, TYPE *dlg, WPARAM wParam, LPARAM lParam)
(処理後)コマンドメッセージ受信インターフェース
Definition: EvMessageMap.h:272
virtual void OnCommandPre(TYPE *dlg, WPARAM wParam, LPARAM lParam)
(処理前)コマンドメッセージ処理関数
Definition: EvMessageMap.h:321
void * m_pvWndMsgPre
(処理前)ウィンドウメッセージ処理関数へ渡すオブジェクトへのポインタ.
Definition: EvMessageMap.h:359
virtual void OnWndMsgPre(TYPE *dlg, UINT message, WPARAM wParam, LPARAM lParam)
(処理前)ウィンドウメッセージ処理関数
Definition: EvMessageMap.h:331
FVCL::CFvList< TYPE * > m_dialogs
メッセージ監視対象のダイアログのコレクション
Definition: EvMessageMap.h:349
bool m_blWndMsgPre
(処理前)ウィンドウメッセージ処理関数の呼び出し指示
Definition: EvMessageMap.h:344
bool GetWndMsgPre(LPWNDMSGHANDLER *function, void **owner) const
(処理前)ウィンドウメッセージ処理関数の取得
Definition: EvMessageMap.h:104
virtual void OnCommandPost(TYPE *dlg, WPARAM wParam, LPARAM lParam)
(処理後)コマンドメッセージ処理関数
Definition: EvMessageMap.h:326
bool SetCommandPost(LPCOMMANDHANDLER function, void *owner)
(処理後)コマンドメッセージ処理関数の設定
Definition: EvMessageMap.h:79
配列テンプレートクラス(単方向リスト)
FVCLの基底クラス
Definition: FvObject.h:23
bool AddDialog(TYPE *dlg, UINT filter=FVCL::DlgCtrlFilter::NONE)
ダイアログの追加登録
Definition: EvMessageMap.h:129
int INT
整数型(32ビット)
Definition: FvDefs.h:36
配列走査テンプレートクラス
Definition: FvIterator.h:38
bool m_blWndMsgPost
(処理後)ウィンドウメッセージ処理関数の呼び出し指示
Definition: EvMessageMap.h:345
bool GetCommandPre(LPCOMMANDHANDLER *function, void **owner) const
(処理前)コマンドメッセージ処理関数の取得
Definition: EvMessageMap.h:71
UINT GetDialogCount(UINT fixedID=0, UINT filter=FVCL::DlgCtrlFilter::NONE) const
ダイアログの個数取得
Definition: EvMessageMap.h:174
TYPE * GetDialog(UINT index) const
ダイアログの取得
Definition: EvMessageMap.h:196
~CEvMessageMap()
デストラクタ
Definition: EvMessageMap.h:55
TYPE * GetDialogByFixedID(UINT fixedID=0, UINT filter=FVCL::DlgCtrlFilter::NONE) const
ダイアログの取得
Definition: EvMessageMap.h:202
bool GetCommandPost(LPCOMMANDHANDLER *function, void **owner) const
(処理後)コマンドメッセージ処理関数の取得
Definition: EvMessageMap.h:87
LPWNDMSGHANDLER m_OnWndMsgPost
(処理後)ウィンドウメッセージ処理関数へのポインタ
Definition: EvMessageMap.h:355
UINT GetDialogFilter(UINT index) const
ダイアログ用途フィルタの取得
Definition: EvMessageMap.h:228
static void ICommandPre(void *pvParam, TYPE *dlg, WPARAM wParam, LPARAM lParam)
(処理前)コマンドメッセージ受信インターフェース
Definition: EvMessageMap.h:257
UINT UpdateDialog(bool bReDraw=true, UINT fixedID=0, UINT filter=FVCL::DlgCtrlFilter::NONE)
ダイアログの更新
Definition: EvMessageMap.h:234
virtual void OnWndMsgPost(TYPE *dlg, UINT message, WPARAM wParam, LPARAM lParam)
(処理後)ウィンドウメッセージ処理関数
Definition: EvMessageMap.h:336
bool m_blCommandPre
(処理前)コマンドメッセージ処理関数の呼び出し指示
Definition: EvMessageMap.h:342
virtual iterator begin()
配列の先頭位置の取得
Definition: FvMultiData.h:112
void(* LPCOMMANDHANDLER)(void *, TYPE *, WPARAM, LPARAM)
コマンドメッセージ処理関数型
Definition: EvMessageMap.h:28
void * m_pvCommandPost
(処理後)コマンドメッセージ処理関数へ渡すオブジェクトへのポインタ
Definition: EvMessageMap.h:358
virtual iterator erase(iterator _First, iterator _Last)
要素の削除
Definition: FvMultiData.h:154
LPCOMMANDHANDLER m_OnCommandPre
(処理前)コマンドメッセージ処理関数へのポインタ
Definition: EvMessageMap.h:352
unsigned int UINT
整数型(32ビット)[符号なし]
Definition: FvDefs.h:37
static void IWndMsgPre(void *pvParam, TYPE *dlg, UINT message, WPARAM wParam, LPARAM lParam)
(処理前)ウィンドウメッセージ受信インターフェース
Definition: EvMessageMap.h:287
LPCOMMANDHANDLER m_OnCommandPost
(処理後)コマンドメッセージ処理関数へのポインタ
Definition: EvMessageMap.h:353
bool SetWndMsgPost(LPWNDMSGHANDLER function, void *owner)
(処理後)ウィンドウメッセージ処理関数の設定
Definition: EvMessageMap.h:113
bool m_blCommandPost
(処理後)コマンドメッセージ処理関数の呼び出し指示
Definition: EvMessageMap.h:343
CEvMessageMap()
コンストラクタ
Definition: EvMessageMap.h:36
CFvObject クラスのインターフェース
bool DelDialog(const TYPE *dlg)
ダイアログの登録解除
Definition: EvMessageMap.h:151
bool SetDialogFilter(UINT index, UINT filter)
ダイアログ用途フィルタの設定
Definition: EvMessageMap.h:220
LPWNDMSGHANDLER m_OnWndMsgPre
(処理前)ウィンドウメッセージ処理関数へのポインタ
Definition: EvMessageMap.h:354
bool SetWndMsgPre(LPWNDMSGHANDLER function, void *owner)
(処理前)ウィンドウメッセージ処理関数の設定
Definition: EvMessageMap.h:96
const UINT NONE
なし
Definition: EVCbasicDeclare.h:52
void(* LPWNDMSGHANDLER)(void *, TYPE *, UINT, WPARAM, LPARAM)
ウィンドウメッセージ処理関数型
Definition: EvMessageMap.h:29
bool GetWndMsgPost(LPWNDMSGHANDLER *function, void **owner) const
(処理後)ウィンドウメッセージ処理関数の取得
Definition: EvMessageMap.h:121
virtual size_type size() const
配列の要素数の取得
Definition: FvMultiData.h:226
bool SetCommandPre(LPCOMMANDHANDLER function, void *owner)
(処理前)コマンドメッセージ処理関数の設定
Definition: EvMessageMap.h:63
メッセージマップクラス
Definition: EvMessageMap.h:24
FVCL::CFvList< UINT > m_filters
処理用途フィルタのコレクション
Definition: EvMessageMap.h:350
static void IWndMsgPost(void *pvParam, TYPE *dlg, UINT message, WPARAM wParam, LPARAM lParam)
(処理後)ウィンドウメッセージ受信インターフェース
Definition: EvMessageMap.h:302
void * m_pvCommandPre
(処理前)コマンドメッセージ処理関数へ渡すオブジェクトへのポインタ
Definition: EvMessageMap.h:357

Documentation copyright © 2007 FAST Corporation. [B-001864]
Generated on 2023年11月02日(木) 10時12分53秒 for WIL説明書(C++) by doxygen 1.8.11