bool Splitter::CheckMaxButton(ComponentEvent *theEvent) { if(theEvent->mType!=ComponentEvent_ButtonPressed) return false; if(theEvent->GetControlId()<ControlId_MaxLeft || theEvent->GetControlId()>ControlId_MaxBottomRight) return false; Button *aButton = dynamic_cast<Button*>(theEvent->mComponent); if(aButton==NULL) return false; if(!aButton->IsChecked()) { UnMaxQuadrant(); return true; } int aType = theEvent->GetControlId() - ControlId_MaxLeft + Position_Left; MaxQuadrant((QuadrantPosition)aType); return true; }
void Button::SetCheck(bool checked, bool sendEvent) { if(IsRadio()) { SetComponentFlags(ComponentFlag_WantFocus,checked); if(checked) { // Make sure all other radio buttons in the group are not checked. Button *aRadio = GetEndRadio(false); while(aRadio!=NULL) { if(aRadio!=this) { aRadio->SetComponentFlags(ComponentFlag_WantFocus,false); if(aRadio->IsChecked()) { aRadio->SetButtonFlags(ButtonFlag_Checked, false); aRadio->Invalidate(); } } aRadio = aRadio->GetNextRadio(true); } RequestFocus(); } } if(sendEvent) FireEvent(ComponentEvent_ButtonPressed); // button pressed event if(IsChecked()==checked) return; SetButtonFlags(ButtonFlag_Checked, checked); Invalidate(); }