TextBox::setOnEditStart(runnable)

This commit is contained in:
MihailRis
2024-01-12 19:29:49 +03:00
parent 175613692f
commit 5669e6ebed
3 changed files with 27 additions and 1 deletions
+16
View File
@@ -7,6 +7,7 @@
#include "../../graphics/Batch2D.h"
#include "../../graphics/Font.h"
#include "../../util/stringutil.h"
#include "GUI.h"
using std::string;
using std::wstring;
@@ -194,6 +195,17 @@ bool TextBox::isValid() const {
return valid;
}
void TextBox::setOnEditStart(gui::runnable oneditstart) {
onEditStart = oneditstart;
}
void TextBox::focus(GUI* gui) {
Panel::focus(gui);
if (onEditStart){
onEditStart();
}
}
void TextBox::keyPressed(int key) {
switch (key) {
case KEY_BACKSPACE:
@@ -241,6 +253,10 @@ wstring TextBox::text() const {
return input;
}
void TextBox::text(std::wstring value) {
this->input = value;
}
// ============================== InputBindBox ================================
InputBindBox::InputBindBox(Binding& binding, vec4 padding)
: Panel(vec2(100,32), padding, 0, false),