code: public void toggleState()
      {
          if (m_iCurrentState == ON)
              m_iCurrentState = NULL;
          else if (m_iCurrentState == OFF)
              m_iCurrentState = ON;
          else
              m_iCurrentState = OFF;
          this.updateImage();
      }
docs: Toggle the button state.