/// <summary> /// Update menu item status /// </summary> /// <param name="id">Identifier of menu item</param> /// <param name="checked">Check status of menu item</param> /// <returns>Indicates success or failure<returns> bool KinectWindow::ProcessMenuItem(UINT id, bool& checked) { if (ID_FORCE_OFF_IR == id) { return true; } // Menu item command HMENU hMenu = GetMenu(m_hWnd); if (hMenu) { if (!GetMenuItemCheckStatus(hMenu, id, checked)) { // Failed to get menu item check status return false; } switch(id) { // For "Pause" menu items, invert check status and enable or disable associated stream setting menus case ID_COLORSTREAM_PAUSE: if (EnablePopupMenuItem(hMenu, ColorStreamMenuPosition, ColorResolutionMenuPosition, checked)) { return InvertCheckMenuItem(hMenu, id, checked); } break; case ID_DEPTHSTREAM_PAUSE: if (EnablePopupMenuItem(hMenu, DepthStreamMenuPosition, DepthRangeModeMenuPosition, checked) && EnablePopupMenuItem(hMenu, DepthStreamMenuPosition, DepthResolutionMenuPosition, checked) && EnablePopupMenuItem(hMenu, DepthStreamMenuPosition, DepthTreatmentMenuPosition, checked)) { return InvertCheckMenuItem(hMenu, id, checked); } break; case ID_SKELETONSTREAM_PAUSE: if (EnablePopupMenuItem(hMenu, SkeletonStreamMenuPosition, SkeletonTrackingModeMenuPosition, checked) && EnablePopupMenuItem(hMenu, SkeletonStreamMenuPosition, SkeletonChooserModeMenuPosition, checked)) { return InvertCheckMenuItem(hMenu, id, checked); } break; case ID_VIEWS_SWITCH: case ID_CAMERA_COLORSETTINGS: case ID_CAMERA_EXPOSURESETTINGS: // These item don't need to modify their check status return true; // For rest of the menu items (radio menu items) default: { // Process radio button check status if (checked) { // Selection doesn't change break; } if (CheckRadioItem(id, ID_SKELETONSTREAM_CHOOSERMODE_START, ID_SKELETONSTREAM_CHOOSERMODE_END, hMenu)) { // Skeleton stream chooser mode return true; } else if (CheckRadioItem(id, ID_SKELETONSTREAM_TRACKINGMODE_START, ID_SKELETONSTREAM_TRACKINGMODE_END, hMenu)) { // Skeleton stream tracking mode return true; } else if (CheckRadioItem(id, ID_DEPTHSTREAM_DEPTHTREATMENT_START, ID_DEPTHSTREAM_DEPTHTREATMENT_END, hMenu)) { // Depth stream depth treatment return true; } else if (CheckRadioItem(id, ID_DEPTHSTREAM_RESOLUTION_START, ID_DEPTHSTREAM_RESOLUTION_END, hMenu)) { // Depth stream image resolution return true; } else if (CheckRadioItem(id, ID_DEPTHSTREAM_RANGEMODE_START, ID_DEPTHSTREAM_RANGEMODE_END, hMenu)) { // Depth stream range mode return true; } else if (CheckRadioItem(id, ID_COLORSTREAM_RESOLUTION_START, ID_COLORSTREAM_RESOLUTION_END, hMenu)) { // Color stream image resolution return true; } } } } return false; }
/// <summary> /// Update menu item status /// </summary> /// <param name="id">Identifier of menu item</param> /// <param name="checked">Check status of menu item</param> /// <returns>Indicates success or failure<returns> bool KinectWindow::ProcessMenuItem(UINT id, bool& checked) { if (ID_FORCE_OFF_IR == id) { return true; } // Menu item command HMENU hMenu = GetMenu(m_hWnd); if (hMenu) { if (!GetMenuItemCheckStatus(hMenu, id, checked)) { // Failed to get menu item check status return false; } switch(id) { // For "Pause" menu items, invert check status and enable or disable associated stream setting menus case ID_COLORSTREAM_PAUSE: if (EnablePopupMenuItem(hMenu, ColorStreamMenuPosition, ColorResolutionMenuPosition, checked)) { return InvertCheckMenuItem(hMenu, id, checked); } break; case ID_DEPTHSTREAM_PAUSE: if (EnablePopupMenuItem(hMenu, DepthStreamMenuPosition, DepthRangeModeMenuPosition, checked) && EnablePopupMenuItem(hMenu, DepthStreamMenuPosition, DepthResolutionMenuPosition, checked) && EnablePopupMenuItem(hMenu, DepthStreamMenuPosition, DepthTreatmentMenuPosition, checked)) { return InvertCheckMenuItem(hMenu, id, checked); } break; case ID_SKELETONSTREAM_PAUSE: if (EnablePopupMenuItem(hMenu, SkeletonStreamMenuPosition, SkeletonTrackingModeMenuPosition, checked) && EnablePopupMenuItem(hMenu, SkeletonStreamMenuPosition, SkeletonChooserModeMenuPosition, checked)) { return InvertCheckMenuItem(hMenu, id, checked); } break; /////Recording check marker case ID_RECORDING_AUDIO: if (EnablePopupMenuItem(hMenu, RecordingMenuPosition, RecordingAllMenuPosition, checked)) { return InvertCheckMenuItem(hMenu, id, checked); } break; case ID_RECORDING_RGB: if (EnablePopupMenuItem(hMenu, RecordingMenuPosition, RecordingAllMenuPosition, checked)) { return InvertCheckMenuItem(hMenu, id, checked); } break; case ID_RECORDING_DEPTH: if (EnablePopupMenuItem(hMenu, RecordingMenuPosition, RecordingAllMenuPosition, checked)) { return InvertCheckMenuItem(hMenu, id, checked); } break; case ID_RECORDING_ALL: if (EnablePopupMenuItem(hMenu, RecordingMenuPosition, RecordingAudioMenuPosition, checked) && EnablePopupMenuItem(hMenu, RecordingMenuPosition, RecordingRGBMenuPosition, checked) && EnablePopupMenuItem(hMenu, RecordingMenuPosition, RecordingDepthMenuPosition, checked)) { return InvertCheckMenuItem(hMenu, id, checked); } break; case ID_RECORDING_3DFACIALMODEL: return InvertCheckMenuItem(hMenu, id, checked); break; case ID_SPEECHRECOGNITION: return InvertCheckMenuItem(hMenu, id, checked); break; case ID_FALLDETECTION: return InvertCheckMenuItem(hMenu, id, checked); break; case ID_MOVEMENTDETECTION: return InvertCheckMenuItem(hMenu, id, checked); break; case ID_OUTOFBEDDETECTION: return InvertCheckMenuItem(hMenu, id, checked); break; case ID_LYANGLEDETECTION: return InvertCheckMenuItem(hMenu, id, checked); break; case ID_CALLNURSINGBYHANDRAISING: return InvertCheckMenuItem(hMenu, id, checked); break; case ID_VIEWDETECTIONRECS: return InvertCheckMenuItem(hMenu, id, checked); break; //Exercises case ID_STANDMOVELEGOUTWARD: if (EnablePopupMenuItem(hMenu, ExercisesMenuPosition, StandHandsOnWallMenuPosition, checked) && EnablePopupMenuItem(hMenu, ExercisesMenuPosition, StandHeelOnTableMenuPosition, checked) && EnablePopupMenuItem(hMenu, ExercisesMenuPosition, StandArmsLiftWeightsMenuPosition, checked) && EnablePopupMenuItem(hMenu, ExercisesMenuPosition, StandRaisingheelsMenuPosition, checked) && EnablePopupMenuItem(hMenu, ExercisesMenuPosition, SitBentLegTo90DegreesMenuPosition, checked) && EnablePopupMenuItem(hMenu, ExercisesMenuPosition, SitToStandMenuPosition, checked)) return InvertCheckMenuItem(hMenu, id, checked); break; case ID_STANDARMSLIFTWEIGHTS: if (EnablePopupMenuItem(hMenu, ExercisesMenuPosition, StandMoveLegOutWardsMenuPosition, checked) && EnablePopupMenuItem(hMenu, ExercisesMenuPosition, StandHandsOnWallMenuPosition, checked) && EnablePopupMenuItem(hMenu, ExercisesMenuPosition, StandHeelOnTableMenuPosition, checked) && EnablePopupMenuItem(hMenu, ExercisesMenuPosition, StandRaisingheelsMenuPosition, checked) && EnablePopupMenuItem(hMenu, ExercisesMenuPosition, SitBentLegTo90DegreesMenuPosition, checked) && EnablePopupMenuItem(hMenu, ExercisesMenuPosition, SitToStandMenuPosition, checked)) return InvertCheckMenuItem(hMenu, id, checked); break; case ID_VIEWS_SWITCH: case ID_CAMERA_COLORSETTINGS: case ID_CAMERA_EXPOSURESETTINGS: // These item don't need to modify their check status return true; // For rest of the menu items (radio menu items) default: { // Process radio button check status if (checked) { // Selection doesn't change break; } if (CheckRadioItem(id, ID_SKELETONSTREAM_CHOOSERMODE_START, ID_SKELETONSTREAM_CHOOSERMODE_END, hMenu)) { // Skeleton stream chooser mode return true; } else if (CheckRadioItem(id, ID_SKELETONSTREAM_TRACKINGMODE_START, ID_SKELETONSTREAM_TRACKINGMODE_END, hMenu)) { // Skeleton stream tracking mode return true; } else if (CheckRadioItem(id, ID_DEPTHSTREAM_DEPTHTREATMENT_START, ID_DEPTHSTREAM_DEPTHTREATMENT_END, hMenu)) { // Depth stream depth treatment return true; } else if (CheckRadioItem(id, ID_DEPTHSTREAM_RESOLUTION_START, ID_DEPTHSTREAM_RESOLUTION_END, hMenu)) { // Depth stream image resolution return true; } else if (CheckRadioItem(id, ID_DEPTHSTREAM_RANGEMODE_START, ID_DEPTHSTREAM_RANGEMODE_END, hMenu)) { // Depth stream range mode return true; } else if (CheckRadioItem(id, ID_COLORSTREAM_RESOLUTION_START, ID_COLORSTREAM_RESOLUTION_END, hMenu)) { // Color stream image resolution return true; } } } } return false; }