|
// *********************************************************
// WM_NOTIFYメッセージ用ポスト関数
// 戻り値 : 無し
// *********************************************************
void LboxListviewNotifyPost(
UINT message, HWND hTarget, HWND hLview, int nRow, int nCol )
{
switch( message ) {
case NM_RCLICK:
PostMessage(
hTarget,
LBOX_LV_RCLICK,
(WPARAM)hLview,
(LPARAM)(MAKELPARAM(nRow,nCol))
);
break;
case NM_DBLCLK:
PostMessage(
hTarget,
LBOX_LV_DBLCLK,
(WPARAM)hLview,
(LPARAM)(MAKELPARAM(nRow,nCol))
);
break;
case NM_RDBLCLK:
PostMessage(
hTarget,
LBOX_LV_RDBLCLK,
(WPARAM)hLview,
(LPARAM)(MAKELPARAM(nRow,nCol))
);
break;
case NM_CLICK:
PostMessage(
hTarget,
LBOX_LV_CLICK,
(WPARAM)hLview,
(LPARAM)(MAKELPARAM(nRow,nCol))
);
break;
case NM_RETURN:
PostMessage(
hTarget,
LBOX_LV_RETURN,
(WPARAM)hLview,
(LPARAM)(MAKELPARAM(nRow,nCol))
);
break;
case NM_SETFOCUS:
PostMessage(
hTarget,
LBOX_LV_SETFOCUS,
(WPARAM)hLview,
0
);
break;
case NM_KILLFOCUS:
PostMessage(
hTarget,
LBOX_LV_KILLFOCUS,
(WPARAM)hLview,
0
);
break;
}
}
// *********************************************************
// WM_NOTIFYメッセージを取得してユーザメッセージを送る
// 戻り値 : メッセージ( 0 の時は対象外 )
// *********************************************************
UINT LboxListview::Notify( HWND hTarget, LPARAM lParam )
{
HWND hLv;
LPNMLISTVIEW lpNmlv;
int nRow;
lpNmlv = (LPNMLISTVIEW)lParam;
hLv = lpNmlv->hdr.hwndFrom;
// メッセ−ジがこのオブジェクトである場合
if ( hLv == this->hWnd ) {
LboxListview::Action = lpNmlv->hdr.code;
LboxListview::hCurrent = lpNmlv->hdr.hwndFrom;
LboxListview::nCurrentId = lpNmlv->hdr.idFrom;
if ( LboxListview::Action == NM_RCLICK ) {
LboxListview::nCurrentCol = lpNmlv->iSubItem;
LboxListview::nCurrentRow = lpNmlv->iItem;
LboxListviewNotifyPost(
LboxListview::Action,
hTarget,
hLv,
LboxListview::nCurrentRow,
LboxListview::nCurrentCol
);
if ( LboxListview::hMenu != NULL ) {
HMENU hPopup;
hPopup = GetSubMenu(
LboxListview::hMenu,
LboxListview::nCurrentPopup
);
LboxWintool::ClientToScreen(
&lpNmlv->ptAction
);
TrackPopupMenu(
hPopup,
TPM_LEFTALIGN | TPM_TOPALIGN,
lpNmlv->ptAction.x,
lpNmlv->ptAction.y,
0,
hTarget,
NULL
);
}
return lpNmlv->hdr.code;
}
switch( LboxListview::Action ) {
case NM_DBLCLK:
case NM_RDBLCLK:
case NM_CLICK:
LboxListview::nCurrentCol = lpNmlv->iSubItem;
LboxListview::nCurrentRow = lpNmlv->iItem;
break;
case NM_RETURN:
LboxListview::nCurrentCol = 0;
nRow = -1;
LboxListview::FindNextSelectedRow( &nRow );
break;
}
LboxListviewNotifyPost(
LboxListview::Action,
hTarget,
hLv,
LboxListview::nCurrentRow,
LboxListview::nCurrentCol
);
return lpNmlv->hdr.code;
}
return 0;
}
| |