mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
Move from function pointers to std::function
This commit is contained in:
@@ -4,13 +4,12 @@
|
||||
#include "UI_x_boxes.hpp"
|
||||
|
||||
#define UI_CHECKBOX_TYPE std::string("UIcheckbox")
|
||||
typedef void (*UI_checkbox_on_change) (std::string id, std::vector<std::string> selected);
|
||||
|
||||
class UI_checkbox : public UI_x_boxes
|
||||
{
|
||||
public:
|
||||
UI_checkbox();
|
||||
UI_checkbox(std::string id, std::string text, Color fg_color, Color bg_color, std::vector<std::string> options, UI_checkbox_on_change on_change = nullptr);
|
||||
UI_checkbox(std::string id, std::string text, Color fg_color, Color bg_color, std::vector<std::string> options, std::function<void(std::string, std::vector<std::string>)> on_change = nullptr);
|
||||
UI_checkbox(const json& j);
|
||||
|
||||
void toggle_selected(size_t selected);
|
||||
@@ -23,5 +22,5 @@ class UI_checkbox : public UI_x_boxes
|
||||
private:
|
||||
std::vector<bool> p_selected;
|
||||
|
||||
UI_checkbox_on_change p_on_change;
|
||||
std::function<void(std::string, std::vector<std::string>)> p_on_change;
|
||||
};
|
||||
Reference in New Issue
Block a user