LCOV - code coverage report
Current view: top level - source/gui/ObjectTypes - CRadioButton.cpp (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 0 15 0.0 %
Date: 2023-01-19 00:18:29 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /* Copyright (C) 2021 Wildfire Games.
       2             :  * This file is part of 0 A.D.
       3             :  *
       4             :  * 0 A.D. is free software: you can redistribute it and/or modify
       5             :  * it under the terms of the GNU General Public License as published by
       6             :  * the Free Software Foundation, either version 2 of the License, or
       7             :  * (at your option) any later version.
       8             :  *
       9             :  * 0 A.D. is distributed in the hope that it will be useful,
      10             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12             :  * GNU General Public License for more details.
      13             :  *
      14             :  * You should have received a copy of the GNU General Public License
      15             :  * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
      16             :  */
      17             : 
      18             : #include "precompiled.h"
      19             : 
      20             : #include "CRadioButton.h"
      21             : 
      22           0 : CRadioButton::CRadioButton(CGUI& pGUI)
      23           0 :     : CCheckBox(pGUI)
      24             : {
      25           0 : }
      26             : 
      27           0 : void CRadioButton::HandleMessage(SGUIMessage& Message)
      28             : {
      29           0 :     IGUIButtonBehavior::HandleMessage(Message);
      30           0 :     switch (Message.type)
      31             :     {
      32           0 :     case GUIM_PRESSED:
      33           0 :         for (IGUIObject* const& obj : GetParent()->GetChildren())
      34             :         {
      35             :             // Notice, if you use other objects within the parent object that has got
      36             :             //  the setting "checked", it too will change. Hence NO OTHER OBJECTS THAN
      37             :             //  RADIO BUTTONS SHOULD BE WITHIN IT!
      38             :             // TODO: this should be enforced in the engine, and then we could cast IGUIObject* to CRadioButton*.
      39           0 :             obj->SetSettingFromString("checked", L"false", true);
      40           0 :         }
      41             : 
      42           0 :         m_Checked.Set(true, true);
      43           0 :         break;
      44             : 
      45           0 :     default:
      46           0 :         break;
      47             :     }
      48           0 : }

Generated by: LCOV version 1.13