They work exactly the same as current checkbox-decorated items, but in order to preserve compatibility, separate methods are used, like `add_radio_check_item()`. The other option would have been to add a new parameter at the end of `add_check_item()` and the like, but that would have forced callers to provide the defaults manually.
`is_item_checkable()`, `is_item_checked()` and `set_item_checked()` are used regardless the item is set to look as check box or radio button.
Keeping check in the name adds an additional clue about these facts.
Closes#13055.
(cherry picked from commit ab3b1d9f3e)
3.0
Pedro J. Estébanez2018-03-23 21:55:40 +07:00committed byHein-Pieter van Braam
Add a new checkable item with text "label". An id can optionally be provided, as well as an accelerator. If no id is provided, one will be created from the index. Note that checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually.
The same as [method add_check_item] but the inserted item will look as a radio button. Remember this is just cosmetic and you have to add the logic for checking/unchecking items in radio groups.
Return whether the item at index "idx" has a checkbox. Note that checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually.
Return whether the item at index "idx" is checkable in some way, i.e., whether has a checkbox or radio button. Note that checkable items just display a checkmark or radio button, but don't have any built-in checking behavior and must be checked/unchecked manually.
Return whether the item at index "idx" has radio-button-style checkability. Remember this is just cosmetic and you have to add the logic for checking/unchecking items in radio groups.
</description>
</method>
<methodname="is_item_checked"qualifiers="const">
@ -248,7 +282,7 @@
<argumentindex="0"name="idx"type="int">
</argument>
<description>
Return the checkstate status of the item at index "idx".
Return whether the item at index "idx" is checked.
</description>
</method>
<methodname="is_item_disabled"qualifiers="const">
@ -300,6 +334,18 @@
Set whether the item at index "idx" has a checkbox. Note that checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually.
</description>
</method>
<methodname="set_item_as_radio_checkable">
<returntype="void">
</return>
<argumentindex="0"name="idx"type="int">
</argument>
<argumentindex="1"name="enable"type="bool">
</argument>
<description>
The same as [method set_item_as_checkable] but placing a radio button in case of enabling. If used for disabling, it's the same.
Remember this is just cosmetic and you have to add the logic for checking/unchecking items in radio groups.