Add missing Checkbox() implementation (#796)

Fix: #795
This commit is contained in:
Particle_G 2023-12-23 15:35:20 +08:00 committed by GitHub
parent a7b6785420
commit d0634e1ca0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,6 +86,32 @@ class CheckboxBase : public ComponentBase, public CheckboxOption {
}; };
} // namespace } // namespace
/// @brief Draw checkable element.
/// @param option Additional optional parameters.
/// @ingroup component
/// @see CheckboxBase
///
/// ### Example
///
/// ```cpp
/// auto screen = ScreenInteractive::FitComponent();
/// CheckboxOption option;
/// option.label = "Make a sandwidth";
/// option.checked = false;
/// Component checkbox = Checkbox(option);
/// screen.Loop(checkbox)
/// ```
///
/// ### Output
///
/// ```bash
/// ☐ Make a sandwitch
/// ```
// NOLINTNEXTLINE
Component Checkbox(CheckboxOption option) {
return Make<CheckboxBase>(std::move(option));
}
/// @brief Draw checkable element. /// @brief Draw checkable element.
/// @param label The label of the checkbox. /// @param label The label of the checkbox.
/// @param checked Whether the checkbox is checked or not. /// @param checked Whether the checkbox is checked or not.