BOOL CALLBACK SetupDlgFunc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: return InitDialog(hWnd); case WM_NOTIFY: OnNotify(hWnd, wParam, lParam); break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: OnSetupOK(hWnd); EndDialog(hWnd, IDOK); break; case IDCANCEL: EndDialog(hWnd, IDCANCEL); break; case IDC_PROPERTY: // プロパティ OnProperty(hWnd); break; } } return false; }
BOOL CAggrDiskUIHandler::OnCommand(CDiskObjectPtr obj, UINT nCommandID) const { ATLASSERT( dynamic_cast<CAggrDiskObject*>(obj.get()) != NULL ); switch( nCommandID ) { case IDM_TOOL_PROPERTY: return OnProperty( obj ); } return FALSE; }
BOOL CUnsupportedDiskUIHandler::OnCommand(CDiskObjectPtr obj, UINT nCommandID) const { switch( nCommandID ) { case IDM_TOOL_CLEARDIB: return OnClearDIB( obj ); case IDM_TOOL_PROPERTY: return OnProperty( obj ); } return FALSE; }
BOOL CMirDiskUIHandler::OnCommand(CDiskObjectPtr obj, UINT nCommandID) const { ATLASSERT( dynamic_cast<CMirDiskObject*>(obj.get()) != NULL ); switch ( nCommandID ) { case IDM_TOOL_SYNCHRONIZE: return OnSynchronize( obj ); case IDM_TOOL_PROPERTY: return OnProperty( obj ); case IDM_TOOL_MIGRATE: return OnMigrate( obj ); } return FALSE; }
BOOL CUnitDiskUIHandler::OnCommand(CDiskObjectPtr obj, UINT nCommandID) const { ATLASSERT( dynamic_cast<CUnitDiskObject*>(obj.get()) != NULL); switch( nCommandID ) { case IDM_TOOL_SYNCHRONIZE: { // Delegate command to parent const CObjectUIHandler *phandler = CObjectUIHandler::GetUIHandler( obj->GetParent() ); return phandler->OnCommand( obj->GetParent(), nCommandID ); } case IDM_TOOL_PROPERTY: return OnProperty( obj ); } return FALSE; }
BOOL OnNotifyListView(HWND hWnd, WPARAM wParam, LPARAM lParam) { HWND hWndLV = GetDlgItem(hWnd, IDC_LIST_MAILBOX); LV_DISPINFO *lvinfo = (LV_DISPINFO *)lParam; LPNMLISTVIEW pnmlist = (LPNMLISTVIEW)lParam; // 選択されているインデックスを取得 int iItem = ListView_GetNextItem(hWndLV, -1, LVNI_ALL | LVNI_SELECTED); // チェックボックスの状態を取得 int lvChecked = ListView_GetCheckState(hWndLV, iItem); // アイテムの状態を取得 int state = pnmlist->uNewState; switch (lvinfo->hdr.code) { case LVN_ITEMCHANGED: // プロパティボタンの有効/無効を切り替える EnableWindow(GetDlgItem(hWnd, IDC_PROPERTY), lvChecked); if (pnmlist->iItem == iItem) { // 選択されているアイテムのチェックボックス if (state != (pnmlist->uOldState & LVIS_STATEIMAGEMASK)) { if (state == INDEXTOSTATEIMAGEMASK(2)) { // チェックされた EnableWindow(GetDlgItem(hWnd, IDC_PROPERTY), true); } else if (state == INDEXTOSTATEIMAGEMASK(1)) { // チェックが外された EnableWindow(GetDlgItem(hWnd, IDC_PROPERTY), false); } } } break; case NM_DBLCLK: if (lvChecked) { // チェックされていたらプロパティ画面の呼び出し OnProperty(hWnd); } break; } return true; }