/* Copyright (c) 2018 Alex Diener This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Alex Diener alex@ludobloom.com */ #ifndef __UIRadioGroup_H__ #define __UIRadioGroup_H__ #ifdef __cplusplus extern "C" { #endif typedef struct UIRadioGroup UIRadioGroup; #define UIRadioGroup_superclass StemObject #include "stemobject/StemObject.h" #include "uitoolkit/UIRadioButton.h" #define UIRadioGroup_ivars \ StemObject_ivars \ \ UIRadioButton * checkedRadioButton; \ unsigned int referenceCount; #define UIRadioGroup_vtable(self_type) \ StemObject_vtable(self_type) stemobject_declare(UIRadioGroup) // UIRadioGroup is initialized with a reference count of 0. Each radio button added to it increments reference count by 1. // Each radio button disposed while in a group decrements reference count by 1. When reference count is decremented to 0, // the group is disposed. If the UIRadioGroup itself needs to continue existing beyond the lifetime of the radio buttons // added to it for some reason, call UIRadioGroup_incrementReferenceCount() after creation, and either // UIRadioGroup_decrementReferenceCount() or UIRadioGroup_dispose() to free it. In the most common use case, you can // create a UIRadioGroup, pass it to UIRadioButtons as they're created, and immediately forget about it. UIRadioGroup * UIRadioGroup_create(void); bool UIRadioGroup_init(UIRadioGroup * self); void UIRadioGroup_dispose(UIRadioGroup * self); void UIRadioGroup_incrementReferenceCount(UIRadioGroup * self); void UIRadioGroup_decrementReferenceCount(UIRadioGroup * self); void UIRadioGroup_setCheckedButton(UIRadioGroup * self, UIRadioButton * radioButton); #ifdef __cplusplus } #endif #endif