1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- //
- // MySwitchBtn.h
- // CandyCpp
- //
- // Created by 杜家兑macbook on 16/8/23.
- //
- //
- #ifndef RUSwitchBtn_h
- #define RUSwitchBtn_h
- #include "RUQCoreBtn.h"
- NS_RU_BEGIN
- class SwitchBtn: public redutils::QCoreBtn
- {
- public:
- RED_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(SwitchBtn, create);
- SwitchBtn();
- ~SwitchBtn();
- void setQueryFunc(std::function<bool()>);
- void setCallbackWhileSwitched(std::function<void(bool)>);
- virtual void onEnter() override;
-
- protected:
- void onClicked(redutils::QCoreBtn* cl, int tag);
-
- std::function<bool(void)> _query = nullptr;
- std::function<void(bool)> _cbWhileSwitched = nullptr;
- };
- class SwitchBtnLoader : public redream::LayerLoader {
- public:
- RED_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(SwitchBtnLoader, loader);
- protected:
- RED_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(SwitchBtn);
- };
- NS_RU_END
- #endif /* defined(RUSwitchBtn_h) */
|