ZKCheckBox.h 975 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * ZKCheckBox.h
  3. *
  4. * Created on: Oct 22, 2017
  5. * Author: guoxs
  6. */
  7. #ifndef _CONTROL_ZKCHECKBOX_H_
  8. #define _CONTROL_ZKCHECKBOX_H_
  9. #include "ZKButton.h"
  10. class ZKCheckBoxPrivate;
  11. class ZKCheckBox : public ZKButton {
  12. ZK_DECLARE_PRIVATE(ZKCheckBox)
  13. public:
  14. ZKCheckBox(ZKBase *pParent);
  15. virtual ~ZKCheckBox();
  16. void setChecked(bool isChecked);
  17. bool isChecked() const;
  18. public:
  19. class ICheckedChangeListener {
  20. public:
  21. virtual ~ICheckedChangeListener() { }
  22. virtual void onCheckedChanged(ZKCheckBox *pCheckBox, bool isChecked) = 0;
  23. };
  24. void setCheckedChangeListener(ICheckedChangeListener *pListener);
  25. protected:
  26. ZKCheckBox(ZKBase *pParent, ZKBasePrivate *pBP);
  27. virtual void onBeforeCreateWindow(const Json::Value &json);
  28. virtual const char* getClassName() const { return ZK_CHECKBOX; }
  29. virtual bool onTouchEvent(const MotionEvent &ev);
  30. private:
  31. void parseCheckBoxAttributeFromJson(const Json::Value &json);
  32. };
  33. #endif /* _CONTROL_ZKCHECKBOX_H_ */