ZKRadioGroup.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * ZKRadioGroup.h
  3. *
  4. * Created on: Oct 23, 2017
  5. * Author: guoxs
  6. */
  7. #ifndef _CONTROL_ZKRADIOGROUP_H_
  8. #define _CONTROL_ZKRADIOGROUP_H_
  9. #include "ZKCheckBox.h"
  10. class ZKRadioGroupPrivate;
  11. class ZKRadioGroup : public ZKBase {
  12. ZK_DECLARE_PRIVATE(ZKRadioGroup)
  13. public:
  14. ZKRadioGroup(ZKBase *pParent);
  15. virtual ~ZKRadioGroup();
  16. void setCheckedID(int id);
  17. int getCheckedID() const;
  18. ZKCheckBox* getRadioItem(int index) const;
  19. void clearCheck();
  20. void reloadTextTr();
  21. public:
  22. class ICheckedChangeListener {
  23. public:
  24. virtual ~ICheckedChangeListener() { }
  25. virtual void onCheckedChanged(ZKRadioGroup *pRadioGroup, int checkedID) = 0;
  26. };
  27. void setCheckedChangeListener(ICheckedChangeListener *pListener);
  28. protected:
  29. ZKRadioGroup(ZKBase *pParent, ZKBasePrivate *pBP);
  30. virtual void onBeforeCreateWindow(const Json::Value &json);
  31. virtual void onAfterCreateWindow(const Json::Value &json);
  32. virtual const char* getClassName() const { return ZK_RADIOGROUP; }
  33. virtual bool onTouchEvent(const MotionEvent &ev);
  34. private:
  35. void parseRadioGroupAttributeFromJson(const Json::Value &json);
  36. void parseRadioButtonsAttributeFromJson(const Json::Value &json);
  37. };
  38. #endif /* _CONTROL_ZKRADIOGROUP_H_ */