2013-08-18 14:16:11 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../GuiComponent.h"
|
|
|
|
#include "GuiBox.h"
|
|
|
|
|
2013-08-19 15:36:48 +00:00
|
|
|
class Font;
|
|
|
|
|
2013-08-18 14:16:11 +00:00
|
|
|
class TextEditComponent : public GuiComponent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TextEditComponent(Window* window);
|
|
|
|
|
2013-08-19 15:36:48 +00:00
|
|
|
void textInput(const char* text) override;
|
|
|
|
void render(const Eigen::Affine3f& parentTrans) override;
|
2013-08-18 14:16:11 +00:00
|
|
|
|
|
|
|
void onFocusGained() override;
|
|
|
|
void onFocusLost() override;
|
|
|
|
|
|
|
|
void onSizeChanged() override;
|
|
|
|
|
|
|
|
void setValue(const std::string& val) override;
|
|
|
|
std::string getValue() const override;
|
2013-08-19 15:36:48 +00:00
|
|
|
|
2013-08-21 19:49:33 +00:00
|
|
|
void setAllowResize(bool allow); //Allow automatic resizing of height to accomodate more text.
|
|
|
|
|
2013-08-18 14:16:11 +00:00
|
|
|
private:
|
2013-08-21 19:49:33 +00:00
|
|
|
void onTextChanged();
|
|
|
|
|
2013-08-18 14:16:11 +00:00
|
|
|
std::string mText;
|
2013-08-19 15:36:48 +00:00
|
|
|
bool mFocused;
|
2013-08-21 19:49:33 +00:00
|
|
|
bool mAllowResize;
|
2013-08-19 15:36:48 +00:00
|
|
|
|
|
|
|
std::shared_ptr<Font> getFont();
|
2013-08-18 14:16:11 +00:00
|
|
|
|
|
|
|
GuiBox mBox;
|
|
|
|
};
|