Beispiel #1
0
void RadioButtonGroup::updateCheckedState(HTMLInputElement* button)
{
    ASSERT(button->isRadioButton());
    ASSERT(m_members.contains(button));
    bool wasValid = isValid();
    if (button->checked())
        setCheckedButton(button);
    else {
        if (m_checkedButton == button)
            setCheckedButton(nullptr);
    }
    if (wasValid != isValid())
        updateValidityForAllButtons();
}
void RadioButtonGroup::updateCheckedState(HTMLInputElement* button) {
  DCHECK_EQ(button->type(), InputTypeNames::radio);
  DCHECK(m_members.contains(button));
  bool wasValid = isValid();
  if (button->checked()) {
    setCheckedButton(button);
  } else {
    if (m_checkedButton == button)
      m_checkedButton = nullptr;
  }
  if (wasValid != isValid())
    setNeedsValidityCheckForAllButtons();
  for (auto& member : m_members) {
    HTMLInputElement* const inputElement = member.key;
    inputElement->pseudoStateChanged(CSSSelector::PseudoIndeterminate);
  }
}
void RadioButtonGroup::add(HTMLInputElement* button) {
  DCHECK_EQ(button->type(), InputTypeNames::radio);
  auto addResult = m_members.add(button, false);
  if (!addResult.isNewEntry)
    return;
  bool groupWasValid = isValid();
  updateRequiredButton(*addResult.storedValue, button->isRequired());
  if (button->checked())
    setCheckedButton(button);

  bool groupIsValid = isValid();
  if (groupWasValid != groupIsValid) {
    setNeedsValidityCheckForAllButtons();
  } else if (!groupIsValid) {
    // A radio button not in a group is always valid. We need to make it
    // invalid only if the group is invalid.
    button->setNeedsValidityCheck();
  }
}
Beispiel #4
0
void RadioButtonGroup::add(HTMLInputElement* button)
{
    ASSERT(button->isRadioButton());
    if (!m_members.add(button).isNewEntry)
        return;
    bool groupWasValid = isValid();
    if (button->isRequired())
        ++m_requiredCount;
    if (button->checked())
        setCheckedButton(button);

    bool groupIsValid = isValid();
    if (groupWasValid != groupIsValid)
        updateValidityForAllButtons();
    else if (!groupIsValid) {
        // A radio button not in a group is always valid. We need to make it
        // invalid only if the group is invalid.
        button->updateValidity();
    }
}
void JulyButtonMenu::aboutToHideWindow()
{
    emit setCheckedButton(false);
}
Beispiel #6
0
void WButtonGroup::setSelectedButtonIndex(int idx)
{
  setCheckedButton(idx != -1 ? buttons_[idx].button : 0);
}