//***************************************************************************** // // Handles press notifications for the push button widgets. // //***************************************************************************** void OnButtonPress(tWidget *psWidget) { uint32_t ui32Idx; // // Find the index of this push button. // for(ui32Idx = 0; ui32Idx < NUM_PUSH_BUTTONS; ui32Idx++) { if(psWidget == (tWidget *)(g_psPushButtons + ui32Idx)) { break; } } // // Return if the push button could not be found. // if(ui32Idx == NUM_PUSH_BUTTONS) { return; } // // Toggle the state of this push button indicator. // g_ui32ButtonState ^= 1 << ui32Idx; // // Set the matching indicator based on the selected state of the check box. // CanvasImageSet(g_psPushButtonIndicators + ui32Idx, (g_ui32ButtonState & (1 << ui32Idx)) ? g_pui8LightOn : g_pui8LightOff); WidgetPaint((tWidget *)(g_psPushButtonIndicators + ui32Idx)); }
//***************************************************************************** // // Handles change notifications for the check box widgets. // //***************************************************************************** void OnCheckChange(tWidget *psWidget, uint32_t bSelected) { uint32_t ui32Idx; // // Find the index of this check box. // for(ui32Idx = 0; ui32Idx < NUM_CHECK_BOXES; ui32Idx++) { if(psWidget == (tWidget *)(g_psCheckBoxes + ui32Idx)) { break; } } // // Return if the check box could not be found. // if(ui32Idx == NUM_CHECK_BOXES) { return; } // // Set the matching indicator based on the selected state of the check box. // CanvasImageSet(g_psCheckBoxIndicators + ui32Idx, bSelected ? g_pui8LightOn : g_pui8LightOff); WidgetPaint((tWidget *)(g_psCheckBoxIndicators + ui32Idx)); }
//***************************************************************************** // // Handles change notifications for the radio button widgets. // //***************************************************************************** void OnRadioChange(tWidget *pWidget, unsigned long bSelected) { unsigned long ulIdx; // // Find the index of this radio button in the first group. // for(ulIdx = 0; ulIdx < NUM_RADIO1_BUTTONS; ulIdx++) { if(pWidget == (tWidget *)(g_psRadioButtons1 + ulIdx)) { break; } } // // See if the radio button was found. // if(ulIdx == NUM_RADIO1_BUTTONS) { // // Find the index of this radio button in the second group. // for(ulIdx = 0; ulIdx < NUM_RADIO2_BUTTONS; ulIdx++) { if(pWidget == (tWidget *)(g_psRadioButtons2 + ulIdx)) { break; } } // // Return if the radio button could not be found. // if(ulIdx == NUM_RADIO2_BUTTONS) { return; } // // Sind the radio button is in the second group, offset the index to // the indicators associated with the second group. // ulIdx += NUM_RADIO1_BUTTONS; } // // Set the matching indicator based on the selected state of the radio // button. // CanvasImageSet(g_psRadioButtonIndicators + ulIdx, bSelected ? g_pucLightOn : g_pucLightOff); WidgetPaint((tWidget *)(g_psRadioButtonIndicators + ulIdx)); // // Play the key click sound. // SoundPlay(g_pusKeyClick, g_ulKeyClickLen); }
//***************************************************************************** // // Handles change notifications for the radio button widgets. // //***************************************************************************** void OnRadioChange(tWidget *psWidget, uint32_t bSelected) { uint32_t ui32Idx; // // Find the index of this radio button in the first group. // for(ui32Idx = 0; ui32Idx < NUM_RADIO1_BUTTONS; ui32Idx++) { if(psWidget == (tWidget *)(g_psRadioButtons1 + ui32Idx)) { break; } } // // See if the radio button was found. // if(ui32Idx == NUM_RADIO1_BUTTONS) { // // Find the index of this radio button in the second group. // for(ui32Idx = 0; ui32Idx < NUM_RADIO2_BUTTONS; ui32Idx++) { if(psWidget == (tWidget *)(g_psRadioButtons2 + ui32Idx)) { break; } } // // Return if the radio button could not be found. // if(ui32Idx == NUM_RADIO2_BUTTONS) { return; } // // Sind the radio button is in the second group, offset the index to // the indicators associated with the second group. // ui32Idx += NUM_RADIO1_BUTTONS; } // // Set the matching indicator based on the selected state of the radio // button. // CanvasImageSet(g_psRadioButtonIndicators + ui32Idx, bSelected ? g_pui8LightOn : g_pui8LightOff); WidgetPaint((tWidget *)(g_psRadioButtonIndicators + ui32Idx)); }
//***************************************************************************** // // Handles press notifications for the push button widgets. // //***************************************************************************** void OnButtonPress(tWidget *pWidget) { unsigned int ulIdx; // // Find the index of this push button. // for(ulIdx = 0; ulIdx < NUM_PUSH_BUTTONS; ulIdx++) { if(pWidget == (tWidget *)(g_psPushButtons + ulIdx)) { break; } } // // Return if the push button could not be found. // if(ulIdx == NUM_PUSH_BUTTONS) { return; } // // Toggle the state of this push button indicator. // g_ulButtonState ^= 1 << ulIdx; // // Set the matching indicator based on the selected state of the check box. // CanvasImageSet(g_psPushButtonIndicators + ulIdx, (g_ulButtonState & (1 << ulIdx)) ? g_ledON : g_ledOFF); WidgetPaint((tWidget *)(g_psPushButtonIndicators + ulIdx)); // // Play the key click sound. // //SoundPlay(g_pusKeyClick, sizeof(g_pusKeyClick) / 2); ClickPlay(); }
//***************************************************************************** // // Handles change notifications for the check box widgets. // //***************************************************************************** void OnCheckChange(tWidget *pWidget, unsigned int bSelected) { unsigned int ulIdx; // // Find the index of this check box. // for(ulIdx = 0; ulIdx < NUM_CHECK_BOXES; ulIdx++) { if(pWidget == (tWidget *)(g_psCheckBoxes + ulIdx)) { break; } } // // Return if the check box could not be found. // if(ulIdx == NUM_CHECK_BOXES) { return; } // // Set the matching indicator based on the selected state of the check box. // CanvasImageSet(g_psCheckBoxIndicators + ulIdx, bSelected ? g_ledON : g_ledOFF); WidgetPaint((tWidget *)(g_psCheckBoxIndicators + ulIdx)); // // Play the key click sound. // //SoundPlay(g_pusKeyClick, sizeof(g_pusKeyClick) / 2); ClickPlay(); }