axmol/extensions/fairygui/GTextInput.h

48 lines
1.2 KiB
C
Raw Normal View History

2020-08-04 12:31:33 +08:00
#ifndef __GTEXTINPUT_H__
#define __GTEXTINPUT_H__
#include "cocos2d.h"
#include "FairyGUIMacros.h"
#include "GTextField.h"
#include "display/FUIInput.h"
NS_FGUI_BEGIN
2022-08-08 18:02:17 +08:00
class GTextInput : public GTextField, ax::ui::EditBoxDelegate
2020-08-04 12:31:33 +08:00
{
public:
GTextInput();
virtual ~GTextInput();
CREATE_FUNC(GTextInput);
virtual bool isSingleLine() const override;
virtual void setSingleLine(bool value) override;
virtual TextFormat* getTextFormat() const override { return _input->getTextFormat(); }
virtual void applyTextFormat() override;
void setPrompt(const std::string& value);
void setPassword(bool value);
void setKeyboardType(int value);
void setMaxLength(int value);
void setRestrict(const std::string& value);
protected:
virtual void handleInit() override;
virtual void handleSizeChanged() override;
virtual void setup_beforeAdd(ByteBuffer* buffer, int beginPos) override;
virtual void setTextFieldText() override;
2022-08-08 18:02:17 +08:00
virtual void editBoxReturn(ax::ui::EditBox* editBox) override;
virtual void editBoxTextChanged(ax::ui::EditBox* editBox, std::string_view text) override;
2020-08-04 12:31:33 +08:00
private:
FUIInput* _input;
};
NS_FGUI_END
#endif