diff options
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h | 251 |
1 files changed, 129 insertions, 122 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h index 1721759..305195d 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h | |||
| @@ -18,142 +18,149 @@ namespace gui | |||
| 18 | namespace controls | 18 | namespace controls |
| 19 | { | 19 | { |
| 20 | 20 | ||
| 21 | //============================================================================ | 21 | //============================================================================ |
| 22 | /// | ||
| 23 | /// \defgroup cpp_kodi_gui_controls_CRadioButton Control Radio Button | ||
| 24 | /// \ingroup cpp_kodi_gui | ||
| 25 | /// @brief \cpp_class{ kodi::gui::controls::CRadioButton } | ||
| 26 | /// **Window control for a radio button (as used for on/off settings)** | ||
| 27 | /// | ||
| 28 | /// The radio button control is used for creating push button on/off settings | ||
| 29 | /// in Kodi. You can choose the position, size, and look of the button. When | ||
| 30 | /// the user clicks on the radio button, the state will change, toggling the | ||
| 31 | /// extra textures (textureradioon and textureradiooff). Used for settings | ||
| 32 | /// controls. | ||
| 33 | /// | ||
| 34 | /// It has the header \ref RadioButton.h "#include <kodi/gui/controls/RadioButton.h>" | ||
| 35 | /// be included to enjoy it. | ||
| 36 | /// | ||
| 37 | /// Here you find the needed skin part for a \ref Radio_button_control "radio button control" | ||
| 38 | /// | ||
| 39 | /// @note The call of the control is only possible from the corresponding | ||
| 40 | /// window as its class and identification number is required. | ||
| 41 | /// | ||
| 42 | class ATTRIBUTE_HIDDEN CRadioButton : public CAddonGUIControlBase | ||
| 43 | { | ||
| 44 | public: | ||
| 45 | //========================================================================== | ||
| 46 | /// | ||
| 47 | /// \ingroup cpp_kodi_gui_controls_CRadioButton | ||
| 48 | /// @brief Construct a new control | ||
| 49 | /// | ||
| 50 | /// @param[in] window related window control class | ||
| 51 | /// @param[in] controlId Used skin xml control id | ||
| 22 | /// | 52 | /// |
| 23 | /// \defgroup cpp_kodi_gui_controls_CRadioButton Control Radio Button | 53 | CRadioButton(CWindow* window, int controlId) : CAddonGUIControlBase(window) |
| 24 | /// \ingroup cpp_kodi_gui | 54 | { |
| 25 | /// @brief \cpp_class{ kodi::gui::controls::CRadioButton } | 55 | m_controlHandle = m_interface->kodi_gui->window->get_control_radio_button( |
| 26 | /// **Window control for a radio button (as used for on/off settings)** | 56 | m_interface->kodiBase, m_Window->GetControlHandle(), controlId); |
| 57 | if (!m_controlHandle) | ||
| 58 | kodi::Log(ADDON_LOG_FATAL, | ||
| 59 | "kodi::gui::controls::CRadioButton can't create control class from Kodi !!!"); | ||
| 60 | } | ||
| 61 | //-------------------------------------------------------------------------- | ||
| 62 | |||
| 63 | //========================================================================== | ||
| 27 | /// | 64 | /// |
| 28 | /// The radio button control is used for creating push button on/off settings | 65 | /// \ingroup cpp_kodi_gui_controls_CRadioButton |
| 29 | /// in Kodi. You can choose the position, size, and look of the button. When | 66 | /// @brief Destructor |
| 30 | /// the user clicks on the radio button, the state will change, toggling the | ||
| 31 | /// extra textures (textureradioon and textureradiooff). Used for settings | ||
| 32 | /// controls. | ||
| 33 | /// | 67 | /// |
| 34 | /// It has the header \ref RadioButton.h "#include <kodi/gui/controls/RadioButton.h>" | 68 | ~CRadioButton() override = default; |
| 35 | /// be included to enjoy it. | 69 | //-------------------------------------------------------------------------- |
| 70 | |||
| 71 | //========================================================================== | ||
| 36 | /// | 72 | /// |
| 37 | /// Here you find the needed skin part for a \ref Radio_button_control "radio button control" | 73 | /// \ingroup cpp_kodi_gui_controls_CRadioButton |
| 74 | /// @brief Set the control on window to visible | ||
| 38 | /// | 75 | /// |
| 39 | /// @note The call of the control is only possible from the corresponding | 76 | /// @param[in] visible If true visible, otherwise hidden |
| 40 | /// window as its class and identification number is required. | ||
| 41 | /// | 77 | /// |
| 42 | class CRadioButton : public CAddonGUIControlBase | 78 | void SetVisible(bool visible) |
| 43 | { | 79 | { |
| 44 | public: | 80 | m_interface->kodi_gui->control_radio_button->set_visible(m_interface->kodiBase, m_controlHandle, |
| 45 | //========================================================================== | 81 | visible); |
| 46 | /// | 82 | } |
| 47 | /// \ingroup cpp_kodi_gui_controls_CRadioButton | 83 | //-------------------------------------------------------------------------- |
| 48 | /// @brief Construct a new control | ||
| 49 | /// | ||
| 50 | /// @param[in] window related window control class | ||
| 51 | /// @param[in] controlId Used skin xml control id | ||
| 52 | /// | ||
| 53 | CRadioButton(CWindow* window, int controlId) | ||
| 54 | : CAddonGUIControlBase(window) | ||
| 55 | { | ||
| 56 | m_controlHandle = m_interface->kodi_gui->window->get_control_radio_button(m_interface->kodiBase, m_Window->GetControlHandle(), controlId); | ||
| 57 | if (!m_controlHandle) | ||
| 58 | kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CRadioButton can't create control class from Kodi !!!"); | ||
| 59 | } | ||
| 60 | //-------------------------------------------------------------------------- | ||
| 61 | |||
| 62 | //========================================================================== | ||
| 63 | /// | ||
| 64 | /// \ingroup cpp_kodi_gui_controls_CRadioButton | ||
| 65 | /// @brief Destructor | ||
| 66 | /// | ||
| 67 | ~CRadioButton() override = default; | ||
| 68 | //-------------------------------------------------------------------------- | ||
| 69 | |||
| 70 | //========================================================================== | ||
| 71 | /// | ||
| 72 | /// \ingroup cpp_kodi_gui_controls_CRadioButton | ||
| 73 | /// @brief Set the control on window to visible | ||
| 74 | /// | ||
| 75 | /// @param[in] visible If true visible, otherwise hidden | ||
| 76 | /// | ||
| 77 | void SetVisible(bool visible) | ||
| 78 | { | ||
| 79 | m_interface->kodi_gui->control_radio_button->set_visible(m_interface->kodiBase, m_controlHandle, visible); | ||
| 80 | } | ||
| 81 | //-------------------------------------------------------------------------- | ||
| 82 | 84 | ||
| 83 | //========================================================================== | 85 | //========================================================================== |
| 84 | /// | 86 | /// |
| 85 | /// \ingroup cpp_kodi_gui_controls_CRadioButton | 87 | /// \ingroup cpp_kodi_gui_controls_CRadioButton |
| 86 | /// @brief Set's the control's enabled/disabled state | 88 | /// @brief Set's the control's enabled/disabled state |
| 87 | /// | 89 | /// |
| 88 | /// @param[in] enabled If true enabled, otherwise disabled | 90 | /// @param[in] enabled If true enabled, otherwise disabled |
| 89 | /// | 91 | /// |
| 90 | void SetEnabled(bool enabled) | 92 | void SetEnabled(bool enabled) |
| 91 | { | 93 | { |
| 92 | m_interface->kodi_gui->control_radio_button->set_enabled(m_interface->kodiBase, m_controlHandle, enabled); | 94 | m_interface->kodi_gui->control_radio_button->set_enabled(m_interface->kodiBase, m_controlHandle, |
| 93 | } | 95 | enabled); |
| 94 | //-------------------------------------------------------------------------- | 96 | } |
| 97 | //-------------------------------------------------------------------------- | ||
| 95 | 98 | ||
| 96 | //========================================================================== | 99 | //========================================================================== |
| 97 | /// | 100 | /// |
| 98 | /// \ingroup cpp_kodi_gui_controls_CRadioButton | 101 | /// \ingroup cpp_kodi_gui_controls_CRadioButton |
| 99 | /// @brief To set the text string on radio button | 102 | /// @brief To set the text string on radio button |
| 100 | /// | 103 | /// |
| 101 | /// @param[in] label Text to show | 104 | /// @param[in] label Text to show |
| 102 | /// | 105 | /// |
| 103 | void SetLabel(const std::string& label) | 106 | void SetLabel(const std::string& label) |
| 104 | { | 107 | { |
| 105 | m_interface->kodi_gui->control_radio_button->set_label(m_interface->kodiBase, m_controlHandle, label.c_str()); | 108 | m_interface->kodi_gui->control_radio_button->set_label(m_interface->kodiBase, m_controlHandle, |
| 106 | } | 109 | label.c_str()); |
| 107 | //-------------------------------------------------------------------------- | 110 | } |
| 111 | //-------------------------------------------------------------------------- | ||
| 108 | 112 | ||
| 109 | //========================================================================== | 113 | //========================================================================== |
| 110 | /// | 114 | /// |
| 111 | /// \ingroup cpp_kodi_gui_controls_CRadioButton | 115 | /// \ingroup cpp_kodi_gui_controls_CRadioButton |
| 112 | /// @brief Get the used text from control | 116 | /// @brief Get the used text from control |
| 113 | /// | 117 | /// |
| 114 | /// @return Text shown | 118 | /// @return Text shown |
| 115 | /// | 119 | /// |
| 116 | std::string GetLabel() const | 120 | std::string GetLabel() const |
| 121 | { | ||
| 122 | std::string label; | ||
| 123 | char* ret = m_interface->kodi_gui->control_radio_button->get_label(m_interface->kodiBase, | ||
| 124 | m_controlHandle); | ||
| 125 | if (ret != nullptr) | ||
| 117 | { | 126 | { |
| 118 | std::string label; | 127 | if (std::strlen(ret)) |
| 119 | char* ret = m_interface->kodi_gui->control_radio_button->get_label(m_interface->kodiBase, m_controlHandle); | 128 | label = ret; |
| 120 | if (ret != nullptr) | 129 | m_interface->free_string(m_interface->kodiBase, ret); |
| 121 | { | ||
| 122 | if (std::strlen(ret)) | ||
| 123 | label = ret; | ||
| 124 | m_interface->free_string(m_interface->kodiBase, ret); | ||
| 125 | } | ||
| 126 | return label; | ||
| 127 | } | 130 | } |
| 128 | //-------------------------------------------------------------------------- | 131 | return label; |
| 132 | } | ||
| 133 | //-------------------------------------------------------------------------- | ||
| 129 | 134 | ||
| 130 | //========================================================================== | 135 | //========================================================================== |
| 131 | /// | 136 | /// |
| 132 | /// \ingroup cpp_kodi_gui_controls_CRadioButton | 137 | /// \ingroup cpp_kodi_gui_controls_CRadioButton |
| 133 | /// @brief To set radio button condition to on or off | 138 | /// @brief To set radio button condition to on or off |
| 134 | /// | 139 | /// |
| 135 | /// @param[in] selected true set radio button to selection on, otherwise | 140 | /// @param[in] selected true set radio button to selection on, otherwise |
| 136 | /// off | 141 | /// off |
| 137 | /// | 142 | /// |
| 138 | void SetSelected(bool selected) | 143 | void SetSelected(bool selected) |
| 139 | { | 144 | { |
| 140 | m_interface->kodi_gui->control_radio_button->set_selected(m_interface->kodiBase, m_controlHandle, selected); | 145 | m_interface->kodi_gui->control_radio_button->set_selected(m_interface->kodiBase, |
| 141 | } | 146 | m_controlHandle, selected); |
| 142 | //-------------------------------------------------------------------------- | 147 | } |
| 148 | //-------------------------------------------------------------------------- | ||
| 143 | 149 | ||
| 144 | //========================================================================== | 150 | //========================================================================== |
| 145 | /// | 151 | /// |
| 146 | /// \ingroup cpp_kodi_gui_controls_CRadioButton | 152 | /// \ingroup cpp_kodi_gui_controls_CRadioButton |
| 147 | /// @brief Get the current selected condition of radio button | 153 | /// @brief Get the current selected condition of radio button |
| 148 | /// | 154 | /// |
| 149 | /// @return Selected condition | 155 | /// @return Selected condition |
| 150 | /// | 156 | /// |
| 151 | bool IsSelected() const | 157 | bool IsSelected() const |
| 152 | { | 158 | { |
| 153 | return m_interface->kodi_gui->control_radio_button->is_selected(m_interface->kodiBase, m_controlHandle); | 159 | return m_interface->kodi_gui->control_radio_button->is_selected(m_interface->kodiBase, |
| 154 | } | 160 | m_controlHandle); |
| 155 | //-------------------------------------------------------------------------- | 161 | } |
| 156 | }; | 162 | //-------------------------------------------------------------------------- |
| 163 | }; | ||
| 157 | 164 | ||
| 158 | } /* namespace controls */ | 165 | } /* namespace controls */ |
| 159 | } /* namespace gui */ | 166 | } /* namespace gui */ |
