12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #ifndef _RED_EDITBOX_H_
- #define _RED_EDITBOX_H_
- #include "ui/UIEditBox/UIEditBox.h"
- #include "ui/UIEditBox/UIEditBoxImpl.h"
- #include "cocos2d.h"
- class REDEditBoxDelegate : public cocos2d::ui::EditBoxDelegate {
- public:
- typedef void (Ref::*Handler)(Ref*);
- typedef std::function<void(Ref*)> ccEditBoxCallback;
-
- virtual void editBoxTextChanged(cocos2d::ui::EditBox* editBox, const std::string& text) override;
-
- virtual void editBoxReturn(cocos2d::ui::EditBox* editBox) override;
-
- void setTextChangeEvent(ccEditBoxCallback textChangeEvent);
-
- void setReturnEvent(ccEditBoxCallback returnEvent);
-
- protected:
- ccEditBoxCallback _textChangeEvent;
- ccEditBoxCallback _returnEvent;
- };
- class REDEditBox : public cocos2d::ui::EditBox {
- public:
-
- CREATE_FUNC(REDEditBox)
- virtual bool init() override;
-
- bool initWithSizeAndBackgroundSprite(const cocos2d::Size& size, const std::string& pNormal9SpriteBg, TextureResType texType = TextureResType::LOCAL);
-
- void loadBackgroundTexture(const std::string& fileName, TextureResType texType);
- void setInsetLeft(float leftInset);
- float getInsetLeft() const;
- void setInsetTop(float topInset);
- float getInsetTop() const;
- void setInsetRight(float rightInset);
- float getInsetRight() const;
- void setInsetBottom(float bottomInset);
- float getInsetBottom() const;
- };
- #endif /* _RED_EDITBOX_H_ */
|