added FullCheckBox
This commit is contained in:
@@ -333,7 +333,6 @@ void TrackBar::mouseMove(GUI*, int x, int y) {
|
||||
// ================================ CheckBox ==================================
|
||||
CheckBox::CheckBox(bool checked) : UINode(vec2(), vec2(32.0f)), checked_(checked) {
|
||||
color(vec4(0.0f, 0.0f, 0.0f, 0.5f));
|
||||
margin(vec4(0.0f, 0.0f, 5.0f, 0.0f));
|
||||
}
|
||||
|
||||
void CheckBox::draw(Batch2D* batch, Assets* assets) {
|
||||
@@ -364,4 +363,17 @@ void CheckBox::consumer(boolconsumer consumer) {
|
||||
CheckBox* CheckBox::checked(bool flag) {
|
||||
checked_ = flag;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
FullCheckBox::FullCheckBox(std::wstring text, glm::vec2 size, bool checked)
|
||||
: Panel(size),
|
||||
checkbox(std::make_shared<CheckBox>(checked)){
|
||||
color(vec4(0.0f));
|
||||
orientation(Orientation::horizontal);
|
||||
|
||||
add(checkbox);
|
||||
|
||||
auto label = std::make_shared<Label>(text);
|
||||
label->margin(vec4(5.0f, 5.0f, 0.0f, 0.0f));
|
||||
add(label);
|
||||
}
|
||||
|
||||
@@ -166,6 +166,29 @@ namespace gui {
|
||||
return checked_;
|
||||
}
|
||||
};
|
||||
|
||||
class FullCheckBox : public Panel {
|
||||
protected:
|
||||
std::shared_ptr<CheckBox> checkbox;
|
||||
public:
|
||||
FullCheckBox(std::wstring text, glm::vec2 size, bool checked=false);
|
||||
|
||||
virtual void supplier(boolsupplier supplier) {
|
||||
checkbox->supplier(supplier);
|
||||
}
|
||||
|
||||
virtual void consumer(boolconsumer consumer) {
|
||||
checkbox->consumer(consumer);
|
||||
}
|
||||
|
||||
virtual void checked(bool flag) {
|
||||
checkbox->checked(flag);
|
||||
}
|
||||
|
||||
virtual bool checked() const {
|
||||
return checkbox->checked();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // FRONTEND_GUI_CONTROLS_H_
|
||||
Reference in New Issue
Block a user